Skip to main content
100%

Point-Along-Path Interpolation

✓ Published0🌍 Public
Aantonyross
Last edited Apr 17, 2016
Created on Apr 17, 2016

Two closed Catmull–Rom splines are drawn with D3’s SVG line generator, and clicking anywhere on the page appends a red circle that begins a looping 10-second transition along one of the paths. The animation relies on the native SVG path methods `getTotalLength` and `getPointAtLength`, which the `transition.attrTween` uses to compute the circle’s position at each time step. The example demonstrates point-along-path interpolation with d3.v3, rendering both the static paths and animated circles in SVG.

AI-generated description

This example demonstrates how to use the getTotalLength and getPointAtLength methods on SVG path elements to interpolate a point along a Catmull–Rom spline.

A related technique is stroke dash interpolation.

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/1705868'>Point-Along-Path Interpolation</a>

gpl-3.0 Licensed

Similar vizzes