176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
feat: our version of the chart that changes as you read, a pinned dot chart of example data that rearranges with each text step (checked on its site 2026-10-22)
matin510cbb92d520
diff --git a/famous/index.html b/famous/index.htmlindex c9cf0566..6cc2bba0 100644--- a/famous/index.html+++ b/famous/index.html@@ -382,7 +382,9 @@ button{font:inherit;color:inherit}.gp-load .m1 b{background:#e6e8f0}.gp-load .m2 b{background:#8f96ad}-/* the chart that changes step by step as the text goes by */+/* the chart that changes step by step as the text goes by: columns of dots that grow, then the three tallest light up while the rest fade, then+ slide to the front. A column is a clipped box; the dotted layer inside it moves down to hide dots from the top, so the column keeps its+ dots at the baseline (transform only). At rest the picture shows the middle step. */.gp-chart{background:radial-gradient(80% 90% at 70% 60%,#10152a,#08080a 72%)}.gp-chart .tl{left:8cqw;height:2.2cqw;border-radius:1cqw;background:#2a3042}.gp-chart .tl1{top:14cqw;width:25cqw}@@ -391,13 +393,16 @@ button{font:inherit;color:inherit}.gp-chart .tl4{top:32cqw;width:19cqw}.gp-chart .tl5{top:38cqw;width:24cqw}.gp-chart .mk{left:5.4cqw;top:13.2cqw;width:.8cqw;height:3.8cqw;border-radius:1cqw;background:var(--c1);transform:translateY(6cqw)}-.gp-chart .bar{bottom:9cqw;width:6.2cqw;height:38cqw;border-radius:1.2cqw 1.2cqw .4cqw .4cqw;background:#323a52;transform-origin:50% 100%;transform:scaleY(var(--b))}-.gp-chart .k1{left:44cqw;--a:.35;--b:.55;--c:.3}-.gp-chart .k2{left:52.4cqw;--a:.5;--b:.4;--c:.65}-.gp-chart .k3{left:60.8cqw;--a:.3;--b:.8;--c:.55;background:var(--c1)}-.gp-chart .k4{left:69.2cqw;--a:.65;--b:.5;--c:.9}-.gp-chart .k5{left:77.6cqw;--a:.45;--b:.7;--c:.4;background:var(--c4)}-.gp-chart .k6{left:86cqw;--a:.25;--b:.35;--c:.6}+.gp-chart .bar{bottom:9cqw;width:6.2cqw;height:33.6cqw;overflow:hidden;opacity:var(--dim)}+.gp-chart .mv,.gp-chart .g{left:0;top:0;width:100%;height:100%;background:radial-gradient(circle 1.5cqw at 50% 50%,var(--dc) 96%,transparent) 0 0/100% 4.8cqw}+.gp-chart .mv{--dc:#8d93ad;transform:translateY(calc(var(--h2) * 4.8cqw))}+.gp-chart .g{--dc:var(--c1);opacity:var(--lit)}+.gp-chart .k1{left:44cqw;--h1:6;--h2:5;--lit:0;--dim:.26;--sx:33.6cqw}+.gp-chart .k2{left:52.4cqw;--h1:6;--h2:4;--lit:0;--dim:.26;--sx:16.8cqw}+.gp-chart .k3{left:60.8cqw;--h1:5;--h2:2;--lit:1;--dim:1;--sx:-8.4cqw}+.gp-chart .k4{left:69.2cqw;--h1:5;--h2:1;--lit:1;--dim:1;--sx:-25.2cqw}+.gp-chart .k5{left:77.6cqw;--h1:6;--h2:3;--lit:1;--dim:1;--sx:-16.8cqw}+.gp-chart .k6{left:86cqw;--h1:6;--h2:5;--lit:0;--dim:.26;--sx:0cqw}/* the top bar that slides away while the page scrolls down and comes back when it scrolls up: a page that rises from the bottom edge */.gp-bar{background:radial-gradient(80% 90% at 50% 100%,#12162a,#08080a 72%)}@@ -441,7 +446,9 @@ button{font:inherit;color:inherit}@keyframes g-pt{0%{opacity:0;transform:translate(-41.5cqw,-15.7cqw)}6%{opacity:1;transform:translate(-41.5cqw,-15.7cqw)}16%,40%{opacity:1;transform:translate(-31.3cqw,0)}50%,78%{opacity:1;transform:none}86%{opacity:1;transform:translate(8cqw,-16.7cqw)}92%,100%{opacity:0;transform:translate(8cqw,-16.7cqw)}}@keyframes g-pop{0%,31%{opacity:0}31.5%,88%{opacity:1}88.5%,100%{opacity:0}}@keyframes g-fill{0%,33%{opacity:0}33.4%,88%{opacity:1}88.5%,100%{opacity:0}}-@keyframes g-bars{0%,26%{transform:scaleY(var(--a))}36%,62%{transform:scaleY(var(--b))}72%,92%{transform:scaleY(var(--c))}100%{transform:scaleY(var(--a))}}+@keyframes g-dots{0%,26%{transform:translateY(calc(var(--h1) * 4.8cqw))}36%,92%{transform:translateY(calc(var(--h2) * 4.8cqw))}100%{transform:translateY(calc(var(--h1) * 4.8cqw))}}+@keyframes g-lit{0%,26%{opacity:0}36%,92%{opacity:var(--lit)}100%{opacity:0}}+@keyframes g-sort{0%,26%{opacity:1;transform:none}36%,62%{opacity:var(--dim);transform:none}72%,92%{opacity:var(--dim);transform:translateX(var(--sx))}100%{opacity:1;transform:none}}@keyframes g-mark{0%,26%{transform:none}36%,62%{transform:translateY(6cqw)}72%,92%{transform:translateY(12cqw)}100%{transform:none}}@keyframes g-page{0%,10%{transform:translateY(-6cqh)}38%,56%{transform:translateY(-40cqh)}70%,92%{transform:translateY(-32cqh)}100%{transform:translateY(-6cqh)}}@keyframes g-slide{0%,14%{transform:none}24%,58%{transform:translateY(-105%)}68%,92%{transform:none}100%{transform:none}}@@ -497,7 +504,9 @@ button{font:inherit;color:inherit}.gp-load .l-b{--d:.15s}.gp-load .l-c{--d:.3s}.gp-chart{--x:3.2s}- .gp-chart .bar{animation:g-bars 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}+ .gp-chart .mv{animation:g-dots 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}+ .gp-chart .g{animation:g-lit 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}+ .gp-chart .bar{animation:g-sort 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}.gp-chart .mk{animation:g-mark 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}.gp-bar{--x:.4s}.tb-page{animation:g-page 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}@@ -851,7 +860,7 @@ html.fx-open{overflow:hidden;padding-right:var(--fx-gap,0px)} /* the page does n</li><li class="tile" data-fx-tile="pudding-chart"><div class="t-stage">- <div class="gp gp-chart" aria-hidden="true"><i class="tl tl1"></i><i class="tl tl2"></i><i class="tl tl3"></i><i class="tl tl4"></i><i class="tl tl5"></i><i class="mk"></i><i class="bar k1"></i><i class="bar k2"></i><i class="bar k3"></i><i class="bar k4"></i><i class="bar k5"></i><i class="bar k6"></i></div>+ <div class="gp gp-chart" aria-hidden="true"><i class="tl tl1"></i><i class="tl tl2"></i><i class="tl tl3"></i><i class="tl tl4"></i><i class="tl tl5"></i><i class="mk"></i><i class="bar k1"><i class="mv"><i class="g"></i></i></i><i class="bar k2"><i class="mv"><i class="g"></i></i></i><i class="bar k3"><i class="mv"><i class="g"></i></i></i><i class="bar k4"><i class="mv"><i class="g"></i></i></i><i class="bar k5"><i class="mv"><i class="g"></i></i></i><i class="bar k6"><i class="mv"><i class="g"></i></i></i></div><div class="t-tags"><span class="t-tag">Our version</span><span class="t-tag t-start">On scroll</span></div></div><div class="t-meta">@@ -1183,15 +1192,26 @@ html.fx-open{overflow:hidden;padding-right:var(--fx-gap,0px)} /* the page does n</section><section class="fx" id="pudding-chart" aria-labelledby="pudding-chart-t" data-fx-site="The Pudding" data-fx-start="scroll">- <p class="fx-seen">Seen on <a href="https://pudding.cool/2025/11/democracy/" target="_blank" rel="noopener">pudding.cool/2025/11/democracy<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p>+ <p class="fx-seen">Seen on <a href="https://pudding.cool/2025/11/democracy/" target="_blank" rel="noopener">pudding.cool/2025/11/democracy<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-22">2026</time></p><h2 id="pudding-chart-t" tabindex="-1">The chart that changes as you read</h2><p class="fx-chips"><span class="fx-chip">Starts on scroll</span><span class="fx-chip">Made from 2 animations</span></p>+ <div class="fx-version">+ <div class="fx-stage">+ <iframe title="Our version: The chart that changes as you read" data-src="versions/pudding-chart.html"></iframe>+ <span class="fx-vlabel" aria-hidden="true">Our version</span>+ </div>+ <div class="fx-player">+ <button type="button" class="fx-pbtn" data-fx-cmd="play">Play</button>+ <button type="button" class="fx-pbtn" data-fx-cmd="top">Back to top</button>+ <p class="fx-phint">Built from the prompt below. Scroll inside the box, or press Play.</p>+ </div>+ </div><h3 class="fx-sub">What you see</h3><p class="fx-what">A chart of dots stays on screen while short paragraphs scroll past. As you scroll, the years go by and each year's dots pile up into the chart, the ones the story is about in bright color, and at some paragraphs the dots slide into a new chart; scrolling back undoes each step.</p><h3 class="fx-sub">Good to know</h3><dl class="fx-know"><div><dt>Starts</dt><dd>Each time a new block of text reaches the middle of the screen.</dd></div>- <div><dt>On phones</dt><dd>The chart stays at the top and the text scrolls over it on cards.</dd></div>+ <div><dt>On phones</dt><dd>The chart stays at the top and each block of text slides up below it on a card.</dd></div><div><dt>Reduced motion</dt><dd>The steps switch without animating.</dd></div></dl><h3 class="fx-sub">Build it with these animations</h3>@@ -1200,7 +1220,7 @@ html.fx-open{overflow:hidden;padding-right:var(--fx-gap,0px)} /* the page does n<article class="card c1" data-slug="sticky-section"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The chart stays</span></div><div class="meta"><h4 class="title"><a href="../animations/01-scroll-based/sticky-section/">Sticky Section</a></h4><p class="desc">A section holds still while its content changes. Best for feature tours.</p></div></article></div><h3 class="fx-sub">A prompt to build something similar</h3>- <div class="fx-pbox"><p class="fx-prompt">Add a scrollytelling layout to <mark>[your story or data article]</mark>. Keep a chart or picture fixed on the screen while short blocks of text scroll past it, and change the chart each time a new block reaches the middle of the screen: light up the dots or bars the text talks about and fade the rest, so the words and the chart tell the story together. Change it smoothly, and let scrolling back undo each step. On phones, keep the chart at the top and let the text scroll over it on cards. Keep every step readable without the chart for screen readers. If the visitor has reduced motion turned on, switch between the steps without animating.</p></div>+ <div class="fx-pbox"><p class="fx-prompt">Add a scrollytelling layout to <mark>[your story or data article]</mark>. Keep a chart or picture fixed on the screen while short blocks of text scroll past it, and change the chart each time a new block reaches the middle of the screen: light up the dots or bars the text talks about and fade the rest, so the words and the chart tell the story together. Change it smoothly, and let scrolling back undo each step. On phones, keep the chart at the top and let each block of text slide up below it on a wide card. Keep every step readable without the chart for screen readers. If the visitor has reduced motion turned on, switch between the steps without animating.</p></div><button type="button" class="copy" aria-label="Copy prompt for The chart that changes as you read"><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a2 2 0 0 1 2-2h10"/></svg><span class="copy-l" aria-live="polite">Copy prompt</span></button><a class="fx-real" href="https://pudding.cool/2025/11/democracy/" target="_blank" rel="noopener">Watch the real one on pudding.cool <span aria-hidden="true">↗</span><span class="sr"> (opens in a new tab)</span></a></section>diff --git a/famous/versions/pudding-chart.html b/famous/versions/pudding-chart.htmlnew file mode 100644index 00000000..2aa8f238--- /dev/null+++ b/famous/versions/pudding-chart.html@@ -0,0 +1,187 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<meta name="robots" content="noindex">+<title>Our version: The chart that changes as you read</title>+<style>+@font-face{font-family:'Schibsted Grotesk';src:url('../../assets/fonts/schibsted-latin-ext.woff2') format('woff2');font-weight:400 900;font-display:swap;unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}+@font-face{font-family:'Schibsted Grotesk';src:url('../../assets/fonts/schibsted-latin.woff2') format('woff2');font-weight:400 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}+:root{--H:100vh;--bg:#0b0b0f;--ink:#f4f4f2;--mut:#a3a4b4;--dot:#8d93ad;--c1:#6ea8ff;--c4:#ff9d5c;color-scheme:dark}+@supports(height:100svh){:root{--H:100svh}}+*{box-sizing:border-box;margin:0}+html{background:var(--bg);overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#3c3c4a var(--bg)}+body{color:var(--ink);font:400 15px/1.45 'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;-webkit-font-smoothing:antialiased}+body::after{content:"";position:fixed;left:0;top:0;width:min(23em,40%);height:72px;z-index:3;pointer-events:none;background:linear-gradient(var(--bg) 40px,#0b0b0f00)} /* cards leave through a soft edge, clear of the page's Our version label */+.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}+.tag{position:fixed;z-index:4;right:14px;top:12px;padding:6px 11px;border-radius:999px;background:#171a27;border:1px solid #2b3047;font-size:12px;line-height:1;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#c3c4d0}++/* the chart is pinned for the whole scroll; the text cards scroll over it. Every mark (dot, label, axis) is moved with transform and opacity only. */+.stage{position:sticky;top:0;height:var(--H);overflow:hidden}+.panel{position:absolute;border-radius:16px;background:#10131d;border:1px solid #1f2436}+.ct{position:absolute;font-size:13px;line-height:1.2;font-weight:600;color:#d6d8e4}+.ct span{position:absolute;left:0;top:0;white-space:nowrap}+.m{position:absolute;left:0;top:0;transition:transform 1.5s cubic-bezier(.22,.7,.2,1) var(--dl,0s),opacity .5s ease var(--dl,0s)}+.d{width:var(--d);height:var(--d);border-radius:50%;background:var(--dot)}+.d::before,.d::after{content:"";position:absolute;inset:0;border-radius:50%;opacity:0;transition:opacity .5s ease var(--dl,0s)}+.d::before{background:var(--c1);box-shadow:0 0 calc(var(--d) * .7) rgba(110,168,255,.5)}+.d::after{background:var(--c4);box-shadow:0 0 calc(var(--d) * .7) rgba(255,157,92,.45)}+.d.a::before,.d.b::after{opacity:1}+.l{width:max-content;translate:-50% 0;font-size:12px;line-height:1;font-style:normal;color:var(--mut)}+.ax{height:1px;background:#3a4058}+.ct span,.l,.ax{opacity:0;transition:opacity .45s ease}+[data-ch="1"] :is(.ax,.ct span:first-child),:is([data-k="1"],[data-k="2"]) .l.w,[data-k="3"] .l.v,[data-ch="2"] :is(.l.g,.ct span:last-child){opacity:1;transition-delay:.55s} /* labels come back after the dots have mostly arrived, and leave at once */+.tiny .ct{display:none}+.snap *,.snap *::before,.snap *::after{transition:none!important}+.lite .d::before,.lite .d::after{box-shadow:none}++.steps{position:relative;z-index:2;display:flow-root;list-style:none;width:min(23em,40%);margin-top:calc(var(--H) * -1);padding:0 12px 0 clamp(14px,3vw,30px)}+.card{position:relative;margin-bottom:calc(var(--H) * .46);padding:13px 15px 14px;border-radius:14px;background:#151722;border:1px solid #2b3047;transition:opacity .3s ease} /* opaque, so the chart never shows through a card */+.card:nth-last-child(2){margin-bottom:0}+.end{height:var(--endh,0px)} /* room after the last card, so it ends just above the middle (on phones, so it can stay put at the middle) */+.card b,.card p{opacity:.62;transition:opacity .4s ease}+.card::before{content:"";position:absolute;left:0;top:12px;bottom:12px;width:3px;border-radius:2px;background:var(--c1);opacity:0;transition:opacity .4s ease}+.card.on b,.card.on p,.card.on::before{opacity:1}+.card b{display:block;margin-bottom:4px;font-size:12px;line-height:1.2;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#d0d2de}+.card p{text-wrap:pretty}+/* phones: the chart is at the top; each card slides up below it, stops at the middle and stays until the next card slides over it */+@media(max-width:639px){.steps{width:100%;padding-left:14px;padding-right:14px}.card{position:sticky;top:var(--stick,50vh);padding:11px 14px 12px}.card.past{opacity:0;transition-delay:.12s}body::after{display:none}}+@media(prefers-reduced-motion:reduce){*,::before,::after{transition:none!important}}+</style>+<script>+{+ const q = '(max-width:600px),(max-height:500px)';+ let lite;+ try { lite = window.parent.matchMedia(q).matches; } catch (e) { lite = screen.width <= 600 || screen.height <= 500; }+ document.documentElement.classList.toggle('lite', lite);+}+</script>+</head>+<body>+<h1 class="sr">A chart that changes as you read</h1>+<p class="tag">Example data</p>+<main>+ <div class="stage" role="img" aria-label=""><div class="panel"></div><p class="ct"><span>Samples per week</span><span>Samples per group</span></p></div>+ <ol class="steps">+ <li class="card"><b>Step 1 of 4</b><p>Each dot is one made-up sample. Keep scrolling, and the loose dots pile up into eight weeks.</p></li>+ <li class="card"><b>Step 2 of 4</b><p>Three weeks were busier than the rest. Their dots light up while the others fade back.</p></li>+ <li class="card"><b>Step 3 of 4</b><p>Sort the weeks from busiest to quietest, and the bright ones slide to the front.</p></li>+ <li class="card"><b>Step 4 of 4</b><p>Group the dots instead: the three busy weeks make one bar, and the other five make another.</p></li>+ <li class="end" aria-hidden="true"></li>+ </ol>+</main>+<script>+const $ = s => document.querySelector(s);+const stage = $('.stage'), panel = $('.panel'), steps = $('.steps'), cards = [...document.querySelectorAll('.card')], N = cards.length;+const reduce = matchMedia('(prefers-reduced-motion: reduce)'), FRAME = 1000 / 60;+const COUNTS = [2, 4, 7, 9, 8, 5, 3, 2], BUSY = [2, 3, 4], NW = COUNTS.length; // made-up samples per week; the three busiest weeks+const ORDER = COUNTS.map((_, c) => c).sort((a, b) => COUNTS[b] - COUNTS[a] || a - b), SLOT = COUNTS.map((_, c) => ORDER.indexOf(c));+const SAY = ['Example chart: loose dots scattered across the box.', 'Example chart: the dots piled up into eight columns, one for each week.',+ 'Example chart: three busy weeks lit in blue, the other dots faded.', 'Example chart: the weeks sorted from busiest to quietest, the three busy ones first.',+ 'Example chart: the dots grouped into two bars, the busy weeks in blue and the other weeks in orange.'];+let seed = 11; const rnd = () => (seed = seed * 16807 % 2147483647) / 2147483647;+const mk = (cls, text) => { const e = document.createElement('i'); e.className = 'm ' + cls; if (text) e.textContent = text; stage.append(e); return e; };+const ax = mk('ax'), wl = COUNTS.map((_, c) => mk('l w', c + 1)), vl = ORDER.map(c => mk('l v', c + 1)), gl = ['Busy weeks', 'Other weeks'].map(t => mk('l g', t)), ct = $('.ct');+const dots = []; let jb = 0, jo = 0;+COUNTS.forEach((n, c) => { for (let r = 0; r < n; r++) { const busy = BUSY.includes(c); dots.push({ c, r, busy, j: busy ? jb++ : jo++, fx: rnd(), fy: rnd(), dl: rnd(), e: mk('d') }); } });+const cells = dots.map((_, i) => i); // each dot gets its own cell of the scattered grid, so no two dots land on each other+for (let i = cells.length - 1; i > 0; i--) { const j = Math.floor(rnd() * (i + 1)); [cells[i], cells[j]] = [cells[j], cells[i]]; }+dots.forEach((d, i) => { d.cell = cells[i]; });++// Where everything sits at this size: the chart goes to the right of the cards, or on phones to the top above them. The dots form 1 or 2 sub-columns+// per week, whichever lets them be biggest.+let G = {};+function geo() {+ const W = innerWidth, H = stage.clientHeight, narrow = W < 640, tiny = H < 330, TOP = tiny ? 8 : 30;+ const ax0 = narrow ? 14 : Math.round(Math.min(W * .43, 440)), ax1 = W - (narrow ? 14 : 22), ay0 = 46, ay1 = narrow ? Math.round(H * .46) - 8 : H - 14;+ const cx0 = ax0 + 14, cx1 = ax1 - 14, fit = [1, 2].map(s => { const rows = Math.ceil(9 / s); return { s, rows, u: Math.max(4, Math.min((ay1 - ay0 - TOP - 30) / (rows + .4), (cx1 - cx0) / (NW * (s + .9)), 44)) }; }).sort((a, b) => b.u - a.u)[0];+ const { s, rows, u } = fit, ph = rows * u + TOP + 30, top = narrow ? ay0 : ay0 + Math.max(0, (ay1 - ay0 - ph) / 2);+ const cw = Math.min((cx1 - cx0) / NW, (s + 1.4) * u);+ G = { s, u, cw, cx0, cx1, top, ry: top + TOP, base: top + TOP + rows * u, x0: (cx0 + cx1) / 2 - NW * cw / 2, bc: Math.max(4, Math.ceil(24 / rows)) };+ stage.classList.toggle('tiny', tiny);+ panel.style.cssText = `left:${ax0}px;top:${top}px;width:${ax1 - ax0}px;height:${ph}px`;+ ct.style.cssText = `left:${ax0 + 14}px;top:${top + 10}px`;+ ax.style.width = NW * cw + 8 + 'px';+ stage.style.setProperty('--d', (u * .8).toFixed(1) + 'px');+}+function at(d, k) { // a dot's place in step k: scattered, in its week, in its sorted week, or in its group's block+ const { s, u, cw, x0, cx0, cx1, ry, base, bc } = G;+ if (k === 0) return [cx0 + (d.cell % NW + .25 + .5 * d.fx) * (cx1 - cx0) / NW, ry + 4 + (Math.floor(d.cell / NW) + .25 + .5 * d.fy) * (base - ry - 8) / (dots.length / NW)];+ if (k < 4) return [x0 + ((k === 3 ? SLOT[d.c] : d.c) + .5) * cw + (d.r % s - (s - 1) / 2) * u, base - (Math.floor(d.r / s) + .5) * u];+ return [cx0 + (cx1 - cx0) * (d.busy ? .28 : .72) + (d.j % bc - (bc - 1) / 2) * u, base - (Math.floor(d.j / bc) + .5) * u];+}+const px = (x, y) => `translate(${x.toFixed(1)}px,${y.toFixed(1)}px)`;+function show(k, snap) {+ if (snap) stage.classList.add('snap');+ stage.dataset.k = k; stage.dataset.ch = k ? (k < 4 ? 1 : 2) : 0; stage.setAttribute('aria-label', SAY[k]);+ const r = G.u * .4, lag = c => ((c / (NW - 1)) * .45).toFixed(2) + 's'; // the weeks fill one after another, left to right+ dots.forEach(d => {+ const [x, y] = at(d, k), e = d.e, fade = (k === 2 || k === 3) && !d.busy;+ e.style.setProperty('--dl', snap ? '0s' : (parseFloat(lag(d.c)) + d.dl * .12).toFixed(2) + 's');+ e.style.transform = px(x - r, y - r); e.style.opacity = k === 0 ? .7 : fade ? .26 : 1;+ e.classList.toggle('a', k > 1 && d.busy); e.classList.toggle('b', k === 4 && !d.busy);+ });+ [wl, vl].forEach(set => set.forEach((e, i) => { e.style.transform = px(G.x0 + (i + .5) * G.cw, G.base + 9); })); // the weeks' numbers, and the same numbers in sorted order+ gl.forEach((e, i) => { e.style.transform = px(G.cx0 + (G.cx1 - G.cx0) * (i ? .72 : .28), G.base + 9); });+ ax.style.transform = px(G.x0 - 4, G.base + 1);+ cards.forEach((c, i) => { c.classList.toggle('on', i === k - 1); c.classList.toggle('past', i < k - 1); });+ if (snap) { void stage.offsetWidth; stage.classList.remove('snap'); }+}++// The step is the last card that has reached the middle of the box, so scrolling back undoes each step at the same place.+let cur = -1, trig = [], END = 0, lastY = 0, raf = 0, lastT = null, playing = false, pos = 0, acted = false;+function measure() {+ const H = innerHeight, phone = innerWidth < 640; // the first card waits below the middle, fully in view when the box is tall enough for it+ let y = Math.max(H * .5 + 8, Math.min(H * .64, H - cards[0].offsetHeight - 12));+ steps.style.paddingTop = y + 'px';+ steps.style.setProperty('--stick', H * .5 + 'px');+ steps.style.setProperty('--endh', Math.max(0, phone ? H * .5 : H * .54 - cards[N - 1].offsetHeight) + 'px');+ END = Math.max(0, document.documentElement.scrollHeight - H);+ trig = cards.map(c => { const t = y - H * .5; y += c.offsetHeight + parseFloat(getComputedStyle(c).marginBottom); return t; }); // where each card would be if nothing stuck+}+function check(snap) {+ const y = scrollY; let k = 0;+ while (k < N && y >= trig[k]) k++;+ if (k !== cur) show(cur = k, snap || Math.abs(y - lastY) > innerHeight * .9); // a jump (Back to top, the scrollbar, End) shows the new step at once+ lastY = y;+}++function tick(ts) {+ raf = 0;+ const dt = lastT === null ? 0 : Math.min(ts - lastT, 50);+ lastT = ts;+ if (playing && Math.abs(scrollY - pos) > 2) playing = false; // the visitor moved it+ if (playing) {+ pos = Math.min(END, pos + END / 360 * (dt / FRAME)); // the whole scroll in 6 s+ scrollTo({ top: pos, behavior: 'instant' });+ if (pos >= END) playing = false;+ }+ if (playing) raf = requestAnimationFrame(tick); else lastT = null;+}+function toTop() { playing = false; scrollTo({ top: 0, behavior: 'instant' }); check(true); }+function play() {+ measure();+ if (END <= 0) return;+ if (scrollY >= END - 2) toTop();+ pos = scrollY; playing = true; lastT = null;+ if (!raf) raf = requestAnimationFrame(tick);+}++addEventListener('message', e => {+ if (e.source !== parent || !e.data) return;+ if (e.data.fx === 'play') { acted = true; play(); } else if (e.data.fx === 'top') { acted = true; toTop(); }+});+['wheel', 'touchstart', 'pointerdown', 'keydown'].forEach(t => addEventListener(t, e => { if (e.isTrusted) { acted = true; playing = false; } }, { passive: true, capture: true }));+addEventListener('scroll', () => check(false), { passive: true });+addEventListener('resize', () => { geo(); measure(); cur = -1; check(true); });+document.addEventListener('visibilitychange', () => { lastT = null; });+geo(); measure(); check(true);+if (document.fonts) document.fonts.ready.then(() => { measure(); check(false); }); // the cards may change height once the font is in+addEventListener('load', () => {+ measure(); check(false);+ setTimeout(() => { if (!acted && !reduce.matches && scrollY < 2) play(); }, 700);+});+</script>+</body>+</html>diff --git a/tests/famous.test.js b/tests/famous.test.jsindex 41c534c1..d59efbcd 100644--- a/tests/famous.test.js+++ b/tests/famous.test.js@@ -489,7 +489,7 @@ const SITE_PHRASES = [const CHECKED_IDS = ['stripe-ribbon', 'apple-scroll', 'landonorris-reveal', 'linear-intro', 'apple-menu', 'wikipedia-previews', 'apple-sweep', 'spotify-cards', 'youtube-loading', 'pudding-chart', 'medium-top-bar'];const CHECKED_DAY = '2026-10-13';// Entries checked again on their site before the gallery release, and the day of that check.-const RECHECKED = { 'apple-menu': '2026-10-22', 'apple-scroll': '2026-10-22', 'apple-sweep': '2026-10-22', 'landonorris-reveal': '2026-10-22', 'linear-intro': '2026-10-22', 'spotify-cards': '2026-10-22', 'stripe-ribbon': '2026-10-22', 'wikipedia-previews': '2026-10-22', 'youtube-loading': '2026-10-22' };+const RECHECKED = { 'apple-menu': '2026-10-22', 'apple-scroll': '2026-10-22', 'apple-sweep': '2026-10-22', 'landonorris-reveal': '2026-10-22', 'linear-intro': '2026-10-22', 'pudding-chart': '2026-10-22', 'spotify-cards': '2026-10-22', 'stripe-ribbon': '2026-10-22', 'wikipedia-previews': '2026-10-22', 'youtube-loading': '2026-10-22' };// The text a visitor reads, with each tag ending a word (textOf above joins the end of one element to the start of the next, so a// slogan at the end of a card label would run into the card's name and go unseen).