Skip to main content
100%

Lifespan events using segmented bézier curves

✓ Published0🌍 Public
AAjayyy
Last edited Jun 17, 2019
Created on Jun 17, 2019

This example visualizes the lifespans of 100 individuals as animated, segmented Bézier curves. Each curve represents a person’s life from birth to death, with the curve’s height proportional to their age at death, and is rendered using D3 v4’s SVG path elements. The animation uses `transition.attrTween` to draw each segment sequentially, employing a seeded random number generator to create reproducible variation in the segmentation and styling. The visualization highlights an efficient method for styling parametric curves without gradient stops or clipping paths.

AI-generated description

This block demonstrates an alternative styling approach to gradient stops and clipping-paths for parametric <a href="https://en.wikipedia.org/wiki/B%C3%A9zier_curve">bézier curves</a>. Given an initial bézier curve, we splice it into segments rather than generating gradient stops or clipping-paths to style the segments differently. The main advantage of this approach is that it reduces the number of elements required for each conceptual curve and simplify the representation in the DOM -- especially when anticipating large numbers of curves and a non-uniform segmentation. Thanks to <a href="https://github.com/timhall">Tim Hall</a> for code review, and to <a href="https://www.jasondavies.com/">Jason Davies</a> for his work on <a href="https://www.jasondavies.com/animated-bezier/">animated béziers</a>. Lifespan design concept inspired by <a href="http://guns.periscopic.com">Periscopic's work on U.S. gun deaths</a>. Related: Aaron Bycoffe's block on how to <a href="http://bl.ocks.org/bycoffe/18441cddeb8fe147b719fab5e30b5d45">Split an SVG path into pieces</a>.

forked from <a href='http://bl.ocks.org/john-clarke/'>john-clarke</a>'s block: <a href='http://bl.ocks.org/john-clarke/3d305d8506d33c76917decefde960715'>Lifespan events using segmented bézier curves</a>

mit Licensed

Similar vizzes