Scroll inside the frame. The shot stays paused.
The prompt
Build a fixed scroll progress rail. ## Look A 3px bar fixed to the top, track #23232e, fill #7c6cff, origin left center. Article max-width 62ch, body text #c9c9d4, headings #f2f2f7, page #08080d, padding bottom 40vh. ## Behavior scaleX the fill with scroll progress from 0 to 1. Include function mountScroll. ## Design tokens - Fill #7c6cff; track #23232e; page #08080d. ## Motion - No duration. The bar matches scroll position. ## 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; }
#rail { position: fixed; left: 0; top: 0; right: 0; height: 3px; background: #23232e; z-index: 5; } #rail i { display: block; height: 100%; width: 100%; background: #7c6cff; transform: scaleX(0); transform-origin: 0 50%; } article { max-width: 62ch; margin: 0 auto; padding: 64px 20px 40vh; } p { margin-top: 16px; color: #c9c9d4; line-height: 1.6; }
@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 id="rail"><i id="fill"></i></div><article><h1>Read down the rail.</h1><p>The bar is the only motion. It maps scroll position, not time, so a fast reader and a slow reader see the same fill at the same paragraph.</p><p>Use it on docs, changelogs, and long prompts where a spinner would be a lie.</p><p>The end of the page is the end of the bar.</p></article>
<script>
var reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
function layout(p) { document.getElementById("fill").style.transform = "scaleX(" + p + ")"; }
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
A 3px rail sticks to the top and scales on X with scroll progress. The page underneath is a short essay so there is something to scroll.
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.