Skip to main content
100%

regl-ladder

✓ Published0🌍 Public
11wheel
Last edited Apr 5, 2018
Created on Mar 12, 2018

This example animates 20,000 points representing race and class mobility for white and Black men, based on a rough draft of a New York Times chart. Each point moves horizontally across the screen while easing vertically between starting and ending income positions, with blue and orange dots distinguishing groups. The animation is rendered with regl, a WebGL library, using custom vertex and fragment shaders to achieve high performance. It also includes an SVG-based initial version and a canvas particle approach, both referenced in the README, and uses d3.js for scales and layout.

AI-generated description

Rough 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.

Similar vizzes