Skip to main content
100%

One-Way Markers

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Feb 16, 2013

A looping animation draws a twisting black curve, overlaid with evenly spaced arrowhead markers that trace the same path. The example uses D3 v3 to sample points along the SVG path via `getPointAtLength`, resampling them at uniform pixel intervals to place the markers. A `d3.svg.line` with basis interpolation generates the base shape, while an SVG `<marker>` element with `orient="auto"` orients each arrowhead along the curve. The path continuously updates from parametric cosine and sine functions, creating a fluid, morphing line.

AI-generated description

Inspired by Tom MacWright’s previous take on one-way line markers, this example adopts a technique from my path tween example: uniform sampling via getPointAtLength. A rendered line is resampled such that each control point is equally spaced along the length of the line. Thus, the desired number of markers are rendered.

gpl-3.0 Licensed

Similar vizzes