regl-ladder
This animated scatterplot uses WebGL to render 20,000 points representing the economic mobility of white and black men, arranged in a "ladder" comparing outcomes across income quintiles. Each dot eases along a path from its starting position to a target percentile line, with blue and orange encoding racial groups. The visualization iterates from a static SVG version through canvas-based approaches before settling on a regl implementation for performance, enabling many more points on screen. The final version optimizes rendering by passing precomputed arrays of attributes to the vertex shader and animating the points along their trajectories over time.
AI-generated descriptionRough draft of this chart.
We started out with a SVG animation, tried out Elijah's canvas sankey particles and ended up rewriting in regl to get more dots on the screen.
The final version gets better performance by passing in array of attibutes to the vertex shader - I'm not sure why that is.
Update: Ricky Reusser points out that I was creating a new array of points every frame with:
attributes: {x: () => data.map(d => d.x)}
This is faster:
attributes: {x: => data.map(d => d.x)}
Also! pow is undefined for negative numbers, so the points take a different path on different devices.