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
fix: Famous effects after the final reviews: each entry's cards sit under "Build it with these animations", the ChatGPT prompt gives no status word, the heart prompt fills with your own color and the note says each entry was checked on its live site in the year shown; tests hold one <main>, the star count as the only request that leaves the site, no outside <link>, hover only where hover exists, the message's reduced-motion fade and the five-line prompts on phones, and the reduced-motion page check presses Copy prompt
matincef1a6d4c65f
diff --git a/CLAUDE.md b/CLAUDE.mdindex d15c1fa1..c54bcf78 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -252,7 +252,7 @@ object, are written by `node tools/make-famous.mjs` from the home page, never by`data-fx-start` (`loop`, `load`, `scroll`, `hover` or `press`), then, in order: "Seen on" and the site's address as a link(`https://`, in a new tab, its text the address without `https://` or `www.`, its name ending "(opens in a new tab)") andthe year in a `<time>` whose `datetime` is the day it was checked; the plain title as an `h2` with `tabindex="-1"`; what-you see, 25 to 70 words; "Made with these animations" and one to three cards (the card's `CATS` name and line, its page's+you see, 25 to 70 words; "Build it with these animations" and one to three cards (the card's `CATS` name and line, its page'slink and `data-slug`, and on its preview a label of one to three words saying what that animation makes here; two differentanimations on the page never share a preview); "A prompt to build something similar" and Copy prompt, which names itsentry. Copy a neighbor entry's markup, add its chip to the jump row and count it in the pill.@@ -308,8 +308,8 @@ Run both before calling a page done. They need Node 22 or later (the `--test` gl- **Famous effects:** `node tools/check-pages.mjs --base http://127.0.0.1:<port> famous` checks `famous/` at the same sixsetups (six `ok` lines): the first screen, overflow and touch targets; its desktop run presses each jump link, watcheseach entry's previews and presses each Copy prompt (twice more with the clipboard refused or missing); its- reduced-motion run checks that nothing moves and that every preview holds a still frame that shows something. Run it- after changing that page, its cards or a preview it shows.+ reduced-motion run checks that nothing moves, that every preview holds a still frame that shows something and that+ Copy prompt's message does not slide. Run it after changing that page, its cards or a preview it shows.## Out of scope- Backend code, databases, APIs.diff --git a/famous/index.html b/famous/index.htmlindex fe00d146..eb191830 100644--- a/famous/index.html+++ b/famous/index.html@@ -421,7 +421,7 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://stripe.com/" target="_blank" rel="noopener">stripe.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p><h2 id="stripe-ribbon-t" tabindex="-1">The twisting ribbon of light</h2><p class="fx-what">Behind the headline, a wide ribbon made of fine strands of glowing color slowly twists in depth, some strands sharp and others soft, as if filmed by a camera, under a fine grain. Before 2026 the same place held a flat band of blended colors that flowed like slow paint, the look <a href="../animations/07-ambient-background/mesh-gradient/">Mesh Gradient Animation</a> makes.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c7" data-slug="aurora"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The soft light</span></div><div class="meta"><h4 class="title"><a href="../animations/07-ambient-background/aurora/">Aurora / Northern Lights</a></h4><p class="desc">Blurred bands of light sway like the northern lights. Best for dark backgrounds.</p></div></article><article class="card c7" data-slug="grain-overlay"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The grain</span></div><div class="meta"><h4 class="title"><a href="../animations/07-ambient-background/grain-overlay/">Grain / Film Noise Overlay</a></h4><p class="desc">Fine grain flickers over the page, like old film. Best for editorial sites.</p></div></article>@@ -436,7 +436,7 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://www.apple.com/apple-vision-pro/" target="_blank" rel="noopener">apple.com/apple-vision-pro<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p><h2 id="apple-scroll-t" tabindex="-1">The headset that comes apart as you scroll</h2><p class="fx-what">About two thirds of the way down the page, the headset stays in the middle of the screen while you scroll: its parts rise out of it layer by layer, then it tips up to show its lenses, and scrolling back puts it together.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c1" data-slug="scrub-animation"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Scroll plays it</span></div><div class="meta"><h4 class="title"><a href="../animations/01-scroll-based/scrub-animation/">Scrub Animation</a></h4><p class="desc">Scroll plays it forward and back, like dragging a video. Best for product tours.</p></div></article><article class="card c1" data-slug="pin-animation"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">It stays put</span></div><div class="meta"><h4 class="title"><a href="../animations/01-scroll-based/pin-animation/">Pin Animation</a></h4><p class="desc">One part stays put while its text changes on scroll. Best for feature lists.</p></div></article>@@ -450,7 +450,7 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://landonorris.com/" target="_blank" rel="noopener">landonorris.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p><h2 id="landonorris-reveal-t" tabindex="-1">The liquid reveal under the pointer</h2><p class="fx-what">A large portrait stands in the middle of the screen. Wherever the pointer moves across his head, a soft, liquid-looking blob shows a second picture through it, his racing helmet, as if the portrait were being wiped away.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c4" data-slug="cursor-follower"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Follows the pointer</span></div><div class="meta"><h4 class="title"><a href="../animations/04-micro-interactions/cursor-follower/">Cursor Follower</a></h4><p class="desc">A dot trails your pointer and flips the colors under it. Best for portfolios.</p></div></article><article class="card c6" data-slug="morphing-blob"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The liquid shape</span></div><div class="meta"><h4 class="title"><a href="../animations/06-3d-advanced/morphing-blob/">Morphing Blob</a></h4><p class="desc">Blobs melt together, and one drop chases your pointer. Best for hero sections.</p></div></article>@@ -465,7 +465,7 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://linear.app/" target="_blank" rel="noopener">linear.app<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p><h2 id="linear-intro-t" tabindex="-1">The headline that comes into focus</h2><p class="fx-what">As the page opens, the headline comes in line by line, each line fading in while it rises a little and sharpens out of a soft blur; the short line under it and a small link follow the same way, then a large flat picture of the app fades in below.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c2" data-slug="split-text-reveal"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Lines in turn</span></div><div class="meta"><h4 class="title"><a href="../animations/02-entrance-and-exit/split-text-reveal/">Split Text Reveal</a></h4><p class="desc">Text breaks into pieces that appear one after another. Best for headlines.</p></div></article><article class="card c2" data-slug="blur-in"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Blur to sharp</span></div><div class="meta"><h4 class="title"><a href="../animations/02-entrance-and-exit/blur-in/">Blur In</a></h4><p class="desc">Comes into focus from a blur, like a camera. Best for featured cards and photos.</p></div></article>@@ -480,7 +480,7 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://www.apple.com/" target="_blank" rel="noopener">apple.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p><h2 id="apple-menu-t" tabindex="-1">The menu that drops in, link by link</h2><p class="fx-what">On a phone, the two-line menu button folds into an X while the menu fills the screen and its links drop into place one after another. On a computer, pointing at a top item opens a panel that grows down from the bar, its links appearing in turn, while the page behind blurs.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c4" data-slug="hamburger-menu-toggle"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The button</span></div><div class="meta"><h4 class="title"><a href="../animations/04-micro-interactions/hamburger-menu-toggle/">Hamburger Menu Toggle</a></h4><p class="desc">Three lines turn into an X as the menu opens. Best for mobile menus.</p></div></article><article class="card c1" data-slug="stagger-reveal"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Links in turn</span></div><div class="meta"><h4 class="title"><a href="../animations/01-scroll-based/stagger-reveal/">Stagger Reveal</a></h4><p class="desc">Items in a group appear one after another as it scrolls in. Best for card grids.</p></div></article>@@ -495,7 +495,7 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://en.wikipedia.org/wiki/Animation" target="_blank" rel="noopener">en.wikipedia.org/wiki/Animation<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p><h2 id="wikipedia-previews-t" tabindex="-1">Link previews</h2><p class="fx-what">On any article, rest the pointer on a link and, after a short pause, a small card with the linked article's first lines and picture fades in under the link, rising slightly into place; move away and it fades out.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c4" data-slug="tooltip-reveal"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The pause</span></div><div class="meta"><h4 class="title"><a href="../animations/04-micro-interactions/tooltip-reveal/">Tooltip Reveal</a></h4><p class="desc">A small label fades in after a short pause. Best for icon buttons.</p></div></article><article class="card c2" data-slug="fade-in-out"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The fade</span></div><div class="meta"><h4 class="title"><a href="../animations/02-entrance-and-exit/fade-in-out/">Fade In / Fade Out</a></h4><p class="desc">Fades in to appear and fades out to leave. Best for pop-ups and tooltips.</p></div></article>@@ -509,14 +509,14 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://chatgpt.com/" target="_blank" rel="noopener">chatgpt.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-14">2026</time></p><h2 id="chatgpt-reply-t" tabindex="-1">The answer that writes itself</h2><p class="fx-what">After you send a question, a small dot pulses until the reply starts; a model that works longer shows a short status word with a band of light sweeping across its letters. Then the answer arrives a few words at a time, as if typed live.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c7" data-slug="breathing-glow"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The waiting dot</span></div><div class="meta"><h4 class="title"><a href="../animations/07-ambient-background/breathing-glow/">Breathing / Pulsing Glow</a></h4><p class="desc">A soft glow slowly grows and shrinks, like calm breathing. Best for idle states.</p></div></article><article class="card c5" data-slug="text-gradient-animation"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The shimmer</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><article class="card c2" data-slug="word-by-word-reveal"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Words arriving</span></div><div class="meta"><h4 class="title"><a href="../animations/02-entrance-and-exit/word-by-word-reveal/">Word-by-Word Reveal</a></h4><p class="desc">Words appear one after another at a reading pace. Best for quotes and intros.</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 live reply to <mark>[the answer area of your chat or assistant]</mark>. While the reply is being prepared, show a small dot that slowly pulses; when the work takes longer, show a short status word such as Thinking, with a soft band of light sweeping across its letters. When the answer starts, let it appear a few words at a time, each new group fading in at the end of the text, as if it were being written now. Keep finished lines where they are, and follow the newest words only while the reader has not scrolled away. Let screen readers hear the finished answer once. If the visitor has reduced motion turned on, keep the dot and the word still and show the words without fading.</p></div>+ <div class="fx-pbox"><p class="fx-prompt">Add a live reply to <mark>[the answer area of your chat or assistant]</mark>. While the reply is being prepared, show a small dot that slowly pulses; when the work takes longer, show a short status word with a soft band of light sweeping across its letters. When the answer starts, let it appear a few words at a time, each new group fading in at the end of the text, as if it were being written now. Keep finished lines where they are, and follow the newest words only while the reader has not scrolled away. Let screen readers hear the finished answer once. If the visitor has reduced motion turned on, keep the dot and the word still and show the words without fading.</p></div><button type="button" class="copy" aria-label="Copy prompt for The answer that writes itself"><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></section>@@ -524,13 +524,13 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://x.com/" target="_blank" rel="noopener">x.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-14">2026</time></p><h2 id="x-heart-t" tabindex="-1">The heart that bursts</h2><p class="fx-what">Press the heart and it shrinks for an instant, pops back a little too big and settles in pink-⁠red, while a circle of color swells into a thin ring and small colored dots burst out and fade, all within about a second.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c4" data-slug="heart-burst"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Pop and dots</span></div><div class="meta"><h4 class="title"><a href="../animations/04-micro-interactions/heart-burst/">Heart / Like Burst</a></h4><p class="desc">The heart pops and fills as small hearts burst out. Best for like buttons.</p></div></article><article class="card c4" data-slug="click-ripple"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The ring</span></div><div class="meta"><h4 class="title"><a href="../animations/04-micro-interactions/click-ripple/">Click / Tap Ripple</a></h4><p class="desc">A ripple spreads out from the spot you press. Best for buttons and list items.</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 like button with a burst to <mark>[the heart button on your posts]</mark>. When it is pressed, the heart shrinks for an instant, then pops back a little too big and settles as it fills with color, while a circle of color swells into a thin ring and small dots burst out from its center and fade. Unliking takes the color away with no burst. Keep it all under a second and draw it over the button, so nothing around it moves. A tap on a touch screen and Enter or Space on the keyboard work the same, and screen readers hear whether the post is liked. If the visitor has reduced motion turned on, only change the color.</p></div>+ <div class="fx-pbox"><p class="fx-prompt">Add a like button with a burst to <mark>[the heart button on your posts]</mark>. When it is pressed, the heart shrinks for an instant, then pops back a little too big and settles as it fills with your own color, while a circle of color swells into a thin ring and small dots burst out from its center and fade. Unliking takes the color away with no burst. Keep it all under a second and draw it over the button, so nothing around it moves. A tap on a touch screen and Enter or Space on the keyboard work the same, and screen readers hear whether the post is liked. If the visitor has reduced motion turned on, only change the color.</p></div><button type="button" class="copy" aria-label="Copy prompt for The heart that bursts"><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></section>@@ -538,7 +538,7 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://open.spotify.com/" target="_blank" rel="noopener">open.spotify.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p><h2 id="spotify-cards-t" tabindex="-1">The play button that rises</h2><p class="fx-what">Point at an album or playlist card and the card lightens a shade while a round green play button fades in, rising a few pixels into the cover's bottom corner.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c4" data-slug="hover-state"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The card lightens</span></div><div class="meta"><h4 class="title"><a href="../animations/04-micro-interactions/hover-state/">Hover State Animation</a></h4><p class="desc">Six ways a card can react when you point at it. Best for buttons and cards.</p></div></article><article class="card c2" data-slug="slide-in"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The button rises</span></div><div class="meta"><h4 class="title"><a href="../animations/02-entrance-and-exit/slide-in/">Slide In</a></h4><p class="desc">Travels into place from one edge. Best for side panels and notifications.</p></div></article>@@ -552,7 +552,7 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://www.youtube.com/" target="_blank" rel="noopener">youtube.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p><h2 id="youtube-loading-t" tabindex="-1">Gray shapes while it loads</h2><p class="fx-what">Before the videos appear, gray boxes and bars in the shapes of thumbnails, round channel pictures and titles fill the page; then the real content takes their places.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c4" data-slug="skeleton-loader"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Gray shapes</span></div><div class="meta"><h4 class="title"><a href="../animations/04-micro-interactions/skeleton-loader/">Skeleton Loader</a></h4><p class="desc">Gray shapes hold the place of content while it loads. Best for feeds and cards.</p></div></article></div>@@ -565,7 +565,7 @@ button{font:inherit;color:inherit}<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><h2 id="pudding-chart-t" tabindex="-1">The chart that changes as you read</h2><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">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c1" data-slug="scrollytelling"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The steps</span></div><div class="meta"><h4 class="title"><a href="../animations/01-scroll-based/scrollytelling/">Scrollytelling</a></h4><p class="desc">A picture beside the story changes as you read down. Best for data stories.</p></div></article><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>@@ -579,7 +579,7 @@ button{font:inherit;color:inherit}<p class="fx-seen">Seen on <a href="https://medium.com/" target="_blank" rel="noopener">medium.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p><h2 id="medium-top-bar-t" tabindex="-1">The top bar that hides while you read</h2><p class="fx-what">On a phone, scroll down into an article and the top bar moves up out of the way with the text; scroll up a little and it comes back down.</p>- <h3 class="fx-sub">Made with these animations</h3>+ <h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c1" data-slug="hide-on-scroll-header"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The whole effect</span></div><div class="meta"><h4 class="title"><a href="../animations/01-scroll-based/hide-on-scroll-header/">Hide-on-Scroll Header</a></h4><p class="desc">Scrolling down hides the top bar; scrolling up shows it. Best for mobile pages.</p></div></article></div>@@ -592,7 +592,7 @@ button{font:inherit;color:inherit}<h2 id="fx-more-t">Seen one we should add?</h2><p>Seen an effect on a well-known site that you want explained?</p><a class="fx-suggest" href="https://github.com/matinmonshizadeh/animation-handbook/issues/new?template=famous_effect.yml" target="_blank" rel="noopener">Suggest it on GitHub<span class="sr"> (opens in a new tab)</span></a>- <p class="fx-note">Each entry was checked by hand on the date shown; a site may have changed since.</p>+ <p class="fx-note">Each entry was checked on its live site in the year shown; a site may have changed since.</p></section></main>diff --git a/tests/famous.test.js b/tests/famous.test.jsindex a51b9364..f4923aa5 100644--- a/tests/famous.test.js+++ b/tests/famous.test.js@@ -234,7 +234,7 @@ test('the page script copies, falls back to the copy keys, shortens prompts on ptest('Seen one we should add? opens the Famous effect issue template, which asks for the site and what you see in your own words, with no screenshots or code', () => {assert.ok(PAGE.includes(`<a class="fx-suggest" href="${TEMPLATE}" target="_blank" rel="noopener">Suggest it on GitHub<span class="sr"> (opens in a new tab)</span></a>`), 'the Suggest link');- assert.ok(PAGE.includes('<p class="fx-note">Each entry was checked by hand on the date shown; a site may have changed since.</p>'), 'the note on dates');+ assert.ok(PAGE.includes('<p class="fx-note">Each entry was checked on its live site in the year shown; a site may have changed since.</p>'), 'the note on dates');const yml = read(path.join(ROOT, '.github', 'ISSUE_TEMPLATE', 'famous_effect.yml'));assert.match(yml, /^name: Famous effect$/m, 'its name');const field = id => yml.split('\n - type: ').find(part => part.includes(`\n id: ${id}\n`)) || '';@@ -305,7 +305,7 @@ for (const e of ENTRIES) {assert.ok(!/["“”]/.test(textOf(what[1])), 'what you see quotes no words: it says what shows in our own words');assert.ok(STARTS.includes(e.start), `data-fx-start "${e.start}" is one of ${STARTS.join(', ')}`);assert.ok(e.site.trim(), 'data-fx-site names the site');- assert.ok(e.body.includes('<h3 class="fx-sub">Made with these animations</h3>') && e.body.includes('<h3 class="fx-sub">A prompt to build something similar</h3>'), 'its two parts');+ assert.ok(e.body.includes('<h3 class="fx-sub">Build it with these animations</h3>') && e.body.includes('<h3 class="fx-sub">A prompt to build something similar</h3>'), 'its two parts');});test(`${e.id}: one to three cards, each an animation of the home page with its name, line and page, and a short label`, async () => {@@ -422,3 +422,43 @@ test('from 601px to 640px the top bar\'s two text links are narrower, so the barassert.equal(band[1], '.top .nav .lnk', 'for the two text links');assert.match(band[2], /^padding:0 \d+px$/, 'with less padding');});++// ---------- Rules the tests did not hold yet (final review B) ----------+// The page's own style (no generated previews, no comments) and its script.+const OWN_CSS = (() => {+ const css = between(PAGE, '<style>', '</style>'), a = css.indexOf('/* ── previews:'), b = css.indexOf('/* ── end of previews ── */');+ return (css.slice(0, a) + css.slice(b)).replace(/\/\*[\s\S]*?\*\//g, '');+})();+const SCRIPT = [...PAGE.matchAll(/<script>([\s\S]*?)<\/script>/g)].map(m => m[1]).join('\n');+// The top-level blocks of a style, as { head, body }.+const cssBlocks = css => {+ const out = [];+ let depth = 0, head = '', body = '';+ for (const ch of css) {+ if (ch === '{' && depth++ === 0) { body = ''; continue; }+ if (ch === '}' && --depth === 0) { out.push({ head: head.trim(), body }); head = ''; continue; }+ if (depth) body += ch; else head += ch;+ }+ return out;+};++test('one <main> holds the entries, and the only request that leaves the site is the GitHub star count', () => {+ assert.equal(count(MARKUP, '<main'), 1, 'one <main>');+ assert.ok(MARKUP.indexOf('<main') < MARKUP.indexOf('<section class="fx"') && MARKUP.indexOf('</main>') > MARKUP.lastIndexOf('</section>'), 'around the entries');+ const calls = [...SCRIPT.matchAll(/\b(fetch|XMLHttpRequest|sendBeacon|EventSource|WebSocket)\b\s*\(?\s*(['"`]?)([^'"`)]*)/g)].map(m => `${m[1]} ${m[3]}`);+ assert.deepEqual(calls, [`fetch ${REPO.replace('github.com/', 'api.github.com/repos/')}`], 'one request: the star count');+ for (const [tag] of PAGE.matchAll(/<link\b[^>]*>/g)) {+ if (!/\srel="canonical"/.test(tag)) assert.ok(!/\shref="(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(tag), `a <link> that loads from elsewhere: ${tag}`);+ }+});++test('hover effects only where hover exists, the message fades in place under reduced motion, and prompts start at five lines on phones', () => {+ const blocks = cssBlocks(OWN_CSS), block = head => (blocks.find(b => b.head === head) || { body: '' }).body;+ for (const { head, body } of blocks) {+ if (head === '@media(hover:hover)' || head === '@media(prefers-reduced-motion:reduce)') continue; // the second only undoes the lift+ assert.ok(!/:hover/.test(head + body), `a hover rule outside @media(hover:hover): ${head}`);+ }+ assert.match(block('@media(prefers-reduced-motion:reduce)'), /\.toast\{transform:translate\(-50%,0\);transition:opacity \.25s\}/, 'the message does not slide');+ assert.match(block('@media(max-width:600px)'), /\.fx-prompt\.is-clamped\{[^}]*-webkit-line-clamp:5/, 'five lines on phones');+ assert.ok(SCRIPT.includes("p.classList.add('is-clamped');"), 'each prompt starts shortened');+});diff --git a/tools/check-pages.mjs b/tools/check-pages.mjsindex 836109cb..adf32f01 100644--- a/tools/check-pages.mjs+++ b/tools/check-pages.mjs@@ -12,8 +12,8 @@// the lede and the not-connected line shown, and on the first screen. The desktop run also presses each jump link (the last// one twice), watches each entry's previews move and presses each Copy prompt, then twice more with the clipboard refused// or missing (the hidden text box copies; when it fails too, the prompt is selected); the reduced-motion run checks that-// nothing moves, that every preview holds a still frame that shows something and that a jump does not glide. Like home, it-// stores a star count first.+// nothing moves, that every preview holds a still frame that shows something, that a jump does not glide and that Copy+// prompt shows its message without a slide. Like home, it stores a star count first.// A folder with no index.html of its own stands for the page folders inside it. Each page is loaded at six screen// setups and prints one line for each (ok or FAIL); problems are printed and screenshots saved, by default into// a folder of its own in the temp folder, whose path is printed. Console warnings count as problems too (the page@@ -1014,27 +1014,31 @@ async function famousPreviewProblems() {return problems;}-// Famous effects, desktop run: each entry's Copy prompt, pressed for real at its center (scrolled into view, the pointer moved-// onto it, then a mouse press and release), puts exactly that entry's prompt on the clipboard (stubbed: a headless run cannot-// grant it), reads "Copied", says so in its name and shows the message. Then the browser refuses the clipboard: the first-// entry's press copies through the hidden text box (its copy command stubbed to report what is selected), so the button reads-// "Copied" with the message, the text box is gone and keyboard focus is back on the button. Last, with no clipboard and the-// copy command failing, the second entry's press (the first's again on a page of one) selects its prompt and asks for Ctrl+C.+// Famous effects: presses an entry's Copy prompt for real at its center (scrolled into view, the pointer moved onto it, then a+// mouse press and release). Returns what went wrong, or ''.+async function famousPressCopy(id) {+ const spot = await evaluate(`(() => { const btn = document.querySelector('#${id} .copy'); if (!btn) return null;+ btn.scrollIntoView({ block: 'center', behavior: 'instant' });+ const b = btn.getBoundingClientRect(), x = b.left + b.width / 2, y = b.top + b.height / 2, hit = document.elementFromPoint(x, y);+ return { x, y, covered: btn.contains(hit) ? '' : hit ? hit.tagName.toLowerCase() + (hit.getAttribute('class') ? '.' + hit.getAttribute('class').split(' ')[0] : '') : 'nothing' }; })()`);+ if (!spot) return 'no Copy prompt button';+ if (spot.covered) return `Copy prompt is covered by ${spot.covered} at its center`;+ await send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: spot.x, y: spot.y, button: 'none' });+ for (const type of ['mousePressed', 'mouseReleased']) await send('Input.dispatchMouseEvent', { type, x: spot.x, y: spot.y, button: 'left', clickCount: 1 });+ return '';+}++// Famous effects, desktop run: each entry's Copy prompt, pressed for real, puts exactly that entry's prompt on the clipboard+// (stubbed: a headless run cannot grant it), reads "Copied", says so in its name and shows the message. Then the browser+// refuses the clipboard: the first entry's press copies through the hidden text box (its copy command stubbed to report what+// is selected), so the button reads "Copied" with the message, the text box is gone and keyboard focus is back on the button.+// Last, with no clipboard and the copy command failing, the second entry's press (the first's again on a page of one) selects+// its prompt and asks for Ctrl+C.async function famousCopyProblems() {const ids = await evaluate(`[...document.querySelectorAll('section.fx')].map(s => s.id)`);if (!ids.length) return ['no entries to copy'];const problems = [];- const press = async id => {- const spot = await evaluate(`(() => { const btn = document.querySelector('#${id} .copy'); if (!btn) return null;- btn.scrollIntoView({ block: 'center', behavior: 'instant' });- const b = btn.getBoundingClientRect(), x = b.left + b.width / 2, y = b.top + b.height / 2, hit = document.elementFromPoint(x, y);- return { x, y, covered: btn.contains(hit) ? '' : hit ? hit.tagName.toLowerCase() + (hit.getAttribute('class') ? '.' + hit.getAttribute('class').split(' ')[0] : '') : 'nothing' }; })()`);- if (!spot) return 'no Copy prompt button';- if (spot.covered) return `Copy prompt is covered by ${spot.covered} at its center`;- await send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: spot.x, y: spot.y, button: 'none' });- for (const type of ['mousePressed', 'mouseReleased']) await send('Input.dispatchMouseEvent', { type, x: spot.x, y: spot.y, button: 'left', clickCount: 1 });- return '';- };+ const press = famousPressCopy;const prompt = id => `document.querySelector('#${id} .fx-prompt').textContent.replace(/\\s+/g, ' ').trim()`;await evaluate(`(() => { navigator.clipboard.writeText = async text => { window.__clipboardGot = text; }; })()`);for (const id of ids) {@@ -1110,8 +1114,9 @@ const changedShare = (a, b) => evaluate(`new Promise(done => {// Famous effects, reduced-motion phone run: nothing runs (every animation in the page is paused), neither at once nor once// every card has been on screen; every preview holds a still frame that shows something (the home check's pixel test: the// stage captured with the preview and again with the preview's contents hidden must differ in at least 0.3% of its pixels,-// inside a box of at least 1% of it); and a jump does not glide: two frames after the press, the entry's heading is in the-// window.+// inside a box of at least 1% of it); a jump does not glide: two frames after the press, the entry's heading is in the+// window; and the first entry's Copy prompt, pressed for real, copies (the clipboard stubbed), reads "Copied" and shows the+// message where it stands: no change of position runs on it and it is not offset.async function famousMotionProblems() {const problems = [];const running = when => evaluate(`document.getAnimations().filter(a => a.playState === 'running').map(a => {@@ -1147,6 +1152,19 @@ async function famousMotionProblems() {if (!jump) problems.push('reduced motion: no links in the jump row');else if (jump.missing) problems.push(`reduced motion: the last link of the jump row (${jump.href}) has no entry with a heading`);else if (!jump.shown) problems.push(`reduced motion: the jump to ${jump.href} glides (two frames after the press its heading is at ${jump.top}px)`);+ const first = await evaluate(`(() => { const s = document.querySelector('section.fx'); if (!s) return null;+ window.__clipboardGot = null; navigator.clipboard.writeText = async text => { window.__clipboardGot = text; }; return s.id; })()`);+ const trouble = first ? await famousPressCopy(first) : 'no entry';+ if (trouble) problems.push(`reduced motion, Copy prompt: ${trouble}`);+ else {+ const copy = await evaluate(`(async () => { const t = document.getElementById('toast');+ for (let i = 0; i < 60 && !t.classList.contains('show'); i++) await new Promise(r => setTimeout(r, 50));+ return { label: document.querySelector('#${first} .copy').textContent.trim(), copied: window.__clipboardGot !== null, shown: t.classList.contains('show'),+ sliding: t.getAnimations().filter(a => a.transitionProperty === 'transform' || a.animationName).length, offset: Math.round(new DOMMatrix(getComputedStyle(t).transform).m42) }; })()`);+ if (copy.label !== 'Copied' || !copy.copied || !copy.shown || copy.sliding || copy.offset) {+ problems.push(`reduced motion, Copy prompt of ${first}: ${JSON.stringify(copy)} (expected "Copied" and the message shown in place, with no slide)`);+ }+ }return problems;}