Point-Along-Path Interpolation
✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Jan 30, 2012
A steelblue circle travels indefinitely along a closed Catmull–Rom spline path, interpolating its position over ten seconds per loop. Seven fixed white-ringed points mark the path’s control vertices. The SVG animation uses D3’s `transition.attrTween` with the path’s `getTotalLength` and `getPointAtLength` methods to compute each frame’s coordinates, while `d3.svg.line().tension(0)` defines the curve geometry.
AI-generated descriptionThis 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.
gpl-3.0 Licensed