Skip to main content
100%

Point-Along-Path Interpolation

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

This visualization demonstrates how to interpolate a point along an SVG path using the native `getTotalLength` and `getPointAtLength` methods. Two rectangular Catmull–Rom splines are rendered, with circles animated along each path using custom Vector and Runner classes that apply acceleration, velocity, and edge-bouncing behavior. The animation shows two points moving along the paths, with their motion influenced by simple physics (forces and mass) while remaining constrained to the path geometry. The example is built with D3 v3 and renders using SVG, with the circles styled with white strokes to stand out against the black paths.

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>

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

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

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

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

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

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

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

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

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

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

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

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

gpl-3.0 Licensed

Similar vizzes