Scroll inside the frame. The shot stays paused.
The prompt
Build a scroll-drawn SVG curve. ## Look One cubic path, stroke #c4b5fd, width 3, round caps, no fill, inside a viewBox 0 0 320 120. Percent label in #8a8a99. Page #08080d. Runway about 220vh. ## Behavior Set stroke-dasharray to the path length. Set stroke-dashoffset to length * (1 - progress). Include function mountScroll. ## Design tokens - Stroke #c4b5fd; label #8a8a99; page #08080d. ## Motion - Drawing is 1:1 with scroll progress. ## Constraints - Single self-contained HTML file. No libraries. - Honor prefers-reduced-motion: reduce by skipping the loop and leaving a readable static frame - Readable at 390px width with no horizontal page scroll
The code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body {
background: #08080d; color: #f2f2f7; font-family: Inter, system-ui, sans-serif;
min-height: 100vh; overflow-x: hidden;
}
.hint { position: absolute; left: 16px; top: 16px; z-index: 5; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a8a99; }
svg { width: min(92vw, 640px); height: auto; display: block; margin: 18vh auto; } path { fill: none; stroke: #c4b5fd; stroke-width: 3; stroke-linecap: round; } p { text-align: center; color: #8a8a99; } .runway { height: 220vh; }
@media (max-width: 420px) {
.hint { font-size: 10px; letter-spacing: 0.08em; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
</style>
</head>
<body>
<div class="runway"><svg viewBox="0 0 320 120"><path id="p" d="M16 90 C 70 10, 140 110, 200 40 S 290 20, 304 70"/></svg><p id="label">0%</p></div>
<script>
var path = document.getElementById("p");
var len = path.getTotalLength();
path.style.strokeDasharray = String(len);
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
function layout(p) {
path.style.strokeDashoffset = String(len * (1 - p));
document.getElementById("label").textContent = Math.round(p * 100) + "%";
}
function mountScroll() {
function read() {
var max = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) - window.innerHeight;
var p = max > 0 ? window.scrollY / max : 0;
if (p < 0) p = 0;
if (p > 1) p = 1;
layout(p);
}
layout(reduce ? 1 : 0);
if (!reduce) window.addEventListener("scroll", read, { passive: true });
}
mountScroll();
</script>
</body>
</html>About this effect
An SVG path’s stroke-dashoffset tracks scroll from full length to zero. A label under the curve names the progress in percent.
Similar effects
Parallax Layers
Pinned dusk landscape where three SVG ridgelines drift at different speeds as you scroll.
Stacked Scroll Gallery
Vertical scroll lifts a column of cards into place, scrubbed to the scrollbar.
Scroll Reveal Cards
Grid cards fade up 40px into view with a buttery 0.08s stagger as you scroll.