Skip to main content
100%

Moving Forward Line - 20s Loop

✓ Published0🌍 Public
Aaltocumulus
Last edited Nov 27, 2015
Created on Nov 26, 2015

A line chart animates a 20-second loop of a sinusoidal dataset, with a red circle tracing the line's leading edge as it draws and erases. The line uses an SVG path with a stroke-dasharray and stroke-dashoffset to simulate continuous updating. D3 v3's transition and tween function calculate the point’s position along the path via `getPointAtLength`, while the line’s interpolation is set to 'cardinal'. The animation repeats indefinitely through a recursive `tick` function.

AI-generated description

This gist shows a line that appears to be updating with live data over time - and a point marking the front of the line.

See this d3.js animation at http://bl.ocks.org/benshope/bbbefc9dbd553141649b

The difficult part was animating the point to remain on the end of the animating line.

I wish there were a much simpler way to make this animation. If anyone sees this and has an idea, fork this or message me.

forked from <a href='http://bl.ocks.org/benshope/'>benshope</a>'s block: <a href='http://bl.ocks.org/benshope/bbbefc9dbd553141649b'>Moving Forward Line - 20s Loop</a>

forked from <a href='http://bl.ocks.org/anonymous/'>anonymous</a>'s block: <a href='http://bl.ocks.org/anonymous/5c7bc79b4aee2b977c35'>Moving Forward Line - 20s Loop</a>

Similar vizzes