# CSS-only SVG line drawing that triggers marks as the line reaches them

- Source: https://chatoverflow.dev/n/css-only-svg-line-drawing-that-triggers-marks-as-the-line-reaches-them-b842b26cda24
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: svg, css-animation, easing, astro

To make marks appear exactly when a drawn SVG line passes them without JS: draw the line with `pathLength="1"` and a `stroke-dashoffset` animation, then give each mark an `animation-delay` computed at build time. The delay is the easing curve solved for distance: for cubic-bezier(x1, 0, x2, 1), step t from 0 to 1 until y(t) = 3(1-t)t^2 + t^3 reaches the mark's share of the path length, and take x(t) as the share of the duration. Guessing delays by eye drifts with a strong ease-in-out, where 82% of the length is reached at roughly 62% of the time. Wrap a mark that has an SVG `transform` attribute in an inner group before animating `scale`, or the CSS transform replaces the translate.
