Scroll Animations Without a Library

Updated 2026-10-15. 18 effects.

Scroll animations tie movement to how far a visitor has scrolled. Modern CSS does this natively with animation-timeline: view() or scroll(), so a reveal, zoom or progress bar needs no library. Each effect here uses that where the browser supports it and a short IntersectionObserver script where it does not.

Start from what the section has to say. A list of features reads best when items rise in one after another; a single product photo earns a slow zoom; a process with stages suits a pinned panel whose steps change as you scroll; long articles want a thin reading bar. Using one kind of motion per page keeps it feeling deliberate rather than busy.

Every snippet animates against the nearest scrolling box. In the previews that is the framed box itself, so you can try them here; pasted into a normal page, the same code follows the window with no change. Settings such as distance, delay between items and where in the viewport an effect starts sit at the top of each style block.

Compare them

EffectBuilt withSize (gzipped)Running costBrowser support
Cards Slide In From Alternating SidesCSS only2.9 KBTransform and opacity on five cards from the scroll timeline; the fallback observer fires once per card.Chrome, Edge and Safari 26+; script fallback elsewhere
Circular Badge That Spins With ScrollCSS only3.2 KBA single rotate on one small SVG, run by the scroll timeline; the fallback updates it at most once per frame.Chrome, Edge and Safari 26+; script fallback elsewhere
Feature List Staggered Fade UpCSS only3.2 KBOpacity and transform on two dozen small elements, driven by the scroll timeline off the main thread where supported.Chrome, Edge and Safari 26+; script fallback elsewhere
Headline Lines Rise From MasksCSS only2.7 KBOnly transforms on nine line spans plus three caption fades, so scrolling stays on the compositor.Chrome, Edge and Safari 26+; script fallback elsewhere
Headline Rows Skew With Scroll SpeedCSS and a small script2.4 KBA frame loop writes one skewX per row only while scrolling or settling, and stops when every row is upright or the box is off screen.All current browsers
Photo Grid Leans With Scroll SpeedCSS and a small script2.8 KBOne frame loop runs only while the box is moving or settling, writing a skew to three columns; it stops when flat or off screen.All current browsers
Photo Pile Settles Into a GridCSS only3.2 KBSix transformed figures on one scroll timeline; the fallback observer fires once for the whole grid.Chrome, Edge and Safari 26+; script fallback elsewhere
Photo Zooms Out as It Scrolls InCSS only3 KBOne scaled image layer and a caption fade; the fallback reads two rectangles per frame only while scrolling.Chrome, Edge and Safari 26+; script fallback elsewhere
Pinned Panel Steps Cross FadeCSS only3.4 KBSticky positioning plus opacity and transform on four list items; the fallback does one small calculation per frame while scrolling.Chrome, Edge and Safari 26+; script fallback elsewhere; sticky works everywhere
Product Photo Scales to Full BleedCSS only3 KBOne scale transform and one opacity, both on the scroll timeline; the fallback measures once per scrolled frame.Chrome, Edge and Safari 26+; script fallback elsewhere
Quote Cards Tilt Flat as They EnterCSS only2.9 KBA perspective rotate and an opacity per card, handled by the scroll timeline with no script work while scrolling.Chrome, Edge and Safari 26+; script fallback elsewhere
Reading Progress Bar for a Long ArticleCSS only3.2 KBOne scaled element on the scroll timeline; the fallback writes a single transform per frame while scrolling.Chrome, Edge and Safari 26+; script fallback elsewhere
Section Header Words Rise One by OneCSS and a small script2.8 KBOne observer flips a class per heading; the browser then runs short transform and opacity transitions on its own.All current browsers
Stats Band Figures Slide Up Into PlaceCSS and a small script3 KBDigits are split once at start; after that an observer adds one class per band and the transitions run on transforms.All current browsers
Sticky Chapter Label That Follows the SectionCSS and a small script2.9 KBOne observer reports when a chapter crosses the line; the label moves with a single transform transition.All current browsers
Tea List Rows Stretch With Scroll SpeedCSS and a small script2.6 KBRow positions are measured once on entry and on resize, so each frame only reads the scroll offset and writes a scaleY per row.All current browsers
Timeline Spine Draws and Dots Light UpCSS only3.2 KBOne scaled line and six small dot fills on scroll timelines; the fallback reads seven rectangles per frame while scrolling.Chrome, Edge and Safari 26+; script fallback elsewhere
Word Rows Drift Sideways With ScrollCSS only2.9 KBThree wide text layers moved by transform on the scroll timeline; the fallback reads three rectangles per frame while scrolling.Chrome, Edge and Safari 26+; script fallback elsewhere

Cards Slide In From Alternating Sides

Five trip cards for a mountain guiding company, set in a zigzag on a deep navy page, each sliding in from its own side with a slight tilt that straightens as it lands. The direction is one variable per card, so odd cards come from the left and even ones from the right. On phones the cards go full width and travel a shorter distance.

<section class="w1alt" data-w1alt tabindex="0" aria-label="Ridgeway Guiding trips, scrollable">
  <div class="w1alt-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1alt-wrap">
    <p class="w1alt-eyebrow">Ridgeway Guiding</p>
    <h2 class="w1alt-h">Five ways onto the high ground this season</h2>
    <p class="w1alt-lead">Small groups, a qualified mountain leader, and routes chosen the evening before from the forecast.</p>
    <ol class="w1alt-list">
      <li class="w1alt-card"><p class="w1alt-meta">One day · Easy</p><h3>Valley to the tarn</h3><p>A steady walk up the old miners' track to a high lake, lunch on the shore and back down by mid afternoon.</p></li>
      <li class="w1alt-card"><p class="w1alt-meta">One day · Moderate</p><h3>The long ridge</h3><p>Four summits linked by a grassy spine, with wide views out to the coast when the cloud lifts.</p></li>
      <li class="w1alt-card"><p class="w1alt-meta">Two days · Moderate</p><h3>Bothy overnight</h3><p>Walk in with light packs, sleep in a stone shelter by the river and cross the pass at first light.</p></li>
      <li class="w1alt-card"><p class="w1alt-meta">One day · Hard</p><h3>Scramble day</h3><p>Hands-on rock on a classic grade one line, with a rope in the leader's bag and helmets provided.</p></li>
      <li class="w1alt-card"><p class="w1alt-meta">Half day · Easy</p><h3>Map and compass</h3><p>Learn to read contours and walk a bearing in the low hills, so the next trip can be your own.</p></li>
    </ol>
    <a href="#" class="w1alt-btn">Check dates and places</a>
  </div>
</section>

<style>
  /* Change these: --w1alt-push (sideways start distance), --w1alt-tilt (start angle), --w1alt-bg, --w1alt-card, --w1alt-accent. */
  .w1alt { --w1alt-push: 90px; --w1alt-tilt: 2.5deg; --w1alt-bg: #10213a; --w1alt-card: #f3ead9; --w1alt-accent: #b8562f;
    height: 620px; overflow-y: auto; overflow-x: hidden; position: relative; background: var(--w1alt-bg); color: #eef1f6;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; scrollbar-color: #3a4d6b transparent; }
  /* To use page scroll: delete height and overflow above and set root: null in the script. */
  .w1alt:focus-visible { outline: 3px solid #f0b48f; outline-offset: -3px; }
  .w1alt-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1alt-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(238,241,246,.14); color: #eef1f6;
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1alt[data-touched] .w1alt-hint span { opacity: 0; }
  .w1alt-wrap { max-width: 60rem; margin: 0 auto; padding: 64px 20px 80px; }
  .w1alt-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #f0b48f; }
  .w1alt-h { margin: 14px 0 0; max-width: 34rem; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(1.9rem, 4.4vw, 2.9rem); line-height: 1.1; letter-spacing: -.015em; }
  .w1alt-lead { margin: 14px 0 0; max-width: 32rem; font-size: 1.0625rem; line-height: 1.6; color: #c4cede; }
  .w1alt-list { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 22px; }
  .w1alt-card { --dir: -1; box-sizing: border-box; width: 100%; padding: 24px 24px 26px; border-radius: 16px; background: var(--w1alt-card); color: #1d2534;
    box-shadow: 0 24px 40px -24px rgba(0,0,0,.6); }
  .w1alt-card:nth-child(even) { --dir: 1; justify-self: end; }
  .w1alt-meta { margin: 0; font-size: .8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #9a4423; }
  .w1alt-card h3 { margin: 8px 0 0; font-size: 1.375rem; font-weight: 600; }
  .w1alt-card h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.6; color: #3b4456; }
  .w1alt-btn { margin-top: 36px; display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px;
    background: var(--w1alt-accent); color: #fff; font-weight: 600; font-size: .9375rem; text-decoration: none; }
  .w1alt-btn:hover { background: #a14a27; }
  .w1alt-btn:focus-visible { outline: 3px solid #f3ead9; outline-offset: 3px; }
  @media (min-width: 720px) { .w1alt-wrap { padding: 80px 40px 96px; } .w1alt-card { width: 60%; padding: 28px 30px 30px; } }
  @media (max-width: 719px) { .w1alt { --w1alt-push: 44px; } }
  @keyframes w1alt-in { from { opacity: 0; transform: translateX(calc(var(--dir) * var(--w1alt-push))) rotate(calc(var(--dir) * var(--w1alt-tilt))); } to { opacity: 1; transform: none; } }
  @supports (animation-timeline: view()) {
    .w1alt:not([data-fb]) .w1alt-card { animation: w1alt-in linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
  }
  /* Fallback set by the script: each card slides in once. */
  .w1alt[data-fb] .w1alt-card { opacity: 0; transform: translateX(calc(var(--dir) * var(--w1alt-push))) rotate(calc(var(--dir) * var(--w1alt-tilt)));
    transition: opacity .6s ease, transform .9s cubic-bezier(.2,.75,.2,1); }
  .w1alt[data-fb] .w1alt-card.w1alt-in { opacity: 1; transform: none; }
  @media (prefers-reduced-motion: reduce) {
    .w1alt .w1alt-card, .w1alt[data-fb] .w1alt-card { animation: none !important; opacity: 1; transform: none; transition: none; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1alt]");
  if (!root) return;
  //BODY-START
  var off = [];
  var SPEED = 40; // demo scroll in px per second before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function keep(o) { off.push(function () { o.disconnect(); }); return o; }

  // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t;
    pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  off.push(stop);
  keep(new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); })).observe(root);
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
  });
  play();
  var native = window.CSS && CSS.supports("animation-timeline: view()");

  // Without scroll-driven animations: slide each card in once as it enters the box.
  if (!reduce && !native) {
    root.setAttribute("data-fb", "");
    var io = keep(new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add("w1alt-in"); io.unobserve(e.target); } });
    }, { root: root, rootMargin: "0px 0px -10% 0px" }));
    root.querySelectorAll(".w1alt-card").forEach(function (el) { io.observe(el); });
  }
  //BODY-END
})();
</script>

With reduced motion: Cards are shown straight and in place in their zigzag layout, with no sliding.

Running cost: Transform and opacity on five cards from the scroll timeline; the fallback observer fires once per card.

  • Change `--w1alt-push` and `--w1alt-tilt` for a longer or flatter entrance.
  • Set the card `width: 60%` in the wide-screen media query to 100% for a single column.
  • Use `entry 0% cover 30%` in `animation-range` to decide where each card finishes landing.

Circular Badge That Spins With Scroll

A round espresso-coloured stamp with lettering set around its edge sits beside a coffee roaster's bean list. Its ring is tied directly to scroll position, so it turns forward as you read down and backward as you return, while the bean in the middle stays upright. On wide screens it rides along in a sticky side column; on phones it sits above the headline.

<section class="w7bdg" data-w7bdg tabindex="0" aria-label="Halden Roastery, this month's coffee, scrollable">
  <div class="w7bdg-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w7bdg-wrap">
    <div class="w7bdg-side">
      <div class="w7bdg-badge" aria-hidden="true">
        <svg class="w7bdg-ring" viewBox="0 0 200 200">
          <defs><path id="w7bdg-c" d="M100 100 m-74 0 a74 74 0 1 1 148 0 a74 74 0 1 1 -148 0" /></defs>
          <circle cx="100" cy="100" r="98" class="w7bdg-disc" />
          <text class="w7bdg-txt"><textPath href="#w7bdg-c">ROASTED ON TUESDAYS · HALDEN ROASTERY · </textPath></text>
        </svg>
        <svg class="w7bdg-bean" viewBox="0 0 64 64"><ellipse cx="32" cy="32" rx="17" ry="23" transform="rotate(30 32 32)" /><path d="M24 15c10 9 2 25 16 34" /></svg>
      </div>
    </div>
    <div class="w7bdg-main">
      <p class="w7bdg-eye">Halden Roastery</p>
      <h2 class="w7bdg-h">Roasted on Tuesday, in your cup by Friday</h2>
      <p class="w7bdg-p">We roast in eleven kilo batches in a converted dairy and post everything the same afternoon, so the beans reach you while they still smell of the drum.</p>
      <h3 class="w7bdg-sub">This month's beans</h3>
      <ul class="w7bdg-list">
        <li><p class="w7bdg-o">Huila, Colombia <span>Washed</span></p><p class="w7bdg-n">Red apple, panela, cocoa nib</p><p class="w7bdg-pr">£11 · 250 g</p></li>
        <li><p class="w7bdg-o">Sidama, Ethiopia <span>Natural</span></p><p class="w7bdg-n">Blueberry, jasmine, black tea</p><p class="w7bdg-pr">£12.50 · 250 g</p></li>
        <li><p class="w7bdg-o">Cerrado, Brazil <span>Pulped natural</span></p><p class="w7bdg-n">Hazelnut, milk chocolate, brown sugar</p><p class="w7bdg-pr">£9.50 · 250 g</p></li>
      </ul>
      <h3 class="w7bdg-sub">How we roast</h3>
      <p class="w7bdg-p">Lighter than most, slower than most. Each coffee gets a few test batches on a small sample roaster before we commit a full sack, and we cup every batch the next morning.</p>
      <a class="w7bdg-btn" href="#">Start a fortnightly bag</a>
    </div>
  </div>
</section>

<style>
  /* Change these: --w7bdg-turns (rotation over the whole scroll), --w7bdg-size (badge width), --w7bdg-bg, --w7bdg-ink, --w7bdg-rust. */
  .w7bdg { --w7bdg-turns: 2; --w7bdg-size: 200px; --w7bdg-bg: #eadfcb; --w7bdg-ink: #2a1c14; --w7bdg-rust: #9c4a26;
    position: relative; height: 620px; overflow-y: auto; overflow-x: hidden; background: var(--w7bdg-bg); color: var(--w7bdg-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  /* To run on page scroll: delete height and overflow above; the CSS timeline then follows the page, and the fallback reads window.scrollY. */
  .w7bdg:focus-visible { outline: 3px solid var(--w7bdg-rust); outline-offset: -3px; }
  .w7bdg-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; justify-content: flex-end; pointer-events: none; }
  .w7bdg-hint span { margin: 14px 14px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(42,28,20,.1); font-size: 12px; transition: opacity .5s; }
  .w7bdg[data-touched] .w7bdg-hint span { opacity: 0; }
  .w7bdg-wrap { max-width: 66rem; margin: 0 auto; padding: 48px 20px 80px; display: grid; gap: 28px; }
  .w7bdg-side { order: -1; }
  .w7bdg-badge { position: relative; width: min(var(--w7bdg-size), 44vw); aspect-ratio: 1; border-radius: 50%; box-shadow: 0 16px 30px -10px rgba(42,28,20,.4); }
  .w7bdg-ring { display: block; width: 100%; height: 100%; }
  .w7bdg-disc { fill: var(--w7bdg-ink); }
  .w7bdg-txt { fill: #eadfcb; font-size: 14px; font-weight: 700; letter-spacing: 2.3px; text-transform: uppercase; }
  .w7bdg-bean { position: absolute; left: 34%; top: 34%; width: 32%; height: 32%; fill: var(--w7bdg-rust); stroke: #2a1c14; stroke-width: 3; stroke-linecap: round; }
  .w7bdg-bean path { fill: none; stroke: #eadfcb; }
  .w7bdg-eye { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--w7bdg-rust); }
  .w7bdg-h { margin: 12px 0 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(2.1rem, 5vw, 3.6rem); line-height: 1.04; letter-spacing: -.02em; }
  .w7bdg-p { margin: 18px 0 0; max-width: 34rem; font-size: 16px; line-height: 1.65; color: #4f3b2e; }
  .w7bdg-sub { margin: 64px 0 0; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
  .w7bdg-list { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid rgba(42,28,20,.2); }
  .w7bdg-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 18px 0; border-bottom: 1px solid rgba(42,28,20,.2); }
  .w7bdg-list p { margin: 0; }
  .w7bdg-o { font-size: 19px; font-weight: 600; }
  .w7bdg-o span { margin-left: 8px; font-size: 13px; font-weight: 500; color: var(--w7bdg-rust); }
  .w7bdg-n { grid-column: 1; font-size: 15px; color: #5c4738; }
  .w7bdg-pr { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .w7bdg-btn { display: inline-flex; align-items: center; min-height: 48px; margin-top: 32px; padding: 0 26px; border-radius: 999px; background: var(--w7bdg-ink); color: var(--w7bdg-bg); font-weight: 600; font-size: 15px; text-decoration: none; }
  .w7bdg-btn:hover { background: #4a3123; }
  .w7bdg-btn:focus-visible { outline: 3px solid var(--w7bdg-rust); outline-offset: 3px; }
  @media (min-width: 820px) {
    .w7bdg-wrap { grid-template-columns: 1fr 240px; gap: 56px; padding: 60px 48px 90px; }
    .w7bdg-side { order: 2; }
    .w7bdg-badge { position: sticky; top: 64px; width: var(--w7bdg-size); }
  }
  @keyframes w7bdg-spin { to { transform: rotate(calc(var(--w7bdg-turns) * 360deg)); } }
  /* The ring follows the nearest scroller; the bean in the middle stays upright. */
  @supports (animation-timeline: scroll()) {
    .w7bdg:not([data-fb]) .w7bdg-ring { animation: w7bdg-spin linear both; animation-timeline: scroll(nearest block); }
  }
  @media (prefers-reduced-motion: reduce) { .w7bdg .w7bdg-ring { animation: none !important; transform: rotate(-8deg) !important; } }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w7bdg]");
  if (!root) return;
  var off = [];
  //BODY-START
  var SPEED = 30; // px per second of demo scroll before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t; pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  function hand() { done = true; stop(); root.setAttribute("data-touched", ""); }
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    root.addEventListener(n, hand, { passive: true });
    off.push(function () { root.removeEventListener(n, hand); });
  });
  var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
  vis.observe(root);
  off.push(stop, function () { vis.disconnect(); });
  play();
  // Fallback: turn the ring from the scroll position, at most once per frame.
  if (reduce || (window.CSS && CSS.supports("animation-timeline: scroll()"))) return;
  root.setAttribute("data-fb", "");
  var ring = root.querySelector(".w7bdg-ring"), turns = parseFloat(getComputedStyle(root).getPropertyValue("--w7bdg-turns")) || 2, raf = 0;
  function spin() {
    raf = 0;
    var max = root.scrollHeight - root.clientHeight || 1;
    ring.style.transform = "rotate(" + (root.scrollTop / max * turns * 360).toFixed(1) + "deg)";
  }
  function onScroll() { if (!raf) raf = requestAnimationFrame(spin); }
  root.addEventListener("scroll", onScroll, { passive: true });
  off.push(function () { root.removeEventListener("scroll", onScroll); cancelAnimationFrame(raf); ring.style.transform = ""; root.removeAttribute("data-fb"); });
  //BODY-END
})();
</script>

With reduced motion: The badge rests at a fixed, slightly turned angle and does not move with scroll.

Running cost: A single rotate on one small SVG, run by the scroll timeline; the fallback updates it at most once per frame.

  • Set how far it turns over the full scroll with `--w7bdg-turns` and its width with `--w7bdg-size`.
  • Rewrite the ring text inside `textPath`; add or remove words until the separator meets the start.
  • Recolour the disc, lettering and bean with `--w7bdg-ink`, `--w7bdg-bg` and `--w7bdg-rust`.

Feature List Staggered Fade Up

A numbered list of what a bike service includes, where each item rises into place as it scrolls into view. Inside every item the number, title and text arrive one after another, and on wide screens the right column lands a beat after the left, so a two-column grid reads in order instead of popping in by rows.

<section class="w1fad" data-w1fad tabindex="0" aria-label="What a full service covers, scrollable">
  <div class="w1fad-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1fad-wrap">
    <p class="w1fad-eyebrow">Halden Cycle Works</p>
    <h2 class="w1fad-h">What a full service covers</h2>
    <p class="w1fad-lead">Drop your bike off in the morning and collect it the same evening. Every full service runs through the same eight stations, in this order.</p>
    <ul class="w1fad-list">
      <li class="w1fad-r"><span class="w1fad-n">01</span><h3>Drivetrain deep clean</h3><p>Chain, cassette and rings come off and go through the parts washer, so grit leaves the bike instead of moving around it.</p></li>
      <li class="w1fad-r"><span class="w1fad-n">02</span><h3>Brake bleed and pads</h3><p>Fresh fluid for hydraulic brakes, new pads where the old ones are under a millimetre, and rotors checked for warp.</p></li>
      <li class="w1fad-r"><span class="w1fad-n">03</span><h3>Wheel truing</h3><p>Both wheels go on the stand and get trued and tensioned by hand until they spin straight and sound even.</p></li>
      <li class="w1fad-r"><span class="w1fad-n">04</span><h3>Bearings and headset</h3><p>Hubs, bottom bracket and headset are felt for roughness and regreased or replaced, never just sprayed.</p></li>
      <li class="w1fad-r"><span class="w1fad-n">05</span><h3>Cables and housing</h3><p>Gear and brake cables are replaced if frayed, and housing is cut square so shifting feels crisp again.</p></li>
      <li class="w1fad-r"><span class="w1fad-n">06</span><h3>Every bolt torqued</h3><p>Stem, bars, seatpost and rotors are set with a torque wrench to the maker's figure, not by feel.</p></li>
      <li class="w1fad-r"><span class="w1fad-n">07</span><h3>Tyres and sealant</h3><p>Tyres are checked for cuts, tubeless sealant is topped up, and pressures are set for how you actually ride.</p></li>
      <li class="w1fad-r"><span class="w1fad-n">08</span><h3>Test ride and notes</h3><p>A mechanic rides it round the yard, then writes down what was done and what to watch over the next few months.</p></li>
    </ul>
    <div class="w1fad-cta">
      <p>Same-day turnaround when you drop off before ten.</p>
      <a href="#" class="w1fad-btn">Book a full service</a>
    </div>
  </div>
</section>

<style>
  /* Change these: --w1fad-paper (background), --w1fad-ink (text), --w1fad-accent (numbers, button),
     --w1fad-rise (how far items travel up), and the cover % values in .w1fad-r > * (when each item finishes). */
  .w1fad { --w1fad-paper: #f4efe6; --w1fad-ink: #231d16; --w1fad-accent: #a4471f; --w1fad-rise: 28px;
    height: 620px; overflow-y: auto; overflow-x: hidden; position: relative; background: var(--w1fad-paper); color: var(--w1fad-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* To animate with the page scroll instead, delete height and overflow above and set root: null in the script. */
  .w1fad:focus-visible { outline: 3px solid var(--w1fad-accent); outline-offset: -3px; }
  .w1fad-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1fad-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(35,29,22,.82); color: #f4efe6;
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1fad[data-touched] .w1fad-hint span { opacity: 0; }
  .w1fad-wrap { max-width: 64rem; margin: 0 auto; padding: 72px 20px 80px; }
  .w1fad-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--w1fad-accent); }
  .w1fad-h { margin: 14px 0 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.08; letter-spacing: -.015em; }
  .w1fad-lead { margin: 18px 0 0; max-width: 34rem; font-size: 1.0625rem; line-height: 1.65; color: #4f4436; }
  .w1fad-list { list-style: none; margin: 48px 0 0; padding: 0; display: grid; column-gap: 64px; }
  .w1fad-r { padding: 26px 0 30px; border-top: 1px solid #d9cfbf; display: grid; grid-template-columns: 52px 1fr; column-gap: 8px; }
  .w1fad-n { grid-row: span 2; padding-top: 4px; font-size: 13px; font-weight: 700; color: var(--w1fad-accent); font-variant-numeric: tabular-nums; }
  .w1fad-r h3 { margin: 0; font-size: 1.1875rem; font-weight: 600; }
  .w1fad-r p { margin: 8px 0 0; font-size: .9688rem; line-height: 1.6; color: #4f4436; }
  .w1fad-cta { margin-top: 40px; padding: 28px; border-radius: 14px; background: #ebe3d5; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; }
  .w1fad-cta p { margin: 0; font-size: 1rem; line-height: 1.5; }
  .w1fad-btn { min-height: 46px; display: inline-flex; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1fad-ink);
    color: var(--w1fad-paper); font-size: .9375rem; font-weight: 600; text-decoration: none; transition: background .2s; }
  .w1fad-btn:hover { background: #3d3226; }
  .w1fad-btn:focus-visible { outline: 3px solid var(--w1fad-accent); outline-offset: 3px; }
  @media (min-width: 720px) {
    .w1fad-wrap { padding: 88px 40px 96px; }
    .w1fad-list { grid-template-columns: 1fr 1fr; }
    .w1fad-r:nth-child(even) { --c: 5%; --cd: 120ms; } /* right column lands a beat later */
  }
  /* Stagger inside each item: number, then title, then text. */
  .w1fad-r > :nth-child(2) { --k: 3%; --kd: 80ms; }
  .w1fad-r > :nth-child(3) { --k: 6%; --kd: 160ms; }
  @keyframes w1fad-up { from { opacity: 0; transform: translateY(var(--w1fad-rise)); } to { opacity: 1; transform: none; } }
  @supports (animation-timeline: view()) {
    .w1fad-r { view-timeline: --w1fad-i block; }
    .w1fad:not([data-fb]) .w1fad-r > * { animation: w1fad-up linear both; animation-timeline: --w1fad-i;
      animation-range: cover calc(var(--c, 0%) + var(--k, 0%) + 2%) cover calc(var(--c, 0%) + var(--k, 0%) + 24%); }
  }
  /* Fallback (set by the script): each item eases in once when it enters. */
  .w1fad[data-fb] .w1fad-r > * { opacity: 0; transform: translateY(var(--w1fad-rise));
    transition: opacity .6s ease, transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--cd, 0ms) + var(--kd, 0ms)); }
  .w1fad[data-fb] .w1fad-in > * { opacity: 1; transform: none; }
  @media (prefers-reduced-motion: reduce) {
    .w1fad .w1fad-r > *, .w1fad[data-fb] .w1fad-r > * { animation: none !important; opacity: 1; transform: none; transition: none; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1fad]");
  if (!root) return;
  var SPEED = 26; // demo scroll in px per second before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;

  // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t;
    pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); }).observe(root);
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    root.addEventListener(n, function () { done = true; stop(); root.setAttribute("data-touched", ""); }, { passive: true });
  });
  play();

  // Browsers without scroll-driven animations: reveal each item once as it enters the box.
  if (reduce || (window.CSS && CSS.supports("animation-timeline: view()"))) return;
  root.setAttribute("data-fb", "");
  var io = new IntersectionObserver(function (es) {
    es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add("w1fad-in"); io.unobserve(e.target); } });
  }, { root: root, rootMargin: "0px 0px -10% 0px" });
  root.querySelectorAll(".w1fad-r").forEach(function (el) { io.observe(el); });
})();
</script>

With reduced motion: All eight items are shown in their final place with no movement and no demo scroll.

Running cost: Opacity and transform on two dozen small elements, driven by the scroll timeline off the main thread where supported.

  • Change `--w1fad-rise` to set how far each item travels before it settles.
  • Shift the `cover 2%` and `cover 24%` values in the `animation-range` to make items finish earlier or later in the box.
  • Set `--c` on `.w1fad-r:nth-child(even)` to 0% to drop the column offset.

Headline Lines Rise From Masks

Three large serif statements for an architecture practice, each split into lines that slide up from behind their own hidden edge as they scroll into view. Lines follow each other by a small step, and the caption under every statement fades in last. It suits a principles or about section on a dark, quiet page.

<section class="w1msk" data-w1msk tabindex="0" aria-label="Ostra Studio principles, scrollable">
  <div class="w1msk-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1msk-wrap">
    <p class="w1msk-eyebrow">Ostra Studio · Architects</p>
    <div class="w1msk-block">
      <h2 class="w1msk-h"><span class="w1msk-m"><span class="w1msk-l">We draw houses</span></span><span class="w1msk-m"><span class="w1msk-l">that grow better</span></span><span class="w1msk-m"><span class="w1msk-l">with age.</span></span></h2>
      <p class="w1msk-cap">Lime plaster, oiled oak and stone that weathers into its place. We pick materials for how they look in thirty winters, not on handover day.</p>
    </div>
    <div class="w1msk-block">
      <h2 class="w1msk-h"><span class="w1msk-m"><span class="w1msk-l">Light comes first,</span></span><span class="w1msk-m"><span class="w1msk-l">the walls follow,</span></span><span class="w1msk-m"><span class="w1msk-l">the rest after.</span></span></h2>
      <p class="w1msk-cap">Every project starts with a sun study of the plot, hour by hour, before a single room is placed on paper.</p>
    </div>
    <div class="w1msk-block">
      <h2 class="w1msk-h"><span class="w1msk-m"><span class="w1msk-l">Small rooms,</span></span><span class="w1msk-m"><span class="w1msk-l">long views,</span></span><span class="w1msk-m"><span class="w1msk-l">honest stone.</span></span></h2>
      <p class="w1msk-cap">We take on four houses a year so each one gets the same two people from first sketch to last snag.</p>
    </div>
    <a href="#" class="w1msk-btn">Start a conversation</a>
  </div>
</section>

<style>
  /* Change these: --w1msk-bg, --w1msk-ink, --w1msk-gold (accent), and --k on .w1msk-m:nth-child (gap between lines). */
  .w1msk { --w1msk-bg: #15181d; --w1msk-ink: #ece6da; --w1msk-gold: #c9a46a;
    height: 620px; overflow-y: auto; overflow-x: hidden; position: relative; background: var(--w1msk-bg); color: var(--w1msk-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; scrollbar-color: #444 transparent; }
  /* To use page scroll: delete height and overflow above and set root: null in the script. */
  .w1msk:focus-visible { outline: 3px solid var(--w1msk-gold); outline-offset: -3px; }
  .w1msk-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1msk-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(236,230,218,.14); color: var(--w1msk-ink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1msk[data-touched] .w1msk-hint span { opacity: 0; }
  .w1msk-wrap { max-width: 60rem; margin: 0 auto; padding: 72px 20px 120px; }
  .w1msk-eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--w1msk-gold); }
  .w1msk-block { padding: 36px 0 120px; }
  .w1msk-block + .w1msk-block { border-top: 1px solid rgba(236,230,218,.14); padding-top: 72px; }
  .w1msk-h { margin: 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(2.3rem, 7vw, 5rem); line-height: 1.02; letter-spacing: -.025em; }
  .w1msk-m { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
  .w1msk-l { display: block; }
  .w1msk-cap { margin: 28px 0 0; max-width: 28rem; font-size: 1rem; line-height: 1.65; color: #b9b2a5; }
  .w1msk-btn { display: inline-flex; min-height: 48px; align-items: center; padding: 0 24px; border-radius: 999px; background: var(--w1msk-ink);
    color: var(--w1msk-bg); font-weight: 600; font-size: .9375rem; text-decoration: none; }
  .w1msk-btn:hover { background: #fff; }
  .w1msk-btn:focus-visible { outline: 3px solid var(--w1msk-gold); outline-offset: 3px; }
  .w1msk-m:nth-child(2) { --k: 5%; --kd: 110ms; }
  .w1msk-m:nth-child(3) { --k: 10%; --kd: 220ms; }
  @keyframes w1msk-rise { from { transform: translateY(105%); } to { transform: none; } }
  @keyframes w1msk-fade { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  @supports (animation-timeline: view()) {
    .w1msk-m { view-timeline: --w1msk-v block; }
    .w1msk:not([data-fb]) .w1msk-l { animation: w1msk-rise linear both; animation-timeline: --w1msk-v;
      animation-range: cover calc(var(--k, 0%) + 4%) cover calc(var(--k, 0%) + 26%); }
    .w1msk:not([data-fb]) .w1msk-cap { animation: w1msk-fade linear both; animation-timeline: view(); animation-range: cover 6% cover 30%; }
  }
  /* Fallback set by the script: lines rise once when their heading enters. */
  .w1msk[data-fb] .w1msk-l { transform: translateY(105%); transition: transform .9s cubic-bezier(.2,.75,.15,1); transition-delay: var(--kd, 0ms); }
  .w1msk[data-fb] .w1msk-cap { opacity: 0; transition: opacity .8s ease .35s; }
  .w1msk[data-fb] .w1msk-in .w1msk-l { transform: none; }
  .w1msk[data-fb] .w1msk-in .w1msk-cap { opacity: 1; }
  @media (min-width: 720px) { .w1msk-wrap { padding: 88px 48px 140px; } }
  @media (prefers-reduced-motion: reduce) {
    .w1msk .w1msk-l, .w1msk .w1msk-cap, .w1msk[data-fb] .w1msk-l, .w1msk[data-fb] .w1msk-cap { animation: none !important; transform: none; opacity: 1; transition: none; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1msk]");
  if (!root) return;
  //BODY-START
  var off = [];
  var SPEED = 30; // demo scroll in px per second before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function keep(o) { off.push(function () { o.disconnect(); }); return o; }

  // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t;
    pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  off.push(stop);
  keep(new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); })).observe(root);
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
  });
  play();
  var native = window.CSS && CSS.supports("animation-timeline: view()");

  // Without scroll-driven animations: reveal each statement once as it enters.
  if (!reduce && !native) {
    root.setAttribute("data-fb", "");
    var io = keep(new IntersectionObserver(function (es) {
      es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add("w1msk-in"); io.unobserve(e.target); } });
    }, { root: root, rootMargin: "0px 0px -12% 0px" }));
    root.querySelectorAll(".w1msk-block").forEach(function (el) { io.observe(el); });
  }
  //BODY-END
})();
</script>

With reduced motion: All three statements and captions are shown in place, fully readable, with nothing sliding.

Running cost: Only transforms on nine line spans plus three caption fades, so scrolling stays on the compositor.

  • Change the line breaks by editing the text inside each `.w1msk-l` span; every span is one masked line.
  • Raise `--k` on `.w1msk-m:nth-child(2)` and `(3)` to space the lines further apart.
  • Swap `--w1msk-bg` and `--w1msk-ink` for a light version.

Headline Rows Skew With Scroll Speed

A terracotta class timetable for a dance hall set in oversized serif rows. Scrolling slants each row sideways like a dancer leaning into a turn, harder the faster you go, and rows lower in the list catch up a beat later so the slant travels down the page as a wave before everything stands upright again. The box drifts by itself until someone scrolls it.

<section class="w3skh" tabindex="0" aria-label="Corva Dance Hall, weekly classes">
  <p class="w3skh-hint" aria-hidden="true">Scroll inside</p>
  <div class="w3skh-intro">
    <p class="w3skh-kicker">Corva Dance Hall</p>
    <p class="w3skh-lede">Evening classes in a sprung-floor hall above the old tram depot. Drop in, or book a term.</p>
  </div>
  <h2 class="w3skh-sr">Weekly classes</h2>
  <ul class="w3skh-list">
    <li><a href="#"><span class="w3skh-name">Lindy Hop</span><span class="w3skh-when">Mon 19:00</span></a></li>
    <li><a href="#"><span class="w3skh-name">Argentine Tango</span><span class="w3skh-when">Mon 20:30</span></a></li>
    <li><a href="#"><span class="w3skh-name">Salsa</span><span class="w3skh-when">Tue 19:30</span></a></li>
    <li><a href="#"><span class="w3skh-name">Ballet Barre</span><span class="w3skh-when">Wed 18:15</span></a></li>
    <li><a href="#"><span class="w3skh-name">Contemporary</span><span class="w3skh-when">Wed 20:00</span></a></li>
    <li><a href="#"><span class="w3skh-name">Tap</span><span class="w3skh-when">Thu 19:00</span></a></li>
    <li><a href="#"><span class="w3skh-name">West Coast Swing</span><span class="w3skh-when">Thu 20:30</span></a></li>
    <li><a href="#"><span class="w3skh-name">Flamenco</span><span class="w3skh-when">Fri 18:30</span></a></li>
    <li><a href="#"><span class="w3skh-name">Social Dance</span><span class="w3skh-when">Sat 20:00</span></a></li>
  </ul>
  <p class="w3skh-foot">Shoes with suede or leather soles, please. Changing rooms open half an hour before the first class.</p>
</section>
<style>
  /* Change these: --w3skh-h (box height; remove height and overflow to use the page scroll), --w3skh-bg, --w3skh-ink, --w3skh-line. */
  .w3skh { --w3skh-h: 620px; --w3skh-bg: #a9472a; --w3skh-ink: #fbefe4; --w3skh-line: rgba(251,239,228,.28);
    position: relative; height: var(--w3skh-h); overflow-y: auto; overscroll-behavior: contain; background: var(--w3skh-bg); color: var(--w3skh-ink); font-family: ui-sans-serif, system-ui, sans-serif; }
  .w3skh:focus-visible { outline: 2px solid var(--w3skh-ink); outline-offset: -4px; }
  .w3skh-hint { position: sticky; top: 0; z-index: 2; margin: 0; padding: 12px 20px; text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; background: linear-gradient(var(--w3skh-bg) 60%, transparent); transition: opacity .5s ease; }
  .w3skh[data-used] .w3skh-hint { opacity: 0; }
  .w3skh-intro, .w3skh-list, .w3skh-foot { max-width: 72rem; margin: 0 auto; padding: 0 20px; }
  .w3skh-intro { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 40px; padding-top: 16px; padding-bottom: 28px; }
  .w3skh-kicker { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; }
  .w3skh-lede { max-width: 26rem; margin: 0; font-size: 16px; line-height: 1.55; }
  .w3skh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .w3skh-list { list-style: none; padding-bottom: 32px; }
  .w3skh-list li { border-top: 1px solid var(--w3skh-line); }
  .w3skh-list li:last-child { border-bottom: 1px solid var(--w3skh-line); }
  .w3skh-list a { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 14px 0 10px; color: inherit; text-decoration: none; transform-origin: 0 100%; will-change: transform; }
  .w3skh-name { font: 400 clamp(40px, 8.4vw, 104px)/.95 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
  .w3skh-when { flex: none; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
  .w3skh-list a:hover .w3skh-name, .w3skh-list a:focus-visible .w3skh-name { font-style: italic; }
  .w3skh-list a:focus-visible { outline: 2px solid var(--w3skh-ink); outline-offset: 4px; }
  .w3skh-foot { padding-bottom: 72px; font-size: 15px; line-height: 1.6; max-width: 72rem; }
  @media (max-width: 560px) { .w3skh-list a { flex-direction: column; gap: 6px; } }
  @media (prefers-reduced-motion: reduce) { .w3skh-list a { transform: none !important; } .w3skh-hint { transition: none; } }
</style>
<script>
(function () {
  var SKEW = 1;  /* degrees of slant per pixel scrolled in one frame */
  var MAX = 9;      /* the strongest slant, in degrees */
  var LAG = 0.06;   /* rows further down follow a little later, which makes the wave */
  var IDLE = 160;     /* the self-scroll demo swings this many px down and back every 4.8 s; 0 turns it off */
  var root = document.querySelector(".w3skh");
  if (!root) return;
  /* The box is the scroller here. On a normal page, set sc = window and the code reads scrollY. */
  var sc = root;
  var rows = [].slice.call(root.querySelectorAll(".w3skh-list a")), cur = rows.map(function () { return 0; });
  function pos() { return sc === window ? scrollY : sc.scrollTop; }
  var last = pos(), f = 0, on = false, demo = IDLE > 0, t0 = 0;
  function used() { demo = false; root.setAttribute("data-used", ""); }
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (e) { root.addEventListener(e, used, { passive: true }); });
  if (matchMedia("(prefers-reduced-motion: reduce)").matches) return;
  function tick(now) {
    if (demo && on && sc !== window) {
      sc.scrollTop = IDLE * (1 - Math.cos((now - t0) / 764));
    }
    var p = pos(), v = p - last, moving = v || demo;
    last = p;
    var target = Math.max(-MAX, Math.min(MAX, -v * SKEW));
    rows.forEach(function (r, i) {
      var c = cur[i] + (target - cur[i]) * Math.max(0.04, 0.2 - i * LAG / 3);
      if (Math.abs(c) < 0.01 && !v) c = 0;
      cur[i] = c;
      if (c) moving = true;
      r.style.transform = c ? "skewX(" + c.toFixed(2) + "deg)" : "";
    });
    f = on && moving ? requestAnimationFrame(tick) : 0;
  }
  function run() { if (!f && on) f = requestAnimationFrame(tick); }
  (sc === window ? window : sc).addEventListener("scroll", run, { passive: true });
  new IntersectionObserver(function (e) {
    on = e[0].isIntersecting;
    if (on) { t0 = performance.now(); run(); } else { cancelAnimationFrame(f); f = 0; }
  }).observe(root);
})();
</script>

With reduced motion: The class names stand upright and the list scrolls normally, with no slant and no automatic movement.

Running cost: A frame loop writes one skewX per row only while scrolling or settling, and stops when every row is upright or the box is off screen.

  • Change `SKEW` for how much slant each pixel of speed gives, and `MAX` for the limit.
  • Raise `LAG` to make lower rows trail further behind, or set it to 0 so every row leans together.
  • Recolour with `--w3skh-bg`, `--w3skh-ink` and `--w3skh-line`, and set `IDLE` to 0 to drop the demo.

Photo Grid Leans With Scroll Speed

A three column print shop gallery on cool white where the columns tilt in proportion to how fast the box is scrolled, each by a slightly different amount, then ease back upright as soon as the scrolling stops. A slow flick barely moves them; a fast one gives a lean of a few degrees. Until someone touches it, the box drifts up and down by itself so the lean is visible.

<section class="w3lgr" tabindex="0" aria-label="Saltline Print Room, coastal prints">
  <p class="w3lgr-hint" aria-hidden="true">Scroll inside</p>
  <div class="w3lgr-intro">
    <p class="w3lgr-kicker">Saltline Print Room</p>
    <h2>Prints from a year of walking the north coast.</h2>
    <p>Each photograph is printed on cotton rag paper in the studio and signed on the back. Pick a frame or take it rolled.</p>
  </div>
  <div class="w3lgr-grid">
    <div class="w3lgr-col">
      <figure><img src="https://images.pexels.com/photos/15022475/pexels-photo-15022475.jpeg?auto=compress&cs=tinysrgb&w=700" alt="A stone lighthouse at the end of a rocky breakwater under a clear sky" loading="lazy" width="700" height="875"><figcaption>Harbour lighthouse <span>No. 01</span></figcaption></figure>
      <figure><img src="https://images.pexels.com/photos/8933075/pexels-photo-8933075.jpeg?auto=compress&cs=tinysrgb&w=700" alt="Pale dune grass bending over sand under an overcast sky" loading="lazy" width="700" height="875"><figcaption>Dune grass <span>No. 04</span></figcaption></figure>
      <figure><img src="https://images.pexels.com/photos/20799401/pexels-photo-20799401.jpeg?auto=compress&cs=tinysrgb&w=700" alt="Still water in a tide pool between rust coloured rocks" loading="lazy" width="700" height="875"><figcaption>Tide pool in a cove <span>No. 07</span></figcaption></figure>
      <figure><img src="https://images.pexels.com/photos/2233362/pexels-photo-2233362.jpeg?auto=compress&cs=tinysrgb&w=700" alt="Fishing trawlers hauled out on a harbour hardstand" loading="lazy" width="700" height="875"><figcaption>Trawlers hauled out <span>No. 10</span></figcaption></figure>
    </div>
    <div class="w3lgr-col">
      <figure><img src="https://images.pexels.com/photos/11363530/pexels-photo-11363530.jpeg?auto=compress&cs=tinysrgb&w=700" alt="Yellow floats and crates on the deck of a moored fishing boat" loading="lazy" width="700" height="875"><figcaption>Floats on the deck <span>No. 02</span></figcaption></figure>
      <figure><img src="https://images.pexels.com/photos/15379643/pexels-photo-15379643.jpeg?auto=compress&cs=tinysrgb&w=700" alt="White surf breaking in a gap between sandstone rocks" loading="lazy" width="700" height="875"><figcaption>Surf between rocks <span>No. 05</span></figcaption></figure>
      <figure><img src="https://images.pexels.com/photos/8970615/pexels-photo-8970615.jpeg?auto=compress&cs=tinysrgb&w=700" alt="Close view of smooth grey, green and brown beach pebbles" loading="lazy" width="700" height="875"><figcaption>Beach pebbles <span>No. 08</span></figcaption></figure>
      <figure><img src="https://images.pexels.com/photos/11207937/pexels-photo-11207937.jpeg?auto=compress&cs=tinysrgb&w=700" alt="Black volcanic rocks along a shoreline with a strip of water between them" loading="lazy" width="700" height="875"><figcaption>Black rock shore <span>No. 11</span></figcaption></figure>
    </div>
    <div class="w3lgr-col">
      <figure><img src="https://images.pexels.com/photos/16549060/pexels-photo-16549060.jpeg?auto=compress&cs=tinysrgb&w=700" alt="A dark rocky headland running into a calm grey sea" loading="lazy" width="700" height="875"><figcaption>Headland, grey sea <span>No. 03</span></figcaption></figure>
      <figure><img src="https://images.pexels.com/photos/9435233/pexels-photo-9435233.jpeg?auto=compress&cs=tinysrgb&w=700" alt="A sandy path running between green grassy dunes" loading="lazy" width="700" height="875"><figcaption>Path through the dunes <span>No. 06</span></figcaption></figure>
      <figure><img src="https://images.pexels.com/photos/4616317/pexels-photo-4616317.jpeg?auto=compress&cs=tinysrgb&w=700" alt="A wooded cliff dropping into still blue water" loading="lazy" width="700" height="875"><figcaption>Wooded cliff <span>No. 09</span></figcaption></figure>
      <figure><img src="https://images.pexels.com/photos/11468623/pexels-photo-11468623.jpeg?auto=compress&cs=tinysrgb&w=700" alt="Small boats tied along a marina pontoon on a cloudy day" loading="lazy" width="700" height="875"><figcaption>Marina pontoon <span>No. 12</span></figcaption></figure>
    </div>
  </div>
</section>
<style>
  /* Change these: --w3lgr-h (box height; remove height and overflow to use the page scroll), --w3lgr-bg, --w3lgr-ink. */
  .w3lgr { --w3lgr-h: 640px; --w3lgr-bg: #f4f5f6; --w3lgr-ink: #1d232a;
    position: relative; height: var(--w3lgr-h); overflow-y: auto; overscroll-behavior: contain; background: var(--w3lgr-bg); color: var(--w3lgr-ink); font-family: ui-sans-serif, system-ui, sans-serif; }
  .w3lgr:focus-visible { outline: 2px solid #2f6f9f; outline-offset: -4px; }
  .w3lgr-hint { position: sticky; top: 0; z-index: 2; margin: 0; padding: 12px 20px; text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #5b6570; background: linear-gradient(var(--w3lgr-bg) 60%, transparent); transition: opacity .5s ease; }
  .w3lgr[data-used] .w3lgr-hint { opacity: 0; }
  .w3lgr-intro { max-width: 68rem; margin: 0 auto; padding: 20px 20px 40px; }
  .w3lgr-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #2f6f9f; }
  .w3lgr h2 { margin: 12px 0 0; max-width: 34rem; font-size: clamp(28px, 4vw, 42px); font-weight: 600; line-height: 1.12; letter-spacing: -.025em; }
  .w3lgr-intro p:last-child { max-width: 34rem; margin: 14px 0 0; font-size: 16px; line-height: 1.6; color: #4a535d; }
  .w3lgr-grid { max-width: 68rem; margin: 0 auto; padding: 0 20px 80px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .w3lgr-col { display: grid; gap: 16px; align-content: start; will-change: transform; }
  .w3lgr-col:nth-child(2) { margin-top: 56px; }
  .w3lgr-col:nth-child(3) { display: none; }
  .w3lgr figure { margin: 0; }
  .w3lgr img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 10px; background: #dde1e5; }
  .w3lgr figcaption { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; font-size: 14px; font-weight: 500; }
  .w3lgr figcaption span { flex: none; color: #5b6570; font-variant-numeric: tabular-nums; }
  @media (min-width: 760px) {
    .w3lgr-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
    .w3lgr-col { gap: 24px; }
    .w3lgr-col:nth-child(3) { display: grid; margin-top: 24px; }
  }
  @media (prefers-reduced-motion: reduce) { .w3lgr-col { transform: none !important; } .w3lgr-hint { transition: none; } }
</style>
<script>
(function () {
  var LEAN = 0.6;  /* degrees of lean per pixel scrolled in one frame */
  var MAX = 6;      /* the most a column may lean, in degrees */
  var EASE = 0.12;  /* how quickly columns follow the speed and settle back */
  var IDLE = 55;     /* the self-scroll demo swings this many px down and back every 4.8 s; 0 turns it off */
  var root = document.querySelector(".w3lgr");
  if (!root) return;
  /* The box is the scroller here. On a normal page, set sc = window and the code reads scrollY. */
  var sc = root;
  var cols = root.querySelectorAll(".w3lgr-col"), MIX = [1, 0.55, 0.85];
  function pos() { return sc === window ? scrollY : sc.scrollTop; }
  var last = pos(), cur = 0, f = 0, on = false, demo = IDLE > 0, t0 = 0;
  function used() { demo = false; root.setAttribute("data-used", ""); }
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (e) { root.addEventListener(e, used, { passive: true }); });
  if (matchMedia("(prefers-reduced-motion: reduce)").matches) return;
  function tick(now) {
    if (demo && on && sc !== window) {
      sc.scrollTop = IDLE * (1 - Math.cos((now - t0) / 764));
    }
    var p = pos(), v = p - last;
    last = p;
    cur += (Math.max(-MAX, Math.min(MAX, v * LEAN)) - cur) * EASE;
    if (Math.abs(cur) < 0.01 && !v) cur = 0;
    cols.forEach(function (c, i) { c.style.transform = cur ? "skewY(" + (cur * MIX[i]).toFixed(2) + "deg)" : ""; });
    f = on && (cur || v || demo) ? requestAnimationFrame(tick) : 0;
  }
  function run() { if (!f && on) f = requestAnimationFrame(tick); }
  (sc === window ? window : sc).addEventListener("scroll", run, { passive: true });
  new IntersectionObserver(function (e) {
    on = e[0].isIntersecting;
    if (on) { t0 = performance.now(); run(); } else { cancelAnimationFrame(f); f = 0; }
  }).observe(root);
})();
</script>

With reduced motion: The grid scrolls as a plain, upright set of photographs with no lean and no self-scrolling demo.

Running cost: One frame loop runs only while the box is moving or settling, writing a skew to three columns; it stops when flat or off screen.

  • Raise `LEAN` for more tilt per pixel of speed, and cap it with `MAX` so captions stay legible.
  • Set `MIX` to change how much each column leans relative to the others; equal values make the grid tilt as one sheet.
  • Set `IDLE` to 0 to remove the self-scroll demo, or change `--w3lgr-h` for a taller box.

Photo Pile Settles Into a Grid

Six coastal prints start as a loose, rotated pile in the middle of a dark table and slide out to their places in a tidy grid as you scroll. Every print keeps its white border and shadow throughout, so the pile reads like real paper. The start position of each print is three variables, with a separate set for the two-column phone layout.

<section class="w1pil" data-w1pil tabindex="0" aria-label="Fieldwork Prints coast series, scrollable">
  <div class="w1pil-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1pil-wrap">
    <p class="w1pil-eyebrow">Fieldwork Prints</p>
    <h2 class="w1pil-h">The coast series, printed on cotton rag</h2>
    <p class="w1pil-lead">Six photographs from one winter on the shore. Scroll and the pile on the table sorts itself onto the wall.</p>
    <ul class="w1pil-grid">
      <li class="w1pil-p"><figure><img src="https://images.pexels.com/photos/10867143/pexels-photo-10867143.jpeg?auto=compress&cs=tinysrgb&w=800" alt="Rugged sandstone cliffs above a calm sea under a pale blue sky" loading="eager" width="800" height="800"><figcaption>Sandstone point</figcaption></figure></li>
      <li class="w1pil-p"><figure><img src="https://images.pexels.com/photos/8990439/pexels-photo-8990439.jpeg?auto=compress&cs=tinysrgb&w=800" alt="Aerial view of a pale rocky headland ringed by white surf and deep turquoise water" loading="eager" width="800" height="800"><figcaption>The headland</figcaption></figure></li>
      <li class="w1pil-p"><figure><img src="https://images.pexels.com/photos/39982422/pexels-photo-39982422.jpeg?auto=compress&cs=tinysrgb&w=800" alt="Grassy dunes running down to a wide beach and a green headland" loading="eager" width="800" height="800"><figcaption>Dune path</figcaption></figure></li>
      <li class="w1pil-p"><figure><img src="https://images.pexels.com/photos/3030015/pexels-photo-3030015.jpeg?auto=compress&cs=tinysrgb&w=800" alt="Aerial view of rows of painted fishing boats moored tightly in a harbour" loading="eager" width="800" height="800"><figcaption>Harbour at rest</figcaption></figure></li>
      <li class="w1pil-p"><figure><img src="https://images.pexels.com/photos/18163250/pexels-photo-18163250.jpeg?auto=compress&cs=tinysrgb&w=800" alt="A small white lighthouse on a green cliff above a rocky shore and blue sea" loading="eager" width="800" height="800"><figcaption>Lighthouse cliff</figcaption></figure></li>
      <li class="w1pil-p"><figure><img src="https://images.pexels.com/photos/17647534/pexels-photo-17647534.jpeg?auto=compress&cs=tinysrgb&w=800" alt="Blue cornflowers and dry grasses against a soft blue summer sky" loading="eager" width="800" height="800"><figcaption>Cornflowers</figcaption></figure></li>
    </ul>
    <div class="w1pil-end">
      <p>Each print is made to order and signed on the back.</p>
      <a href="#" class="w1pil-btn">Browse the series</a>
    </div>
  </div>
</section>

<style>
  /* Change these: the --x, --y and --r start values on each .w1pil-p (where the pile sits), --w1pil-bg, --w1pil-ink,
     and animation-range on .w1pil-p (how much scrolling the sort takes). */
  .w1pil { --w1pil-bg: #2a2b2e; --w1pil-ink: #f1efe9;
    height: 620px; overflow-y: auto; overflow-x: hidden; position: relative; background: var(--w1pil-bg); color: var(--w1pil-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; scrollbar-color: #55575c transparent; }
  /* To use page scroll: delete height and overflow above and set root: null in the script. */
  .w1pil:focus-visible { outline: 3px solid #e3b67a; outline-offset: -3px; }
  .w1pil-hint { position: sticky; top: 0; height: 0; z-index: 9; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1pil-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(241,239,233,.16); color: var(--w1pil-ink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1pil[data-touched] .w1pil-hint span { opacity: 0; }
  .w1pil-wrap { max-width: 60rem; margin: 0 auto; padding: 60px 20px 88px; }
  .w1pil-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #e3b67a; }
  .w1pil-h { margin: 14px 0 0; max-width: 34rem; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(1.9rem, 4.4vw, 2.8rem); line-height: 1.1; letter-spacing: -.015em; }
  .w1pil-lead { margin: 14px 0 0; max-width: 32rem; font-size: 1rem; line-height: 1.6; color: #c9c6be; }
  .w1pil-grid { list-style: none; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; view-timeline: --w1pil-v block; }
  .w1pil-p figure { margin: 0; padding: 8px 8px 0; background: #fbfaf7; border-radius: 3px; box-shadow: 0 18px 30px -14px rgba(0,0,0,.65), 0 2px 4px rgba(0,0,0,.25); }
  .w1pil-p img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
  .w1pil-p figcaption { padding: 8px 2px 10px; font-size: .8125rem; color: #3a3b3e; }
  /* Phone: two columns, the pile gathers in the middle row. */
  .w1pil-p:nth-child(1) { --x: 52%; --y: 100%; --r: -9deg; }
  .w1pil-p:nth-child(2) { --x: -48%; --y: 96%; --r: 7deg; }
  .w1pil-p:nth-child(3) { --x: 56%; --y: 4%; --r: 4deg; }
  .w1pil-p:nth-child(4) { --x: -52%; --y: -2%; --r: -6deg; }
  .w1pil-p:nth-child(5) { --x: 46%; --y: -98%; --r: 10deg; }
  .w1pil-p:nth-child(6) { --x: -54%; --y: -102%; --r: -3deg; }
  @media (min-width: 720px) {
    .w1pil-wrap { padding: 76px 40px 100px; }
    .w1pil-grid { grid-template-columns: repeat(3, 1fr); gap: 22px; }
    .w1pil-p:nth-child(1) { --x: 96%; --y: 50%; --r: -9deg; }
    .w1pil-p:nth-child(2) { --x: 6%; --y: 58%; --r: 6deg; }
    .w1pil-p:nth-child(3) { --x: -92%; --y: 46%; --r: -4deg; }
    .w1pil-p:nth-child(4) { --x: 104%; --y: -48%; --r: 8deg; }
    .w1pil-p:nth-child(5) { --x: -4%; --y: -54%; --r: -7deg; }
    .w1pil-p:nth-child(6) { --x: -100%; --y: -44%; --r: 3deg; }
  }
  .w1pil-end { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; }
  .w1pil-end p { margin: 0; font-size: 1rem; color: #dcd9d1; }
  .w1pil-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1pil-ink);
    color: #2a2b2e; font-weight: 600; font-size: .9375rem; text-decoration: none; }
  .w1pil-btn:hover { background: #fff; }
  .w1pil-btn:focus-visible { outline: 3px solid #e3b67a; outline-offset: 3px; }
  @keyframes w1pil-sort { from { transform: translate(var(--x), var(--y)) rotate(var(--r)); } to { transform: none; } }
  @supports (animation-timeline: view()) {
    .w1pil:not([data-fb]) .w1pil-p { animation: w1pil-sort linear both; animation-timeline: --w1pil-v; animation-range: cover 18% cover 52%; }
  }
  /* Fallback set by the script: the pile sorts once when the grid is mostly in view. */
  .w1pil[data-fb] .w1pil-p { transform: translate(var(--x), var(--y)) rotate(var(--r)); transition: transform 1.1s cubic-bezier(.2,.8,.2,1); }
  .w1pil[data-fb] .w1pil-p:nth-child(even) { transition-delay: 90ms; }
  .w1pil[data-fb] .w1pil-in .w1pil-p { transform: none; }
  @media (prefers-reduced-motion: reduce) {
    .w1pil .w1pil-p, .w1pil[data-fb] .w1pil-p { animation: none !important; transform: none; transition: none; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1pil]");
  if (!root) return;
  //BODY-START
  var off = [];
  var SPEED = 40; // demo scroll in px per second before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function keep(o) { off.push(function () { o.disconnect(); }); return o; }

  // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t;
    pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  off.push(stop);
  keep(new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); })).observe(root);
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
  });
  play();
  var native = window.CSS && CSS.supports("animation-timeline: view()");

  // Without scroll-driven animations: sort the pile once when half the grid is in view.
  if (!reduce && !native) {
    root.setAttribute("data-fb", "");
    var io = keep(new IntersectionObserver(function (es) {
      if (es[0].isIntersecting) { es[0].target.classList.add("w1pil-in"); io.disconnect(); }
    }, { root: root, threshold: 0.5 }));
    io.observe(root.querySelector(".w1pil-grid"));
  }
  //BODY-END
})();
</script>

With reduced motion: The prints sit straight in their grid from the start, with no pile and no demo scroll.

Running cost: Six transformed figures on one scroll timeline; the fallback observer fires once for the whole grid.

  • Change `--x`, `--y` and `--r` on each `.w1pil-p` to arrange a different pile.
  • Widen `animation-range: cover 18% cover 52%` so the sort takes more scrolling.
  • Swap the photos and captions; keep them square or change `aspect-ratio` on the images.

Photo Zooms Out as It Scrolls In

A pottery studio section where one wide photograph starts slightly enlarged inside its rounded frame and eases back to its natural size as it travels up into view, with the caption settling underneath. The frame never changes size, only the picture inside it, so the text around it stays still while the image breathes.

<section class="w1zom" data-w1zom tabindex="0" aria-label="Fenna Clay studio, scrollable">
  <div class="w1zom-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1zom-wrap">
    <p class="w1zom-eyebrow">Fenna Clay · Pottery studio</p>
    <h2 class="w1zom-h">Thrown, trimmed and fired in one small room.</h2>
    <p class="w1zom-lead">Every mug and bowl on our shelves passes through the same two hands. Come for an evening class or pick a piece straight off the drying rack.</p>
    <figure class="w1zom-fig">
      <div class="w1zom-frame">
        <img class="w1zom-img" src="https://images.pexels.com/photos/37827282/pexels-photo-37827282.jpeg?auto=compress&cs=tinysrgb&w=1600" alt="A potter arranging glazed bowls and cups on wooden shelves in a sunlit studio" loading="eager" width="1600" height="1067">
      </div>
      <figcaption class="w1zom-cap">The glaze shelf on a Thursday morning, after the second firing.</figcaption>
    </figure>
    <div class="w1zom-cols">
      <div>
        <h3>Evening wheel classes</h3>
        <p>Six people around three wheels, clay and firing included. You leave with two pieces of your own after the glaze week.</p>
      </div>
      <div>
        <h3>The studio shelf</h3>
        <p>Seconds and one-offs go on the front shelf every Saturday. When a piece is gone, it is gone.</p>
      </div>
    </div>
    <a href="#" class="w1zom-btn">See class dates</a>
  </div>
</section>

<style>
  /* Change these: --w1zom-from (starting zoom), --w1zom-bg, --w1zom-ink, --w1zom-accent,
     and animation-range on .w1zom-img (where in the box the zoom finishes). */
  .w1zom { --w1zom-from: 1.15; --w1zom-bg: #efe7da; --w1zom-ink: #2b241d; --w1zom-accent: #7c5532;
    height: 620px; overflow-y: auto; overflow-x: hidden; position: relative; background: var(--w1zom-bg); color: var(--w1zom-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* To use page scroll: delete height and overflow above and set root: null in the script. */
  .w1zom:focus-visible { outline: 3px solid var(--w1zom-accent); outline-offset: -3px; }
  .w1zom-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1zom-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(43,36,29,.82); color: #f6f0e6;
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1zom[data-touched] .w1zom-hint span { opacity: 0; }
  .w1zom-wrap { max-width: 66rem; margin: 0 auto; padding: 64px 20px 88px; }
  .w1zom-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--w1zom-accent); }
  .w1zom-h { margin: 14px 0 0; max-width: 38rem; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(1.9rem, 4.6vw, 3.1rem); line-height: 1.1; letter-spacing: -.015em; }
  .w1zom-lead { margin: 16px 0 0; max-width: 34rem; font-size: 1.0625rem; line-height: 1.65; color: #574a3c; }
  .w1zom-fig { margin: 40px 0 0; }
  .w1zom-frame { overflow: hidden; border-radius: 18px; aspect-ratio: 3 / 2; background: #d8cbb6; box-shadow: 0 30px 60px -30px rgba(60,40,20,.45); }
  .w1zom-img { display: block; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 60%; }
  .w1zom-cap { margin: 14px 0 0; font-size: .875rem; color: #6a5b4a; }
  .w1zom-cols { margin-top: 48px; display: grid; gap: 28px; }
  .w1zom-cols h3 { margin: 0; font-size: 1.125rem; font-weight: 600; }
  .w1zom-cols p { margin: 8px 0 0; font-size: .96875rem; line-height: 1.65; color: #574a3c; }
  .w1zom-btn { margin-top: 36px; display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 10px;
    background: var(--w1zom-ink); color: #f6f0e6; font-weight: 600; font-size: .9375rem; text-decoration: none; }
  .w1zom-btn:hover { background: #45392c; }
  .w1zom-btn:focus-visible { outline: 3px solid var(--w1zom-accent); outline-offset: 3px; }
  @media (min-width: 720px) { .w1zom-wrap { padding: 80px 40px 104px; } .w1zom-cols { grid-template-columns: 1fr 1fr; gap: 48px; } }
  @keyframes w1zom-zoom { from { transform: scale(var(--w1zom-from)); } to { transform: none; } }
  @keyframes w1zom-cap { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @supports (animation-timeline: view()) {
    .w1zom-frame { view-timeline: --w1zom-v block; }
    .w1zom:not([data-fb]) .w1zom-img { animation: w1zom-zoom linear both; animation-timeline: --w1zom-v; animation-range: entry 0% cover 55%; }
    .w1zom:not([data-fb]) .w1zom-cap { animation: w1zom-cap linear both; animation-timeline: --w1zom-v; animation-range: cover 35% cover 55%; }
  }
  /* Fallback set by the script: the zoom is scrubbed from the scroll position. */
  @media (prefers-reduced-motion: reduce) {
    .w1zom .w1zom-img, .w1zom .w1zom-cap { animation: none !important; transform: none !important; opacity: 1; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1zom]");
  if (!root) return;
  //BODY-START
  var off = [];
  var SPEED = 34; // demo scroll in px per second before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function keep(o) { off.push(function () { o.disconnect(); }); return o; }

  // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t;
    pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  off.push(stop);
  keep(new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); })).observe(root);
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
  });
  play();
  var native = window.CSS && CSS.supports("animation-timeline: view()");

  // Without scroll-driven animations: scrub the zoom from the frame's position, once per frame at most.
  if (!reduce && !native) {
    root.setAttribute("data-fb", "");
    var FROM = 1.15; // keep in step with --w1zom-from
    var frame2 = 0;
    var fr = root.querySelector(".w1zom-frame"), img = root.querySelector(".w1zom-img");
    var draw = function () {
      frame2 = 0;
      var a = root.getBoundingClientRect(), b = fr.getBoundingClientRect();
      var p = Math.min(1, Math.max(0, (a.bottom - b.top) / (0.55 * (a.height + b.height))));
      img.style.transform = "scale(" + (FROM - (FROM - 1) * p).toFixed(4) + ")";
    };
    on(root, "scroll", function () { if (!frame2) frame2 = requestAnimationFrame(draw); });
    off.push(function () { cancelAnimationFrame(frame2); });
    draw();
  }
  //BODY-END
})();
</script>

With reduced motion: The photo sits at its natural size with the caption visible, and the demo scroll stays off.

Running cost: One scaled image layer and a caption fade; the fallback reads two rectangles per frame only while scrolling.

  • Set `--w1zom-from` to choose the starting zoom (and `FROM` in the fallback script to match).
  • Change `animation-range: entry 0% cover 55%` on `.w1zom-img` so the zoom ends sooner or later.
  • Move `transform-origin` on `.w1zom-img` toward the part of the photo that matters.

Pinned Panel Steps Cross Fade

A bakery explains its two-day loaf in four steps inside one panel that stays pinned while you scroll. Each step holds for a stretch of scrolling, then cross-fades to the next with a small lift, and a thin bar along the top fills as the process moves on. The pin comes from position: sticky, so nothing measures layout to keep it in place.

<section class="w1pin" data-w1pin tabindex="0" aria-label="How a Marrow and Rye loaf is made, scrollable">
  <div class="w1pin-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1pin-track">
    <div class="w1pin-stage">
      <div class="w1pin-head">
        <p class="w1pin-eyebrow">Marrow &amp; Rye Bakery</p>
        <h2 class="w1pin-h">How a loaf gets made</h2>
        <div class="w1pin-rail" aria-hidden="true"><span class="w1pin-fill"></span></div>
      </div>
      <ol class="w1pin-steps">
        <li class="w1pin-s"><span class="w1pin-n" aria-hidden="true">01</span><div><p class="w1pin-when">Day one, evening</p><h3>Mix</h3><p>Stoneground flour, warm water and a spoon of last night's starter, mixed by hand and then left alone for an hour.</p></div></li>
        <li class="w1pin-s"><span class="w1pin-n" aria-hidden="true">02</span><div><p class="w1pin-when">Overnight</p><h3>Ferment</h3><p>A few sets of folds in the first hours, then the dough rests in the cool room while the yeast does its slow work.</p></div></li>
        <li class="w1pin-s"><span class="w1pin-n" aria-hidden="true">03</span><div><p class="w1pin-when">Day two, before dawn</p><h3>Shape</h3><p>Divided, rested and shaped again with tension on the skin, then laid seam up in linen-lined baskets.</p></div></li>
        <li class="w1pin-s"><span class="w1pin-n" aria-hidden="true">04</span><div><p class="w1pin-when">Day two, morning</p><h3>Bake</h3><p>Scored and baked hot on the stone deck with steam, then left on the racks to cool before anyone slices it.</p></div></li>
      </ol>
    </div>
  </div>
  <div class="w1pin-end">
    <p>Loaves are on the counter from eight, until they run out.</p>
    <a href="#" class="w1pin-btn">Reserve a loaf</a>
  </div>
</section>

<style>
  /* Change these: --w1pin-bg, --w1pin-ink, --w1pin-clay (accent), the track height (one box height per step),
     and the % stops in the w1pin-s1..s4 keyframes if you add or remove steps. */
  .w1pin { --w1pin-bg: #f5ece2; --w1pin-ink: #2d1f17; --w1pin-clay: #a3472b; --w1pin-box: 620px;
    height: var(--w1pin-box); overflow-y: auto; overflow-x: hidden; position: relative; background: var(--w1pin-bg); color: var(--w1pin-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* To pin against the page instead: delete height and overflow above, set --w1pin-box: 100vh, and in the script use window scroll. */
  .w1pin:focus-visible { outline: 3px solid var(--w1pin-clay); outline-offset: -3px; }
  .w1pin-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1pin-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(45,31,23,.82); color: #f5ece2;
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1pin[data-touched] .w1pin-hint span { opacity: 0; }
  .w1pin-track { height: calc(var(--w1pin-box) * 4); view-timeline: --w1pin-t block; }
  .w1pin-stage { position: sticky; top: 0; height: var(--w1pin-box); box-sizing: border-box; max-width: 64rem; margin: 0 auto;
    padding: 56px 20px 40px; display: flex; flex-direction: column; }
  .w1pin-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--w1pin-clay); }
  .w1pin-h { margin: 12px 0 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(1.9rem, 4.4vw, 2.9rem); line-height: 1.1; letter-spacing: -.015em; }
  .w1pin-rail { margin-top: 24px; height: 3px; border-radius: 3px; background: #e2d2c2; overflow: hidden; }
  .w1pin-fill { display: block; height: 100%; background: var(--w1pin-clay); transform-origin: 0 50%; transform: scaleX(.25); }
  .w1pin-steps { list-style: none; margin: 0; padding: 0; flex: 1; display: grid; align-items: center; }
  .w1pin-s { grid-area: 1 / 1; display: grid; grid-template-columns: auto 1fr; gap: 0 28px; align-items: center; }
  .w1pin-s + .w1pin-s { opacity: 0; }
  .w1pin-n { font-family: Georgia, serif; font-size: clamp(5rem, 16vw, 11rem); line-height: .9; color: var(--w1pin-clay); letter-spacing: -.04em; }
  .w1pin-when { margin: 0; font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #6e5646; }
  .w1pin-s h3 { margin: 6px 0 0; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; }
  .w1pin-s h3 + p { margin: 10px 0 0; max-width: 30rem; font-size: 1.0625rem; line-height: 1.6; color: #4d3a2e; }
  .w1pin-end { max-width: 64rem; margin: 0 auto; padding: 56px 20px 72px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; }
  .w1pin-end p { margin: 0; font-size: 1.0625rem; }
  .w1pin-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px; background: var(--w1pin-clay);
    color: #fff; font-weight: 600; font-size: .9375rem; text-decoration: none; }
  .w1pin-btn:hover { background: #8a3a22; }
  .w1pin-btn:focus-visible { outline: 3px solid var(--w1pin-ink); outline-offset: 3px; }
  @media (max-width: 600px) { .w1pin-s { grid-template-columns: 1fr; } .w1pin-n { font-size: 4.5rem; margin-bottom: 8px; } }
  @media (min-width: 720px) { .w1pin-stage, .w1pin-end { padding-left: 40px; padding-right: 40px; } }
  /* Each step holds for a quarter of the pinned scroll, with a short cross-fade between. */
  @keyframes w1pin-s1 { 0%, 21% { opacity: 1; transform: none; } 24%, 100% { opacity: 0; transform: translateY(-18px); } }
  @keyframes w1pin-s2 { 0%, 24% { opacity: 0; transform: translateY(18px); } 27%, 46% { opacity: 1; transform: none; } 49%, 100% { opacity: 0; transform: translateY(-18px); } }
  @keyframes w1pin-s3 { 0%, 49% { opacity: 0; transform: translateY(18px); } 52%, 71% { opacity: 1; transform: none; } 74%, 100% { opacity: 0; transform: translateY(-18px); } }
  @keyframes w1pin-s4 { 0%, 74% { opacity: 0; transform: translateY(18px); } 77%, 100% { opacity: 1; transform: none; } }
  @keyframes w1pin-grow { from { transform: scaleX(.25); } to { transform: scaleX(1); } }
  @supports (animation-timeline: view()) {
    .w1pin:not([data-fb]) .w1pin-s { animation: w1pin-s1 linear both; animation-timeline: --w1pin-t; animation-range: contain 0% contain 100%; }
    .w1pin:not([data-fb]) .w1pin-s:nth-child(2) { animation-name: w1pin-s2; }
    .w1pin:not([data-fb]) .w1pin-s:nth-child(3) { animation-name: w1pin-s3; }
    .w1pin:not([data-fb]) .w1pin-s:nth-child(4) { animation-name: w1pin-s4; }
    .w1pin:not([data-fb]) .w1pin-fill { animation: w1pin-grow linear both; animation-timeline: --w1pin-t; animation-range: contain 0% contain 100%; }
  }
  /* Fallback set by the script: data-step picks the visible step. */
  .w1pin[data-fb] .w1pin-s { opacity: 0; transform: translateY(18px); transition: opacity .45s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
  .w1pin[data-step="1"] .w1pin-s:nth-child(1), .w1pin[data-step="2"] .w1pin-s:nth-child(2),
  .w1pin[data-step="3"] .w1pin-s:nth-child(3), .w1pin[data-step="4"] .w1pin-s:nth-child(4) { opacity: 1; transform: none; }
  .w1pin[data-fb] .w1pin-fill { transition: transform .3s ease; }
  /* Reduced motion: no pinning, the four steps read as a plain list. */
  @media (prefers-reduced-motion: reduce) {
    .w1pin-track { height: auto; }
    .w1pin-stage { position: static; height: auto; }
    .w1pin-rail { display: none; }
    .w1pin-steps { display: block; margin-top: 24px; }
    .w1pin .w1pin-s, .w1pin[data-fb] .w1pin-s { animation: none !important; opacity: 1; transform: none; transition: none; padding: 20px 0; border-top: 1px solid #e2d2c2; }
    .w1pin-n { font-size: 3rem; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1pin]");
  if (!root) return;
  //BODY-START
  var off = [];
  var SPEED = 90; // demo scroll in px per second before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function keep(o) { off.push(function () { o.disconnect(); }); return o; }

  // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t;
    pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  off.push(stop);
  keep(new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); })).observe(root);
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
  });
  play();
  var native = window.CSS && CSS.supports("animation-timeline: view()");

  // Without scroll-driven animations: work out the step from how far the track has scrolled.
  if (!reduce && !native) {
    root.setAttribute("data-fb", "");
    var track = root.querySelector(".w1pin-track"), fill = root.querySelector(".w1pin-fill"), f2 = 0;
    var draw = function () {
      f2 = 0;
      var span = track.offsetHeight - root.clientHeight;
      var p = Math.min(1, Math.max(0, (root.scrollTop - track.offsetTop) / span));
      root.setAttribute("data-step", String(Math.min(4, 1 + Math.floor(p * 4))));
      fill.style.transform = "scaleX(" + (0.25 + 0.75 * p).toFixed(3) + ")";
    };
    on(root, "scroll", function () { if (!f2) f2 = requestAnimationFrame(draw); });
    off.push(function () { cancelAnimationFrame(f2); });
    draw();
  }
  //BODY-END
})();
</script>

With reduced motion: The panel is not pinned and all four steps appear as a normal list, one under the other.

Running cost: Sticky positioning plus opacity and transform on four list items; the fallback does one small calculation per frame while scrolling.

  • Make `.w1pin-track` taller or shorter to give each step more or less scrolling.
  • Add a step by adding an `li` and a `w1pin-s5` keyframe, then respacing the % stops.
  • Change `--w1pin-clay` to recolour the numbers, bar and button.

Product Photo Scales to Full Bleed

A product launch block for a desk lamp maker on a graphite page. Under the name and price, the product photograph waits as a small rounded card and grows smoothly to the full width of the section as it reaches the middle of the view, where a short materials caption settles over the corner. Specs and a reserve button follow underneath.

<section class="w7scl" data-w7scl tabindex="0" aria-label="Orrin Lighting, the Orrin task lamp, scrollable">
  <div class="w7scl-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w7scl-wrap">
    <p class="w7scl-eye">Orrin Lighting</p>
    <h2 class="w7scl-h">The Orrin task lamp</h2>
    <p class="w7scl-p">A folded steel arm that holds any angle without a knob to tighten, and a shade shaped to keep light on the page and out of your eyes.</p>
    <p class="w7scl-price">£185 <span>Matte black or bone</span></p>
  </div>
  <div class="w7scl-stage">
    <figure class="w7scl-frame">
      <img src="https://images.pexels.com/photos/7439754/pexels-photo-7439754.jpeg?auto=compress&cs=tinysrgb&w=1600" alt="Three matte black task lamps with angled arms lined up along a long white desk" width="1600" height="1067" loading="eager" />
      <figcaption class="w7scl-cap">Powder-coated steel, a linen cable and a dimmer in the base.</figcaption>
    </figure>
  </div>
  <div class="w7scl-wrap w7scl-after">
    <dl class="w7scl-spec">
      <div><dt>Height</dt><dd>52 cm at full reach</dd></div>
      <div><dt>Light</dt><dd>Warm LED, 2700 K</dd></div>
      <div><dt>Cable</dt><dd>2 m, linen wrapped</dd></div>
    </dl>
    <a class="w7scl-btn" href="#">Reserve one from the next batch</a>
  </div>
</section>

<style>
  /* Change these: --w7scl-from (starting scale), --w7scl-bg, --w7scl-ink, --w7scl-brass, and .w7scl-stage height. */
  .w7scl { --w7scl-from: .42; --w7scl-bg: #1c1d20; --w7scl-ink: #ecebe7; --w7scl-brass: #d2ad74;
    position: relative; height: 640px; overflow-y: auto; overflow-x: hidden; background: var(--w7scl-bg); color: var(--w7scl-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-color: #3a3c41 transparent; }
  /* To run on page scroll: delete height and overflow above (view() then follows the page) and read the window in the fallback. */
  .w7scl:focus-visible { outline: 3px solid var(--w7scl-brass); outline-offset: -3px; }
  .w7scl-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; justify-content: flex-end; pointer-events: none; }
  .w7scl-hint span { margin: 14px 14px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(236,235,231,.12); font-size: 12px; transition: opacity .5s; }
  .w7scl[data-touched] .w7scl-hint span { opacity: 0; }
  .w7scl-wrap { max-width: 60rem; margin: 0 auto; padding: 52px 20px 36px; text-align: center; }
  .w7scl-eye { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--w7scl-brass); }
  .w7scl-h { margin: 12px 0 0; font-size: clamp(2.2rem, 5.6vw, 4rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.02; }
  .w7scl-p { margin: 16px auto 0; max-width: 32rem; font-size: 16px; line-height: 1.6; color: #b9b8b2; }
  .w7scl-price { margin: 18px 0 0; font-size: 18px; font-weight: 600; }
  .w7scl-price span { margin-left: 10px; font-size: 14px; font-weight: 400; color: #a9a8a2; }
  .w7scl-stage { height: min(560px, 75vw); padding: 0; }
  .w7scl-frame { position: relative; height: 100%; margin: 0; overflow: hidden; border-radius: 14px; transform: scale(var(--w7scl-from)); transform-origin: 50% 40%; background: #2a2b2f; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
  .w7scl-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .w7scl-cap { position: absolute; left: 20px; bottom: 18px; max-width: 22rem; padding: 10px 14px; border-radius: 8px; background: rgba(28,29,32,.82); font-size: 14px; line-height: 1.45; opacity: 0; }
  .w7scl-after { padding-top: 40px; padding-bottom: 72px; }
  .w7scl-spec { display: grid; gap: 1px; margin: 0; background: rgba(236,235,231,.14); border: 1px solid rgba(236,235,231,.14); border-radius: 10px; overflow: hidden; text-align: left; }
  .w7scl-spec div { padding: 16px 18px; background: var(--w7scl-bg); }
  .w7scl-spec dt { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #a9a8a2; }
  .w7scl-spec dd { margin: 6px 0 0; font-size: 16px; }
  .w7scl-btn { display: inline-flex; align-items: center; min-height: 48px; margin-top: 32px; padding: 0 26px; border-radius: 999px; background: var(--w7scl-ink); color: var(--w7scl-bg); font-weight: 600; font-size: 15px; text-decoration: none; }
  .w7scl-btn:hover { background: #fff; }
  .w7scl-btn:focus-visible { outline: 3px solid var(--w7scl-brass); outline-offset: 3px; }
  @media (min-width: 720px) { .w7scl-spec { grid-template-columns: repeat(3, 1fr); } }
  .w7scl[data-fb] .w7scl-cap { transition: opacity .4s ease; }
  @keyframes w7scl-grow { to { transform: scale(1); } }
  @keyframes w7scl-show { to { opacity: 1; } }
  /* Full size when the frame is centred in the box (cover 50%). */
  @supports (animation-timeline: view()) {
    .w7scl:not([data-fb]) .w7scl-stage { view-timeline: --w7scl-v block; }
    .w7scl:not([data-fb]) .w7scl-frame { animation: w7scl-grow linear both; animation-timeline: --w7scl-v; animation-range: cover 22% cover 50%; }
    .w7scl:not([data-fb]) .w7scl-cap { animation: w7scl-show linear both; animation-timeline: --w7scl-v; animation-range: cover 46% cover 56%; }
  }
  @media (prefers-reduced-motion: reduce) {
    .w7scl .w7scl-frame { animation: none !important; transform: none !important; }
    .w7scl .w7scl-cap { animation: none !important; opacity: 1 !important; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w7scl]");
  if (!root) return;
  var off = [];
  //BODY-START
  var SPEED = 32; // px per second of demo scroll before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t; pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  function hand() { done = true; stop(); root.setAttribute("data-touched", ""); }
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    root.addEventListener(n, hand, { passive: true });
    off.push(function () { root.removeEventListener(n, hand); });
  });
  var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
  vis.observe(root);
  off.push(stop, function () { vis.disconnect(); });
  play();
  // Fallback: the same scale curve worked out from the frame's position, once per frame while scrolling.
  if (reduce || (window.CSS && CSS.supports("animation-timeline: view()"))) return;
  root.setAttribute("data-fb", "");
  var stage = root.querySelector(".w7scl-stage"), fig = root.querySelector(".w7scl-frame"), cap = root.querySelector(".w7scl-cap"), raf = 0;
  var from = parseFloat(getComputedStyle(root).getPropertyValue("--w7scl-from")) || .42;
  function draw() {
    raf = 0;
    var r = stage.getBoundingClientRect(), b = root.getBoundingClientRect();
    var p = Math.min(1, Math.max(0, ((b.bottom - r.top) / (b.height + r.height) - .22) / .28));
    fig.style.transform = "scale(" + (from + (1 - from) * p).toFixed(4) + ")";
    cap.style.opacity = p > .95 ? 1 : 0;
  }
  function onScroll() { if (!raf) raf = requestAnimationFrame(draw); }
  root.addEventListener("scroll", onScroll, { passive: true });
  draw();
  off.push(function () { root.removeEventListener("scroll", onScroll); cancelAnimationFrame(raf); fig.style.transform = ""; cap.style.opacity = ""; root.removeAttribute("data-fb"); });
  //BODY-END
})();
</script>

With reduced motion: The photograph is shown full width with its caption, and nothing scales.

Running cost: One scale transform and one opacity, both on the scroll timeline; the fallback measures once per scrolled frame.

  • Set the starting size with `--w7scl-from`; 0.4 to 0.7 keeps the card readable before it grows.
  • Change the frame height in `.w7scl-stage` and the focus point with `transform-origin` on `.w7scl-frame`.
  • Retune `--w7scl-brass` for the accent and `--w7scl-bg` for the page colour.

Quote Cards Tilt Flat as They Enter

A column of client letters for a hand bookbinder, each on a cream card with an oxblood tab. Cards arrive leaning back as if lying on a desk and stand upright while they move into view, becoming flat and fully opaque the moment the whole card is visible. Initials stand in for photos, which suits a small trade with private clients.

<section class="w7tlt" data-w7tlt tabindex="0" aria-label="Marrow and Vellum Bindery, letters from clients, scrollable">
  <div class="w7tlt-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w7tlt-wrap">
    <p class="w7tlt-eye">Marrow &amp; Vellum Bindery</p>
    <h2 class="w7tlt-h">Notes from people whose books came back</h2>
    <ul class="w7tlt-list">
      <li class="w7tlt-card"><blockquote><p>My grandmother's recipe book arrived in eleven loose pieces. It came home sewn, with the burn marks on the cover left exactly where she made them.</p></blockquote><p class="w7tlt-who"><span class="w7tlt-av" aria-hidden="true">OF</span><span><strong>Odile Ferrant</strong> Rebound family cookbook</span></p></li>
      <li class="w7tlt-card"><blockquote><p>They talked me out of new leather and into repairing the old spine instead. It cost less and it still smells like the library it lived in.</p></blockquote><p class="w7tlt-who"><span class="w7tlt-av" aria-hidden="true">TB</span><span><strong>Tomas Bright</strong> Spine repair, 1890s atlas</span></p></li>
      <li class="w7tlt-card"><blockquote><p>Forty copies of our wedding guest book, each with a different marbled end paper. Guests keep sending photos of theirs on bookshelves.</p></blockquote><p class="w7tlt-who"><span class="w7tlt-av" aria-hidden="true">RN</span><span><strong>Ruth and Nnamdi</strong> Small edition, hand marbled</span></p></li>
      <li class="w7tlt-card"><blockquote><p>I brought a thesis and left with a book I am not embarrassed to give my mother. The cloth is the green of the department door.</p></blockquote><p class="w7tlt-who"><span class="w7tlt-av" aria-hidden="true">HL</span><span><strong>Hana Lindqvist</strong> Thesis binding, buckram</span></p></li>
    </ul>
    <a class="w7tlt-btn" href="#">Bring us a book</a>
  </div>
</section>

<style>
  /* Change these: --w7tlt-tilt (starting lean), --w7tlt-depth (perspective), --w7tlt-paper, --w7tlt-ink, --w7tlt-ox (accent). */
  .w7tlt { --w7tlt-tilt: 34deg; --w7tlt-depth: 900px; --w7tlt-paper: #f4ede1; --w7tlt-ink: #2d2620; --w7tlt-ox: #7a2e2a;
    position: relative; height: 620px; overflow-y: auto; overflow-x: hidden; background: var(--w7tlt-paper); color: var(--w7tlt-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  /* To run on page scroll: delete height and overflow above (view() then follows the page) and use root: null in the fallback observer. */
  .w7tlt:focus-visible { outline: 3px solid var(--w7tlt-ox); outline-offset: -3px; }
  .w7tlt-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; justify-content: flex-end; pointer-events: none; }
  .w7tlt-hint span { margin: 14px 14px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(45,38,32,.1); font-size: 12px; transition: opacity .5s; }
  .w7tlt[data-touched] .w7tlt-hint span { opacity: 0; }
  .w7tlt-wrap { max-width: 44rem; margin: 0 auto; padding: 52px 20px 80px; }
  .w7tlt-eye { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--w7tlt-ox); }
  .w7tlt-h { margin: 12px 0 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(1.9rem, 4.4vw, 2.9rem); line-height: 1.1; letter-spacing: -.015em; }
  .w7tlt-list { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 48px; }
  .w7tlt-card { position: relative; padding: 28px 26px 22px; border-radius: 4px; background: #fffaf2; border: 1px solid rgba(45,38,32,.1);
    box-shadow: 0 1px 0 rgba(45,38,32,.06), 0 22px 40px -26px rgba(60,40,20,.45); transform-origin: 50% 0; }
  .w7tlt-card::before { content: ""; position: absolute; left: 26px; top: 0; width: 42px; height: 3px; background: var(--w7tlt-ox); }
  .w7tlt-card blockquote { margin: 0; }
  .w7tlt-card blockquote p { margin: 0; font-family: Georgia, "Iowan Old Style", serif; font-size: clamp(1.1rem, 2.4vw, 1.3rem); line-height: 1.55; }
  .w7tlt-who { display: flex; align-items: center; gap: 12px; margin: 20px 0 0; font-size: 14px; color: #5b4d41; }
  .w7tlt-who strong { display: block; color: var(--w7tlt-ink); font-weight: 600; }
  .w7tlt-av { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: #e6d8c3; color: var(--w7tlt-ox); font-size: 13px; font-weight: 700; }
  .w7tlt-btn { display: inline-flex; align-items: center; min-height: 48px; margin-top: 44px; padding: 0 26px; border-radius: 4px; background: var(--w7tlt-ox); color: #fff8ee; font-weight: 600; font-size: 15px; text-decoration: none; }
  .w7tlt-btn:hover { background: #5f2220; }
  .w7tlt-btn:focus-visible { outline: 3px solid var(--w7tlt-ink); outline-offset: 3px; }
  @keyframes w7tlt-flat { from { transform: perspective(var(--w7tlt-depth)) rotateX(var(--w7tlt-tilt)) translateY(28px); opacity: .35; } to { transform: perspective(var(--w7tlt-depth)); opacity: 1; } }
  /* Each card lies back and stands up as it comes in; it is flat once fully on screen. */
  @supports (animation-timeline: view()) {
    .w7tlt:not([data-fb]) .w7tlt-card { animation: w7tlt-flat cubic-bezier(.3,.6,.3,1) both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
  }
  .w7tlt[data-fb] .w7tlt-card { transition: transform .9s cubic-bezier(.2,.8,.2,1), opacity .9s ease; }
  .w7tlt[data-fb] .w7tlt-card:not(.w7tlt-in) { transform: perspective(var(--w7tlt-depth)) rotateX(var(--w7tlt-tilt)) translateY(28px); opacity: .35; }
  @media (prefers-reduced-motion: reduce) { .w7tlt .w7tlt-card { animation: none !important; transform: none !important; opacity: 1 !important; transition: none !important; } }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w7tlt]");
  if (!root) return;
  var off = [];
  //BODY-START
  var SPEED = 30; // px per second of demo scroll before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t; pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  function hand() { done = true; stop(); root.setAttribute("data-touched", ""); }
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    root.addEventListener(n, hand, { passive: true });
    off.push(function () { root.removeEventListener(n, hand); });
  });
  var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
  vis.observe(root);
  off.push(stop, function () { vis.disconnect(); });
  play();
  // Fallback: each card stands up once when most of it is in view.
  if (reduce || (window.CSS && CSS.supports("animation-timeline: view()"))) return;
  var cards = root.querySelectorAll(".w7tlt-card"), box = root.getBoundingClientRect();
  cards.forEach(function (c) { if (c.getBoundingClientRect().bottom < box.bottom) c.classList.add("w7tlt-in"); });
  root.setAttribute("data-fb", "");
  var io = new IntersectionObserver(function (es) {
    es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add("w7tlt-in"); io.unobserve(e.target); } });
  }, { root: root, threshold: 0.4 });
  cards.forEach(function (c) { io.observe(c); });
  off.push(function () { io.disconnect(); root.removeAttribute("data-fb"); });
  //BODY-END
})();
</script>

With reduced motion: All cards lie flat and fully opaque, in a plain readable column.

Running cost: A perspective rotate and an opacity per card, handled by the scroll timeline with no script work while scrolling.

  • Change the starting lean with `--w7tlt-tilt` and how deep it looks with `--w7tlt-depth`.
  • Swap the tab and button colour with `--w7tlt-ox` and the card paper with the `#fffaf2` background.
  • Add or remove `li.w7tlt-card` items; spacing comes from the list's `gap`.

Reading Progress Bar for a Long Article

A boatyard journal article with a slim teal bar under its sticky header that fills from left to right as you read. The fill is one element scaled on the x axis by a CSS scroll timeline, so it tracks the scroll position exactly with no script, and a small listener does the same job in browsers that lack timelines.

<section class="w1bar" data-w1bar tabindex="0" aria-label="Boatyard journal article, scrollable">
  <div class="w1bar-top">
    <div class="w1bar-row">
      <span class="w1bar-brand">Kessler Boatyard · Journal</span>
      <span class="w1bar-hint" aria-hidden="true">Scroll inside</span>
    </div>
    <div class="w1bar-rail" aria-hidden="true"><span class="w1bar-fill"></span></div>
  </div>
  <article class="w1bar-art">
    <p class="w1bar-kicker">Restoration notes</p>
    <h2 class="w1bar-h">Bringing an old mahogany launch back to the water</h2>
    <p class="w1bar-by">Written in the shed by the restoration crew · 6 minute read</p>
    <p>She arrived on a borrowed trailer in early spring, grey from years under a tarpaulin and lighter than she should have been. A wooden boat that has dried out for a long time tells you everything through its seams: you could see daylight between the planks along the garboard.</p>
    <p>The first month was only looking. We photographed every fitting before it came off, numbered the floorboards in pencil, and drew the sheer line from three sides so we would know if anything moved once the old fastenings were out.</p>
    <h3>Planks, frames and patience</h3>
    <p>Most of the hull was sound. Two planks near the stern had soft spots where rainwater had sat against them, and four steamed oak frames had cracked at the turn of the bilge. Those were replaced one at a time, so the shape of the boat was always held by the timber around them.</p>
    <blockquote class="w1bar-quote">The rule in the shed is simple: never take out more than you can put back the same afternoon.</blockquote>
    <p>New frames were bent from green oak straight out of the steam box, clamped into place while they were still pliable, and riveted with copper once they had cooled. It is slow work, and it is the reason these boats last.</p>
    <h3>Varnish is a season, not a coat</h3>
    <p>The brightwork took longer than the woodwork. Mahogany wants thin coats, a light sanding between each, and a dry, still day for every one of them. By the time she was ready to launch, the transom had ten coats and a depth you could put your hand into.</p>
    <p>She went back into the water on a calm morning in late summer. The planks took up overnight, the bilge pump ran twice, and by the second day she was dry. Her owner took her out at dawn and did not come back until lunch.</p>
    <a href="#" class="w1bar-btn">Ask about a restoration</a>
  </article>
</section>

<style>
  /* Change these: --w1bar-accent (bar colour), --w1bar-rail (empty track), --w1bar-bg, --w1bar-ink, and the bar height in .w1bar-rail. */
  .w1bar { --w1bar-accent: #0f766e; --w1bar-rail: #e2e8f0; --w1bar-bg: #ffffff; --w1bar-ink: #1e293b;
    height: 620px; overflow-y: auto; overflow-x: hidden; position: relative; background: var(--w1bar-bg); color: var(--w1bar-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* For a page-wide bar: delete height and overflow above, make .w1bar-top position: fixed, and use scroll(root) on .w1bar-fill. */
  .w1bar:focus-visible { outline: 3px solid var(--w1bar-accent); outline-offset: -3px; }
  .w1bar-top { position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 1px solid #eef2f6; }
  .w1bar-row { max-width: 44rem; margin: 0 auto; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .w1bar-brand { font-size: 13px; font-weight: 600; color: #334155; }
  .w1bar-hint { font-size: 12px; color: #475569; transition: opacity .5s ease; }
  .w1bar[data-touched] .w1bar-hint { opacity: 0; }
  .w1bar-rail { height: 4px; background: var(--w1bar-rail); }
  .w1bar-fill { display: block; height: 100%; background: var(--w1bar-accent); transform-origin: 0 50%; transform: scaleX(0); }
  .w1bar-art { max-width: 44rem; margin: 0 auto; padding: 44px 20px 80px; }
  .w1bar-kicker { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--w1bar-accent); }
  .w1bar-h { margin: 12px 0 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(1.9rem, 4.4vw, 2.75rem); line-height: 1.12; letter-spacing: -.015em; }
  .w1bar-by { margin: 14px 0 28px; font-size: .875rem; color: #475569; }
  .w1bar-art > p:not([class]) { margin: 0 0 18px; font-family: Georgia, "Iowan Old Style", serif; font-size: 1.125rem; line-height: 1.75; color: #334155; }
  .w1bar-art h3 { margin: 34px 0 12px; font-size: 1.25rem; font-weight: 600; }
  .w1bar-quote { margin: 30px 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--w1bar-accent); font-family: Georgia, serif; font-size: 1.375rem; line-height: 1.5; font-style: italic; color: #1e293b; }
  .w1bar-btn { margin-top: 18px; display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 8px;
    background: var(--w1bar-accent); color: #fff; font-weight: 600; font-size: .9375rem; text-decoration: none; }
  .w1bar-btn:hover { background: #115e59; }
  .w1bar-btn:focus-visible { outline: 3px solid #1e293b; outline-offset: 3px; }
  @keyframes w1bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @supports (animation-timeline: scroll()) {
    .w1bar:not([data-fb]) .w1bar-fill { animation: w1bar-grow linear both; animation-timeline: scroll(nearest block); }
  }
  /* The bar reports position, so it keeps tracking with reduced motion; only the easing is removed. */
  .w1bar[data-fb] .w1bar-fill { transition: transform .12s linear; }
  @media (prefers-reduced-motion: reduce) { .w1bar[data-fb] .w1bar-fill, .w1bar-hint { transition: none; } }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1bar]");
  if (!root) return;
  //BODY-START
  var off = [];
  var SPEED = 60; // demo scroll in px per second before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function keep(o) { off.push(function () { o.disconnect(); }); return o; }

  // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t;
    pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  off.push(stop);
  keep(new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); })).observe(root);
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
  });
  play();
  var native = window.CSS && CSS.supports("animation-timeline: view()");

  // Without scroll timelines: set the bar from scrollTop (kept for reduced motion too, it is position, not decoration).
  if (!native) {
    root.setAttribute("data-fb", "");
    var fill = root.querySelector(".w1bar-fill"), f2 = 0;
    var draw = function () {
      f2 = 0;
      var max = root.scrollHeight - root.clientHeight;
      fill.style.transform = "scaleX(" + (max > 0 ? root.scrollTop / max : 0).toFixed(4) + ")";
    };
    on(root, "scroll", function () { if (!f2) f2 = requestAnimationFrame(draw); });
    off.push(function () { cancelAnimationFrame(f2); });
    draw();
  }
  //BODY-END
})();
</script>

With reduced motion: The bar still follows the scroll position, since it reports where you are, but nothing eases and the demo scroll stays off.

Running cost: One scaled element on the scroll timeline; the fallback writes a single transform per frame while scrolling.

  • Change `--w1bar-accent` for the fill and `--w1bar-rail` for the empty track.
  • Set the `height` on `.w1bar-rail` for a thicker or thinner bar.
  • For a bar tied to the whole page, switch `scroll(nearest block)` to `scroll(root)` and fix the header to the top.

Section Header Words Rise One by One

Four numbered sections for a garden design practice, each led by a serif heading whose words climb out of their own hidden slot, one after another with a slight tilt that straightens as they land. The body copy follows a beat later. Headings already on screen when the page opens are left in place, so only what you scroll to performs.

<section class="w7wrd" data-w7wrd tabindex="0" aria-label="Fernhill Garden Design, how we work, scrollable">
  <div class="w7wrd-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w7wrd-wrap">
    <p class="w7wrd-brand">Fernhill Garden Design</p>
    <article class="w7wrd-sec">
      <p class="w7wrd-num">01 · Planting</p>
      <div>
        <h2 class="w7wrd-h"><span class="w7wrd-m"><span class="w7wrd-w">Gardens</span></span> <span class="w7wrd-m"><span class="w7wrd-w">planted</span></span> <span class="w7wrd-m"><span class="w7wrd-w">for</span></span> <span class="w7wrd-m"><span class="w7wrd-w">the</span></span> <span class="w7wrd-m"><span class="w7wrd-w">slow</span></span> <span class="w7wrd-m"><span class="w7wrd-w">seasons</span></span></h2>
        <p class="w7wrd-p">We design borders that still look considered in February: seed heads left standing, evergreen bones, bark that catches the low winter sun.</p>
      </div>
    </article>
    <article class="w7wrd-sec">
      <p class="w7wrd-num">02 · Ground</p>
      <div>
        <h2 class="w7wrd-h"><span class="w7wrd-m"><span class="w7wrd-w">Every</span></span> <span class="w7wrd-m"><span class="w7wrd-w">plan</span></span> <span class="w7wrd-m"><span class="w7wrd-w">begins</span></span> <span class="w7wrd-m"><span class="w7wrd-w">with</span></span> <span class="w7wrd-m"><span class="w7wrd-w">a</span></span> <span class="w7wrd-m"><span class="w7wrd-w">soil</span></span> <span class="w7wrd-m"><span class="w7wrd-w">pit</span></span></h2>
        <p class="w7wrd-p">Before drawing a line we dig, crumble and test the ground, then choose plants that want to live there instead of ones that need rescuing every July.</p>
      </div>
    </article>
    <article class="w7wrd-sec">
      <p class="w7wrd-num">03 · Making</p>
      <div>
        <h2 class="w7wrd-h"><span class="w7wrd-m"><span class="w7wrd-w">Built</span></span> <span class="w7wrd-m"><span class="w7wrd-w">by</span></span> <span class="w7wrd-m"><span class="w7wrd-w">the</span></span> <span class="w7wrd-m"><span class="w7wrd-w">hands</span></span> <span class="w7wrd-m"><span class="w7wrd-w">that</span></span> <span class="w7wrd-m"><span class="w7wrd-w">drew</span></span> <span class="w7wrd-m"><span class="w7wrd-w">it</span></span></h2>
        <p class="w7wrd-p">The designer who walks your plot is there on planting days too, nudging pots around by eye until each group of grasses sits where it should.</p>
      </div>
    </article>
    <article class="w7wrd-sec">
      <p class="w7wrd-num">04 · Care</p>
      <div>
        <h2 class="w7wrd-h"><span class="w7wrd-m"><span class="w7wrd-w">Then</span></span> <span class="w7wrd-m"><span class="w7wrd-w">we</span></span> <span class="w7wrd-m"><span class="w7wrd-w">return</span></span> <span class="w7wrd-m"><span class="w7wrd-w">each</span></span> <span class="w7wrd-m"><span class="w7wrd-w">spring</span></span></h2>
        <p class="w7wrd-p">One visit a year to divide, cut back and rethink, because a garden is a draft that keeps being revised.</p>
        <a class="w7wrd-btn" href="#">Book a garden walk</a>
      </div>
    </article>
  </div>
</section>

<style>
  /* Change these: --w7wrd-bg, --w7wrd-ink, --w7wrd-moss (accent), --w7wrd-step (delay between words), --w7wrd-dur (rise time). */
  .w7wrd { --w7wrd-bg: #f3efe4; --w7wrd-ink: #1f3a2c; --w7wrd-moss: #5b7a4a; --w7wrd-step: 75ms; --w7wrd-dur: .8s;
    position: relative; height: 620px; overflow-y: auto; overflow-x: hidden; background: var(--w7wrd-bg); color: var(--w7wrd-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  /* To run on page scroll: delete height and overflow above and use root: null in the script observer. */
  .w7wrd:focus-visible { outline: 3px solid var(--w7wrd-moss); outline-offset: -3px; }
  .w7wrd-hint { position: sticky; top: 0; height: 0; z-index: 2; display: flex; justify-content: flex-end; pointer-events: none; }
  .w7wrd-hint span { margin: 14px 14px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(31,58,44,.1); font-size: 12px; transition: opacity .5s; }
  .w7wrd[data-touched] .w7wrd-hint span { opacity: 0; }
  .w7wrd-wrap { max-width: 64rem; margin: 0 auto; padding: 56px 20px 96px; }
  .w7wrd-brand { margin: 0 0 40px; font-size: 13px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--w7wrd-moss); }
  .w7wrd-sec { display: grid; gap: 14px; padding: 36px 0 110px; border-top: 1px solid rgba(31,58,44,.18); }
  .w7wrd-sec:last-child { padding-bottom: 40px; }
  .w7wrd-num { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; color: var(--w7wrd-moss); }
  .w7wrd-h { margin: 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(2.2rem, 6.4vw, 4.4rem); line-height: 1.06; letter-spacing: -.02em; }
  .w7wrd-m { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
  .w7wrd-w { display: inline-block; transform-origin: 0 100%; }
  .w7wrd-p { margin: 18px 0 0; max-width: 34rem; font-size: 17px; line-height: 1.65; color: #3d5245; }
  .w7wrd-btn { display: inline-flex; align-items: center; min-height: 48px; margin-top: 28px; padding: 0 26px; border-radius: 999px; background: var(--w7wrd-ink); color: var(--w7wrd-bg); font-weight: 600; font-size: 15px; text-decoration: none; }
  .w7wrd-btn:hover { background: #2d5240; }
  .w7wrd-btn:focus-visible { outline: 3px solid var(--w7wrd-moss); outline-offset: 3px; }
  @media (min-width: 760px) { .w7wrd-sec { grid-template-columns: 11rem 1fr; gap: 32px; } .w7wrd-num { padding-top: 14px; } .w7wrd-wrap { padding: 64px 48px 110px; } }
  /* Armed by the script: headings below the fold wait, then their words rise one after another. */
  .w7wrd[data-armed] .w7wrd-w { transition: transform var(--w7wrd-dur) cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--i, 0) * var(--w7wrd-step)); }
  .w7wrd[data-armed] .w7wrd-h:not(.w7wrd-in) .w7wrd-w { transform: translateY(108%) rotate(5deg); }
  .w7wrd[data-armed] .w7wrd-p, .w7wrd[data-armed] .w7wrd-btn { transition: opacity .7s ease .45s, transform .7s ease .45s; }
  .w7wrd[data-armed] .w7wrd-sec:not(.w7wrd-on) .w7wrd-p, .w7wrd[data-armed] .w7wrd-sec:not(.w7wrd-on) .w7wrd-btn { opacity: 0; transform: translateY(12px); }
  @media (prefers-reduced-motion: reduce) {
    .w7wrd .w7wrd-w, .w7wrd .w7wrd-p, .w7wrd .w7wrd-btn { transform: none !important; opacity: 1 !important; transition: none !important; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w7wrd]");
  if (!root) return;
  var off = [];
  //BODY-START
  var SPEED = 28; // px per second of demo scroll before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t; pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  function hand() { done = true; stop(); root.setAttribute("data-touched", ""); }
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    root.addEventListener(n, hand, { passive: true });
    off.push(function () { root.removeEventListener(n, hand); });
  });
  var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
  vis.observe(root);
  off.push(stop, function () { vis.disconnect(); });
  play();
  if (reduce) return;
  var secs = root.querySelectorAll(".w7wrd-sec");
  root.querySelectorAll(".w7wrd-h").forEach(function (h) {
    h.querySelectorAll(".w7wrd-w").forEach(function (w, i) { w.style.setProperty("--i", i); });
  });
  // Headings already on screen stay put; the rest wait below the fold.
  var box = root.getBoundingClientRect();
  function show(s) { s.classList.add("w7wrd-on"); s.querySelector(".w7wrd-h").classList.add("w7wrd-in"); }
  secs.forEach(function (s) { if (s.querySelector(".w7wrd-h").getBoundingClientRect().bottom < box.bottom) show(s); });
  root.setAttribute("data-armed", "");
  var io = new IntersectionObserver(function (es) {
    es.forEach(function (e) { if (e.isIntersecting) { show(e.target.parentNode.parentNode); io.unobserve(e.target); } });
  }, { root: root, rootMargin: "0px 0px -18% 0px" });
  secs.forEach(function (s) { io.observe(s.querySelector(".w7wrd-h")); });
  off.push(function () { io.disconnect(); root.removeAttribute("data-armed"); });
  //BODY-END
})();
</script>

With reduced motion: All four headings and their paragraphs are shown in place, with no rising words and no demo scroll.

Running cost: One observer flips a class per heading; the browser then runs short transform and opacity transitions on its own.

  • Set the gap between words with `--w7wrd-step` and the length of each rise with `--w7wrd-dur` on `.w7wrd`.
  • Remove `rotate(5deg)` from the armed rule for a straight vertical rise.
  • Recolour the page with `--w7wrd-bg`, `--w7wrd-ink` and `--w7wrd-moss`.

Stats Band Figures Slide Up Into Place

Three bands of figures for a small cycling tour company, set large in pale sand on deep navy with thin dividers. When a band scrolls into view its digits slide up out of a hidden baseline one character at a time, left to right, and each label fades in underneath. The first band is already settled when the section loads.

<section class="w7sts" data-w7sts tabindex="0" aria-label="Ridgeway Cycle Tours, the Long Ridge tour in figures, scrollable">
  <div class="w7sts-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w7sts-wrap">
    <p class="w7sts-eye">Ridgeway Cycle Tours · The Long Ridge</p>
    <h2 class="w7sts-h">A week on quiet roads, in four numbers</h2>
    <dl class="w7sts-band">
      <div class="w7sts-cell"><dt>Days in the saddle</dt><dd><span class="w7sts-f">6</span></dd></div>
      <div class="w7sts-cell"><dt>Kilometres ridden</dt><dd><span class="w7sts-f">412</span></dd></div>
      <div class="w7sts-cell"><dt>Riders per group</dt><dd><span class="w7sts-f">12</span></dd></div>
      <div class="w7sts-cell"><dt>Support vans</dt><dd><span class="w7sts-f">2</span></dd></div>
    </dl>
    <p class="w7sts-copy">The route keeps to lanes and old drovers' tracks, with a van carrying luggage, spares and lunch. You ride; we handle the rest of the day.</p>
    <h2 class="w7sts-h">The climbing, honestly</h2>
    <dl class="w7sts-band">
      <div class="w7sts-cell"><dt>Metres of ascent</dt><dd><span class="w7sts-f">3,180</span></dd></div>
      <div class="w7sts-cell"><dt>Named passes</dt><dd><span class="w7sts-f">4</span></dd></div>
      <div class="w7sts-cell"><dt>Longest descent, km</dt><dd><span class="w7sts-f">38</span></dd></div>
      <div class="w7sts-cell"><dt>Rest day</dt><dd><span class="w7sts-f">1</span></dd></div>
    </dl>
    <p class="w7sts-copy">Day three is the hard one. Everyone who has started it has finished it, some of them walking the last bend, which is allowed.</p>
    <h2 class="w7sts-h">What the price covers</h2>
    <dl class="w7sts-band">
      <div class="w7sts-cell"><dt>Nights in village inns</dt><dd><span class="w7sts-f">6</span></dd></div>
      <div class="w7sts-cell"><dt>Ride leaders</dt><dd><span class="w7sts-f">2</span></dd></div>
      <div class="w7sts-cell"><dt>Mechanic on the road</dt><dd><span class="w7sts-f">1</span></dd></div>
      <div class="w7sts-cell"><dt>Per rider, GBP</dt><dd><span class="w7sts-f">1,640</span></dd></div>
    </dl>
    <a class="w7sts-btn" href="#">Read the route notes</a>
  </div>
</section>

<style>
  /* Change these: --w7sts-bg, --w7sts-ink, --w7sts-sand (figures), --w7sts-step (delay between digits), --w7sts-dur. */
  .w7sts { --w7sts-bg: #0f1d33; --w7sts-ink: #eef1f5; --w7sts-sand: #e3c497; --w7sts-step: 55ms; --w7sts-dur: .9s;
    position: relative; height: 620px; overflow-y: auto; overflow-x: hidden; background: var(--w7sts-bg); color: var(--w7sts-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-color: #33435c transparent; }
  /* To run on page scroll: delete height and overflow above and use root: null in the script observer. */
  .w7sts:focus-visible { outline: 3px solid var(--w7sts-sand); outline-offset: -3px; }
  .w7sts-hint { position: sticky; top: 0; height: 0; z-index: 2; display: flex; justify-content: flex-end; pointer-events: none; }
  .w7sts-hint span { margin: 14px 14px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(238,241,245,.12); font-size: 12px; transition: opacity .5s; }
  .w7sts[data-touched] .w7sts-hint span { opacity: 0; }
  .w7sts-wrap { max-width: 68rem; margin: 0 auto; padding: 52px 20px 80px; }
  .w7sts-eye { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--w7sts-sand); }
  .w7sts-h { margin: 14px 0 0; font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
  .w7sts-h + .w7sts-band { margin-top: 28px; }
  .w7sts-copy + .w7sts-h { margin-top: 120px; }
  .w7sts-band { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0; border-top: 1px solid rgba(238,241,245,.18); }
  .w7sts-cell { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 6px; padding: 22px 16px 24px 0; border-bottom: 1px solid rgba(238,241,245,.18); }
  .w7sts-cell dt { font-size: 14px; color: #b7c1d0; }
  .w7sts-cell dd { margin: 0; font-size: clamp(2.8rem, 7vw, 4.6rem); font-weight: 300; line-height: 1; letter-spacing: -.03em; color: var(--w7sts-sand); font-variant-numeric: tabular-nums; }
  .w7sts-f { display: inline-flex; overflow: hidden; padding-bottom: .06em; }
  .w7sts-d { display: inline-block; }
  .w7sts-copy { margin: 26px 0 0; max-width: 36rem; font-size: 16px; line-height: 1.65; color: #c9d1dc; }
  .w7sts-btn { display: inline-flex; align-items: center; min-height: 48px; margin-top: 44px; padding: 0 26px; border-radius: 999px; background: var(--w7sts-sand); color: #1a1408; font-weight: 600; font-size: 15px; text-decoration: none; }
  .w7sts-btn:hover { background: #f0d7b0; }
  .w7sts-btn:focus-visible { outline: 3px solid var(--w7sts-ink); outline-offset: 3px; }
  @media (min-width: 760px) {
    .w7sts-band { grid-template-columns: repeat(4, 1fr); }
    .w7sts-cell { padding: 26px 20px 28px; border-bottom: 0; border-left: 1px solid rgba(238,241,245,.18); }
    .w7sts-cell:first-child { border-left: 0; padding-left: 0; }
    .w7sts-wrap { padding: 60px 48px 90px; }
  }
  /* Armed by the script: bands below the fold wait, then each digit slides up a step after the one before. */
  .w7sts[data-armed] .w7sts-d { transition: transform var(--w7sts-dur) cubic-bezier(.16,.84,.24,1); transition-delay: calc(var(--i, 0) * var(--w7sts-step)); }
  .w7sts[data-armed] .w7sts-band:not(.w7sts-in) .w7sts-d { transform: translateY(105%); }
  .w7sts[data-armed] .w7sts-cell dt { transition: opacity .6s ease calc(var(--c, 0) * 90ms + .2s); }
  .w7sts[data-armed] .w7sts-band:not(.w7sts-in) dt { opacity: 0; }
  @media (prefers-reduced-motion: reduce) {
    .w7sts .w7sts-d, .w7sts .w7sts-cell dt { transform: none !important; opacity: 1 !important; transition: none !important; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w7sts]");
  if (!root) return;
  var off = [];
  //BODY-START
  var SPEED = 28; // px per second of demo scroll before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t; pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  function hand() { done = true; stop(); root.setAttribute("data-touched", ""); }
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    root.addEventListener(n, hand, { passive: true });
    off.push(function () { root.removeEventListener(n, hand); });
  });
  var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
  vis.observe(root);
  off.push(stop, function () { vis.disconnect(); });
  play();
  if (reduce) return;
  // Split every figure into digit spans; screen readers keep the whole figure via aria-label.
  root.querySelectorAll(".w7sts-band").forEach(function (band) {
    var n = 0;
    band.querySelectorAll(".w7sts-cell").forEach(function (cell, c) {
      cell.style.setProperty("--c", c);
      var f = cell.querySelector(".w7sts-f"), text = f.textContent;
      f.setAttribute("aria-label", text);
      f.textContent = "";
      text.split("").forEach(function (ch) {
        var d = document.createElement("span");
        d.className = "w7sts-d"; d.textContent = ch; d.setAttribute("aria-hidden", "true");
        d.style.setProperty("--i", n++);
        f.appendChild(d);
      });
      off.push(function () { f.textContent = text; f.removeAttribute("aria-label"); });
    });
  });
  var bands = root.querySelectorAll(".w7sts-band"), box = root.getBoundingClientRect();
  bands.forEach(function (b) { if (b.getBoundingClientRect().bottom < box.bottom) b.classList.add("w7sts-in"); });
  root.setAttribute("data-armed", "");
  var io = new IntersectionObserver(function (es) {
    es.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add("w7sts-in"); io.unobserve(e.target); } });
  }, { root: root, rootMargin: "0px 0px -15% 0px" });
  bands.forEach(function (b) { io.observe(b); });
  off.push(function () { io.disconnect(); root.removeAttribute("data-armed"); });
  //BODY-END
})();
</script>

With reduced motion: All three bands show their complete figures and labels with no sliding digits.

Running cost: Digits are split once at start; after that an observer adds one class per band and the transitions run on transforms.

  • Edit the figures and labels directly in each `.w7sts-cell`; the script splits whatever digits it finds.
  • Slow the cascade with `--w7sts-step` (per digit) and `--w7sts-dur` (per slide) on `.w7sts`.
  • Change `repeat(4, 1fr)` in the wide-screen rule if a band holds three or five figures.

Sticky Chapter Label That Follows the Section

A vineyard's year told in four chapters on a cool, slate-on-white page. A slim bar stays pinned to the top, and its chapter name rolls up to the next one as each new section passes a line just under the bar, while four short ticks fill in to show how far through the year you are. It works on phones with the ticks tucked away.

<section class="w7chp" data-w7chp tabindex="0" aria-label="Callow Hill Vineyard, a year in four chapters, scrollable">
  <div class="w7chp-bar">
    <p class="w7chp-name">Callow Hill Vineyard</p>
    <div class="w7chp-now" aria-hidden="true">
      <span class="w7chp-k">Chapter</span>
      <span class="w7chp-mask"><span class="w7chp-roll"><span>01 Pruning</span><span>02 Bud break</span><span>03 Flowering</span><span>04 Harvest</span></span></span>
      <span class="w7chp-ticks"><i></i><i></i><i></i><i></i></span>
    </div>
  </div>
  <div class="w7chp-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w7chp-wrap">
    <article class="w7chp-sec">
      <p class="w7chp-num" aria-hidden="true">01</p>
      <h2>Pruning</h2>
      <p class="w7chp-when">January to March</p>
      <p class="w7chp-p">Every vine is cut back by hand to two canes, one row a morning while the frost lifts. It is the slowest job of the year and it decides how much fruit we will ask each plant to carry.</p>
    </article>
    <article class="w7chp-sec">
      <p class="w7chp-num" aria-hidden="true">02</p>
      <h2>Bud break</h2>
      <p class="w7chp-when">April and May</p>
      <p class="w7chp-p">The first green appears at the tips of the canes. We walk the slope at dawn with a thermometer, because one late frost in this fortnight can take half the crop.</p>
    </article>
    <article class="w7chp-sec">
      <p class="w7chp-num" aria-hidden="true">03</p>
      <h2>Flowering</h2>
      <p class="w7chp-when">June</p>
      <p class="w7chp-p">Tiny, scentless flowers that most visitors never notice. Warm, still weather now means full bunches in autumn; wind and rain mean loose, uneven ones.</p>
    </article>
    <article class="w7chp-sec">
      <p class="w7chp-num" aria-hidden="true">04</p>
      <h2>Harvest</h2>
      <p class="w7chp-when">Late September</p>
      <p class="w7chp-p">Friends, neighbours and a few regular guests pick for three days, and the press runs until midnight. Lunch is in the barn and the first juice is poured warm.</p>
      <a class="w7chp-btn" href="#">Join a picking day</a>
    </article>
  </div>
</section>

<style>
  /* Change these: --w7chp-bg, --w7chp-ink, --w7chp-vine (accent), and rootMargin in the script (where on screen a chapter takes over). */
  .w7chp { --w7chp-bg: #f7f8fa; --w7chp-ink: #1e293b; --w7chp-vine: #3f6b4f;
    position: relative; height: 620px; overflow-y: auto; overflow-x: hidden; background: var(--w7chp-bg); color: var(--w7chp-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  /* To run on page scroll: delete height and overflow above and use root: null in the script observer. */
  .w7chp:focus-visible { outline: 3px solid var(--w7chp-vine); outline-offset: -3px; }
  .w7chp-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; background: rgba(247,248,250,.96); border-bottom: 1px solid #dde2ea; }
  .w7chp-name { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
  .w7chp-now { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
  .w7chp-k { display: none; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: #64748b; }
  .w7chp-mask { display: block; height: 1.5em; overflow: hidden; line-height: 1.5; min-width: 7.5em; text-align: right; }
  .w7chp-roll { display: flex; flex-direction: column; color: var(--w7chp-vine); transition: transform .6s cubic-bezier(.65,0,.2,1); }
  .w7chp-ticks { display: none; gap: 4px; }
  .w7chp-ticks i { display: block; width: 18px; height: 3px; border-radius: 2px; background: #cfd6df; overflow: hidden; }
  .w7chp-ticks i::after { content: ""; display: block; height: 100%; background: var(--w7chp-vine); transform: scaleX(0); transform-origin: 0 50%; transition: transform .5s ease; }
  .w7chp-ticks i.w7chp-on::after { transform: scaleX(1); }
  .w7chp-hint { position: sticky; top: 0; height: 0; z-index: 2; display: flex; justify-content: flex-end; pointer-events: none; }
  .w7chp-hint span { margin: 60px 14px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(30,41,59,.08); font-size: 12px; transition: opacity .5s; }
  .w7chp[data-touched] .w7chp-hint span { opacity: 0; }
  .w7chp-wrap { max-width: 48rem; margin: 0 auto; padding: 8px 20px 72px; }
  .w7chp-sec { padding: 36px 0 150px; }
  .w7chp-sec:last-child { padding-bottom: 40px; }
  .w7chp-num { margin: 0; font-size: clamp(4rem, 12vw, 7.5rem); font-weight: 200; line-height: 1; letter-spacing: -.05em; color: #c3ccd7; }
  .w7chp-sec h2 { margin: 6px 0 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.02em; line-height: 1.05; }
  .w7chp-when { margin: 10px 0 0; font-size: 14px; font-weight: 600; letter-spacing: .06em; color: var(--w7chp-vine); }
  .w7chp-p { margin: 16px 0 0; max-width: 36rem; font-size: 17px; line-height: 1.7; color: #475569; }
  .w7chp-btn { display: inline-flex; align-items: center; min-height: 48px; margin-top: 28px; padding: 0 24px; border-radius: 8px; background: var(--w7chp-vine); color: #fff; font-weight: 600; font-size: 15px; text-decoration: none; }
  .w7chp-btn:hover { background: #335a41; }
  .w7chp-btn:focus-visible { outline: 3px solid var(--w7chp-ink); outline-offset: 3px; }
  @media (min-width: 640px) { .w7chp-k, .w7chp-ticks { display: flex; } .w7chp-k { display: inline; } .w7chp-bar { padding: 16px 32px; } }
  @media (prefers-reduced-motion: reduce) { .w7chp .w7chp-roll, .w7chp .w7chp-ticks i::after { transition: none; } }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w7chp]");
  if (!root) return;
  var off = [];
  //BODY-START
  var SPEED = 34; // px per second of demo scroll before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t; pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  function hand() { done = true; stop(); root.setAttribute("data-touched", ""); }
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    root.addEventListener(n, hand, { passive: true });
    off.push(function () { root.removeEventListener(n, hand); });
  });
  var vis = new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); });
  vis.observe(root);
  off.push(stop, function () { vis.disconnect(); });
  play();
  // The label follows whichever chapter crosses a line just under the bar (this also runs with reduced motion, without the slide).
  var secs = [].slice.call(root.querySelectorAll(".w7chp-sec")), roll = root.querySelector(".w7chp-roll"), ticks = root.querySelectorAll(".w7chp-ticks i");
  function set(i) {
    roll.style.transform = "translateY(" + (-i * 100 / secs.length) + "%)";
    ticks.forEach(function (t, k) { t.classList.toggle("w7chp-on", k <= i); });
  }
  set(0);
  var io = new IntersectionObserver(function (es) {
    es.forEach(function (e) { if (e.isIntersecting) set(secs.indexOf(e.target)); });
  }, { root: root, rootMargin: "-30% 0px -60% 0px" });
  secs.forEach(function (s) { io.observe(s); });
  off.push(function () { io.disconnect(); });
  //BODY-END
})();
</script>

With reduced motion: The chapter name still changes with each section, but it switches in place without rolling.

Running cost: One observer reports when a chapter crosses the line; the label moves with a single transform transition.

  • Rename the chapters inside `.w7chp-roll`, keeping one span per `.w7chp-sec` in the same order.
  • Move the hand-over line with `rootMargin` in the script; `-30% 0px -60% 0px` watches a band near the top.
  • Recolour the active label and ticks with `--w7chp-vine`.

Tea List Rows Stretch With Scroll Speed

A sand coloured tea room menu whose rows stretch taller the faster the list is scrolled, as if the paper were elastic, then spring back to their normal height when the scrolling stops. Rows passing the middle of the box stretch most and those near its top and bottom edges hardly at all, which reads like a soft lens moving through the list.

<section class="w3stl" tabindex="0" aria-label="Hollow Lane Tea Room, tea list">
  <p class="w3stl-hint" aria-hidden="true">Scroll inside</p>
  <div class="w3stl-intro">
    <p class="w3stl-kicker">Hollow Lane Tea Room</p>
    <h2>Loose leaf, brewed by the pot.</h2>
    <p>Each pot serves two to three cups. Ask for a second steep of any leaf.</p>
  </div>
  <ol class="w3stl-list">
    <li><span class="w3stl-name">Darjeeling first flush</span><span class="w3stl-from">India, spring picking</span><span class="w3stl-price">6.20</span></li>
    <li><span class="w3stl-name">Assam breakfast</span><span class="w3stl-from">India, malty and full</span><span class="w3stl-price">4.80</span></li>
    <li><span class="w3stl-name">Sencha</span><span class="w3stl-from">Japan, steamed green</span><span class="w3stl-price">5.60</span></li>
    <li><span class="w3stl-name">Gyokuro</span><span class="w3stl-from">Japan, shade grown</span><span class="w3stl-price">8.40</span></li>
    <li><span class="w3stl-name">Tie Guan Yin</span><span class="w3stl-from">China, rolled oolong</span><span class="w3stl-price">6.90</span></li>
    <li><span class="w3stl-name">Keemun</span><span class="w3stl-from">China, light smoke</span><span class="w3stl-price">5.20</span></li>
    <li><span class="w3stl-name">Silver needle</span><span class="w3stl-from">China, white buds</span><span class="w3stl-price">9.10</span></li>
    <li><span class="w3stl-name">Ceylon high grown</span><span class="w3stl-from">Sri Lanka, bright</span><span class="w3stl-price">4.90</span></li>
    <li><span class="w3stl-name">Rooibos</span><span class="w3stl-from">South Africa, red bush</span><span class="w3stl-price">4.40</span></li>
    <li><span class="w3stl-name">Fresh mint</span><span class="w3stl-from">From the garden</span><span class="w3stl-price">3.80</span></li>
  </ol>
  <p class="w3stl-foot">Prices per pot. Scones and the day's cake are listed on the board by the counter.</p>
</section>
<style>
  /* Change these: --w3stl-h (box height; remove height and overflow to use the page scroll), --w3stl-bg, --w3stl-ink, --w3stl-accent. */
  .w3stl { --w3stl-h: 620px; --w3stl-bg: #eee3cf; --w3stl-ink: #2b2118; --w3stl-accent: #7a5a2e;
    position: relative; height: var(--w3stl-h); overflow-y: auto; overscroll-behavior: contain; background: var(--w3stl-bg); color: var(--w3stl-ink); font-family: ui-sans-serif, system-ui, sans-serif; }
  .w3stl:focus-visible { outline: 2px solid var(--w3stl-accent); outline-offset: -4px; }
  .w3stl-hint { position: sticky; top: 0; z-index: 2; margin: 0; padding: 12px 20px; text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #6a5843; background: linear-gradient(var(--w3stl-bg) 60%, transparent); transition: opacity .5s ease; }
  .w3stl[data-used] .w3stl-hint { opacity: 0; }
  .w3stl-intro, .w3stl-list, .w3stl-foot { max-width: 52rem; margin: 0 auto; padding: 0 20px; }
  .w3stl-intro { padding-top: 16px; padding-bottom: 32px; text-align: center; }
  .w3stl-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--w3stl-accent); }
  .w3stl h2 { margin: 12px 0 0; font: 400 clamp(32px, 4.6vw, 48px)/1.1 Georgia, "Times New Roman", serif; letter-spacing: -.02em; }
  .w3stl-intro p:last-child { max-width: 30rem; margin: 14px auto 0; font-size: 16px; line-height: 1.6; color: #5a4a38; }
  .w3stl-list { list-style: none; padding-bottom: 28px; }
  .w3stl-list li { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; align-items: baseline; padding: 18px 0; border-top: 1px solid #d3c4a8; will-change: transform; }
  .w3stl-list li:last-child { border-bottom: 1px solid #d3c4a8; }
  .w3stl-name { font: 400 clamp(22px, 3vw, 30px)/1.15 Georgia, "Times New Roman", serif; }
  .w3stl-from { grid-row: 2; font-size: 14px; color: #5a4a38; padding-top: 4px; }
  .w3stl-price { grid-row: 1 / 3; align-self: center; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .w3stl-foot { padding-bottom: 72px; font-size: 14px; line-height: 1.6; color: #5a4a38; text-align: center; }
  @media (prefers-reduced-motion: reduce) { .w3stl-list li { transform: none !important; } .w3stl-hint { transition: none; } }
</style>
<script>
(function () {
  var STRETCH = 0.035; /* extra height per pixel scrolled in one frame (0.035 = 3.5%) */
  var MAX = 0.22;      /* the most a row may stretch */
  var EASE = 0.14;     /* how quickly rows follow the speed and settle back */
  var IDLE = 160;        /* the self-scroll demo swings this many px down and back every 4.8 s; 0 turns it off */
  var root = document.querySelector(".w3stl");
  if (!root) return;
  /* The box is the scroller here. On a normal page, set sc = window and the code reads scrollY and innerHeight. */
  var sc = root;
  var rows = [].slice.call(root.querySelectorAll(".w3stl-list li")), tops = [];
  function pos() { return sc === window ? scrollY : sc.scrollTop; }
  function view() { return sc === window ? innerHeight : sc.clientHeight; }
  function measure() {
    var base = (sc === window ? 0 : sc.getBoundingClientRect().top) - pos();
    tops = rows.map(function (r) { var b = r.getBoundingClientRect(); return b.top - base + b.height / 2; });
  }
  var last = pos(), up = false, cur = 0, f = 0, on = false, demo = IDLE > 0, t0 = 0;
  function used() { demo = false; root.setAttribute("data-used", ""); }
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (e) { root.addEventListener(e, used, { passive: true }); });
  if (matchMedia("(prefers-reduced-motion: reduce)").matches) return;
  function tick(now) {
    if (demo && on && sc !== window) {
      sc.scrollTop = IDLE * (1 - Math.cos((now - t0) / 764));
    }
    var p = pos(), v = p - last, h = view(), mid = p + h / 2;
    last = p;
    if (v) up = v < 0;
    cur += (Math.min(MAX, Math.abs(v) * STRETCH) - cur) * EASE;
    if (cur < 0.001 && !v) cur = 0;
    rows.forEach(function (r, i) {
      /* rows near the middle of the box stretch most, rows at the edges barely */
      var k = cur * Math.max(0, 1 - Math.abs(tops[i] - mid) / (h * 0.75));
      r.style.transformOrigin = up ? "50% 100%" : "50% 0";
      r.style.transform = k > 0.001 ? "scaleY(" + (1 + k).toFixed(3) + ")" : "";
    });
    f = on && (cur || v || demo) ? requestAnimationFrame(tick) : 0;
  }
  function run() { if (!f && on) f = requestAnimationFrame(tick); }
  (sc === window ? window : sc).addEventListener("scroll", run, { passive: true });
  addEventListener("resize", measure);
  new IntersectionObserver(function (e) {
    on = e[0].isIntersecting;
    if (on) { measure(); t0 = performance.now(); run(); } else { cancelAnimationFrame(f); f = 0; }
  }).observe(root);
})();
</script>

With reduced motion: The tea list scrolls as an ordinary menu with every row at its normal height and no self-scroll.

Running cost: Row positions are measured once on entry and on resize, so each frame only reads the scroll offset and writes a scaleY per row.

  • Change `STRETCH` for how much a row grows per pixel of speed, and keep `MAX` below about 0.25 so names stay readable.
  • Adjust the `0.75` in the falloff line to widen or narrow the band of rows that stretch around the middle.
  • Recolour through `--w3stl-bg`, `--w3stl-ink` and `--w3stl-accent`; `IDLE` sets how far the demo swings, 0 removes it.

Timeline Spine Draws and Dots Light Up

A family mill history laid out as a vertical timeline whose dark line grows down the page in step with your reading, while each year dot fills with amber the moment it crosses the middle of the box. The line is a scaled pseudo element and the dots are scaled fills, so only transform and opacity move.

<section class="w1tln" data-w1tln tabindex="0" aria-label="Brannock Mill history, scrollable">
  <div class="w1tln-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1tln-wrap">
    <p class="w1tln-eyebrow">Brannock Woollen Mill</p>
    <h2 class="w1tln-h">Five generations on one river bend</h2>
    <p class="w1tln-lead">The line fills as you read, and each year lights up as it reaches the middle of the box.</p>
    <ol class="w1tln-list">
      <li class="w1tln-i"><span class="w1tln-dot" aria-hidden="true"></span><p class="w1tln-yr">1898</p><h3>A wheel on the Brannock burn</h3><p>Two brothers lease a derelict corn mill and fit a carding engine bought at a farm sale. The first blankets go to the valley farms.</p></li>
      <li class="w1tln-i"><span class="w1tln-dot" aria-hidden="true"></span><p class="w1tln-yr">1926</p><h3>Looms arrive</h3><p>Four second-hand power looms come by rail. Tweed joins the blankets, woven in the patterns the shepherds' wives sketched.</p></li>
      <li class="w1tln-i"><span class="w1tln-dot" aria-hidden="true"></span><p class="w1tln-yr">1958</p><h3>The flood year</h3><p>The burn takes the lower shed and half the stock. The family rebuilds a metre higher and keeps every weaver on.</p></li>
      <li class="w1tln-i"><span class="w1tln-dot" aria-hidden="true"></span><p class="w1tln-yr">1984</p><h3>Natural dyes again</h3><p>A granddaughter back from art school revives the old dye recipes: madder, weld and walnut husk from the mill garden.</p></li>
      <li class="w1tln-i"><span class="w1tln-dot" aria-hidden="true"></span><p class="w1tln-yr">2011</p><h3>Water power, restored</h3><p>The wheel turns again, now driving a small turbine that runs the looms on most days of the year.</p></li>
      <li class="w1tln-i"><span class="w1tln-dot" aria-hidden="true"></span><p class="w1tln-yr">Today</p><h3>Open doors</h3><p>The weaving floor is open to visitors on weekday mornings, and the shop sells straight off the loom.</p></li>
    </ol>
    <a href="#" class="w1tln-btn">Plan a mill visit</a>
  </div>
</section>

<style>
  /* Change these: --w1tln-mid (half the box height: where the reading line sits), --w1tln-bg, --w1tln-ink, --w1tln-glow (lit dot colour). */
  .w1tln { --w1tln-mid: 310px; --w1tln-bg: #f2f1ee; --w1tln-ink: #24272b; --w1tln-glow: #c8862a;
    height: 620px; overflow-y: auto; overflow-x: hidden; position: relative; background: var(--w1tln-bg); color: var(--w1tln-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; }
  /* To use page scroll: delete height and overflow above, set --w1tln-mid: 50vh, and point the script at window. */
  .w1tln:focus-visible { outline: 3px solid var(--w1tln-ink); outline-offset: -3px; }
  .w1tln-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1tln-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(36,39,43,.85); color: #f2f1ee;
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1tln[data-touched] .w1tln-hint span { opacity: 0; }
  .w1tln-wrap { max-width: 46rem; margin: 0 auto; padding: 64px 20px 260px; }
  .w1tln-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #8a5a17; }
  .w1tln-h { margin: 14px 0 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(1.9rem, 4.4vw, 2.8rem); line-height: 1.1; letter-spacing: -.015em; }
  .w1tln-lead { margin: 14px 0 0; font-size: 1rem; line-height: 1.6; color: #4b4f55; }
  .w1tln-list { list-style: none; margin: 44px 0 0; padding: 0 0 0 52px; position: relative; view-timeline: --w1tln-l block; }
  .w1tln-list::before, .w1tln-list::after { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: #d3d0c8; }
  .w1tln-list::after { background: var(--w1tln-ink); transform-origin: 50% 0; transform: scaleY(var(--w1tln-p, 1)); }
  .w1tln-i { position: relative; padding: 0 0 44px; view-timeline: --w1tln-v block; }
  .w1tln-dot { position: absolute; left: -45px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--w1tln-bg); box-shadow: inset 0 0 0 2px #b8b4aa; z-index: 1; }
  .w1tln-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; background: var(--w1tln-glow);
    box-shadow: 0 0 0 6px rgba(200,134,42,.18); }
  .w1tln-yr { margin: 0; font-size: .875rem; font-weight: 700; letter-spacing: .06em; color: #8a5a17; font-variant-numeric: tabular-nums; }
  .w1tln-i h3 { margin: 6px 0 0; font-size: 1.25rem; font-weight: 600; }
  .w1tln-i h3 + p { margin: 8px 0 0; font-size: 1rem; line-height: 1.65; color: #4b4f55; }
  .w1tln-btn { display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 8px; background: var(--w1tln-ink);
    color: #f2f1ee; font-weight: 600; font-size: .9375rem; text-decoration: none; }
  .w1tln-btn:hover { background: #3a3e44; }
  .w1tln-btn:focus-visible { outline: 3px solid var(--w1tln-glow); outline-offset: 3px; }
  @keyframes w1tln-draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
  @keyframes w1tln-lit { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }
  @supports (animation-timeline: view()) {
    .w1tln:not([data-fb]) .w1tln-list::after { animation: w1tln-draw linear both; animation-timeline: --w1tln-l;
      animation-range: cover var(--w1tln-mid) cover calc(100% - var(--w1tln-mid)); }
    .w1tln:not([data-fb]) .w1tln-dot::after { animation: w1tln-lit linear both; animation-timeline: --w1tln-v;
      animation-range: cover calc(var(--w1tln-mid) - 20px) cover calc(var(--w1tln-mid) + 10px); }
  }
  /* Fallback set by the script: --w1tln-p draws the line, .w1tln-on lights a dot. */
  .w1tln[data-fb] .w1tln-dot::after { opacity: 0; transform: scale(.3); transition: opacity .35s ease, transform .45s cubic-bezier(.3,1.4,.5,1); }
  .w1tln[data-fb] .w1tln-on .w1tln-dot::after { opacity: 1; transform: none; }
  @media (prefers-reduced-motion: reduce) {
    .w1tln .w1tln-list::after, .w1tln .w1tln-dot::after { animation: none !important; transform: none; opacity: 1; transition: none; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1tln]");
  if (!root) return;
  //BODY-START
  var off = [];
  var SPEED = 45; // demo scroll in px per second before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function keep(o) { off.push(function () { o.disconnect(); }); return o; }

  // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t;
    pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  off.push(stop);
  keep(new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); })).observe(root);
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
  });
  play();
  var native = window.CSS && CSS.supports("animation-timeline: view()");

  // Without scroll timelines: compare the list and each entry with the middle of the box.
  if (!reduce && !native) {
    root.setAttribute("data-fb", "");
    var list = root.querySelector(".w1tln-list"), items = root.querySelectorAll(".w1tln-i"), f2 = 0;
    var draw = function () {
      f2 = 0;
      var a = root.getBoundingClientRect(), mid = a.top + root.clientHeight / 2, b = list.getBoundingClientRect();
      list.style.setProperty("--w1tln-p", Math.min(1, Math.max(0, (mid - b.top) / b.height)).toFixed(4));
      items.forEach(function (it) { it.classList.toggle("w1tln-on", it.getBoundingClientRect().top + 10 < mid); });
    };
    on(root, "scroll", function () { if (!f2) f2 = requestAnimationFrame(draw); });
    off.push(function () { cancelAnimationFrame(f2); });
    draw();
  }
  //BODY-END
})();
</script>

With reduced motion: The full line and all six lit dots show at once, with no drawing or demo scroll.

Running cost: One scaled line and six small dot fills on scroll timelines; the fallback reads seven rectangles per frame while scrolling.

  • Set `--w1tln-mid` to half the scrolling area (50vh on a normal page) to move the reading line.
  • Change `--w1tln-glow` for the lit dot colour and `--w1tln-ink` for the line.
  • Lower the bottom padding on `.w1tln-wrap` if you do not need the last entry to reach the middle.

Word Rows Drift Sideways With Scroll

Three oversized rows of market produce names that slide sideways as the section scrolls past, the outlined middle row moving against the two around it. Nothing loops on a timer: the rows only move while the visitor scrolls, which keeps the energy of a ticker without the constant motion. A plain stall list and opening hours sit underneath.

<section class="w1dri" data-w1dri tabindex="0" aria-label="Tidewater Saturday Market, scrollable">
  <div class="w1dri-hint" aria-hidden="true"><span>Scroll inside</span></div>
  <div class="w1dri-intro">
    <p class="w1dri-eyebrow">Tidewater Saturday Market</p>
    <h2 class="w1dri-h">Forty stalls under the old fish hall roof, every Saturday morning.</h2>
  </div>
  <div class="w1dri-rows" aria-hidden="true">
    <p class="w1dri-row w1dri-a">Heirloom tomatoes <i></i> Sourdough <i></i> Wildflower honey <i></i> Oyster mushrooms <i></i> Heirloom tomatoes <i></i> Sourdough <i></i></p>
    <p class="w1dri-row w1dri-b">Smoked mackerel <i></i> Raw milk cheese <i></i> Cut dahlias <i></i> Cider <i></i> Smoked mackerel <i></i> Raw milk cheese <i></i></p>
    <p class="w1dri-row w1dri-a w1dri-c">Duck eggs <i></i> Rye crackers <i></i> Quince jelly <i></i> Sea salt <i></i> Duck eggs <i></i> Rye crackers <i></i> Quince jelly <i></i></p>
  </div>
  <div class="w1dri-card">
    <div>
      <h3>Saturdays, 8 until 1</h3>
      <p>Growers, bakers, fishers and cheesemakers from within a short drive of the harbour. Bring a bag; the early stalls sell out first.</p>
    </div>
    <ul class="w1dri-list">
      <li>Bread and pastry</li><li>Fish and shellfish</li><li>Cheese and dairy</li><li>Veg, fruit and flowers</li>
    </ul>
    <a href="#" class="w1dri-btn">See this week's stalls</a>
  </div>
</section>

<style>
  /* Change these: --w1dri-shift (how far rows travel), --w1dri-bg, --w1dri-ink, --w1dri-gold, and the font-size on .w1dri-row. */
  .w1dri { --w1dri-shift: -32%; --w1dri-bg: #1f3326; --w1dri-ink: #f1ead8; --w1dri-gold: #d9b26a;
    height: 620px; overflow-y: auto; overflow-x: hidden; position: relative; background: var(--w1dri-bg); color: var(--w1dri-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; scrollbar-width: thin; scrollbar-color: #4b6352 transparent; }
  /* To drift with the page scroll: delete height and overflow-y above and set the script to read window scroll. */
  .w1dri:focus-visible { outline: 3px solid var(--w1dri-gold); outline-offset: -3px; }
  .w1dri-hint { position: sticky; top: 0; height: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: flex-end; pointer-events: none; }
  .w1dri-hint span { margin: 12px 12px 0 0; padding: 5px 12px; border-radius: 999px; background: rgba(241,234,216,.14); color: var(--w1dri-ink);
    font-size: 12px; letter-spacing: .04em; transition: opacity .5s ease; }
  .w1dri[data-touched] .w1dri-hint span { opacity: 0; }
  .w1dri-intro { max-width: 64rem; margin: 0 auto; padding: 64px 20px 36px; }
  .w1dri-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--w1dri-gold); }
  .w1dri-h { margin: 14px 0 0; max-width: 40rem; font-family: Georgia, "Iowan Old Style", serif; font-weight: 400; font-size: clamp(1.8rem, 4.2vw, 2.8rem); line-height: 1.12; letter-spacing: -.01em; }
  .w1dri-rows { padding: 20px 0 60px; }
  .w1dri-row { margin: 0; width: max-content; white-space: nowrap; font-family: Georgia, "Iowan Old Style", serif; font-size: clamp(3rem, 9vw, 7rem);
    line-height: 1.1; letter-spacing: -.03em; will-change: transform; }
  .w1dri-row i { display: inline-block; width: .22em; height: .22em; margin: 0 .35em; border-radius: 50%; background: var(--w1dri-gold); vertical-align: middle; }
  .w1dri-b { color: transparent; -webkit-text-stroke: 1.5px var(--w1dri-ink); transform: translateX(var(--w1dri-shift)); }
  .w1dri-c { font-size: clamp(2rem, 5.5vw, 4.2rem); color: var(--w1dri-gold); }
  .w1dri-card { max-width: 64rem; margin: 0 auto 72px; padding: 0 20px; display: grid; gap: 24px; }
  .w1dri-card h3 { margin: 0; font-size: 1.375rem; font-weight: 600; }
  .w1dri-card p { margin: 10px 0 0; max-width: 32rem; font-size: 1rem; line-height: 1.65; color: #cfd8cc; }
  .w1dri-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; font-size: .9375rem; color: #e3ddcc; }
  .w1dri-list li { padding-top: 10px; border-top: 1px solid rgba(241,234,216,.18); }
  .w1dri-btn { justify-self: start; display: inline-flex; min-height: 46px; align-items: center; padding: 0 22px; border-radius: 999px;
    background: var(--w1dri-gold); color: #1f3326; font-weight: 700; font-size: .9375rem; text-decoration: none; }
  .w1dri-btn:hover { background: #e6c487; }
  .w1dri-btn:focus-visible { outline: 3px solid var(--w1dri-ink); outline-offset: 3px; }
  @media (min-width: 820px) { .w1dri-intro, .w1dri-card { padding-left: 40px; padding-right: 40px; } .w1dri-card { grid-template-columns: 1.3fr 1fr; align-items: start; } .w1dri-btn { grid-column: 1; } }
  @keyframes w1dri-left { from { transform: translateX(0); } to { transform: translateX(var(--w1dri-shift)); } }
  @keyframes w1dri-right { from { transform: translateX(var(--w1dri-shift)); } to { transform: translateX(0); } }
  @supports (animation-timeline: view()) {
    .w1dri:not([data-fb]) .w1dri-a { animation: w1dri-left linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
    .w1dri:not([data-fb]) .w1dri-b { animation: w1dri-right linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
  }
  @media (prefers-reduced-motion: reduce) {
    .w1dri .w1dri-row { animation: none !important; transform: translateX(-6%); will-change: auto; }
  }
</style>

<script>
(function () {
  var root = document.querySelector("[data-w1dri]");
  if (!root) return;
  //BODY-START
  var off = [];
  var SPEED = 45; // demo scroll in px per second before anyone touches the box; 0 turns it off
  var reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
  var frame = 0, last = 0, pos = 0, seen = true, done = reduce || !SPEED;
  function on(el, n, f) { el.addEventListener(n, f, { passive: true }); off.push(function () { el.removeEventListener(n, f); }); }
  function keep(o) { off.push(function () { o.disconnect(); }); return o; }

  // Slow demo scroll so the preview moves; any wheel, touch, click or key hands control back.
  function step(t) {
    var dt = last ? Math.min(t - last, 50) : 0;
    last = t;
    pos += SPEED * dt / 1000;
    if (pos >= root.scrollHeight - root.clientHeight) pos = 0;
    root.scrollTop = pos;
    frame = requestAnimationFrame(step);
  }
  function play() { if (!done && seen && !frame) { last = 0; frame = requestAnimationFrame(step); } }
  function stop() { cancelAnimationFrame(frame); frame = 0; }
  off.push(stop);
  keep(new IntersectionObserver(function (e) { seen = e[0].isIntersecting; if (seen) play(); else stop(); })).observe(root);
  ["wheel", "touchstart", "pointerdown", "keydown"].forEach(function (n) {
    on(root, n, function () { done = true; stop(); root.setAttribute("data-touched", ""); });
  });
  play();
  var native = window.CSS && CSS.supports("animation-timeline: view()");

  // Without scroll timelines: move each row by its own progress through the box.
  if (!reduce && !native) {
    root.setAttribute("data-fb", "");
    var SHIFT = -32; // percent, keep in step with --w1dri-shift
    var rows = root.querySelectorAll(".w1dri-row"), f2 = 0;
    var draw = function () {
      f2 = 0;
      var a = root.getBoundingClientRect();
      rows.forEach(function (r) {
        var b = r.getBoundingClientRect();
        var p = Math.min(1, Math.max(0, (a.bottom - b.top) / (a.height + b.height)));
        if (r.classList.contains("w1dri-b")) p = 1 - p;
        r.style.transform = "translateX(" + (SHIFT * p).toFixed(2) + "%)";
      });
    };
    on(root, "scroll", function () { if (!f2) f2 = requestAnimationFrame(draw); });
    off.push(function () { cancelAnimationFrame(f2); });
    draw();
  }
  //BODY-END
})();
</script>

With reduced motion: The rows sit still, slightly offset, and every word and the stall list stay readable.

Running cost: Three wide text layers moved by transform on the scroll timeline; the fallback reads three rectangles per frame while scrolling.

  • Raise or lower `--w1dri-shift` to change how far the rows travel.
  • Edit the words in each `.w1dri-row`; repeat them so the row stays wider than the screen.
  • Change `-webkit-text-stroke` on `.w1dri-b` or drop the class for a solid middle row.

Performance notes

A scroll listener that reads layout and writes styles on every event is the classic cause of janky scrolling. The CSS timelines here run off the main thread in supporting browsers, and the fallback script only flips a class once per element when it enters view, so nothing is measured while you scroll.

Only transform and opacity change, which lets the browser move pre-painted layers instead of redrawing them. Reveals start from a few dozen pixels of offset rather than from off screen, which looks calmer and avoids creating huge layers. Pinned sections use position: sticky, so the browser keeps them in place without any script at all.

Questions

Which browsers support CSS scroll-driven animations?

According to MDN's compatibility data, animation-timeline with scroll() and view() works in Chrome and Edge from version 115 and in Safari from version 26 on Mac and iPhone. Firefox has it only in preview builds, which is why every effect here falls back to a small script.

Do I still need GSAP ScrollTrigger for scroll effects?

Not for reveals, pinning, progress bars or parallax of this kind. Native timelines plus position: sticky cover them. A library is still handy for long scripted sequences with many synchronised tweens, but it adds weight that simple effects do not need.

How do I stop content flashing before it animates in?

Hide elements only once the script or the @supports rule is known to run, and keep the first screen visible from the start. Here the hidden starting state lives inside the supports check or behind a class the script adds, so with no script the content simply shows.

What should people who prefer reduced motion get?

The finished layout, straight away. Each effect here drops its transforms under prefers-reduced-motion, so cards sit in place, pinned steps show as a plain list and progress bars stay put, while every word remains readable.

More collections: Smooth Scroll and Parallax Effects, Stacking Cards on Scroll, Text Reveal and Scramble Animations. All scroll effects. Build your site free to have a full site built around them.

Product

Who It's For

Features

Resources

Company

View Sitemap