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 color that sweeps across the headline; the entry describes what its site shows now (checked 2026-10-22)
matin5fc937a1bdbe
diff --git a/famous/index.html b/famous/index.htmlindex 7bc03432..bcf68e1a 100644--- a/famous/index.html+++ b/famous/index.html@@ -329,12 +329,17 @@ button{font:inherit;color:inherit}.wk-card .l3{left:16.6cqw;top:10.4cqw;width:20cqw;height:1.5cqw;background:#9aa0b8}.wk-ptr{left:47cqw;top:37.3cqh;width:4.4cqw;height:4.4cqw;border-radius:50%;border:2px solid #fff;background:rgba(255,255,255,.22);box-shadow:0 0 0 1px rgba(8,8,10,.7),0 .8cqw 2cqw rgba(0,0,0,.45)}-/* the color that sweeps across a headline: a bright band, clipped to the bars */-.gp-sweep{background:radial-gradient(80% 90% at 50% 50%,#12141f,#08080a)}-.gp-sweep .sw{left:11cqw;height:16cqh;border-radius:2.6cqh;overflow:hidden;background:#242938}-.gp-sweep .w1{top:33cqh;width:76cqw}-.gp-sweep .w2{top:57cqh;width:52cqw}-.gp-sweep .sw i{left:0;top:0;bottom:0;width:200%;border-radius:0;transform:translateX(-60%);background:linear-gradient(90deg,#eef0f8 0 76%,var(--c1) 82%,var(--c3) 88%,var(--c5) 94%,transparent)}+/* the color that sweeps across a headline: two headline bars, hidden until a band of color (violet, coral, amber, then plain white) brings them in+ from the left. One wide gradient, as wide as the top bar times 5.12, slides across both bars; at rest it is part way, the front near the end of the top bar. */+.gp-sweep{background:#0b0b0f}+.gp-sweep .sw{left:12cqw;height:17cqh;border-radius:2.8cqh;overflow:hidden}+.gp-sweep .w1{top:30cqh;width:76cqw}+.gp-sweep .w2{top:54cqh;left:24cqw;width:52cqw}+.gp-sweep .sw i{left:0;top:0;bottom:0;width:389cqw;border-radius:0;transform:translateX(-50.8%);background:linear-gradient(90deg,#f4f4f2 19.53%,#ffe9b8 35.16%,#ffce5a 43.95%,#ff9d5c 49.8%,#ff6f8b 54.69%,#b98cff 60.55%,#3a2872 66.02%,#0b0b0f 70.31%)}+.gp-sweep .w2 i{left:-12cqw}+.gp-sweep .sw::after{content:"";position:absolute;top:0;bottom:0;width:4cqw;background:#0b0b0f}+.gp-sweep .w1::after{left:22cqw}+.gp-sweep .w2::after{left:12.5cqw}/* the cards: the middle card lightens and a round play button rises into its corner */.gp-cards{background:#08080a}@@ -427,7 +432,7 @@ button{font:inherit;color:inherit}@keyframes g-drop{0%,22%{opacity:0;transform:translateY(-4cqh)}36%,72%{opacity:1;transform:none}84%,100%{opacity:0;transform:translateY(-2cqh)}}@keyframes g-ptr{0%,8%{transform:translate(30cqw,12cqh)}24%,80%{transform:none}94%,100%{transform:translate(30cqw,12cqh)}}@keyframes g-card{0%,31%{opacity:0;transform:translateY(5cqh)}36%,84%{opacity:1;transform:none}89%,100%{opacity:0;transform:translateY(4cqh)}}-@keyframes g-sweep{0%,10%{transform:translateX(-100%);opacity:1}46%{transform:translateX(0);opacity:1}82%{transform:translateX(0);opacity:1}94%,100%{transform:translateX(0);opacity:0}}+@keyframes g-sweep{0%,8%{transform:translateX(-80.08%);opacity:1}62%,86%{transform:none;opacity:1}96%{transform:none;opacity:0}96.1%,100%{transform:translateX(-80.08%);opacity:0}}@keyframes g-glow{0%,16%{opacity:0}28%,70%{opacity:1}84%,100%{opacity:0}}@keyframes g-play{0%,16%{opacity:0;transform:translateY(2.6cqw)}28%,70%{opacity:1;transform:none}84%,100%{opacity:0;transform:translateY(1.6cqw)}}@keyframes g-sheen{0%{transform:translateX(-100%)}17%{transform:translateX(100%)}18%{transform:translateX(-100%)}35%,100%{transform:translateX(100%)}}@@ -475,9 +480,8 @@ button{font:inherit;color:inherit}.gp-wiki{--x:4s}.wk-ptr{animation:g-ptr 6.5s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}.wk-card{animation:g-card 6.5s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}- .gp-sweep{--x:1.5s}- .gp-sweep .sw i{animation:g-sweep 6s cubic-bezier(.5,0,.3,1) infinite backwards;animation-delay:calc(var(--d,0s) - var(--x))}- .gp-sweep .w2 i{--d:.2s}+ .gp-sweep{--x:1.66s}+ .gp-sweep .sw i{animation:g-sweep 6s linear infinite backwards;animation-delay:calc(0s - var(--x))}.gp-cards{--x:2.3s}.gp-cards .cb::before{animation:g-glow 4.6s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}.gp-cards .play{animation:g-play 4.6s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}@@ -1075,23 +1079,34 @@ html.fx-open{overflow:hidden;padding-right:var(--fx-gap,0px)} /* the page does n</section><section class="fx" id="apple-sweep" aria-labelledby="apple-sweep-t" data-fx-site="Apple" data-fx-start="scroll">- <p class="fx-seen">Seen on <a href="https://www.apple.com/iphone-18-pro/" target="_blank" rel="noopener">apple.com/iphone-18-pro<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://www.apple.com/iphone-18-pro/" target="_blank" rel="noopener">apple.com/iphone-18-pro<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-22">2026</time></p><h2 id="apple-sweep-t" tabindex="-1">The color that sweeps across the headline</h2><p class="fx-chips"><span class="fx-chip">Starts on scroll</span><span class="fx-chip">Made from 1 animation</span></p>+ <div class="fx-version">+ <div class="fx-stage">+ <iframe title="Our version: The color that sweeps across the headline" data-src="versions/apple-sweep.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">Far down the page, as the large headline of the section about the chip comes into view, a band of bright color sweeps across its letters once, from one end to the other, and the words settle into their plain color, as if a light had passed over them.</p>+ <p class="fx-what">Far down the page, a large headline stays hidden until it rises into the window. Then a soft band of pale blue and aqua travels along both lines from left to right, bringing the letters in as it passes, and fades to plain white. It takes about three seconds, plays once and does not replay when you scroll back.</p><h3 class="fx-sub">Good to know</h3><dl class="fx-know">- <div><dt>Starts</dt><dd>When the headline first comes into view. It plays once.</dd></div>+ <div><dt>Starts</dt><dd>When the headline rises into view. It plays once, in about three seconds.</dd></div><div><dt>On phones</dt><dd>Touch scrolling brings it into view the same way.</dd></div>- <div><dt>Reduced motion</dt><dd>The headline shows in its normal color, with no sweep.</dd></div>+ <div><dt>Reduced motion</dt><dd>The headline shows in its plain color, with no sweep.</dd></div></dl><h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c5" data-slug="text-gradient-animation"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The color sweep</span></div><div class="meta"><h4 class="title"><a href="../animations/05-text-typography/text-gradient-animation/">Text Gradient Animation</a></h4><p class="desc">Colors flow through the letters while the text stays still. Best for headlines.</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 one-time color sweep to <mark>[the main headline of your section]</mark>. When the headline first comes into view, let a band of bright color travel across its letters once, from the start of the line to its end, and leave the text in its normal color. Paint the band as a gradient inside the letters and move only the gradient, so the words never shift or blur. Keep the sweep short, about a second, and never repeat it while the visitor reads. Keep the text readable before, during and after the sweep. Touch scrolling brings it into view the same way. If the visitor has reduced motion turned on, show the headline in its normal color with no sweep.</p></div>+ <div class="fx-pbox"><p class="fx-prompt">Add a one-time color sweep to <mark>[the main headline of a section]</mark>. Keep the headline hidden until it rises into the window. Then let a soft-edged band of two or three of your own colors travel along its letters from left to right at a steady pace, bringing each letter in as it passes, and fading to the headline's plain color within about three seconds. Paint the band inside the letters and move only the band, so the words never shift or blur. Play it once, never again while the visitor reads. Keep the real text for screen readers. Touch scrolling brings it into view the same way. If the visitor has reduced motion turned on, show the headline in its plain color with no sweep.</p></div><button type="button" class="copy" aria-label="Copy prompt for The color that sweeps across the headline"><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://www.apple.com/iphone-18-pro/" target="_blank" rel="noopener">Watch the real one on apple.com <span aria-hidden="true">↗</span><span class="sr"> (opens in a new tab)</span></a></section>diff --git a/famous/versions/apple-sweep.html b/famous/versions/apple-sweep.htmlnew file mode 100644index 00000000..13c10c46--- /dev/null+++ b/famous/versions/apple-sweep.html@@ -0,0 +1,128 @@+<!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 color that sweeps across the headline</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;--stage:#0b0b0f;--ink:#f4f4f2;--soft:#c3c4d0;--muted:#a3a4b4;color-scheme:dark}+@supports(height:100svh){:root{--H:100svh}}+*{box-sizing:border-box;margin:0}+html{background:var(--stage);overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#3c3c4a var(--stage)}+body{color:var(--muted);font:400 clamp(15px,.5vw + 12px,18px)/1.6 'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;-webkit-font-smoothing:antialiased}+p{text-wrap:pretty}+.pg{width:min(34em,100%);min-height:var(--H);margin:0 auto;padding:clamp(24px,6vh,56px) clamp(18px,5vw,40px);display:grid;align-content:center;gap:clamp(10px,2.4vh,18px)}+.pg h2{font-size:clamp(20px,1.6vw + 14px,30px);line-height:1.2;font-weight:700;letter-spacing:-.01em;color:var(--ink);text-wrap:balance}+.eyebrow{font-size:13px;line-height:1.3;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:#8d8ea2}+.last{min-height:var(--H);padding:clamp(20px,5vh,48px) clamp(16px,5vw,40px) 14px;display:grid;grid-template-rows:1fr auto;justify-items:center;text-align:center}+.mid{align-self:center;max-width:min(34em,100%);display:grid;justify-items:center;gap:clamp(8px,1.6vh,14px)}+.lede{max-width:28em;color:var(--soft)}+.fine{font-size:13px;color:#8d8ea2}++/* the headline. Armed, it is hidden: the text is drawn white on black and multiplied with a wide gradient behind it, so each letter takes the+ gradient's color; a flat layer of the stage color on top (lightest wins) hides the black around the letters. Only the gradient moves.+ The layers sit inside one another (stage layer, then black, then gradient, each a pixel or two in) so no edge of one shows through. */+.hl{--hs:clamp(26px,min(10vw,calc(var(--H) * .17)),88px);position:relative;isolation:isolate;overflow:hidden;width:fit-content;max-width:100%;padding:3px}+.hl h1{position:relative;padding:.12em .1em .18em;font-size:var(--hs);line-height:1.04;font-weight:800;letter-spacing:-.028em;color:var(--ink)}+.gw{display:none}+.armed h1{background:#000;color:#fff;mix-blend-mode:multiply}+.armed .gw{display:block;position:absolute;inset:4px;z-index:-1;overflow:hidden}+.gw i{position:absolute;top:0;bottom:0;left:0;width:512%;transform:translateX(-80.08%);will-change:transform;+ background:linear-gradient(90deg,#f4f4f2 19.53%,#ffe9b8 35.16%,#ffce5a 43.95%,#ff9d5c 49.8%,#ff6f8b 54.69%,#b98cff 60.55%,#3a2872 66.02%,#000 70.31%)}+.armed::after{content:"";position:absolute;inset:0;background:var(--stage);mix-blend-mode:lighten}+.go .gw i{animation:sweep 3.23s linear .2s forwards}+.done h1{background:none;color:var(--ink);mix-blend-mode:normal}+.done .gw,.done::after{display:none}+@keyframes sweep{from{transform:translateX(-80.08%)}to{transform:none}}+@media(prefers-reduced-motion:reduce),(forced-colors:active){+ .armed h1{background:none;color:var(--ink);mix-blend-mode:normal}+ .armed .gw,.armed::after{display:none}+}+</style>+</head>+<body>+<main>+ <section class="pg">+ <p class="eyebrow">Field notes</p>+ <h2>A slow week by the water</h2>+ <p>The ferry leaves at seven and comes back at dusk. In between, the harbor belongs to gulls, nets and the people who mend them.</p>+ <p>Most days begin the same way: a cup of tea, a walk along the pier and a long look at the sky, to guess what the afternoon will bring.</p>+ </section>+ <section class="pg">+ <p class="eyebrow">Mid-morning</p>+ <p>Down the lane, the bakery opens its shutters. The smell of warm bread reaches the corner long before the door does.</p>+ <p>A boy delivers the newspapers on a bicycle that is a little too big for him. He knows every house by its gate.</p>+ <p>By noon the benches fill with neighbors, and the talk drifts from weather to tides to whose turn it is to host dinner.</p>+ </section>+ <section class="last">+ <div class="mid">+ <p class="eyebrow">A closer look</p>+ <div class="hl"><i class="gw" aria-hidden="true"><i></i></i><h1>Your headline,<br>in color.</h1></div>+ <p class="lede">A short paragraph sits under the headline and stays still. Only the large letters take the color, once.</p>+ </div>+ <p class="fine">More notes follow on the next page.</p>+ </section>+</main>+<script>+const $ = s => document.querySelector(s);+const reduce = matchMedia('(prefers-reduced-motion: reduce)'), FRAME = 1000 / 60, hl = $('.hl'), cl = hl.classList;+const blend = CSS.supports('mix-blend-mode', 'multiply');+let END = 0, raf = 0, lastT = null, playing = false, pos = 0, acted = false;++const measure = () => { END = Math.max(0, document.documentElement.scrollHeight - innerHeight); };+const arm = () => { cl.remove('go', 'done'); cl.add('armed'); }; // hidden, ready to play+const calm = () => cl.remove('armed', 'go', 'done'); // the plain headline, no sweep+const late = () => hl.getBoundingClientRect().top < innerHeight * .88; // risen into the window (or already past it)++// The sweep starts by itself the first time the headline rises into the window, and stays played when you scroll back. Back at the top it is ready again.+function check() {+ if (reduce.matches || !blend) return;+ if (scrollY < 2) { if (!cl.contains('armed') || cl.contains('go')) arm(); }+ else if (cl.contains('armed') && !cl.contains('go') && late()) cl.add('go');+}+hl.addEventListener('animationend', e => { if (e.animationName === 'sweep') cl.add('done'); });++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 play() {+ measure();+ if (END <= 0) return;+ if (scrollY >= END - 2) { scrollTo({ top: 0, behavior: 'instant' }); check(); }+ pos = scrollY; playing = true; lastT = null;+ if (!raf) raf = requestAnimationFrame(tick);+}+function toTop() { playing = false; scrollTo({ top: 0, behavior: 'instant' }); check(); }++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, { passive: true });+addEventListener('resize', () => { measure(); check(); });+document.addEventListener('visibilitychange', () => { lastT = null; });+reduce.addEventListener('change', () => {+ if (reduce.matches) calm();+ else if (scrollY < 2 || hl.getBoundingClientRect().top >= innerHeight) arm(); // never hides a headline that is already in view+});+measure(); check();+addEventListener('load', () => {+ measure(); check();+ setTimeout(() => { if (!acted && !reduce.matches && scrollY < 2) play(); }, 700);+});+</script>+</body>+</html>diff --git a/tests/famous.test.js b/tests/famous.test.jsindex 08216337..2f6f5b88 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', 'landonorris-reveal': '2026-10-22', 'linear-intro': '2026-10-22', 'stripe-ribbon': '2026-10-22', 'wikipedia-previews': '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', 'stripe-ribbon': '2026-10-22', 'wikipedia-previews': '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).