Skip to main content
100%

SVG path animation

✓ Published0🌍 Public
KKoGor
Last edited Dec 28, 2013
Created on Dec 28, 2013

An SVG rendering of a PlayStation 4 controller uses D3.js to animate each path's stroke-dasharray attribute. The `transition.attrTween` method repeatedly interpolates between `"0,l"` and `"l,l"` (where `l` is the path's total length from `getTotalLength()`), creating a continuous drawing effect. An infinite loop via the `each` event restarts the animation, while CSS styles paths as unfilled black strokes.

AI-generated description

Inspired by Vox Media's article: Polygon feature design: SVG animations for fun and profit and Mike Bostock's example: Stroke Dash Interpolation.

Similar vizzes