Skip to content

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.

docs: remove the 30 old work plans in docs/superpowers/plans, whose work is all live, and the test comment that named one

matin467e3c34a3eb
diff --git a/docs/superpowers/plans/2026-05-19-parallax-depth-of-field.md b/docs/superpowers/plans/2026-05-19-parallax-depth-of-field.md
deleted file mode 100644
index b3dc1560..00000000
--- a/docs/superpowers/plans/2026-05-19-parallax-depth-of-field.md
+++ /dev/null
@@ -1,530 +0,0 @@
-# Parallax Depth-of-Field Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Build a self-contained scroll-driven demo of 5 stacked SVG mountain layers with parallax translation and blur-based depth-of-field, plus a fixed right sidebar with a focal-plane slider and live blur readout.
-
-**Architecture:** Single `index.html` file — all CSS in `<style>`, all JS in `<script>`. A 500vh scroll stage drives scroll progress; a `position:sticky` container holds SVG layers that translate and blur based on that progress. A `position:fixed` sidebar provides manual focal-plane control.
-
-**Tech Stack:** Plain HTML5, CSS custom properties, vanilla JS (no libraries, no build step).
-
----
-
-## File Map
-
-| Action | Path | Responsibility |
-|--------|------|---------------|
-| Create | `animations/01-scroll-based/parallax-depth-of-field/index.html` | Full demo: markup, styles, JS |
-| Create | `animations/01-scroll-based/parallax-depth-of-field/README.md` | 6-section explanation |
-| Create | `animations/01-scroll-based/README.md` | Category index listing |
-| Modify | `index.html` (root) | Add link to new animation |
-
----
-
-## Task 1: Folder, README, and Category Index
-
-**Files:**
-- Create: `animations/01-scroll-based/parallax-depth-of-field/README.md`
-- Create: `animations/01-scroll-based/README.md`
-
-- [ ] **Step 1: Create the animation folder**
-
-```bash
-mkdir -p animations/01-scroll-based/parallax-depth-of-field
-```
-
-- [ ] **Step 2: Write the animation README.md**
-
-Create `animations/01-scroll-based/parallax-depth-of-field/README.md`:
-
-```markdown
-# Parallax Depth-of-Field
-
-[Live demo](index.html)
-
-## What it is
-
-Parallax depth-of-field combines two scroll-driven techniques: each layer of a
-scene moves at a speed proportional to its perceived distance from the viewer
-(parallax), and a virtual focal plane blurs every layer according to how far it
-sits from the current focal depth. The result mimics a camera rack-focus pulled
-through a landscape as you scroll.
-
-## When to use it
-
-- Cinematic hero sections where scroll is the narrative driver
-- Storytelling sequences that guide attention through depth layers
-- Portfolio or editorial intros that need more presence than a static image
-- Anywhere you want to make a flat 2D scene feel three-dimensional
-
-## How it works
-
-Each layer has a fixed depth value `d ∈ [0, 1]` (0 = farthest, 1 = nearest).
-The focal plane is a value `f` that advances from 0 to 1 as the user scrolls.
-
-```js
-const blur = MAX_BLUR * Math.abs(layer.depth - f);
-layer.el.style.filter = `blur(${blur}px)`;
-```
-
-Simultaneously, each layer translates vertically at a speed proportional to its
-depth:
-
-```js
-layer.el.style.transform = `translateY(${layer.speed * f * maxOffset}px)`;
-```
-
-Layers closer to the viewer travel farther, reinforcing the sense of depth.
-
-## Key parameters
-
-| Parameter | Default | Effect |
-|------------|---------|--------|
-| `MAX_BLUR` | 14px | Maximum blur on a layer at full distance from focal plane |
-| `depth` | 0.0–1.0 | Fixed depth per layer; 0 = far, 1 = near |
-| `speed` | 0.0–0.70 | Fraction of `maxOffset` the layer travels over full scroll |
-| `maxOffset`| 120px | Maximum translateY distance (applied at nearest layer) |
-
-## Production notes
-
-- `filter: blur()` triggers compositing. Add `will-change: filter` to each
- layer element to promote it to its own compositor layer and avoid per-frame
- paints.
-- Blurring large SVGs is GPU-friendly; blurring large raster images is not —
- test on mobile before shipping.
-- For production scroll choreography, GSAP ScrollTrigger with `scrub: true`
- gives smoother performance and easing control. Framer Motion's `useScroll` +
- `useTransform` is the React equivalent.
-- The focal plane concept maps directly to any animation driven by a 0–1
- progress value — it is not scroll-specific.
-
-## See also
-
-- *(more scroll-based entries coming)*
-```
-
-- [ ] **Step 3: Write the category README**
-
-Create `animations/01-scroll-based/README.md`:
-
-```markdown
-# Scroll-Based Animations
-
-Techniques driven by scroll position.
-
-## Entries
-
-- [Parallax Depth-of-Field](parallax-depth-of-field/) — Five layered SVG mountains with
- parallax translation and blur-based depth-of-field driven by scroll progress.
-```
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add animations/
-git commit -m "feat: add parallax-depth-of-field README and category index"
-```
-
----
-
-## Task 2: HTML Scaffold — Layout, CSS, and Static SVG Layers
-
-**Files:**
-- Create: `animations/01-scroll-based/parallax-depth-of-field/index.html`
-
-Build the full static page first (no JS), so you can verify the visual design before adding any behavior.
-
-- [ ] **Step 1: Create index.html with full markup, CSS, and SVG layers**
-
-Create `animations/01-scroll-based/parallax-depth-of-field/index.html`:
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Parallax Depth-of-Field</title>
- <style>
- :root {
- --bg: #060a10;
- --ui-bg: #0d1117;
- --ui-border: #21262d;
- --ui-accent: #58a6ff;
- --ui-text: #c9d1d9;
- --ui-muted: #8b949e;
- }
- *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
- body { background: var(--bg); color: var(--ui-text); font-family: monospace; }
-
- header {
- position: fixed; top: 0; left: 0; right: 0; z-index: 100;
- padding: 16px 24px;
- background: linear-gradient(to bottom, rgba(6,10,16,.9), transparent);
- pointer-events: none;
- }
- header h1 { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
- header p { font-size: 11px; color: var(--ui-muted); margin-top: 4px; }
-
- .scroll-stage { height: 500vh; position: relative; }
- .sticky-viewport { position: sticky; top: 0; height: 100vh; overflow: hidden; }
-
- .layer {
- position: absolute; top: 0; left: 0; width: 100%; height: 100%;
- will-change: transform, filter;
- }
-
- /* ── Sidebar ── */
- .sidebar {
- position: fixed; right: 0; top: 50%; transform: translateY(-50%);
- width: 112px; z-index: 200;
- background: var(--ui-bg); border: 1px solid var(--ui-border);
- border-right: none; border-radius: 8px 0 0 8px;
- padding: 16px 12px;
- display: flex; flex-direction: column; gap: 10px;
- }
- .s-label {
- font-size: 9px; text-transform: uppercase;
- letter-spacing: 1px; color: var(--ui-accent);
- }
- .slider-wrap {
- display: flex; flex-direction: column; align-items: center; gap: 4px;
- }
- .tick { font-size: 8px; color: var(--ui-muted); }
- input[type=range].focal-slider {
- writing-mode: vertical-lr; direction: rtl;
- -webkit-appearance: slider-vertical; appearance: slider-vertical;
- width: 28px; height: 96px; cursor: pointer;
- accent-color: var(--ui-accent);
- }
- .divider { height: 1px; background: var(--ui-border); }
- .readout { display: flex; flex-direction: column; gap: 3px; }
- .readout-row {
- display: flex; justify-content: space-between;
- font-size: 9px; color: var(--ui-muted);
- }
- .readout-row.focused { color: var(--ui-accent); }
- .readout-row .val { color: var(--ui-text); }
-
- @media (max-width: 600px) {
- .sidebar {
- right: auto; top: auto; bottom: 0; left: 0; width: 100%;
- transform: none; border-radius: 8px 8px 0 0;
- border: 1px solid var(--ui-border); border-bottom: none;
- flex-direction: row; align-items: center;
- padding: 10px 16px; gap: 10px;
- }
- .slider-wrap { flex-direction: row; }
- input[type=range].focal-slider {
- writing-mode: horizontal-tb; direction: ltr;
- -webkit-appearance: auto; appearance: auto;
- width: 110px; height: auto;
- }
- .tick { display: none; }
- .readout { flex-direction: row; gap: 8px; }
- }
- </style>
-</head>
-<body>
-
-<header>
- <h1>Parallax Depth-of-Field</h1>
- <p>Five mountain layers translate at different speeds; a focal plane blurs each by its depth distance.</p>
-</header>
-
-<div class="scroll-stage">
- <div class="sticky-viewport">
-
- <!-- L5: Sky + stars (depth 0.0, static) -->
- <svg class="layer" id="l5" viewBox="0 0 1200 800"
- preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
- <defs>
- <linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
- <stop offset="0%" stop-color="#0a1628"/>
- <stop offset="100%" stop-color="#060a10"/>
- </linearGradient>
- </defs>
- <rect width="1200" height="800" fill="url(#sky)"/>
- <circle cx="80" cy="55" r="1.2" fill="#fff" opacity=".5"/>
- <circle cx="210" cy="28" r="1" fill="#fff" opacity=".4"/>
- <circle cx="345" cy="88" r=".9" fill="#fff" opacity=".6"/>
- <circle cx="480" cy="18" r="1.3" fill="#fff" opacity=".3"/>
- <circle cx="600" cy="52" r="1" fill="#fff" opacity=".5"/>
- <circle cx="720" cy="33" r="1.1" fill="#fff" opacity=".4"/>
- <circle cx="865" cy="14" r=".8" fill="#fff" opacity=".6"/>
- <circle cx="950" cy="68" r="1.2" fill="#fff" opacity=".3"/>
- <circle cx="1055" cy="40" r="1" fill="#fff" opacity=".5"/>
- <circle cx="1150" cy="24" r=".9" fill="#fff" opacity=".4"/>
- <circle cx="155" cy="118" r=".8" fill="#fff" opacity=".3"/>
- <circle cx="395" cy="138" r="1" fill="#fff" opacity=".4"/>
- <circle cx="672" cy="108" r=".9" fill="#fff" opacity=".5"/>
- <circle cx="902" cy="128" r="1.1" fill="#fff" opacity=".3"/>
- </svg>
-
- <!-- L4: Distant peaks (depth 0.2) -->
- <svg class="layer" id="l4" viewBox="0 0 1200 800"
- preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
- <polygon fill="#0d2b3e"
- points="0,500 80,340 180,400 300,280 420,360 540,260
- 660,320 780,290 900,330 1020,270 1140,310 1200,290 1200,800 0,800"/>
- </svg>
-
- <!-- L3: Mid mountains (depth 0.4) -->
- <svg class="layer" id="l3" viewBox="0 0 1200 800"
- preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
- <polygon fill="#0f2236"
- points="0,530 100,390 220,440 360,320 480,400 600,310
- 720,370 840,345 960,382 1080,332 1200,360 1200,800 0,800"/>
- </svg>
-
- <!-- L2: Near hills (depth 0.7) -->
- <svg class="layer" id="l2" viewBox="0 0 1200 800"
- preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
- <polygon fill="#0c1828"
- points="0,570 120,445 260,480 400,392 540,455 680,382
- 820,432 960,408 1100,442 1200,422 1200,800 0,800"/>
- </svg>
-
- <!-- L1: Foreground (depth 1.0) -->
- <svg class="layer" id="l1" viewBox="0 0 1200 800"
- preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
- <polygon fill="#060810"
- points="0,612 160,502 320,542 480,472 640,522 800,482
- 960,522 1120,492 1200,508 1200,800 0,800"/>
- </svg>
-
- </div>
-</div>
-
-<aside class="sidebar">
- <div class="s-label">Focal Plane</div>
- <div class="slider-wrap">
- <span class="tick">far</span>
- <input type="range" class="focal-slider" id="focalSlider" min="0" max="100" value="0">
- <span class="tick">near</span>
- </div>
- <div class="divider"></div>
- <div class="s-label">Blur</div>
- <div class="readout" id="readout">
- <div class="readout-row" id="row-l5"><span>L5</span><span class="val">0px</span></div>
- <div class="readout-row" id="row-l4"><span>L4</span><span class="val">0px</span></div>
- <div class="readout-row" id="row-l3"><span>L3</span><span class="val">0px</span></div>
- <div class="readout-row" id="row-l2"><span>L2</span><span class="val">0px</span></div>
- <div class="readout-row" id="row-l1"><span>L1</span><span class="val">0px</span></div>
- </div>
-</aside>
-
-</body>
-</html>
-```
-
-- [ ] **Step 2: Open in browser and verify static layout**
-
-Open `animations/01-scroll-based/parallax-depth-of-field/index.html` directly in a browser (double-click or `file://` URL).
-
-Expected:
-- Dark background with a star field visible
-- 5 mountain ridgeline silhouettes stacked, progressively darker/closer
-- Fixed right sidebar with slider and 5 blur rows all reading `0px`
-- Header text at top-left
-- No errors in browser console
-
-- [ ] **Step 3: Commit the static scaffold**
-
-```bash
-git add animations/01-scroll-based/parallax-depth-of-field/index.html
-git commit -m "feat: add parallax-depth-of-field static scaffold"
-```
-
----
-
-## Task 3: Parallax Scroll + Focal Plane JS
-
-**Files:**
-- Modify: `animations/01-scroll-based/parallax-depth-of-field/index.html` — add `<script>` before `</body>`
-
-- [ ] **Step 1: Add the script block**
-
-Insert this immediately before `</body>` in `index.html` (replace the closing `</body>` tag):
-
-```html
-<script>
- const LAYERS = [
- { el: document.getElementById('l5'), depth: 0.0, speed: 0.00 },
- { el: document.getElementById('l4'), depth: 0.2, speed: 0.10 },
- { el: document.getElementById('l3'), depth: 0.4, speed: 0.25 },
- { el: document.getElementById('l2'), depth: 0.7, speed: 0.45 },
- { el: document.getElementById('l1'), depth: 1.0, speed: 0.70 },
- ];
- const ROWS = [
- document.getElementById('row-l5'),
- document.getElementById('row-l4'),
- document.getElementById('row-l3'),
- document.getElementById('row-l2'),
- document.getElementById('row-l1'),
- ];
- const slider = document.getElementById('focalSlider');
- const MAX_BLUR = 14;
- const MAX_OFFSET = 120;
- let manualOverride = false;
-
- function applyFrame(f) {
- let closestIdx = 0, closestDist = Infinity;
- LAYERS.forEach((layer, i) => {
- const dist = Math.abs(layer.depth - f);
- if (dist < closestDist) { closestDist = dist; closestIdx = i; }
- const blur = Math.round(MAX_BLUR * dist * 10) / 10;
- const offset = layer.speed * f * MAX_OFFSET;
- layer.el.style.filter = `blur(${blur}px)`;
- layer.el.style.transform = `translateY(${offset}px)`;
- ROWS[i].querySelector('.val').textContent = `${blur}px`;
- });
- ROWS.forEach((r, i) => r.classList.toggle('focused', i === closestIdx));
- }
-
- function onScroll() {
- if (manualOverride) return;
- const stage = document.querySelector('.scroll-stage');
- const max = stage.offsetHeight - window.innerHeight;
- const f = Math.min(1, Math.max(0, window.scrollY / max));
- slider.value = f * 100;
- applyFrame(f);
- }
-
- slider.addEventListener('input', () => {
- manualOverride = true;
- applyFrame(slider.value / 100);
- });
-
- window.addEventListener('scroll', () => {
- manualOverride = false;
- onScroll();
- }, { passive: true });
-
- applyFrame(0);
-</script>
-</body>
-</html>
-```
-
-- [ ] **Step 2: Verify parallax + blur in browser**
-
-Reload `index.html` in the browser.
-
-Expected — scroll behavior:
-- Scrolling down moves near layers (L1, L2) much faster than far layers (L4, L5)
-- As you scroll, blur transitions: L5 starts sharp at scroll top, each successive layer comes into focus then blurs as you continue down
-- Blur readout values update live on every scroll tick
-- The focused layer row highlights in accent blue
-
-Expected — slider behavior:
-- Dragging the slider changes the focal plane independently of scroll position
-- Blur readout updates immediately
-- Scrolling after touching the slider takes control back from the slider
-
-- [ ] **Step 3: Check line count**
-
-```bash
-wc -l animations/01-scroll-based/parallax-depth-of-field/index.html
-```
-
-Expected: under 200 lines. If over 300, the file violates the project constraint — review SVG verbosity and collapse whitespace.
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add animations/01-scroll-based/parallax-depth-of-field/index.html
-git commit -m "feat: add parallax scroll and focal-plane blur to depth-of-field demo"
-```
-
----
-
-## Task 4: Update Root Index Page
-
-**Files:**
-- Modify: `index.html` (root)
-
-The root `index.html` is currently nearly empty. Replace it with a proper handbook index page that links to the animation.
-
-- [ ] **Step 1: Replace root index.html**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Animation Handbook</title>
- <style>
- :root { --bg: #060a10; --text: #c9d1d9; --muted: #8b949e; --accent: #58a6ff; --border: #21262d; }
- *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
- body { background: var(--bg); color: var(--text); font-family: monospace; padding: 48px 32px; max-width: 720px; margin: 0 auto; }
- h1 { font-size: 18px; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 8px; }
- .subtitle { font-size: 12px; color: var(--muted); margin-bottom: 48px; }
- h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); margin: 32px 0 12px; }
- ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
- a { color: var(--accent); text-decoration: none; font-size: 13px; }
- a:hover { text-decoration: underline; }
- .desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
- </style>
-</head>
-<body>
- <h1>Animation Handbook</h1>
- <p class="subtitle">A visual reference of web animation techniques.</p>
-
- <h2>01 — Scroll-Based</h2>
- <ul>
- <li>
- <a href="animations/01-scroll-based/parallax-depth-of-field/">Parallax Depth-of-Field</a>
- <p class="desc">Five mountain layers with parallax translation and blur-based depth-of-field driven by scroll.</p>
- </li>
- </ul>
-</body>
-</html>
-```
-
-- [ ] **Step 2: Open root index.html in browser and verify**
-
-Open the root `index.html`. Expected:
-- Dark page with "Animation Handbook" header
-- One entry under "01 — Scroll-Based" linking to the animation
-- Clicking the link opens the animation demo
-
-- [ ] **Step 3: Commit**
-
-```bash
-git add index.html
-git commit -m "feat: add root handbook index page with depth-of-field entry"
-```
-
----
-
-## Self-Review Checklist
-
-### Spec coverage
-
-| Spec requirement | Covered by |
-|-----------------|------------|
-| 5 stacked SVG layers, mountains/peaks aesthetic | Task 2 Step 1 — 5 SVG polygons with teal/indigo palette |
-| Layers translate at different speeds on scroll | Task 3 Step 1 — `speed` array, `translateY` in `applyFrame` |
-| Virtual focal plane slides far→near on scroll | Task 3 Step 1 — `f = scrollY / maxScroll`, `blur = MAX_BLUR * abs(depth - f)` |
-| Slider to manually set focal plane | Task 3 Step 1 — `<input type=range>`, `manualOverride` flag |
-| Live readout panel per layer blur | Task 2 Step 1 (markup) + Task 3 Step 1 (JS update) |
-| Fixed right sidebar | Task 2 Step 1 — `position:fixed`, right-aligned |
-| Mobile responsive, collapse under 600px | Task 2 Step 1 — `@media (max-width:600px)` block |
-| Dark stage, CSS variables, header | Task 2 Step 1 |
-| README with all 6 sections | Task 1 Step 2 |
-| Category README updated | Task 1 Step 3 |
-| Root index.html updated | Task 4 |
-| Single file, no external deps, offline | All code is self-contained |
-| Under 300 lines | Task 3 Step 3 — explicit line count check |
-
-### No placeholders
-
-Scanned — no TBD, TODO, or vague steps. All code is shown in full.
-
-### Type consistency
-
-- `LAYERS[i].el` used in Task 3; elements are obtained by `getElementById` matching IDs set in Task 2 (`l5`, `l4`, `l3`, `l2`, `l1`) — consistent.
-- `ROWS[i].querySelector('.val')` used in Task 3; `.val` class set on `<span class="val">` in Task 2 markup — consistent.
-- `slider.value / 100` maps 0–100 range input to 0–1 focal value — consistent with `applyFrame(f)` expecting 0–1.
diff --git a/docs/superpowers/plans/2026-05-19-parallax-scrolling.md b/docs/superpowers/plans/2026-05-19-parallax-scrolling.md
deleted file mode 100644
index 08bdb5c3..00000000
--- a/docs/superpowers/plans/2026-05-19-parallax-scrolling.md
+++ /dev/null
@@ -1,572 +0,0 @@
-# Parallax Scrolling Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Build a self-contained demo showing 4 SVG mountain-valley layers scrolling at different speeds inside a bounded stage, with a live control panel for per-layer speed adjustment.
-
-**Architecture:** Single `index.html` — CSS/JS all inline. A `600px` stage div with `overflow-y: scroll` and hidden scrollbars contains a `1800px` scene; a sticky wrapper keeps the 4 absolutely-positioned SVG layers in the viewport while a passive scroll listener queues one `requestAnimationFrame` per scroll group to apply `translate3d` offsets. Controls panel sits beside the stage (stacks below on mobile).
-
-**Tech Stack:** Plain HTML5, CSS custom properties, vanilla JS. No libraries, no build step.
-
----
-
-## File Map
-
-| Action | Path | Responsibility |
-|--------|------|----------------|
-| Create | `animations/01-scroll-based/parallax-scrolling/index.html` | Full demo |
-| Create | `animations/01-scroll-based/parallax-scrolling/README.md` | 6-section explanation |
-| Modify | `animations/01-scroll-based/README.md` | Add entry to category index |
-| Modify | `index.html` (root) | Add link to new animation |
-
----
-
-## Task 1: Folder, README, and Category Index Update
-
-**Files:**
-- Create: `animations/01-scroll-based/parallax-scrolling/README.md`
-- Modify: `animations/01-scroll-based/README.md`
-
-- [ ] **Step 1: Create folder**
-
-```bash
-mkdir -p animations/01-scroll-based/parallax-scrolling
-```
-
-- [ ] **Step 2: Create README.md**
-
-Create `animations/01-scroll-based/parallax-scrolling/README.md`:
-
-```markdown
-# Parallax Scrolling
-
-[Live demo](index.html)
-
-## What it is
-
-Parallax scrolling moves background layers slower than foreground layers as the
-user scrolls, creating an illusion of 3D depth on a flat screen. The effect
-exploits motion parallax: nearby objects appear to move more than distant ones
-as the observer moves. Each layer is assigned a speed multiplier; slower
-multipliers simulate greater distance.
-
-## When to use it
-
-- Hero sections on landing pages where a scene sets the mood
-- Storytelling scrolls and editorial features with environmental depth
-- Product showcases where scene context reinforces the subject
-- Portfolio "about" sections that benefit from atmospheric immersion
-
-## How it works
-
-Each layer has a speed multiplier `s ∈ [0, 1.5]`. On scroll, a single
-`requestAnimationFrame` callback reads `scrollTop` and applies:
-
-```js
-const offset = scrollTop * speed;
-layer.el.style.transform = `translate3d(0, ${offset}px, 0)`;
-```
-
-Layers with low speed (sky: 10%) barely move — they appear far away. Layers
-with high speed (foreground: 100%) track the scroll — they appear close. The
-ratio between speeds determines how convincing the illusion is.
-
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Sky speed | 10% | Near-zero drift — appears stationary |
-| Ridgeline speed | 30% | Slow drift |
-| Treeline speed | 60% | Mid-distance drift |
-| Foreground speed | 100% | Full scroll travel |
-| Scene height | 1800px | Total scroll distance (max scroll = 1200px) |
-
-## Production notes
-
-- **GPU acceleration:** `translate3d` (not `translateY`) promotes the element
- to a compositor layer. Pair with `will-change: transform` declared before the
- first frame to avoid layer promotion jank on the initial scroll.
-- **rAF throttling:** scroll events fire faster than display refresh (up to
- 1000Hz on some devices vs. 60–120Hz frame rate). The dirty-flag pattern
- (`ticking` boolean) ensures only one `requestAnimationFrame` is queued per
- rendered frame, preventing redundant work.
-- **Library alternatives:** GSAP ScrollTrigger provides `scrub` easing and
- timeline integration. Locomotive Scroll and Lenis add momentum/inertia
- scrolling with parallax hooks. Rellax is a lightweight zero-dependency option
- for simple cases.
-- **Accessibility:** respect `prefers-reduced-motion: reduce`. When the user
- has requested reduced motion, skip all `transform` updates and show the
- static scene. Apply `will-change: auto` in the reduced-motion media query to
- avoid unnecessary layer promotion.
-
-## See also
-
-- [Parallax Depth-of-Field](../parallax-depth-of-field/) — the same depth
- technique with blur applied per layer based on focal-plane distance rather
- than translation speed.
-```
-
-- [ ] **Step 3: Update category README**
-
-Open `animations/01-scroll-based/README.md` and replace its content with:
-
-```markdown
-# Scroll-Based Animations
-
-Techniques driven by scroll position.
-
-## Entries
-
-- [Parallax Depth-of-Field](parallax-depth-of-field/) — Five layered SVG mountains with
- parallax translation and blur-based depth-of-field driven by scroll progress.
-- [Parallax Scrolling](parallax-scrolling/) — Four SVG layers at different scroll speeds
- create a 3D depth illusion; adjustable speed multipliers show how ratios make or break the effect.
-```
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add animations/01-scroll-based/
-git commit -m "feat: add parallax-scrolling README and update category index"
-```
-
----
-
-## Task 2: HTML Scaffold — Layout, CSS, and Static SVG Layers
-
-**Files:**
-- Create: `animations/01-scroll-based/parallax-scrolling/index.html`
-
-Build the full page without JavaScript first. Verify the scene looks correct before wiring the scroll mechanic.
-
-- [ ] **Step 1: Create index.html**
-
-Create `animations/01-scroll-based/parallax-scrolling/index.html` with this exact content:
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Parallax Scrolling</title>
- <style>
- :root {
- --bg:#060a10; --ui-bg:#0d1117; --ui-border:#21262d;
- --ui-accent:#58a6ff; --ui-text:#c9d1d9; --ui-muted:#8b949e;
- }
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- body{background:var(--bg);color:var(--ui-text);font-family:monospace;
- padding:clamp(12px,3vw,24px)}
-
- header{margin-bottom:20px}
- header h1{font-size:clamp(11px,1.8vw,15px);letter-spacing:2px;text-transform:uppercase}
- header p{font-size:clamp(10px,1.2vw,12px);color:var(--ui-muted);margin-top:4px}
-
- .layout{display:flex;gap:clamp(12px,2vw,24px);align-items:flex-start}
-
- .stage{
- flex:1;min-width:0;height:600px;
- overflow-y:scroll;scrollbar-width:none;
- border:1px solid var(--ui-border);border-radius:8px;
- }
- .stage::-webkit-scrollbar{display:none}
- .scene{height:1800px}
- .layers{position:sticky;top:0;height:600px;overflow:hidden}
- .layer{
- position:absolute;top:0;left:0;width:100%;height:600px;
- will-change:transform;
- }
- .layer svg{width:100%;height:100%}
-
- aside{
- width:clamp(180px,20vw,220px);flex-shrink:0;
- background:var(--ui-bg);border:1px solid var(--ui-border);
- border-radius:8px;padding:16px;
- display:flex;flex-direction:column;gap:10px;
- }
- .note{
- font-size:10px;color:var(--ui-muted);line-height:1.6;
- border-left:2px solid var(--ui-accent);padding-left:8px;
- }
- .lbl{font-size:9px;text-transform:uppercase;letter-spacing:1px;color:var(--ui-accent)}
- .row{display:flex;justify-content:space-between;font-size:10px}
- .row .v{color:var(--ui-text)}
- .tbl{display:flex;flex-direction:column;gap:2px}
- .tbl .row{font-size:9px;color:var(--ui-muted)}
- .sliders{display:flex;flex-direction:column;gap:5px}
- .sr{display:flex;align-items:center;gap:5px;font-size:9px}
- .sr label{width:42px;color:var(--ui-muted);flex-shrink:0}
- .sr input[type=range]{flex:1;accent-color:var(--ui-accent);min-height:20px}
- .sr .sv{width:32px;text-align:right;color:var(--ui-text)}
- .div{height:1px;background:var(--ui-border)}
- .tog{display:flex;align-items:center;gap:8px;font-size:10px;cursor:pointer}
- .tog input{accent-color:var(--ui-accent);width:16px;height:16px;flex-shrink:0}
- button{
- background:transparent;border:1px solid var(--ui-border);
- color:var(--ui-text);font-family:monospace;font-size:10px;
- padding:8px;border-radius:4px;cursor:pointer;width:100%;
- }
- button:hover{border-color:var(--ui-accent);color:var(--ui-accent)}
-
- @media(max-width:600px){
- .layout{flex-direction:column}
- aside{width:100%}
- .stage{height:400px}
- .layers{height:400px}
- .layer{height:400px}
- }
- @media(min-width:601px) and (max-width:1024px){
- .sr input[type=range]{min-height:28px}
- }
- @media(prefers-reduced-motion:reduce){.layer{will-change:auto}}
- </style>
-</head>
-<body>
-
-<header>
- <h1>Parallax Scrolling</h1>
- <p>Elements move at different speeds — background slower, foreground faster — creating a 3D depth illusion.</p>
-</header>
-
-<div class="layout">
-
- <div class="stage" id="stage">
- <div class="scene">
- <div class="layers">
-
- <!-- L1: Sky + stars (speed 10%) -->
- <div class="layer" id="l1">
- <svg viewBox="0 0 800 600" preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
- <defs>
- <linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
- <stop offset="0%" stop-color="#0a1628"/>
- <stop offset="100%" stop-color="#060a10"/>
- </linearGradient>
- </defs>
- <rect width="800" height="600" fill="url(#sky)"/>
- <circle cx="80" cy="55" r="1.2" fill="#fff" opacity=".5"/>
- <circle cx="200" cy="28" r="1" fill="#fff" opacity=".4"/>
- <circle cx="330" cy="78" r=".9" fill="#fff" opacity=".6"/>
- <circle cx="470" cy="18" r="1.3" fill="#fff" opacity=".3"/>
- <circle cx="580" cy="52" r="1" fill="#fff" opacity=".5"/>
- <circle cx="680" cy="33" r="1.1" fill="#fff" opacity=".4"/>
- <circle cx="755" cy="14" r=".8" fill="#fff" opacity=".6"/>
- <circle cx="140" cy="108" r=".9" fill="#fff" opacity=".3"/>
- <circle cx="420" cy="96" r="1" fill="#fff" opacity=".4"/>
- <circle cx="640" cy="116" r=".8" fill="#fff" opacity=".3"/>
- </svg>
- </div>
-
- <!-- L2: Distant ridgeline (speed 30%) -->
- <div class="layer" id="l2">
- <svg viewBox="0 0 800 600" preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
- <polygon fill="#0d2b3e"
- points="0,380 60,258 130,298 220,208 310,268 400,193
- 490,243 580,213 660,253 740,223 800,236 800,600 0,600"/>
- </svg>
- </div>
-
- <!-- L3: Pine treeline (speed 60%) -->
- <div class="layer" id="l3">
- <svg viewBox="0 0 800 600" preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
- <polygon fill="#0a1f2e"
- points="0,442 35,362 65,380 95,320 135,344 175,297 215,324
- 265,287 305,310 360,274 400,297 450,262 490,284
- 540,270 580,294 635,280 675,304 720,287 760,310
- 800,294 800,600 0,600"/>
- </svg>
- </div>
-
- <!-- L4: Foreground grass (speed 100%) -->
- <div class="layer" id="l4">
- <svg viewBox="0 0 800 600" preserveAspectRatio="xMidYMid slice" xmlns="http://www.w3.org/2000/svg">
- <polygon fill="#050e08"
- points="0,497 80,452 160,472 240,450 320,467 400,454
- 480,470 560,457 640,472 720,458 800,464 800,600 0,600"/>
- <ellipse cx="100" cy="507" rx="60" ry="15" fill="#040c07"/>
- <ellipse cx="280" cy="514" rx="70" ry="18" fill="#030b06"/>
- <ellipse cx="500" cy="508" rx="65" ry="16" fill="#040c07"/>
- <ellipse cx="700" cy="502" rx="55" ry="14" fill="#040c07"/>
- </svg>
- </div>
-
- </div>
- </div>
- </div>
-
- <aside>
- <p class="note">Real cameras render depth geometrically — layers slow down roughly as 1/distance. Try ratios like 100% / 60% / 30% / 10% for the most believable depth.</p>
-
- <div>
- <div class="lbl">Scroll Progress</div>
- <div class="row"><span>Progress</span><span class="v" id="progress">0%</span></div>
- </div>
-
- <div>
- <div class="lbl">Layer Offsets</div>
- <div class="tbl">
- <div class="row"><span>Sky</span><span class="v" id="off1">0px</span></div>
- <div class="row"><span>Ridgeline</span><span class="v" id="off2">0px</span></div>
- <div class="row"><span>Treeline</span><span class="v" id="off3">0px</span></div>
- <div class="row"><span>Grass</span><span class="v" id="off4">0px</span></div>
- </div>
- </div>
-
- <div class="div"></div>
-
- <div>
- <div class="lbl">Speed Multipliers</div>
- <div class="sliders">
- <div class="sr"><label>Sky</label>
- <input type="range" id="s1" min="0" max="150" value="10">
- <span class="sv" id="sv1">10%</span></div>
- <div class="sr"><label>Ridge</label>
- <input type="range" id="s2" min="0" max="150" value="30">
- <span class="sv" id="sv2">30%</span></div>
- <div class="sr"><label>Trees</label>
- <input type="range" id="s3" min="0" max="150" value="60">
- <span class="sv" id="sv3">60%</span></div>
- <div class="sr"><label>Grass</label>
- <input type="range" id="s4" min="0" max="150" value="100">
- <span class="sv" id="sv4">100%</span></div>
- </div>
- </div>
-
- <div class="div"></div>
-
- <label class="tog">
- <input type="checkbox" id="tog">
- <span>Disable parallax (all 100%)</span>
- </label>
-
- <button id="resetBtn">Reset to defaults</button>
- </aside>
-
-</div>
-
-</body>
-</html>
-```
-
-- [ ] **Step 2: Check line count**
-
-```bash
-wc -l animations/01-scroll-based/parallax-scrolling/index.html
-```
-
-Expected: under 200. If over 300, the file violates the project constraint.
-
-- [ ] **Step 3: Open in browser and verify static layout**
-
-Open `animations/01-scroll-based/parallax-scrolling/index.html` directly.
-
-Expected:
-- Dark stage (600px tall) with all 4 mountain layers visible, stacked correctly
-- Sky gradient + stars at back, near-black grass at front
-- Right sidebar with note, readout placeholders, 4 sliders, toggle, reset button
-- No console errors
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add animations/01-scroll-based/parallax-scrolling/index.html
-git commit -m "feat: add parallax-scrolling static scaffold"
-```
-
----
-
-## Task 3: Scroll Mechanic + Controls JS
-
-**Files:**
-- Modify: `animations/01-scroll-based/parallax-scrolling/index.html` — insert `<script>` before `</body>`
-
-- [ ] **Step 1: Insert script block**
-
-Find the `</body>` closing tag and replace `</body>\n</html>` with:
-
-```html
-<script>
- const DEFAULTS = [0.10, 0.30, 0.60, 1.00];
- const LAYERS = DEFAULTS.map((s, i) => ({
- el: document.getElementById('l' + (i + 1)),
- speed: s,
- }));
- const stage = document.getElementById('stage');
- const progEl = document.getElementById('progress');
- const OFFS = [1,2,3,4].map(i => document.getElementById('off' + i));
- const SLIDERS = [1,2,3,4].map(i => document.getElementById('s' + i));
- const SVALS = [1,2,3,4].map(i => document.getElementById('sv' + i));
- const tog = document.getElementById('tog');
- const resetBtn = document.getElementById('resetBtn');
- const noMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
- let ticking = false;
-
- function update() {
- const st = stage.scrollTop;
- const max = stage.scrollHeight - stage.clientHeight;
- progEl.textContent = max > 0 ? Math.round(st / max * 100) + '%' : '0%';
- LAYERS.forEach((L, i) => {
- const off = Math.round(st * L.speed);
- L.el.style.transform = `translate3d(0,${off}px,0)`;
- OFFS[i].textContent = off + 'px';
- });
- ticking = false;
- }
-
- stage.addEventListener('scroll', () => {
- if (noMotion) return;
- if (!ticking) { requestAnimationFrame(update); ticking = true; }
- }, { passive: true });
-
- SLIDERS.forEach((sl, i) => {
- sl.addEventListener('input', () => {
- if (!tog.checked) LAYERS[i].speed = sl.value / 100;
- SVALS[i].textContent = sl.value + '%';
- update();
- });
- });
-
- tog.addEventListener('change', () => {
- LAYERS.forEach((L, i) => {
- L.speed = tog.checked ? 1.0 : SLIDERS[i].value / 100;
- });
- update();
- });
-
- resetBtn.addEventListener('click', () => {
- tog.checked = false;
- DEFAULTS.forEach((d, i) => {
- LAYERS[i].speed = d;
- SLIDERS[i].value = d * 100;
- SVALS[i].textContent = Math.round(d * 100) + '%';
- });
- update();
- });
-
- update();
-</script>
-</body>
-</html>
-```
-
-- [ ] **Step 2: Check final line count**
-
-```bash
-wc -l animations/01-scroll-based/parallax-scrolling/index.html
-```
-
-Expected: under 280 lines. If over 300, collapse CSS whitespace or inline SVG attributes.
-
-- [ ] **Step 3: Verify in browser**
-
-Reload `index.html`.
-
-Expected — scroll behavior:
-- Scrolling inside the dark stage box moves layers at visibly different speeds
-- Sky barely moves; grass moves 10× faster
-- Progress % increments from 0% to 100% as you scroll through the 1800px scene
-- Offset readout updates live (sky single-digit px, grass triple-digit px)
-
-Expected — controls:
-- Sky slider at 0%: sky is frozen (no translateY change on scroll)
-- Sky slider at 150%: sky moves faster than everything else (broken illusion)
-- "Disable parallax" checked: all layers move at the same speed (flat/2D appearance)
-- "Disable parallax" unchecked: speeds restored from slider positions
-- "Reset to defaults": sliders snap to 10/30/60/100, toggle unchecked
-
-Expected — reduced motion:
-- In Chrome DevTools: Rendering → Emulate CSS media feature `prefers-reduced-motion: reduce` → scrolling does nothing (static scene)
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add animations/01-scroll-based/parallax-scrolling/index.html
-git commit -m "feat: add scroll mechanic and controls to parallax-scrolling demo"
-```
-
----
-
-## Task 4: Update Root Index Page
-
-**Files:**
-- Modify: `index.html` (root)
-
-- [ ] **Step 1: Add the new entry to the list**
-
-In root `index.html`, find:
-
-```html
- <li>
- <a href="animations/01-scroll-based/parallax-depth-of-field/">Parallax Depth-of-Field</a>
- <span class="desc" style="display:block">Five mountain layers with parallax translation and blur-based depth-of-field driven by scroll.</span>
- </li>
- </ul>
-```
-
-Replace with:
-
-```html
- <li>
- <a href="animations/01-scroll-based/parallax-depth-of-field/">Parallax Depth-of-Field</a>
- <span class="desc" style="display:block">Five mountain layers with parallax translation and blur-based depth-of-field driven by scroll.</span>
- </li>
- <li>
- <a href="animations/01-scroll-based/parallax-scrolling/">Parallax Scrolling</a>
- <span class="desc" style="display:block">Four SVG layers at different scroll speeds create a 3D depth illusion; adjustable speed sliders show how ratios make or break the effect.</span>
- </li>
- </ul>
-```
-
-- [ ] **Step 2: Verify root index in browser**
-
-Open root `index.html`. Expected:
-- Two entries under "01 — Scroll-Based"
-- Both links open the correct demo
-
-- [ ] **Step 3: Commit**
-
-```bash
-git add index.html
-git commit -m "feat: add parallax-scrolling to root handbook index"
-```
-
----
-
-## Self-Review
-
-### Spec coverage
-
-| Requirement | Covered by |
-|-------------|-----------|
-| 4 depth layers (sky, ridgeline, treeline, grass) | Task 2 — 4 SVG layers with IDs l1–l4 |
-| Speeds: ~10% / ~30% / ~60% / ~100% | Task 3 — `DEFAULTS = [0.10, 0.30, 0.60, 1.00]` |
-| Inline SVG, mountain valley theme | Task 2 — polygon silhouettes, midnight palette |
-| Scene ≥ 2× viewport height scroll distance | Task 2 — `scene` is 1800px, stage 600px → 1200px scroll range |
-| `translate3d` for GPU acceleration | Task 3 — `translate3d(0, ${off}px, 0)` |
-| Single scroll listener + rAF | Task 3 — `ticking` dirty flag + `requestAnimationFrame(update)` |
-| Scroll progress readout | Task 3 — `progEl.textContent = Math.round(st/max*100)+'%'` |
-| Per-layer live offset table | Task 3 — `OFFS[i].textContent = off + 'px'` |
-| 4 speed sliders (0–150%) | Task 2 markup + Task 3 listeners |
-| Reset to defaults button | Task 3 — `resetBtn` listener restores `DEFAULTS` |
-| Disable parallax toggle | Task 3 — `tog` listener sets all speeds to 1.0 or restores |
-| Educational note above controls | Task 2 — `.note` paragraph |
-| Unrealistic ratios break illusion | Inherent — sliders go 0–150%, reversing ratios creates backward parallax |
-| Mobile: panel stacks below stage ≤600px | Task 2 — `@media(max-width:600px)` flex-direction:column |
-| Touch controls usable | Task 2 — `min-height:20px` on sliders, `16×16px` checkbox |
-| README all 6 sections | Task 1 |
-| Category README updated | Task 1 |
-| Root index updated | Task 4 |
-| Single file, no deps, offline | All code inline |
-| Under 300 lines | Task 3 Step 2 — explicit check |
-| `prefers-reduced-motion` | Task 2 CSS + Task 3 `noMotion` guard |
-
-### Placeholder scan
-
-None found.
-
-### Type consistency
-
-- `LAYERS[i].speed` set in `DEFAULTS.map()` (Task 3), read in `update()` (Task 3), mutated in slider/toggle/reset listeners (Task 3) — consistent.
-- `SLIDERS[i].value` is a string from `<input>`; divided by 100 for speed — consistent across all listeners.
-- `OFFS[i].textContent` updated in `update()` — consistent with IDs `off1`–`off4` defined in Task 2 markup.
diff --git a/docs/superpowers/plans/2026-05-20-cover-card-to-fixed-header.md b/docs/superpowers/plans/2026-05-20-cover-card-to-fixed-header.md
deleted file mode 100644
index 7e35d238..00000000
--- a/docs/superpowers/plans/2026-05-20-cover-card-to-fixed-header.md
+++ /dev/null
@@ -1,689 +0,0 @@
-# Cover Card to Fixed Header Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Build a scroll stage where a large hero cover card scrubs into a compact fixed header, with every visual property — height, font size, opacity, blur, shadow — driven by a single eased 0→1 progress value.
-
-**Architecture:** Single `index.html`. A `position:sticky` cover element collapses from `var(--cover-full)` to `var(--cover-min)` via JS-controlled `height`. A `flex:1` spacer inside the cover makes content rise organically as height shrinks — no transforms needed on individual text elements. Eight properties are interpolated against `e = easeOutCubic(scrollTop / RANGE)` inside a single rAF-throttled scroll handler. Controls panel provides collapse override slider, transition-range slider, binary toggle, and reset.
-
-**Tech Stack:** Plain HTML5, CSS custom properties, vanilla JS. No libraries, no build step.
-
----
-
-## File Map
-
-| Action | Path | Responsibility |
-|--------|------|----------------|
-| Create | `animations/01-scroll-based/cover-card-to-fixed-header/index.html` | Full demo |
-| Create | `animations/01-scroll-based/cover-card-to-fixed-header/README.md` | 6-section explanation |
-| Modify | `animations/01-scroll-based/README.md` | Add entry |
-| Modify | `index.html` (root) | Add link |
-
----
-
-## Task 1: Folder, README, and Index Updates
-
-**Files:**
-- Create: `animations/01-scroll-based/cover-card-to-fixed-header/README.md`
-- Modify: `animations/01-scroll-based/README.md`
-- Modify: `index.html` (root)
-
-- [ ] **Step 1: Create folder**
-
-```bash
-mkdir -p animations/01-scroll-based/cover-card-to-fixed-header
-```
-
-- [ ] **Step 2: Create README.md**
-
-Create `animations/01-scroll-based/cover-card-to-fixed-header/README.md`:
-
-```markdown
-# Cover Card to Fixed Header
-
-[Live demo](index.html)
-
-## What it is
-
-A large hero cover card that smoothly morphs into a compact fixed header as
-the user scrolls. Height, font size, background opacity, blur, and element
-visibility are all tied to a single progress value `p ∈ [0, 1]` derived from
-scroll position. At `p = 0` the full cover is visible; at `p = 1` a minimal
-header is pinned to the top. Every value between those extremes is a
-deliberate, intentional intermediate state — not an accidental artifact of
-a CSS transition.
-
-## When to use it
-
-- Article pages where a rich hero section should give way to a persistent
- navigation header without jarring the reader
-- Product detail pages (e.g. Apple, Stripe) where the hero image collapses
- into a sticky toolbar
-- Editorial sites and blogs that need to retain identity (title, author)
- without the full cover consuming scroll real estate
-
-## How it works
-
-One scroll listener reads `stage.scrollTop` and computes:
-
-```js
-const p = Math.min(1, Math.max(0, scrollTop / RANGE));
-const e = easeOutCubic(p);
-```
-
-Eight properties are then interpolated against `e` in a single
-`requestAnimationFrame` callback:
-
-```js
-cover.style.height = lerp(530, 56, e) + 'px';
-coverTitle.style.fontSize = lerp(26, 13, e) + 'px';
-coverBg.style.opacity = lerp(1, 0.12, e);
-coverBg.style.filter = `blur(${lerp(0, 6, e)}px)`;
-coverMeta.style.opacity = 1 - clamp(e * 3, 0, 1);
-coverSub.style.opacity = 1 - clamp(e * 3, 0, 1);
-coverAuthor.style.opacity = 1 - clamp(e * 2, 0, 1);
-headerChip.style.opacity = clamp((e - 0.5) * 2, 0, 1);
-```
-
-A `flex: 1` spacer inside the cover pushes content to the bottom at full
-height and compresses as height shrinks, making the title rise to header
-position without any JS transform on the title element itself.
-
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| `RANGE` | 320px | Scroll distance over which the morph completes |
-| Cover full height | 530px (desktop) / 480px (mobile) | Starting cover height |
-| Cover min height | 56px (desktop) / 64px (mobile) | Collapsed header height |
-| Easing | easeOutCubic | Brisk start, settled finish |
-
-## Production notes
-
-- **Scrubbing beats binary toggles.** A hard class-swap at a scroll threshold
- creates an awkward snap — if the user pauses exactly at the threshold,
- the header flickers. Scrubbing to a 0→1 value means every scroll position
- has a well-defined, intentional appearance. Medium, Substack, and the NYT
- app all use variants of this pattern.
-- **The height animation triggers layout.** Animating `height` forces the
- browser to recalculate layout on every frame. The production alternative:
- keep the outer container at a fixed height, set `overflow: hidden`, and
- animate `clip-path` (layout-free) or `transform: scaleY()` on the inner
- element with `transform-origin: top`. This demo prioritises readability
- over raw performance.
-- **Real-world examples.** Medium's article header, Apple's product detail
- pages, and Stripe's blog all implement variants of this morph. The
- distinguishing quality is always whether intermediate scroll states look
- intentional or accidental.
-- **Library equivalents.** GSAP ScrollTrigger with `scrub: true` and a
- timeline that sets each property handles this pattern with easing per
- property. Framer Motion's `useScroll` + `useTransform` is the React
- equivalent. Both let you define keyframes along a scroll timeline rather
- than writing the interpolation arithmetic by hand.
-- **Accessibility.** Under `prefers-reduced-motion: reduce`, skip the scrubbed
- morph entirely — snap instantly to the collapsed header when scroll exceeds
- `RANGE / 2`. Opposing or complex motion can be disorienting for users with
- vestibular disorders; this pattern specifically triggers that concern because
- properties change continuously during scroll.
-
-## See also
-
-- [Parallax Scrolling](../parallax-scrolling/) — single progress value driving
- speed-ratio depth; the same interpolation model applied to layer motion.
-- [Reverse-Scrolling Columns](../reverse-scrolling-columns/) — another
- scroll-progress pattern, this time driving directional column motion.
-```
-
-- [ ] **Step 3: Update category README**
-
-Replace entire content of `animations/01-scroll-based/README.md` with:
-
-```markdown
-# Scroll-Based Animations
-
-Techniques driven by scroll position.
-
-## Entries
-
-- [Parallax Depth-of-Field](parallax-depth-of-field/) — Five layered SVG mountains with
- parallax translation and blur-based depth-of-field driven by scroll progress.
-- [Parallax Scrolling](parallax-scrolling/) — Four SVG layers at different scroll speeds
- create a 3D depth illusion; adjustable speed multipliers show how ratios make or break the effect.
-- [Reverse-Scrolling Columns](reverse-scrolling-columns/) — center column scrolls normally
- while two flanking columns scroll in reverse, all three looping infinitely.
-- [Cover Card to Fixed Header](cover-card-to-fixed-header/) — a hero cover card scrubs
- into a compact fixed header; every visual property driven by a single 0→1 progress value.
-```
-
-- [ ] **Step 4: Update root index.html**
-
-In root `index.html`, find:
-
-```html
- <li>
- <a href="animations/01-scroll-based/reverse-scrolling-columns/">Reverse-Scrolling Columns</a>
- <span class="desc" style="display:block">A center column scrolls normally while two flanking columns scroll in reverse, looping infinitely — the opposing motion creates strong directional depth contrast.</span>
- </li>
- </ul>
-```
-
-Replace with:
-
-```html
- <li>
- <a href="animations/01-scroll-based/reverse-scrolling-columns/">Reverse-Scrolling Columns</a>
- <span class="desc" style="display:block">A center column scrolls normally while two flanking columns scroll in reverse, looping infinitely — the opposing motion creates strong directional depth contrast.</span>
- </li>
- <li>
- <a href="animations/01-scroll-based/cover-card-to-fixed-header/">Cover Card to Fixed Header</a>
- <span class="desc" style="display:block">A hero cover card scrubs into a compact fixed header on scroll — height, font size, opacity, and blur all driven by a single eased progress value.</span>
- </li>
- </ul>
-```
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add animations/01-scroll-based/cover-card-to-fixed-header/README.md
-git add animations/01-scroll-based/README.md index.html
-git commit -m "feat: add cover-card-to-fixed-header README and update indexes"
-```
-
----
-
-## Task 2: HTML Scaffold — CSS, Layout, Cover Card, Article Body, Sidebar
-
-**Files:**
-- Create: `animations/01-scroll-based/cover-card-to-fixed-header/index.html`
-
-Build the full page without JavaScript first.
-
-- [ ] **Step 1: Create index.html**
-
-Create `animations/01-scroll-based/cover-card-to-fixed-header/index.html` with exactly this content:
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Cover Card to Fixed Header</title>
- <style>
- :root{
- --bg:#060a10;--ui-bg:#0d1117;--ui-border:#21262d;
- --ui-accent:#3fb950;--ui-text:#c9d1d9;--ui-muted:#8b949e;
- --cover-full:530px;--cover-min:56px;
- }
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- body{background:var(--bg);color:var(--ui-text);font-family:monospace;
- padding:clamp(12px,3vw,24px)}
- header{margin-bottom:20px}
- header h1{font-size:clamp(11px,1.8vw,15px);letter-spacing:2px;text-transform:uppercase}
- header p{font-size:clamp(10px,1.2vw,12px);color:var(--ui-muted);margin-top:4px}
-
- .layout{display:flex;gap:clamp(12px,2vw,24px);align-items:flex-start}
-
- .stage{
- flex:1;min-width:0;height:620px;
- overflow-y:scroll;scrollbar-width:none;
- border:1px solid var(--ui-border);border-radius:8px;
- }
- .stage::-webkit-scrollbar{display:none}
- .scene{min-height:2500px}
-
- .cover{
- position:sticky;top:0;z-index:10;
- height:var(--cover-full);overflow:hidden;
- background:#050e08;
- }
- .cover-bg{
- position:absolute;inset:0;
- background:linear-gradient(150deg,#050e08,#0c2820,#060a10);
- will-change:opacity,filter;
- }
- .cover-code{
- position:absolute;top:14px;left:16px;
- font-size:9px;color:#1a4a30;line-height:1.7;
- pointer-events:none;user-select:none;
- }
- .cover-inner{
- position:relative;z-index:1;
- display:flex;flex-direction:column;
- height:100%;padding:0 24px 20px;
- }
- .cover-spacer{flex:1}
- .cover-meta{
- font-size:10px;color:#3d7a52;
- letter-spacing:1px;text-transform:uppercase;margin-bottom:8px;
- }
- .cover-title{
- font-size:26px;color:#d1f7d6;line-height:1.2;
- letter-spacing:-.5px;margin-bottom:8px;
- will-change:font-size;
- }
- .cover-sub{
- font-size:12px;color:#3d7a52;line-height:1.5;margin-bottom:14px;
- }
- .cover-author{display:flex;align-items:center;gap:8px}
- .avatar{
- width:24px;height:24px;border-radius:50%;flex-shrink:0;
- background:linear-gradient(135deg,#3fb950,#56d364);
- }
- .author-name{font-size:10px;color:#3d7a52}
- .header-chip{
- position:absolute;top:14px;right:16px;
- display:flex;align-items:center;gap:6px;opacity:0;
- }
- .avatar-sm{
- width:16px;height:16px;border-radius:50%;flex-shrink:0;
- background:linear-gradient(135deg,#3fb950,#56d364);
- }
- .chip-name{font-size:10px;color:#d1f7d6}
-
- .article-body{padding:28px 24px;max-width:600px}
- .article-body h2{
- font-size:11px;color:var(--ui-accent);letter-spacing:1px;
- text-transform:uppercase;margin:28px 0 10px;
- }
- .article-body p{
- font-size:12px;color:var(--ui-muted);line-height:1.75;margin-bottom:14px;
- }
- .article-body blockquote{
- border-left:2px solid var(--ui-accent);padding:8px 16px;margin:18px 0;
- font-size:13px;color:var(--ui-text);font-style:italic;
- }
-
- aside{
- width:clamp(200px,22vw,240px);flex-shrink:0;
- background:var(--ui-bg);border:1px solid var(--ui-border);
- border-radius:8px;padding:16px;
- display:flex;flex-direction:column;gap:10px;
- }
- .note{
- font-size:10px;color:var(--ui-muted);line-height:1.6;
- border-left:2px solid var(--ui-accent);padding-left:8px;
- }
- .lbl{font-size:10px;text-transform:uppercase;letter-spacing:1px;color:var(--ui-accent)}
- .row{display:flex;justify-content:space-between;font-size:10px}
- .row .v{color:var(--ui-text)}
- .tbl{display:flex;flex-direction:column;gap:2px}
- .tbl .row{font-size:10px;color:var(--ui-muted)}
- .sr{display:flex;align-items:center;gap:6px;font-size:10px}
- .sr input[type=range]{flex:1;accent-color:var(--ui-accent);min-height:44px}
- .sr .sv{width:38px;text-align:right;color:var(--ui-text)}
- .div{height:1px;background:var(--ui-border)}
- .tog{display:flex;align-items:center;gap:8px;font-size:10px;cursor:pointer;min-height:44px}
- .tog input{accent-color:var(--ui-accent);width:16px;height:16px;flex-shrink:0}
- button{
- background:transparent;border:1px solid var(--ui-border);
- color:var(--ui-text);font-family:monospace;font-size:10px;
- padding:17px 8px;border-radius:4px;cursor:pointer;width:100%;
- }
- button:hover{border-color:var(--ui-accent);color:var(--ui-accent)}
-
- @media(max-width:600px){
- .layout{flex-direction:column}
- aside{width:100%}
- .stage{height:520px}
- :root{--cover-full:480px;--cover-min:64px}
- }
- @media(prefers-reduced-motion:reduce){
- .cover,.cover-title,.cover-bg,.header-chip{will-change:auto}
- }
- </style>
-</head>
-<body>
-
-<header>
- <h1>Cover Card to Fixed Header</h1>
- <p>A full-page hero cover morphs into a compact fixed header as you scroll — every property scrubbed to a single 0→1 progress value.</p>
-</header>
-
-<div class="layout">
-
- <div class="stage" id="stage">
- <div class="scene">
-
- <div class="cover" id="cover">
- <div class="cover-bg" id="cover-bg"></div>
- <div class="cover-code" aria-hidden="true">
- const p = scrollY / RANGE;<br>
- const e = easeOutCubic(p);<br>
- height = lerp(530, 56, e);
- </div>
- <div class="cover-inner">
- <div class="cover-spacer"></div>
- <div class="cover-meta" id="cover-meta">Article · 8 min read</div>
- <h1 class="cover-title" id="cover-title">The Architecture<br>of Scroll Motion</h1>
- <p class="cover-sub" id="cover-sub">How browsers render scroll-driven animations at 60fps</p>
- <div class="cover-author" id="cover-author">
- <div class="avatar"></div>
- <span class="author-name">Matin M. · May 2026</span>
- </div>
- </div>
- <div class="header-chip" id="header-chip">
- <div class="avatar-sm"></div>
- <span class="chip-name">Matin M.</span>
- </div>
- </div>
-
- <article class="article-body">
- <h2>Parsing the Render Pipeline</h2>
- <p>Every modern browser separates rendering into distinct phases: style
- recalculation, layout, paint, and composite. Scroll-driven animations that
- stay on the compositor thread — using only transform and opacity — bypass
- the first three phases entirely, enabling smooth motion regardless of
- main-thread load.</p>
- <p>The performance boundary is predictable. Any property that triggers
- layout — height, padding, margin, width — forces the browser to
- recalculate the geometry of every affected element before painting. A
- scroll handler that reads offsetTop and writes height on every event is
- a classic layout-thrash pattern.</p>
- <blockquote>"The fastest animation is one the compositor can run
- without consulting the main thread."</blockquote>
- <h2>The Single-Progress Model</h2>
- <p>This demo maps all visual changes to one value: p ∈ [0, 1]. That
- number drives height, font size, opacity, blur, and border
- simultaneously. When every property shares the same source of truth,
- intermediate states are always consistent — no awkward frames where the
- title has shrunk but the background remains fully visible.</p>
- <p>Easing the progress value once (easeOutCubic) rather than easing
- each property separately keeps multi-property interpolation coherent.
- All elements decelerate together, which reads as intentional rather
- than coincidental.</p>
- <p>Adjusting the transition range slider shows how the same logic
- produces very different feels. At 150px the morph is punchy. At 600px
- it becomes cinematic — the user invests real scroll before the header
- locks in.</p>
- </article>
-
- </div>
- </div>
-
- <aside>
- <p class="note">This pattern is the foundation of every good article header on the modern web — Medium, Substack, NYT, Stripe blog. The trick is scrubbing every property to a single 0→1 progress value so intermediate states all look intentional.</p>
-
- <div>
- <div class="lbl">Progress</div>
- <div class="tbl">
- <div class="row"><span>Scroll</span><span class="v" id="scroll-prog">0%</span></div>
- <div class="row"><span>Collapse</span><span class="v" id="collapse-prog">0%</span></div>
- </div>
- </div>
-
- <div class="div"></div>
-
- <div>
- <div class="lbl" id="col-lbl">Collapse Override</div>
- <div class="sr">
- <input type="range" id="collapse-slider" aria-labelledby="col-lbl"
- min="0" max="100" value="0">
- <span class="sv" id="col-val">0%</span>
- </div>
- </div>
-
- <div>
- <div class="lbl" id="range-lbl">Transition Range</div>
- <div class="sr">
- <input type="range" id="range-slider" aria-labelledby="range-lbl"
- min="150" max="600" step="10" value="320">
- <span class="sv" id="range-val">320px</span>
- </div>
- </div>
-
- <div class="div"></div>
-
- <label class="tog" for="binary-tog">
- <input type="checkbox" id="binary-tog">
- <span>Binary (snap at midpoint)</span>
- </label>
-
- <button id="reset-btn">Reset scroll</button>
- </aside>
-
-</div>
-
-</body>
-</html>
-```
-
-- [ ] **Step 2: Check line count**
-
-```bash
-wc -l animations/01-scroll-based/cover-card-to-fixed-header/index.html
-```
-
-Expected: under 175 lines. JS added in Task 3 will bring total to ~270.
-
-- [ ] **Step 3: Verify in browser**
-
-Open the file. Expected:
-- Large green-tinted cover card with code watermark, title, subtitle, author
-- Article content below
-- Sidebar to the right with all controls visible but inactive
-- No console errors
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add animations/01-scroll-based/cover-card-to-fixed-header/index.html
-git commit -m "feat: add cover-card-to-fixed-header HTML scaffold"
-```
-
----
-
-## Task 3: Collapse Mechanic + Controls JS
-
-**Files:**
-- Modify: `animations/01-scroll-based/cover-card-to-fixed-header/index.html` — insert `<script>` before `</body>`
-
-- [ ] **Step 1: Insert script block**
-
-Find `</body>\n</html>` at the end and replace with:
-
-```html
-<script>
- const cover = document.getElementById('cover');
- const coverBg = document.getElementById('cover-bg');
- const coverMeta = document.getElementById('cover-meta');
- const coverTitle = document.getElementById('cover-title');
- const coverSub = document.getElementById('cover-sub');
- const coverAuthor = document.getElementById('cover-author');
- const headerChip = document.getElementById('header-chip');
- const stage = document.getElementById('stage');
- const scrollProg = document.getElementById('scroll-prog');
- const collapseProg= document.getElementById('collapse-prog');
- const colSlider = document.getElementById('collapse-slider');
- const colVal = document.getElementById('col-val');
- const rangeSlider = document.getElementById('range-slider');
- const rangeVal = document.getElementById('range-val');
- const binaryTog = document.getElementById('binary-tog');
- const resetBtn = document.getElementById('reset-btn');
- const motionMQ = window.matchMedia('(prefers-reduced-motion: reduce)');
-
- // Read cover heights from CSS variables (respects mobile overrides)
- const cs = getComputedStyle(document.documentElement);
- const FULL = parseFloat(cs.getPropertyValue('--cover-full')) || 530;
- const MIN = parseFloat(cs.getPropertyValue('--cover-min')) || 56;
- let RANGE = 320;
- let manual = false;
- let ticking = false;
-
- function lerp(a, b, t) { return a + (b - a) * t; }
- function clamp(v, lo, hi) { return Math.min(Math.max(v, lo), hi); }
- function ease(t) { return 1 - Math.pow(1 - t, 3); } // easeOutCubic
-
- function apply(rawE) {
- // Under reduced motion: instant snap only — no scrubbing
- const e = motionMQ.matches ? (rawE > 0.5 ? 1 : 0) : rawE;
-
- cover.style.height = lerp(FULL, MIN, e) + 'px';
- coverBg.style.opacity = lerp(1, 0.12, e);
- coverBg.style.filter = `blur(${lerp(0, 6, e)}px)`;
- coverTitle.style.fontSize = lerp(26, 13, e) + 'px';
-
- const fadeEarly = 1 - clamp(e * 3, 0, 1);
- coverMeta.style.opacity = fadeEarly;
- coverSub.style.opacity = fadeEarly;
- coverAuthor.style.opacity = 1 - clamp(e * 2, 0, 1);
- headerChip.style.opacity = clamp((e - 0.5) * 2, 0, 1);
-
- cover.style.boxShadow = `0 1px 0 rgba(63,185,80,${lerp(0, 0.2, e)})`;
- collapseProg.textContent = Math.round(e * 100) + '%';
- }
-
- function computeE(scrollTop) {
- const p = clamp(scrollTop / RANGE, 0, 1);
- return binaryTog.checked ? (p > 0.5 ? 1 : 0) : ease(p);
- }
-
- function update() {
- const st = stage.scrollTop;
- const max = stage.scrollHeight - stage.clientHeight;
- scrollProg.textContent = max > 0 ? Math.round(st / max * 100) + '%' : '0%';
- if (!manual) {
- const e = computeE(st);
- colSlider.value = Math.round(e * 100);
- colVal.textContent = Math.round(e * 100) + '%';
- apply(e);
- }
- ticking = false;
- }
-
- stage.addEventListener('scroll', () => {
- manual = false;
- if (!ticking) { requestAnimationFrame(update); ticking = true; }
- }, { passive: true });
-
- colSlider.addEventListener('input', () => {
- manual = true;
- const rawE = ease(colSlider.value / 100);
- colVal.textContent = colSlider.value + '%';
- apply(rawE);
- collapseProg.textContent = Math.round(rawE * 100) + '%';
- });
-
- rangeSlider.addEventListener('input', () => {
- RANGE = parseInt(rangeSlider.value);
- rangeVal.textContent = RANGE + 'px';
- if (!manual) update();
- });
-
- binaryTog.addEventListener('change', () => {
- if (manual) {
- apply(ease(colSlider.value / 100));
- } else {
- update();
- }
- });
-
- resetBtn.addEventListener('click', () => {
- manual = false;
- stage.scrollTop = 0;
- colSlider.value = 0;
- colVal.textContent = '0%';
- apply(0);
- });
-
- apply(0);
-</script>
-</body>
-</html>
-```
-
-- [ ] **Step 2: Check final line count**
-
-```bash
-wc -l animations/01-scroll-based/cover-card-to-fixed-header/index.html
-```
-
-Expected: under 280 lines. If over 300, collapse CSS declarations.
-
-- [ ] **Step 3: Verify in browser**
-
-Open the file. Scroll down in the dark stage.
-
-Expected — scroll behavior:
-- Cover smoothly shrinks as you scroll
-- Title font size visibly decreases
-- Subtitle and meta fade out early (gone by ~30% collapse)
-- Author fades out by ~50%
-- Small "Matin M." chip fades in on the right after 50%
-- Background fades and blurs as cover collapses
-- A faint green bottom border appears on the header when fully collapsed
-- Scrolling back up reverses everything perfectly
-
-Expected — controls:
-- Collapse override slider: drag to any position, cover shows exact intermediate state; next scroll re-syncs
-- Transition range at 150px: brisk, morph completes very early in scroll
-- Transition range at 600px: cinematic, long wind-up before header locks
-- Binary toggle: flips between scrubbed (smooth) and hard snap at 50% scroll
-- Reset: scrolls back to top, cover fully expanded
-
-Expected — reduced motion:
-- In DevTools Rendering: `prefers-reduced-motion: reduce` → scrolling snaps instantly between full cover and full header at the midpoint; no scrubbing
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add animations/01-scroll-based/cover-card-to-fixed-header/index.html
-git commit -m "feat: add collapse mechanic and controls to cover-card demo"
-```
-
----
-
-## Self-Review
-
-### Spec coverage
-
-| Requirement | Covered by |
-|-------------|-----------|
-| Large cover card, hero section | Task 2 — `.cover` with `var(--cover-full)` height, code-green gradient |
-| Cover content: title, subtitle, meta, avatar | Task 2 — `.cover-meta`, `.cover-title`, `.cover-sub`, `.cover-author` |
-| Article body below cover | Task 2 — `<article class="article-body">` with paragraphs, headings, blockquote |
-| Cover height: full → min | Task 3 — `cover.style.height = lerp(FULL, MIN, e)` |
-| Background fades + blurs | Task 3 — `coverBg.style.opacity`, `coverBg.style.filter` |
-| Title shrinks | Task 3 — `coverTitle.style.fontSize = lerp(26, 13, e)` |
-| Subtitle + meta fade out | Task 3 — `fadeEarly = 1 - clamp(e×3, 0, 1)` |
-| Author fades | Task 3 — `1 - clamp(e×2, 0, 1)` |
-| Avatar chip appears in header | Task 2 (markup) + Task 3 — `headerChip.style.opacity = clamp((e-0.5)×2, 0, 1)` |
-| Header border appears | Task 3 — `cover.style.boxShadow` |
-| Scrubbed to scroll position | Task 3 — `computeE(scrollTop)` called in rAF handler |
-| easeOutCubic | Task 3 — `ease(t) = 1 - (1-t)^3` |
-| Stays fixed after full collapse | Handled by `position:sticky` + height staying at MIN |
-| Reversal on scroll-up | Inherent — `computeE` re-runs on every scroll event |
-| rAF-throttled scroll handler | Task 3 — `ticking` dirty flag |
-| Scroll progress readout | Task 3 — `scrollProg.textContent` |
-| Collapse progress readout | Task 3 — `collapseProg.textContent` |
-| Collapse override slider | Task 2 (markup) + Task 3 — `manual` flag, `apply(rawE)` |
-| Transition range slider | Task 2 (markup) + Task 3 — updates `RANGE` |
-| Binary vs scrubbed toggle | Task 2 (markup) + Task 3 — `binaryTog.checked` in `computeE` |
-| Reset button | Task 3 — resets scrollTop, slider, applies 0 |
-| Educational note | Task 2 — `<p class="note">` |
-| Mobile: controls stack below | Task 2 — `@media(max-width:600px) .layout{flex-direction:column}` |
-| Mobile: larger header (64px) | Task 2 — `:root{--cover-min:64px}` in mobile media query |
-| Mobile: larger cover (480px) | Task 2 — `:root{--cover-full:480px}` |
-| Touch targets ≥44px | Task 2 — sliders `min-height:44px`, button `padding:17px`, toggle `min-height:44px` |
-| Touch scroll works | Task 3 — passive listener on `.stage` |
-| prefers-reduced-motion: snap | Task 3 — `apply()` reads `motionMQ.matches`, snaps `e` |
-| CSS variables for heights | Task 2 — `--cover-full`, `--cover-min` in `:root` and mobile override |
-| JS reads CSS variables | Task 3 — `getComputedStyle(document.documentElement).getPropertyValue(...)` |
-| Single file, no deps, offline | All code inline |
-| Under 300 lines | Task 3 Step 2 — explicit check |
-
-### Placeholder scan
-
-None.
-
-### Type consistency
-
-- `FULL` and `MIN` — read from CSS variables at startup; used in `apply()` as numbers. ✓
-- `RANGE` — initialized to 320; mutated by `rangeSlider` listener; used in `computeE()`. ✓
-- `manual` — boolean; set false on scroll, true on colSlider; checked in `update()`. ✓
-- `apply(rawE)` — receives `rawE ∈ [0,1]`; `computeE()` always returns values in that range. ✓
-- `ease()` is used in two places: `update()` via `computeE()`, and `colSlider` listener directly. Both expect `t ∈ [0,1]`. `colSlider.value / 100` is `[0,1]`. ✓
-
-### One concern flagged
-
-The `colSlider` listener applies `ease(colSlider.value / 100)` — this double-eases when the user drags the override slider. The slider shows a raw 0–100 value (displayed as `colSlider.value + '%'`), but `collapseProg` shows the eased result. This is intentional: the slider is a raw progress input, and the collapse progress readout reflects the actual eased `e` value. The displayed `col-val` shows raw slider position while `collapseProg` shows eased — both are informative. No fix needed.
diff --git a/docs/superpowers/plans/2026-05-20-fly-in-fly-out-contact-list.md b/docs/superpowers/plans/2026-05-20-fly-in-fly-out-contact-list.md
deleted file mode 100644
index 0528f330..00000000
--- a/docs/superpowers/plans/2026-05-20-fly-in-fly-out-contact-list.md
+++ /dev/null
@@ -1,617 +0,0 @@
-# Fly-in Fly-out Contact List Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Build a scrollable contact list where each row flies in/out via piecewise-interpolated opacity, translateY, and scale as it enters and exits the viewport — effect scrubbed continuously to scroll position using IntersectionObserver + rAF.
-
-**Architecture:** Single `index.html`. 15 contact rows generated by JS from a data array (keeps HTML compact). An `IntersectionObserver` (root = the `.stage` scroll container) maintains a `Set` of currently-near-viewport rows. A rAF-throttled scroll handler iterates only that Set and computes `pos = (row.offsetTop - scrollTop) / viewportH`, then maps it through a three-zone piecewise lerp to produce opacity, translateY, and scale. Controls panel has three sliders + effect-mode radios + zone-preview toggle.
-
-**Tech Stack:** Plain HTML5, CSS custom properties, vanilla JS, IntersectionObserver. No libraries, no build step.
-
----
-
-## File Map
-
-| Action | Path | Responsibility |
-|--------|------|----------------|
-| Create | `animations/01-scroll-based/fly-in-fly-out-contact-list/index.html` | Full demo |
-| Create | `animations/01-scroll-based/fly-in-fly-out-contact-list/README.md` | 6-section explanation |
-| Modify | `animations/01-scroll-based/README.md` | Add entry |
-| Modify | `index.html` (root) | Add link |
-
----
-
-## Task 1: Folder, README, and Index Updates
-
-**Files:**
-- Create: `animations/01-scroll-based/fly-in-fly-out-contact-list/README.md`
-- Modify: `animations/01-scroll-based/README.md`
-- Modify: `index.html` (root)
-
-- [ ] **Step 1: Create folder**
-
-```bash
-mkdir -p animations/01-scroll-based/fly-in-fly-out-contact-list
-```
-
-- [ ] **Step 2: Create README.md**
-
-Create `animations/01-scroll-based/fly-in-fly-out-contact-list/README.md`:
-
-```markdown
-# Fly-in Fly-out Contact List
-
-[Live demo](index.html)
-
-## What it is
-
-Each row in a scrollable contact list animates through three viewport zones:
-an entry zone at the bottom (row fades and translates in from below), an
-active zone in the middle (row is fully visible and stable), and an exit zone
-at the top (row fades and translates out upward). The effect is continuous and
-bidirectional — scrubbed to scroll position rather than triggered once. A row
-that scrolls back into the active zone after exiting reappears smoothly.
-
-## When to use it
-
-- Contact lists, activity feeds, and inbox views where long lists need
- visual structure as the user scans
-- Any vertically scrollable list where spatial cues help orient the user
- within the content
-- Messaging app chat lists, notification trays, search results
-
-## How it works
-
-For each row currently near the viewport (tracked by `IntersectionObserver`),
-a single `requestAnimationFrame` callback computes:
-
-```js
-const pos = (row.offsetTop - stage.scrollTop) / stage.clientHeight;
-// pos ≈ 0: row top aligns with viewport top
-// pos ≈ 1: row top aligns with viewport bottom
-```
-
-Three zones (Z = zone size, default 0.25):
-
-```js
-if (pos < Z) { // exit zone (top)
- const t = pos / Z; // 0 = fully exited, 1 = entering active
- opacity = lerp(0, 1, t);
- ty = lerp(-DIST, 0, t);
- scale = lerp(SCALE_MIN, 1, t);
-} else if (pos > 1 - Z) { // entry zone (bottom)
- const t = (1 - pos) / Z; // 0 = fully below, 1 = entering active
- opacity = lerp(0, 1, t);
- ty = lerp(DIST, 0, t);
- scale = lerp(SCALE_MIN, 1, t);
-} // else: active zone — opacity=1, ty=0, scale=1
-```
-
-An `IntersectionObserver` with `rootMargin: '25% 0px'` maintains a Set of
-rows currently in or near the viewport. The rAF callback iterates only that
-Set — never all 15 rows unconditionally.
-
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| `DIST` | 40px | Translation distance at zone edges |
-| `SCALE_MIN` | 0.94 | Scale at zone edges (1 = no shrink) |
-| `Z` | 0.25 | Fraction of viewport height for each zone |
-| Effect mode | all combined | opacity + translateY + scale together |
-
-## Production notes
-
-- **Continuous vs. one-time reveal.** A common pattern is to trigger a reveal
- animation once per element when it first enters the viewport and never
- reverse it. This demo is bidirectional — scrolling back up restores the
- fly-in state. The distinction matters for context: one-time reveals work
- for reading flows; continuous effects work for navigational lists where
- the user scans up and down repeatedly.
-- **Performance pattern.** `IntersectionObserver` filters the work set to
- only rows near the viewport. The rAF callback then applies
- `transform + opacity` — compositor-only properties that never trigger
- layout or paint. Together these keep the per-frame cost proportional to
- the number of visible rows, not the total list length.
-- **Real-world examples.** The iOS Contacts app, Telegram's chat list, and
- Notion's sidebar all use variants of this entering/exiting fade-translate.
- The scale component is what makes it feel physical rather than flat.
-- **Library equivalents.** GSAP ScrollTrigger with `scrub: true` and a
- timeline per row achieves the same piecewise control. Framer Motion's
- `useScroll` with `useTransform` per item is the React equivalent; it
- handles the `IntersectionObserver` bookkeeping automatically.
-- **Accessibility.** The combination of translate + scale is a known
- vestibular trigger. Under `prefers-reduced-motion: reduce`, disable
- translate and scale entirely; use only a subtle opacity fade
- (0.3 → 1) at the zone edges so the list remains spatially stable.
-
-## See also
-
-- [Cover Card to Fixed Header](../cover-card-to-fixed-header/) — the same
- single-progress piecewise lerp model applied to a morphing header.
-- [Parallax Scrolling](../parallax-scrolling/) — scroll-position driving
- layer transforms; the architectural pattern this builds on.
-```
-
-- [ ] **Step 3: Update category README**
-
-Replace entire content of `animations/01-scroll-based/README.md`:
-
-```markdown
-# Scroll-Based Animations
-
-Techniques driven by scroll position.
-
-## Entries
-
-- [Parallax Depth-of-Field](parallax-depth-of-field/) — Five layered SVG mountains with
- parallax translation and blur-based depth-of-field driven by scroll progress.
-- [Parallax Scrolling](parallax-scrolling/) — Four SVG layers at different scroll speeds
- create a 3D depth illusion; adjustable speed multipliers show how ratios make or break the effect.
-- [Reverse-Scrolling Columns](reverse-scrolling-columns/) — center column scrolls normally
- while two flanking columns scroll in reverse, all three looping infinitely.
-- [Cover Card to Fixed Header](cover-card-to-fixed-header/) — a hero cover card scrubs
- into a compact fixed header; every visual property driven by a single 0→1 progress value.
-- [Fly-in Fly-out Contact List](fly-in-fly-out-contact-list/) — rows translate and fade
- as they enter and exit the scroll viewport; effect scrubbed continuously to scroll position.
-```
-
-- [ ] **Step 4: Update root index.html**
-
-In root `index.html`, find:
-
-```html
- <li>
- <a href="animations/01-scroll-based/cover-card-to-fixed-header/">Cover Card to Fixed Header</a>
- <span class="desc" style="display:block">A hero cover card scrubs into a compact fixed header on scroll — height, font size, opacity, and blur all driven by a single eased progress value.</span>
- </li>
- </ul>
-```
-
-Replace with:
-
-```html
- <li>
- <a href="animations/01-scroll-based/cover-card-to-fixed-header/">Cover Card to Fixed Header</a>
- <span class="desc" style="display:block">A hero cover card scrubs into a compact fixed header on scroll — height, font size, opacity, and blur all driven by a single eased progress value.</span>
- </li>
- <li>
- <a href="animations/01-scroll-based/fly-in-fly-out-contact-list/">Fly-in Fly-out Contact List</a>
- <span class="desc" style="display:block">Contact rows translate and fade through entry, active, and exit zones as you scroll — a continuous bidirectional effect scrubbed to scroll position.</span>
- </li>
- </ul>
-```
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add animations/01-scroll-based/fly-in-fly-out-contact-list/README.md
-git add animations/01-scroll-based/README.md index.html
-git commit -m "feat: add fly-in-fly-out-contact-list README and update indexes"
-```
-
----
-
-## Task 2: HTML Scaffold — CSS, Layout, Contact List Shell, Sidebar
-
-**Files:**
-- Create: `animations/01-scroll-based/fly-in-fly-out-contact-list/index.html`
-
-Build the full page without JavaScript. The contact list is empty — rows are injected by JS in Task 3.
-
-- [ ] **Step 1: Create index.html**
-
-Create `animations/01-scroll-based/fly-in-fly-out-contact-list/index.html`:
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Fly-in Fly-out Contact List</title>
- <style>
- :root{
- --bg:#060a10;--ui-bg:#0d1117;--ui-border:#21262d;
- --ui-accent:#58a6ff;--ui-text:#c9d1d9;--ui-muted:#8b949e;
- --row-bg:#161b22;
- }
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- body{background:var(--bg);color:var(--ui-text);font-family:monospace;
- padding:clamp(12px,3vw,24px)}
- header{margin-bottom:20px}
- header h1{font-size:clamp(11px,1.8vw,15px);letter-spacing:2px;text-transform:uppercase}
- header p{font-size:clamp(10px,1.2vw,12px);color:var(--ui-muted);margin-top:4px}
-
- .layout{display:flex;gap:clamp(12px,2vw,24px);align-items:flex-start}
-
- .stage{
- flex:1;min-width:0;height:620px;
- overflow-y:scroll;scrollbar-width:none;
- border:1px solid var(--ui-border);border-radius:8px;
- position:relative;
- }
- .stage::-webkit-scrollbar{display:none}
-
- .contact-list{padding:12px;display:flex;flex-direction:column;gap:6px;position:relative}
-
- .row{
- background:var(--row-bg);border:1px solid var(--ui-border);
- border-radius:8px;padding:10px 12px;
- display:flex;align-items:center;gap:10px;
- min-height:56px;will-change:transform,opacity;
- }
- .avatar{
- width:36px;height:36px;border-radius:50%;flex-shrink:0;
- display:flex;align-items:center;justify-content:center;
- font-size:12px;font-weight:bold;color:var(--ui-text);
- }
- .row-info{flex:1;min-width:0}
- .row-name{font-size:12px;color:#e6edf3}
- .row-sub{font-size:10px;color:var(--ui-muted);margin-top:2px}
- .row-meta{display:flex;flex-direction:column;align-items:flex-end;gap:3px;flex-shrink:0}
- .dot{width:7px;height:7px;border-radius:50%}
- .dot.online{background:#3fb950}
- .dot.offline{background:var(--ui-muted)}
- .badge{background:#0d2840;color:#58a6ff;font-size:9px;padding:1px 5px;border-radius:8px}
- .meta-time{font-size:8px;color:var(--ui-muted)}
-
- .zone-overlay{
- position:sticky;top:0;height:0;overflow:visible;
- pointer-events:none;display:none;z-index:5;
- }
- .zone-overlay.visible{display:block}
- .zone-band{position:absolute;left:0;right:0}
- .zone-exit{background:rgba(248,81,73,.1);top:0}
- .zone-entry{background:rgba(63,185,80,.1)}
- .zone-label{font-size:8px;color:var(--ui-muted);padding:2px 6px;display:block}
-
- aside{
- width:clamp(200px,22vw,240px);flex-shrink:0;
- background:var(--ui-bg);border:1px solid var(--ui-border);
- border-radius:8px;padding:16px;
- display:flex;flex-direction:column;gap:10px;
- }
- .note{font-size:10px;color:var(--ui-muted);line-height:1.6;
- border-left:2px solid var(--ui-accent);padding-left:8px}
- .lbl{font-size:10px;text-transform:uppercase;letter-spacing:1px;color:var(--ui-accent)}
- .kv{display:flex;justify-content:space-between;font-size:10px;color:var(--ui-muted)}
- .kv .v{color:var(--ui-text)}
- .tbl{display:flex;flex-direction:column;gap:2px}
- .sr{display:flex;align-items:center;gap:6px;font-size:10px}
- .sr input[type=range]{flex:1;accent-color:var(--ui-accent);min-height:44px}
- .sr .sv{width:34px;text-align:right;color:var(--ui-text)}
- .div{height:1px;background:var(--ui-border)}
- .modes{display:flex;flex-direction:column;gap:2px}
- .mode-opt{display:flex;align-items:center;gap:6px;font-size:10px;cursor:pointer;min-height:36px}
- .mode-opt input{accent-color:var(--ui-accent);width:14px;height:14px;flex-shrink:0}
- .tog{display:flex;align-items:center;gap:8px;font-size:10px;cursor:pointer;min-height:44px}
- .tog input{accent-color:var(--ui-accent);width:16px;height:16px;flex-shrink:0}
- button{
- background:transparent;border:1px solid var(--ui-border);
- color:var(--ui-text);font-family:monospace;font-size:10px;
- padding:17px 8px;border-radius:4px;cursor:pointer;width:100%;
- }
- button:hover{border-color:var(--ui-accent);color:var(--ui-accent)}
-
- @media(max-width:600px){
- .layout{flex-direction:column}
- aside{width:100%}
- .stage{height:480px}
- .avatar{width:32px;height:32px;font-size:10px}
- }
- @media(prefers-reduced-motion:reduce){.row{will-change:auto}}
- </style>
-</head>
-<body>
-
-<header>
- <h1>Fly-in Fly-out Contact List</h1>
- <p>Rows translate and fade as they enter and exit the scroll viewport — effect scrubbed continuously to scroll position.</p>
-</header>
-
-<div class="layout">
-
- <div class="stage" id="stage">
- <div class="contact-list" id="contact-list">
- <div class="zone-overlay" id="zone-overlay">
- <div class="zone-band zone-exit" id="zone-exit">
- <span class="zone-label">↑ exit zone</span>
- </div>
- <div class="zone-band zone-entry" id="zone-entry">
- <span class="zone-label" style="position:absolute;bottom:2px">↓ entry zone</span>
- </div>
- </div>
- </div>
- </div>
-
- <aside>
- <p class="note">The combination of fade + translate + scale is what gives this effect its 'flying' quality. Each property alone feels mechanical. Together they read as smooth, physical motion.</p>
-
- <div>
- <div class="lbl">Viewport</div>
- <div class="tbl">
- <div class="kv"><span>Scroll</span><span class="v" id="scroll-prog">0%</span></div>
- <div class="kv"><span>Visible rows</span><span class="v" id="visible-count">0</span></div>
- </div>
- </div>
-
- <div class="div"></div>
-
- <div>
- <div class="lbl" id="dist-lbl">Translate Distance</div>
- <div class="sr"><input type="range" id="dist-sl" aria-labelledby="dist-lbl" min="0" max="80" value="40"><span class="sv" id="dist-val">40px</span></div>
- </div>
- <div>
- <div class="lbl" id="scale-lbl">Scale Delta</div>
- <div class="sr"><input type="range" id="scale-sl" aria-labelledby="scale-lbl" min="80" max="100" value="94"><span class="sv" id="scale-val">0.94</span></div>
- </div>
- <div>
- <div class="lbl" id="zone-lbl">Zone Size</div>
- <div class="sr"><input type="range" id="zone-sl" aria-labelledby="zone-lbl" min="10" max="40" value="25"><span class="sv" id="zone-val">25%</span></div>
- </div>
-
- <div class="div"></div>
-
- <div>
- <div class="lbl">Effect Mode</div>
- <div class="modes">
- <label class="mode-opt"><input type="radio" name="mode" value="all" checked><span>All combined</span></label>
- <label class="mode-opt"><input type="radio" name="mode" value="translate"><span>Translate only</span></label>
- <label class="mode-opt"><input type="radio" name="mode" value="fade"><span>Fade only</span></label>
- </div>
- </div>
-
- <div class="div"></div>
-
- <label class="tog" for="preview-tog">
- <input type="checkbox" id="preview-tog">
- <span>Preview zones</span>
- </label>
-
- <button id="reset-btn">Reset</button>
- </aside>
-
-</div>
-
-</body>
-</html>
-```
-
-- [ ] **Step 2: Check line count**
-
-```bash
-wc -l animations/01-scroll-based/fly-in-fly-out-contact-list/index.html
-```
-
-Expected: under 160 lines. JS in Task 3 will bring the total to ~270.
-
-- [ ] **Step 3: Commit**
-
-```bash
-git add animations/01-scroll-based/fly-in-fly-out-contact-list/index.html
-git commit -m "feat: add fly-in-fly-out-contact-list HTML scaffold"
-```
-
----
-
-## Task 3: Contact Data, IntersectionObserver, and Scroll Animation JS
-
-**Files:**
-- Modify: `animations/01-scroll-based/fly-in-fly-out-contact-list/index.html` — insert `<script>` before `</body>`
-
-- [ ] **Step 1: Insert script block**
-
-Find `</body>\n</html>` at end and replace with:
-
-```html
-<script>
- const CONTACTS = [
- {i:'SK',n:'Sara Klein', s:'Design lead · Berlin', t:'now', b:0,o:true },
- {i:'MR',n:'Marco Rossi', s:'Engineering · Milan', t:'2h', b:3,o:false},
- {i:'YT',n:'Yuki Tanaka', s:'Product · Tokyo', t:'1d', b:0,o:false},
- {i:'AO',n:'Amara Okafor', s:'Research · Lagos', t:'now', b:0,o:true },
- {i:'LP',n:'Lena Park', s:'UX · Seoul', t:'5m', b:1,o:true },
- {i:'JB',n:'Jules Bernard', s:'Data · Paris', t:'3h', b:0,o:false},
- {i:'RM',n:'Ravi Mehta', s:'Infra · Mumbai', t:'2d', b:0,o:false},
- {i:'CF',n:'Clara Ferreira',s:'Brand · São Paulo', t:'30m', b:7,o:true },
- {i:'SO',n:"Sam O'Brien", s:'Mobile · Dublin', t:'now', b:0,o:true },
- {i:'NW',n:'Nia Williams', s:'Growth · London', t:'1h', b:2,o:false},
- {i:'DK',n:'Dae-Jung Kim', s:'Security · Busan', t:'4h', b:0,o:false},
- {i:'HZ',n:'Hana Zhao', s:'ML · Shanghai', t:'now', b:0,o:true },
- {i:'TN',n:'Tariq Nassar', s:'Strategy · Dubai', t:'2d', b:0,o:false},
- {i:'EV',n:'Elena Vasquez', s:'Finance · Mexico City', t:'45m', b:4,o:false},
- {i:'IB',n:'Ivan Brykov', s:'Platform · Kyiv', t:'now', b:0,o:true },
- ];
- const COLORS = ['#1a3a5c','#2d1b3d','#1e3a1e','#3d2000','#1a3a3a',
- '#3a1a1a','#1a2a3d','#2d1a3d','#1e2d1e','#3a2a00'];
- const avatarColor = i => COLORS[(i.charCodeAt(0)+i.charCodeAt(1))%COLORS.length];
-
- const list = document.getElementById('contact-list');
- const rows = CONTACTS.map(c => {
- const el = document.createElement('div');
- el.className = 'row';
- el.innerHTML =
- `<div class="avatar" style="background:${avatarColor(c.i)}">${c.i}</div>` +
- `<div class="row-info"><div class="row-name">${c.n}</div>` +
- `<div class="row-sub">${c.s}</div></div>` +
- `<div class="row-meta">` +
- (c.b ? `<span class="badge">${c.b}</span>` : `<span class="dot ${c.o?'online':'offline'}"></span>`) +
- `<span class="meta-time">${c.t}</span></div>`;
- list.appendChild(el);
- return el;
- });
-
- const stage = document.getElementById('stage');
- const scrollProg = document.getElementById('scroll-prog');
- const visCount = document.getElementById('visible-count');
- const distSl = document.getElementById('dist-sl');
- const distVal = document.getElementById('dist-val');
- const scaleSl = document.getElementById('scale-sl');
- const scaleVal = document.getElementById('scale-val');
- const zoneSl = document.getElementById('zone-sl');
- const zoneVal = document.getElementById('zone-val');
- const previewTog = document.getElementById('preview-tog');
- const resetBtn = document.getElementById('reset-btn');
- const zoneOverlay= document.getElementById('zone-overlay');
- const zoneExit = document.getElementById('zone-exit');
- const zoneEntry = document.getElementById('zone-entry');
- const motionMQ = window.matchMedia('(prefers-reduced-motion: reduce)');
-
- let DIST = 40, SCALE = 0.94, Z = 0.25, mode = 'all';
- let ticking = false;
- const visible = new Set();
-
- const io = new IntersectionObserver(entries => {
- entries.forEach(e => e.isIntersecting ? visible.add(e.target) : visible.delete(e.target));
- }, { root: stage, rootMargin: '25% 0px', threshold: 0 });
- rows.forEach(r => io.observe(r));
-
- function lerp(a, b, t) { return a + (b - a) * t; }
- function clamp(v, lo, hi) { return Math.min(Math.max(v, lo), hi); }
-
- function applyRow(el) {
- const pos = (el.offsetTop - stage.scrollTop) / stage.clientHeight;
- const reduced = motionMQ.matches;
- let opacity = 1, ty = 0, sc = 1;
-
- if (pos < Z) {
- const t = clamp(pos / Z, 0, 1);
- opacity = reduced ? lerp(0.3, 1, t) : (mode !== 'translate' ? lerp(0, 1, t) : 1);
- if (!reduced && mode !== 'fade') ty = lerp(-DIST, 0, t);
- if (!reduced && mode === 'all') sc = lerp(SCALE, 1, t);
- } else if (pos > 1 - Z) {
- const t = clamp((1 - pos) / Z, 0, 1);
- opacity = reduced ? lerp(0.3, 1, t) : (mode !== 'translate' ? lerp(0, 1, t) : 1);
- if (!reduced && mode !== 'fade') ty = lerp(DIST, 0, t);
- if (!reduced && mode === 'all') sc = lerp(SCALE, 1, t);
- }
-
- el.style.opacity = opacity;
- el.style.transform = `translate3d(0,${ty}px,0) scale(${sc})`;
- }
-
- function updateOverlay() {
- const h = stage.clientHeight, zH = Math.round(h * Z);
- zoneExit.style.height = zH + 'px';
- zoneEntry.style.height = zH + 'px';
- zoneEntry.style.top = (h - zH) + 'px';
- }
-
- function update() {
- const st = stage.scrollTop;
- const max = stage.scrollHeight - stage.clientHeight;
- scrollProg.textContent = max > 0 ? Math.round(st / max * 100) + '%' : '0%';
- visible.forEach(applyRow);
- visCount.textContent = visible.size;
- ticking = false;
- }
-
- stage.addEventListener('scroll', () => {
- if (!ticking) { requestAnimationFrame(update); ticking = true; }
- }, { passive: true });
-
- distSl.addEventListener('input', () => { DIST = +distSl.value; distVal.textContent = DIST + 'px'; update(); });
- scaleSl.addEventListener('input', () => { SCALE = scaleSl.value / 100; scaleVal.textContent = SCALE.toFixed(2); update(); });
- zoneSl.addEventListener('input', () => { Z = zoneSl.value / 100; zoneVal.textContent = zoneSl.value + '%'; updateOverlay(); update(); });
- document.querySelectorAll('input[name="mode"]').forEach(r =>
- r.addEventListener('change', () => { mode = r.value; update(); }));
- previewTog.addEventListener('change', () => zoneOverlay.classList.toggle('visible', previewTog.checked));
-
- resetBtn.addEventListener('click', () => {
- distSl.value = 40; DIST = 40; distVal.textContent = '40px';
- scaleSl.value = 94; SCALE = 0.94; scaleVal.textContent = '0.94';
- zoneSl.value = 25; Z = 0.25; zoneVal.textContent = '25%';
- document.querySelector('input[value="all"]').checked = true; mode = 'all';
- previewTog.checked = false; zoneOverlay.classList.remove('visible');
- stage.scrollTop = 0; updateOverlay(); update();
- });
-
- updateOverlay();
- update();
-</script>
-</body>
-</html>
-```
-
-- [ ] **Step 2: Check final line count**
-
-```bash
-wc -l animations/01-scroll-based/fly-in-fly-out-contact-list/index.html
-```
-
-Expected: under 290 lines.
-
-- [ ] **Step 3: Verify in browser**
-
-Open the file. Scroll down inside the dark stage.
-
-Expected — visual behavior:
-- Rows slide in from the bottom as they enter: fade from invisible + translate up from +40px
-- Rows in the center of the viewport: fully visible, no transform
-- Rows sliding off the top: fade out + translate up to -40px
-- Scrolling back up reverses the effect — rows reappear
-- Effect is smooth, not a one-time trigger
-
-Expected — controls:
-- Translate distance at 0: fade only, no movement
-- Scale delta at 1.00: rows don't shrink at edges
-- Zone size at 10%: very tight transition zone, snappier feel
-- Zone size at 40%: very wide zone, most rows always in transition
-- "Translate only" mode: rows move but don't fade
-- "Fade only" mode: rows fade but don't move or scale
-- "Preview zones" toggle: red band at top, green band at bottom of viewport
-
-Expected — reduced motion:
-- In DevTools: `prefers-reduced-motion: reduce` → no translate or scale; only a subtle opacity fade (0.3 → 1) at zone edges
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add animations/01-scroll-based/fly-in-fly-out-contact-list/index.html
-git commit -m "feat: add contact generation, IntersectionObserver, and scroll animation"
-```
-
----
-
-## Self-Review
-
-### Spec coverage
-
-| Requirement | Covered |
-|-------------|---------|
-| 15 contact rows: avatar (initials + deterministic color), name, sub-line, meta | Task 3 — `CONTACTS` array, `avatarColor()`, innerHTML generation |
-| Three visual zones: entering/active/exiting | Task 3 — `applyRow()` piecewise logic |
-| Entry: opacity 0→1, translateY +DIST→0, scale SCALE→1 | Task 3 — `pos > 1 - Z` branch |
-| Exit: opacity 0→1, translateY -DIST→0, scale SCALE→1 | Task 3 — `pos < Z` branch |
-| Active: fully visible, stable | Task 3 — neither branch → opacity=1, ty=0, sc=1 |
-| Continuous, scrubbed, bidirectional | Task 3 — scroll handler calls `update()` → `visible.forEach(applyRow)` every frame |
-| IntersectionObserver to limit which rows update | Task 3 — `io` with `root: stage, rootMargin: '25% 0px'`, `visible` Set |
-| transform + opacity only (no top/margin/height) | Task 3 — `translate3d` + `opacity` only in `applyRow` |
-| Scroll progress readout | Task 3 — `scrollProg.textContent` |
-| Visible rows counter | Task 3 — `visCount.textContent = visible.size` |
-| Translate distance slider (0–80px, default 40) | Task 2 (markup) + Task 3 |
-| Scale delta slider (0.80–1.00, default 0.94) | Task 2 (markup, range 80–100) + Task 3 |
-| Zone size slider (10%–40%, default 25%) | Task 2 (markup) + Task 3 |
-| "All / translate / fade" effect mode toggle | Task 2 (markup) + Task 3 — `mode` variable |
-| "Preview zones" overlay | Task 2 (markup) + Task 3 — `updateOverlay()`, `visible` class toggle |
-| Reset button | Task 3 — restores all defaults, scrolls to top |
-| Educational note | Task 2 — `<p class="note">` |
-| Mobile: controls stack below | Task 2 — `@media(max-width:600px)` |
-| Mobile: avatar 32px, min-height 56px on rows | Task 2 CSS |
-| Sliders touch targets ≥44px | Task 2 — `min-height:44px` on range inputs |
-| Touch scroll drives effect | Task 3 — passive scroll listener on `.stage` |
-| prefers-reduced-motion: fade only 0.3→1 | Task 3 — `reduced` flag in `applyRow` |
-| Under 300 lines | Task 3 Step 2 — explicit check |
-
-### Placeholder scan
-
-None.
-
-### Type consistency
-
-- `DIST` — `Number`, set from `+distSl.value`; used in `lerp(-DIST, 0, t)` and `lerp(DIST, 0, t)` in `applyRow`. ✓
-- `SCALE` — `Number` in [0.80, 1.00], set from `scaleSl.value / 100`; used in `lerp(SCALE, 1, t)`. ✓
-- `Z` — `Number` in [0.10, 0.40], set from `zoneSl.value / 100`; used in `pos < Z`, `pos > 1 - Z`, `zH = Math.round(h * Z)`. ✓
-- `mode` — string `'all' | 'translate' | 'fade'`; read from radio `r.value`; compared via `!==` in `applyRow`. ✓
-- `visible` — `Set<HTMLElement>`; populated by `io` callback; iterated with `visible.forEach(applyRow)`. ✓
diff --git a/docs/superpowers/plans/2026-05-20-reverse-scrolling-columns.md b/docs/superpowers/plans/2026-05-20-reverse-scrolling-columns.md
deleted file mode 100644
index 28f515e0..00000000
--- a/docs/superpowers/plans/2026-05-20-reverse-scrolling-columns.md
+++ /dev/null
@@ -1,611 +0,0 @@
-# Reverse-Scrolling Columns Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Build a scroll stage with three infinitely-looping columns where the center scrolls down and the two flanking columns scroll up, with a live speed-multiplier slider that lets users break and restore the depth illusion.
-
-**Architecture:** Single `index.html`. Cards are generated by JS (not hardcoded HTML) to stay under 300 lines. Each column-inner contains two identical card sets stacked; modulo math wraps the `translate3d` offset for seamless looping. The center column uses a `margin-top: -singleSetH` trick so its downward motion loops from above. A passive rAF-throttled scroll listener drives all three column transforms.
-
-**Tech Stack:** Plain HTML5, CSS custom properties, vanilla JS. No libraries, no build step.
-
----
-
-## File Map
-
-| Action | Path | Responsibility |
-|--------|------|----------------|
-| Create | `animations/01-scroll-based/reverse-scrolling-columns/index.html` | Full demo |
-| Create | `animations/01-scroll-based/reverse-scrolling-columns/README.md` | 6-section explanation |
-| Modify | `animations/01-scroll-based/README.md` | Add entry |
-| Modify | `index.html` (root) | Add link |
-| Modify | `animations/01-scroll-based/parallax-depth-of-field/README.md` | Add back-link |
-| Modify | `animations/01-scroll-based/parallax-scrolling/README.md` | Add back-link |
-
----
-
-## Task 1: Folder, README, and All Index/Back-Link Updates
-
-**Files:**
-- Create: `animations/01-scroll-based/reverse-scrolling-columns/README.md`
-- Modify: `animations/01-scroll-based/README.md`
-- Modify: `index.html` (root)
-- Modify: `animations/01-scroll-based/parallax-depth-of-field/README.md`
-- Modify: `animations/01-scroll-based/parallax-scrolling/README.md`
-
-- [ ] **Step 1: Create folder**
-
-```bash
-mkdir -p animations/01-scroll-based/reverse-scrolling-columns
-```
-
-- [ ] **Step 2: Create README.md**
-
-Create `animations/01-scroll-based/reverse-scrolling-columns/README.md`:
-
-```markdown
-# Reverse-Scrolling Columns
-
-[Live demo](index.html)
-
-## What it is
-
-Reverse-scrolling columns place a normally-scrolling center column between
-two flanking columns that scroll in the opposite direction. All three columns
-loop infinitely using a two-set DOM structure and modulo offset math. The
-opposing motion amplifies perceived depth: the brain interprets counter-motion
-as evidence of different distances — the same cue used in parallax, but made
-explicit and exaggerated.
-
-## When to use it
-
-- Hero layouts where bold visual contrast sets the editorial tone
-- Portfolio or agency showcases that need motion without heavy assets
-- Scrolljacking-free scroll-driven features (the stage drives its own scroll)
-- Anywhere opposing motion is used intentionally to create visual tension
-
-## How it works
-
-Each column contains two identical card sets stacked vertically. A single
-`scroll` event listener reads `stage.scrollTop` and feeds it into a
-`requestAnimationFrame` callback that applies `translate3d` to each column:
-
-```js
-// Center column — scrolls down (margin-top pre-offsets by -singleSetH)
-const cOff = scrollTop % singleSetH;
-centerInner.style.transform = `translate3d(0, ${cOff}px, 0)`;
-
-// Side columns — scroll up at the multiplier's magnitude
-const sideOff = (scrollTop * Math.abs(mult)) % singleSetH;
-const sideY = mult >= 0 ? sideOff : -sideOff;
-sideInner.style.transform = `translate3d(0, ${sideY}px, 0)`;
-```
-
-`singleSetH` is the height of one card set (12 cards + gaps), measured from
-the DOM after card generation. The modulo keeps the offset in the range
-`[0, singleSetH)`, producing a seamless wrap when the second set aligns
-exactly with where the first set started.
-
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| `mult` | −1.0 | Side-column direction and speed; negative = reverse |
-| `singleSetH` | measured | Height of one card set; determines loop period |
-| Card count | 12 | More cards = longer loop period |
-| Scene height | 2000px | Total scroll travel (max scroll ≈ 1380px) |
-
-## Production notes
-
-- **Infinite loop requires modulo math.** Without wrapping, columns run out
- of content after one traversal. The two-set structure (one visible, one
- waiting) ensures there is always content at either end.
-- **Vestibular risk at high speed.** Opposing motion is a known vestibular
- trigger. In production, keep `|mult|` between 0.3 and 1.0; avoid values
- above 1.5. Always respect `prefers-reduced-motion` by setting `mult = 0`
- (side columns freeze) — opposing motion is specifically listed in WCAG 2.3
- as a hazard for motion-sensitive users.
-- **Library equivalents.** GSAP ScrollTrigger can drive column transforms
- with `scrub: true` and custom callbacks per column. Locomotive Scroll
- exposes per-element `data-scroll-speed` attributes that accept negative
- values for reverse motion. Lenis + a scroll subscriber achieves the same.
-- **Performance.** `translate3d` promotes each column to its own compositor
- layer. Pair with `will-change: transform` declared in CSS before the first
- paint. Never animate `top`, `margin-top`, or `height` — those trigger layout.
-
-## See also
-
-- [Parallax Scrolling](../parallax-scrolling/) — speed-ratio depth without
- opposing direction; the foundation this technique builds on.
-- [Parallax Depth-of-Field](../parallax-depth-of-field/) — depth via blur
- rather than directional contrast.
-```
-
-- [ ] **Step 3: Update category README**
-
-Open `animations/01-scroll-based/README.md` and replace its entire content with:
-
-```markdown
-# Scroll-Based Animations
-
-Techniques driven by scroll position.
-
-## Entries
-
-- [Parallax Depth-of-Field](parallax-depth-of-field/) — Five layered SVG mountains with
- parallax translation and blur-based depth-of-field driven by scroll progress.
-- [Parallax Scrolling](parallax-scrolling/) — Four SVG layers at different scroll speeds
- create a 3D depth illusion; adjustable speed multipliers show how ratios make or break the effect.
-- [Reverse-Scrolling Columns](reverse-scrolling-columns/) — A center column that scrolls
- normally while two flanking columns scroll in the opposite direction, looping infinitely.
-```
-
-- [ ] **Step 4: Update root index.html**
-
-In root `index.html`, find:
-
-```html
- <li>
- <a href="animations/01-scroll-based/parallax-scrolling/">Parallax Scrolling</a>
- <span class="desc" style="display:block">Four SVG layers at different scroll speeds create a 3D depth illusion; adjustable speed sliders show how ratios make or break the effect.</span>
- </li>
- </ul>
-```
-
-Replace with:
-
-```html
- <li>
- <a href="animations/01-scroll-based/parallax-scrolling/">Parallax Scrolling</a>
- <span class="desc" style="display:block">Four SVG layers at different scroll speeds create a 3D depth illusion; adjustable speed sliders show how ratios make or break the effect.</span>
- </li>
- <li>
- <a href="animations/01-scroll-based/reverse-scrolling-columns/">Reverse-Scrolling Columns</a>
- <span class="desc" style="display:block">A center column scrolls normally while two flanking columns scroll in reverse, looping infinitely — the opposing motion creates a striking depth contrast.</span>
- </li>
- </ul>
-```
-
-- [ ] **Step 5: Add back-link to parallax-depth-of-field README**
-
-In `animations/01-scroll-based/parallax-depth-of-field/README.md`, find the `## See also` section and replace it with:
-
-```markdown
-## See also
-
-- [Parallax Scrolling](../parallax-scrolling/) — four SVG layers at different scroll speeds;
- the speed-ratio concept without the blur.
-- [Reverse-Scrolling Columns](../reverse-scrolling-columns/) — opposing column motion
- creates depth contrast via direction rather than blur or speed ratios.
-```
-
-- [ ] **Step 6: Add back-link to parallax-scrolling README**
-
-In `animations/01-scroll-based/parallax-scrolling/README.md`, find the `## See also` section and replace it with:
-
-```markdown
-## See also
-
-- [Parallax Depth-of-Field](../parallax-depth-of-field/) — the same depth
- technique with blur applied per layer based on focal-plane distance rather
- than translation speed.
-- [Reverse-Scrolling Columns](../reverse-scrolling-columns/) — takes speed-ratio
- depth further by making columns scroll in opposite directions.
-```
-
-- [ ] **Step 7: Commit**
-
-```bash
-git add animations/ index.html
-git commit -m "feat: add reverse-scrolling-columns README and update all indexes"
-```
-
----
-
-## Task 2: HTML Scaffold — CSS, Layout, and Sidebar Markup
-
-**Files:**
-- Create: `animations/01-scroll-based/reverse-scrolling-columns/index.html`
-
-Build the full page without JavaScript. Column divs will be empty — cards are injected by JS in Task 3.
-
-- [ ] **Step 1: Create index.html**
-
-Create `animations/01-scroll-based/reverse-scrolling-columns/index.html` with exactly this content:
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Reverse-Scrolling Columns</title>
- <style>
- :root{
- --bg:#060a10;--ui-bg:#0d1117;--ui-border:#21262d;
- --ui-accent:#58a6ff;--ui-text:#c9d1d9;--ui-muted:#8b949e;
- --card-bg:#161b22;
- }
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- body{background:var(--bg);color:var(--ui-text);font-family:monospace;
- padding:clamp(12px,3vw,24px)}
- header{margin-bottom:20px}
- header h1{font-size:clamp(11px,1.8vw,15px);letter-spacing:2px;text-transform:uppercase}
- header p{font-size:clamp(10px,1.2vw,12px);color:var(--ui-muted);margin-top:4px}
-
- .layout{display:flex;gap:clamp(12px,2vw,24px);align-items:flex-start}
-
- .stage{
- flex:1;min-width:0;height:620px;
- overflow-y:scroll;scrollbar-width:none;
- border:1px solid var(--ui-border);border-radius:8px;
- }
- .stage::-webkit-scrollbar{display:none}
- .scene{height:2000px}
- .columns{
- position:sticky;top:0;height:620px;
- display:flex;gap:8px;overflow:hidden;padding:8px;
- }
- .col{flex:1;overflow:hidden}
- .col-inner{display:flex;flex-direction:column;gap:8px;will-change:transform}
- .card-set{display:flex;flex-direction:column;gap:8px}
-
- .card{
- background:var(--card-bg);border:1px solid var(--ui-border);
- border-radius:6px;padding:10px 12px;
- display:flex;align-items:center;gap:10px;flex-shrink:0;
- }
- .icon-box{
- width:28px;height:28px;border-radius:4px;flex-shrink:0;
- display:flex;align-items:center;justify-content:center;
- }
- .card-label{font-size:11px;color:var(--ui-text);letter-spacing:.3px}
- .card-meta{font-size:9px;color:var(--ui-muted);margin-top:2px}
-
- aside{
- width:clamp(200px,22vw,240px);flex-shrink:0;
- background:var(--ui-bg);border:1px solid var(--ui-border);
- border-radius:8px;padding:16px;
- display:flex;flex-direction:column;gap:10px;
- }
- .note{
- font-size:10px;color:var(--ui-muted);line-height:1.6;
- border-left:2px solid var(--ui-accent);padding-left:8px;
- }
- .lbl{font-size:10px;text-transform:uppercase;letter-spacing:1px;color:var(--ui-accent)}
- .row{display:flex;justify-content:space-between;font-size:10px}
- .row .v{color:var(--ui-text)}
- .tbl{display:flex;flex-direction:column;gap:2px}
- .tbl .row{font-size:10px;color:var(--ui-muted)}
- .sr{display:flex;align-items:center;gap:6px;font-size:10px}
- .sr input[type=range]{flex:1;accent-color:var(--ui-accent);min-height:44px}
- .sr .sv{width:40px;text-align:right;color:var(--ui-text)}
- .div{height:1px;background:var(--ui-border)}
- .tog{display:flex;align-items:center;gap:8px;font-size:10px;cursor:pointer;min-height:44px}
- .tog input{accent-color:var(--ui-accent);width:16px;height:16px;flex-shrink:0}
- button{
- background:transparent;border:1px solid var(--ui-border);
- color:var(--ui-text);font-family:monospace;font-size:10px;
- padding:17px 8px;border-radius:4px;cursor:pointer;width:100%;
- }
- button:hover{border-color:var(--ui-accent);color:var(--ui-accent)}
-
- @media(max-width:600px){
- .layout{flex-direction:column}
- aside{width:100%}
- .stage{height:480px}
- .columns{height:480px}
- .col-right{display:none}
- }
- @media(prefers-reduced-motion:reduce){.col-inner{will-change:auto}}
- </style>
-</head>
-<body>
-
-<header>
- <h1>Reverse-Scrolling Columns</h1>
- <p>A center column that scrolls normally while two flanking columns scroll in the opposite direction.</p>
-</header>
-
-<div class="layout">
-
- <div class="stage" id="stage">
- <div class="scene">
- <div class="columns">
- <div class="col">
- <div class="col-inner" id="inner-left"></div>
- </div>
- <div class="col">
- <div class="col-inner" id="inner-center"></div>
- </div>
- <div class="col col-right">
- <div class="col-inner" id="inner-right"></div>
- </div>
- </div>
- </div>
- </div>
-
- <aside>
- <p class="note">The illusion of the side columns 'flowing the other way' is purely visual — they scroll at the same speed as your input, just in the opposite direction. Setting the multiplier to +1.0× makes them move with you and the effect disappears.</p>
-
- <div>
- <div class="lbl">Scroll Progress</div>
- <div class="row"><span>Progress</span><span class="v" id="progress">0%</span></div>
- </div>
-
- <div>
- <div class="lbl">Column Offsets</div>
- <div class="tbl">
- <div class="row"><span>Left</span><span class="v" id="off-left">0px</span></div>
- <div class="row"><span>Center</span><span class="v" id="off-center">0px</span></div>
- <div class="row"><span>Right</span><span class="v" id="off-right">0px</span></div>
- </div>
- </div>
-
- <div class="div"></div>
-
- <div>
- <div class="lbl">Speed Multiplier</div>
- <div class="sr">
- <input type="range" id="mult-slider" min="-200" max="200" step="10" value="-100">
- <span class="sv" id="mult-val">−1.0×</span>
- </div>
- </div>
-
- <div class="div"></div>
-
- <label class="tog" for="match-tog">
- <input type="checkbox" id="match-tog">
- <span>Match direction (+1.0×)</span>
- </label>
-
- <button id="reset-btn">Reset</button>
- </aside>
-
-</div>
-
-</body>
-</html>
-```
-
-- [ ] **Step 2: Check line count**
-
-```bash
-wc -l animations/01-scroll-based/reverse-scrolling-columns/index.html
-```
-
-Expected: under 130 lines (JS added in Task 3 will bring total to ~280).
-
-- [ ] **Step 3: Commit**
-
-```bash
-git add animations/01-scroll-based/reverse-scrolling-columns/index.html
-git commit -m "feat: add reverse-scrolling-columns HTML scaffold"
-```
-
----
-
-## Task 3: Card Generation + Infinite Loop JS
-
-**Files:**
-- Modify: `animations/01-scroll-based/reverse-scrolling-columns/index.html` — insert `<script>` before `</body>`
-
-- [ ] **Step 1: Insert the script block**
-
-Find `</body>\n</html>` at the end of `index.html` and replace with:
-
-```html
-<script>
- const CARDS = [
- {s:'grid', l:'Project Alpha', m:'Design · 2024', a:'#58a6ff'},
- {s:'circle', l:'Studio Work', m:'Motion · 2023', a:'#bf91f3'},
- {s:'tri', l:'Concept 03', m:'Dev · 2024', a:'#3fb950'},
- {s:'diamond', l:'Brand Atlas', m:'Identity · 2023', a:'#f78166'},
- {s:'cross', l:'Interface V2', m:'UX · 2024', a:'#ffa657'},
- {s:'arc', l:'Motion Reel', m:'Video · 2022', a:'#79c0ff'},
- {s:'zz', l:'Type Study', m:'Type · 2023', a:'#d2a8ff'},
- {s:'dot', l:'Data Viz', m:'Research · 2024', a:'#56d364'},
- {s:'lines', l:'Scroll Kit', m:'Library · 2023', a:'#58a6ff'},
- {s:'hex', l:'Space UI', m:'Design · 2024', a:'#bf91f3'},
- {s:'wave', l:'Sound Tools', m:'Audio · 2023', a:'#3fb950'},
- {s:'ring', l:'Orbit System', m:'Motion · 2024', a:'#f78166'},
- ];
- const SVG = {
- grid: '<rect x="2" y="2" width="4" height="4" rx="1" fill="currentColor"/><rect x="8" y="2" width="4" height="4" rx="1" fill="currentColor" opacity=".45"/><rect x="2" y="8" width="4" height="4" rx="1" fill="currentColor" opacity=".45"/><rect x="8" y="8" width="4" height="4" rx="1" fill="currentColor"/>',
- circle: '<circle cx="7" cy="7" r="4" stroke="currentColor" stroke-width="1.5" fill="none"/><circle cx="7" cy="7" r="1.5" fill="currentColor"/>',
- tri: '<polygon points="7,2 12,11 2,11" stroke="currentColor" stroke-width="1.5" fill="none"/>',
- diamond:'<polygon points="7,1 13,7 7,13 1,7" stroke="currentColor" stroke-width="1.5" fill="none"/>',
- cross: '<line x1="7" y1="2" x2="7" y2="12" stroke="currentColor" stroke-width="1.5"/><line x1="2" y1="7" x2="12" y2="7" stroke="currentColor" stroke-width="1.5"/>',
- arc: '<path d="M3 10 Q7 2 11 10" stroke="currentColor" stroke-width="1.5" fill="none"/>',
- zz: '<polyline points="2,10 5,4 8,10 11,4" stroke="currentColor" stroke-width="1.5" fill="none"/>',
- dot: '<circle cx="7" cy="7" r="2.5" fill="currentColor"/><circle cx="3" cy="11" r="1.5" fill="currentColor" opacity=".5"/><circle cx="11" cy="11" r="1.5" fill="currentColor" opacity=".5"/>',
- lines: '<line x1="2" y1="5" x2="12" y2="5" stroke="currentColor" stroke-width="1.5"/><line x1="2" y1="9" x2="9" y2="9" stroke="currentColor" stroke-width="1.5"/>',
- hex: '<polygon points="7,1 12,4 12,10 7,13 2,10 2,4" stroke="currentColor" stroke-width="1.5" fill="none"/>',
- wave: '<path d="M2 7 C4 4 6 10 8 7 S12 4 12 7" stroke="currentColor" stroke-width="1.5" fill="none"/>',
- ring: '<circle cx="7" cy="7" r="5" stroke="currentColor" stroke-width="2" fill="none"/><circle cx="7" cy="7" r="2" fill="currentColor" opacity=".35"/>',
- };
-
- function makeSet() {
- const div = document.createElement('div');
- div.className = 'card-set';
- div.innerHTML = CARDS.map(c =>
- `<div class="card">` +
- `<div class="icon-box" style="background:${c.a}22;color:${c.a}">` +
- `<svg width="14" height="14" viewBox="0 0 14 14">${SVG[c.s]}</svg></div>` +
- `<div><div class="card-label">${c.l}</div>` +
- `<div class="card-meta">${c.m}</div></div></div>`
- ).join('');
- return div;
- }
-
- const leftInner = document.getElementById('inner-left');
- const centerInner = document.getElementById('inner-center');
- const rightInner = document.getElementById('inner-right');
-
- [leftInner, centerInner, rightInner].forEach(el => {
- el.appendChild(makeSet());
- el.appendChild(makeSet());
- });
-
- // Measure loop period AFTER DOM insertion
- const singleSetH = leftInner.children[0].offsetHeight + 8; // +8px = gap between the two sets
-
- // Center column: pre-offset upward so set A is above the viewport, set B is visible
- centerInner.style.marginTop = `-${singleSetH}px`;
-
- const stage = document.getElementById('stage');
- const progEl = document.getElementById('progress');
- const offLeft = document.getElementById('off-left');
- const offCtr = document.getElementById('off-center');
- const offRight = document.getElementById('off-right');
- const slider = document.getElementById('mult-slider');
- const multVal = document.getElementById('mult-val');
- const matchTog = document.getElementById('match-tog');
- const resetBtn = document.getElementById('reset-btn');
- const motionMQ = window.matchMedia('(prefers-reduced-motion: reduce)');
- let mult = -1.0;
- let ticking = false;
-
- function fmt(n) { return (n >= 0 ? '+' : '') + n.toFixed(1) + '×'; }
-
- function update() {
- if (motionMQ.matches) return;
- const st = stage.scrollTop;
- const max = stage.scrollHeight - stage.clientHeight;
- progEl.textContent = max > 0 ? Math.round(st / max * 100) + '%' : '0%';
-
- // Center: always scrolls downward; margin-top=-singleSetH makes it loop from above
- const cOff = st % singleSetH;
- centerInner.style.transform = `translate3d(0,${cOff}px,0)`;
- offCtr.textContent = Math.round(cOff) + 'px';
-
- // Sides: magnitude drives speed, sign drives direction
- const sideRaw = st * Math.abs(mult);
- const sideOff = sideRaw % singleSetH;
- const sideY = mult >= 0 ? sideOff : -sideOff;
- leftInner.style.transform = `translate3d(0,${sideY}px,0)`;
- rightInner.style.transform = `translate3d(0,${sideY}px,0)`;
- offLeft.textContent = Math.round(sideY) + 'px';
- offRight.textContent = Math.round(sideY) + 'px';
-
- ticking = false;
- }
-
- stage.addEventListener('scroll', () => {
- if (motionMQ.matches) return;
- if (!ticking) { requestAnimationFrame(update); ticking = true; }
- }, { passive: true });
-
- slider.addEventListener('input', () => {
- if (matchTog.checked) return;
- mult = slider.value / 100;
- multVal.textContent = fmt(mult);
- update();
- });
-
- matchTog.addEventListener('change', () => {
- mult = matchTog.checked ? 1.0 : slider.value / 100;
- multVal.textContent = fmt(mult);
- update();
- });
-
- resetBtn.addEventListener('click', () => {
- matchTog.checked = false;
- slider.value = -100;
- mult = -1.0;
- multVal.textContent = '−1.0×';
- stage.scrollTop = 0;
- update();
- });
-
- update();
-</script>
-</body>
-</html>
-```
-
-- [ ] **Step 2: Check final line count**
-
-```bash
-wc -l animations/01-scroll-based/reverse-scrolling-columns/index.html
-```
-
-Expected: under 280 lines. If over 300, collapse SVG strings to fewer characters.
-
-- [ ] **Step 3: Verify in browser**
-
-Open `animations/01-scroll-based/reverse-scrolling-columns/index.html`.
-
-Expected — static state:
-- Three equal columns with 12 cards each visible (cards injected by JS)
-- Cards show icon box with tinted background, label, meta line
-- Dark stage with sidebar to the right
-
-Expected — scroll behavior:
-- Left and right columns scroll upward as user scrolls down
-- Center column scrolls downward as user scrolls down
-- All three loop seamlessly — no gap or jump when a set repeats
-- Progress % updates in sidebar; offset readouts update live
-
-Expected — controls:
-- Slider at 0: side columns freeze (only center moves)
-- Slider at +1.0: all three move same direction (effect breaks, no depth contrast)
-- Slider at −2.0: side columns move twice as fast in reverse (dramatic)
-- "Match direction" toggle: forces mult to +1.0, dims slider
-- Reset: scrolls back to top, restores −1.0, clears toggle
-
-Expected — mobile (resize to ≤600px):
-- Right column hidden, two-column layout (left + center)
-- Sidebar stacks below stage
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add animations/01-scroll-based/reverse-scrolling-columns/index.html
-git commit -m "feat: add card generation and infinite-loop scroll mechanic"
-```
-
----
-
-## Self-Review
-
-### Spec coverage
-
-| Requirement | Covered by |
-|-------------|-----------|
-| 3 columns: left up, center down, right up | Task 3 — `sideY = -sideOff`, `cOff = +offset` |
-| ~12 cards per column, portfolio tiles | Task 3 — `CARDS` array (12 entries), Style A |
-| Cards: icon box, label, meta | Task 3 — `makeSet()` generates `.card` with `.icon-box`, `.card-label`, `.card-meta` |
-| Infinite loop via modulo | Task 3 — `% singleSetH`; center margin-top trick; two card-sets per column |
-| Single rAF-throttled scroll listener | Task 3 — `ticking` flag, passive listener |
-| `translate3d` for GPU | Task 3 — all transforms use `translate3d(0,Xpx,0)` |
-| Speed multiplier slider −2.0 to +2.0 | Task 2 (markup) + Task 3 (slider listener) |
-| Slider at +1.0 = effect disappears | Task 3 — `sideY = mult >= 0 ? sideOff : -sideOff`; at mult=+1, sides move down with center |
-| Match direction toggle | Task 3 — `matchTog` forces mult=1.0 |
-| Per-column offset readout | Task 3 — `offLeft`, `offCtr`, `offRight` updated in `update()` |
-| Scroll progress % | Task 3 — `progEl.textContent` |
-| Reset button | Task 3 — resets scrollTop, mult, slider, toggle |
-| Educational note | Task 2 — `<p class="note">` |
-| Mobile: 2 columns (left + center) | Task 2 — `@media(max-width:600px) .col-right{display:none}` |
-| Controls stack below on mobile | Task 2 — `flex-direction:column` at ≤600px |
-| Touch targets ≥44px | Task 2 — slider `min-height:44px`, button `padding:17px`, toggle `min-height:44px` |
-| Touch scroll works | Task 3 — passive listener on `.stage` (real scroll event, works with touch) |
-| `prefers-reduced-motion` — freeze all | Task 3 — `motionMQ.matches` guard in `update()` and scroll handler |
-| `will-change: transform` on col-inners | Task 2 — CSS `.col-inner { will-change:transform }` |
-| README all 6 sections | Task 1 |
-| Category README updated | Task 1 |
-| Root index updated | Task 1 |
-| Back-links in sibling entries | Task 1 |
-| Single file, no deps, offline | All code inline |
-| Under 300 lines | Task 3 Step 2 — explicit check |
-
-### Placeholder scan
-
-None.
-
-### Type/name consistency
-
-- `singleSetH` — computed in Task 3 after DOM insertion; used in `update()` in same script. ✓
-- `mult` — declared at module scope; mutated by slider, toggle, reset. ✓
-- `leftInner`, `centerInner`, `rightInner` — set from `getElementById`; used in `update()`. ✓
-- `matchTog` checkbox ID is `match-tog`; JS selects it with `getElementById('match-tog')`. ✓
-- Slider `value` is in range [−200, 200]; divided by 100 → [−2.0, +2.0]. Consistent with `mult` semantics throughout. ✓
diff --git a/docs/superpowers/plans/2026-09-25-demo-page-redesign-pilot.md b/docs/superpowers/plans/2026-09-25-demo-page-redesign-pilot.md
deleted file mode 100644
index 61c70752..00000000
--- a/docs/superpowers/plans/2026-09-25-demo-page-redesign-pilot.md
+++ /dev/null
@@ -1,2038 +0,0 @@
-# Demo Page Redesign — Foundation + Entrance & Exit Pilot Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Build the shared demo-page layout (big playing demo, side column with settings, prompt preview and Read more), switch the site to Schibsted Grotesk, and convert the 13 Entrance & Exit demos as the pilot the user reviews before any other category changes.
-
-**Architecture:** Each demo keeps its animation code inside its own `index.html`. A shared stylesheet (`assets/css/handbook.css`) and script (`assets/js/handbook.js`) supply the page chrome: layout, fonts, the prompt box, "Read more" (rendered live from the demo's `README.md`) and Replay. A one-time migration tool (`tools/migrate-demo.js`) rewrites each legacy page into the new skeleton from a per-category JSON file that also carries each demo's prompt.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (ES5-style in the shared script so it runs everywhere). Node 24's built-in test runner for tests and the migration tool — no npm packages. Headless Chrome and the browser pane for visual checks.
-
-**Spec:** `docs/superpowers/specs/2026-09-25-demo-page-redesign-design.md` · **Approved visual:** `samples/demo-page-design.html`
-
-## Global Constraints
-
-- No build step, no frameworks, no npm packages (CLAUDE.md). Tests use only `node:test`, `node:assert`, `node:fs`, `node:path`.
-- No code appears anywhere on the site: no code blocks, no "Copy source" / "Source ↗", README "How it works" and "Production notes" are never rendered, inline code in rendered README text is shown as plain text.
-- The copied prompt is the prompt text plus `\n\nSettings from the demo: <label> <value>, ….` generated from the demo's controls.
-- Prompts: 60–130 words, tool- and framework-neutral, no code, end with "Match the settings listed below."
-- Fonts: Schibsted Grotesk (SIL Open Font License), self-hosted in `assets/fonts/`. Download only after the user approves the download.
-- Breakpoints: mobile ≤ 600px, tablet 601–1024px, desktop ≥ 1025px. Touch targets ≥ 44×44px on mobile. Respect `prefers-reduced-motion`.
-- Desktop stage fills `100dvh` minus the 48px bar and padding; side column `clamp(300px, 27vw, 370px)`; tablet column 300px; phone stage `56svh`, at least 320px.
-- Preserve every demo's animation behaviour exactly (CLAUDE.md refactor rule). Only the page chrome around the stage changes.
-- Work on branch `feat/demo-page-redesign`. Commit at the end of each task. Do not push. Do not touch demos outside `animations/02-entrance-and-exit/` (they keep Bricolage and Plex Mono until their own plan).
-
----
-
-## File Structure
-
-| File | Status | Responsibility |
-|---|---|---|
-| `assets/js/handbook.js` | Create | Shared page behaviour: README → HTML helpers, settings line, prompt box, Read more, Replay, auto-play |
-| `assets/css/handbook.css` | Create | Shared page chrome: fonts, tokens, top bar, layout, side column, restyled controls, prompt box, details |
-| `assets/fonts/schibsted-latin.woff2` | Create (download) | Schibsted Grotesk variable 400–900, Latin |
-| `assets/fonts/schibsted-latin-ext.woff2` | Create (download) | Schibsted Grotesk variable 400–900, Latin Extended |
-| `tools/migrate-demo.js` | Create | One-time rewrite of a legacy demo page into the shared skeleton |
-| `tools/migrations/02-entrance-and-exit.json` | Create | Per-demo data for the pilot: number, pager, markers, one-off edits, plain lede, prompt |
-| `tests/handbook.test.js` | Create | Unit tests for the pure helpers in `handbook.js` |
-| `tests/migrate.test.js` | Create | Tests for `tools/migrate-demo.js` |
-| `tests/fixtures/legacy-demo.html` | Create | Minimal legacy page used by the migration tests |
-| `tests/pages.test.js` | Create | Static checks for converted pages, pilot READMEs and the home page |
-| `animations/02-entrance-and-exit/*/index.html` | Modify (13) | Converted by the migration tool |
-| `animations/02-entrance-and-exit/*/README.md` | Modify (13) | Plain-language "What it is" and "Key parameters" |
-| `index.html` | Modify | Schibsted Grotesk, new intro line |
-
-Run all tests from the repo root with:
-
-```bash
-node --test "tests/*.test.js"
-```
-
----
-
-## Verification kit (used by Tasks 3, 4, 6, 7, 9)
-
-**Start the site.** Use the browser pane's `preview_start` with `{ "name": "static-site" }` (serves the repo on `http://localhost:8731`). Without that tool, run `python -m http.server 8731 --bind 127.0.0.1` from the repo root in the background.
-
-**Page check.** Open a converted demo in the browser pane, set the viewport with `resize_window` (1280×800, 768×1024, then preset `mobile`), reload, and run this with `javascript_tool` (top-level `await` works there):
-
-```js
-const q = s => document.querySelector(s);
-const wait = ms => new Promise(r => setTimeout(r, ms));
-await wait(1500);
-const res = { page: location.pathname, width: innerWidth };
-res.noOverflowX = document.documentElement.scrollWidth <= innerWidth + 1;
-const vis = r => r.width * Math.max(0, Math.min(r.bottom, innerHeight) - Math.max(r.top, 0));
-res.stageBiggest = vis(q('.hb-view > .stage').getBoundingClientRect()) > vis(q('.hb-side').getBoundingClientRect());
-const line = q('.hb-prompt-box .hb-set');
-res.settingsLine = line ? line.textContent : null;
-const slider = [...document.querySelectorAll('.hb-settings input[type=range]')].find(r => !r.closest('[data-hb-skip]'));
-if (slider) {
- const before = line.textContent;
- slider.value = slider.value === slider.max ? slider.min : slider.max;
- slider.dispatchEvent(new Event('input', { bubbles: true }));
- await wait(50);
- res.settingsLineFollowsSlider = line.textContent !== before;
-}
-let copied = '';
-Object.defineProperty(navigator.clipboard, 'writeText', { configurable: true, value: t => { copied = t; return Promise.resolve(); } });
-q('.hb-prompt-box .hb-copy').click();
-await wait(50);
-res.copyHasPrompt = copied.startsWith(q('.hb-prompt').textContent.trim());
-res.copyHasSettings = /\n\nSettings from the demo: .+\.$/.test(copied);
-res.replayButton = !!q('.hb-replay');
-q('.hb-more').click();
-await wait(1500);
-const d = q('#details');
-res.detailsOpen = !d.hidden;
-res.detailsHeadings = [...d.querySelectorAll('h2')].map(h => h.textContent).join(' | ');
-res.codeInDetails = d.querySelectorAll('pre, code').length;
-res.brokenRelated = [];
-for (const a of d.querySelectorAll('.hb-rel')) { const r = await fetch(a.href); if (!r.ok) res.brokenRelated.push(a.getAttribute('href')); }
-if (innerWidth <= 600) res.smallTargets = [...document.querySelectorAll('.hb-bar a, .hb-settings .seg button, .hb-settings .act, .hb-settings .tog, .hb-settings select, .hb-copy, .hb-more, .hb-replay')].filter(e => e.getBoundingClientRect().height < 44).length;
-res
-```
-
-Expected: `noOverflowX: true`, `stageBiggest: true`, `settingsLine` starts with `Your settings:`, `settingsLineFollowsSlider: true`, `copyHasPrompt: true`, `copyHasSettings: true`, `replayButton: true`, `detailsOpen: true`, `detailsHeadings: "What it is | When to use it | What the controls do | Full prompt | Related animations"`, `codeInDetails: 0`, `brokenRelated: []`, and on the phone size `smallTargets: 0`. Then call `read_console_messages` with `onlyErrors: true` — expected: no errors. Reload the page before checking the next size (the check changes a slider).
-
-**Screenshots.** Headless Chrome, one Chrome run per shell command, each with a fresh profile folder:
-
-```bash
-OUT="$(cygpath -w /tmp)"
-"/c/Program Files/Google/Chrome/Application/chrome.exe" --headless=new --disable-gpu --hide-scrollbars --user-data-dir="$OUT\\hb-$RANDOM" --window-size=1440,860 --force-device-scale-factor=1 --virtual-time-budget=3000 "--screenshot=$OUT\\hb-desktop.png" "http://localhost:8731/animations/02-entrance-and-exit/bounce-in/"
-```
-
-Add `--force-prefers-reduced-motion` for the reduced-motion view. Headless Chrome will not make a window narrower than about 500px, so capture phones through an iframe:
-
-```bash
-cat > /tmp/hb-phone.html <<'EOF'
-<!doctype html><meta charset="utf-8"><style>html,body{margin:0;background:#1d1d22}iframe{border:0;width:390px;height:844px;display:block}</style>
-<iframe src="http://localhost:8731/animations/02-entrance-and-exit/bounce-in/"></iframe>
-EOF
-OUT="$(cygpath -w /tmp)"
-"/c/Program Files/Google/Chrome/Application/chrome.exe" --headless=new --disable-gpu --hide-scrollbars --user-data-dir="$OUT\\hb-$RANDOM" --window-size=600,860 --force-device-scale-factor=2 --virtual-time-budget=3000 "--screenshot=$OUT\\hb-phone.png" "file:///$(cygpath -m /tmp)/hb-phone.html"
-```
-
-The phone view is the top-left 780×1688 pixels of `hb-phone.png`. Open screenshots with the Read tool and compare them with `samples/demo-page-design.html` at the same size.
-
----
-
-### Task 1: Shared script — README and settings helpers
-
-**Files:**
-- Create: `assets/js/handbook.js`
-- Test: `tests/handbook.test.js`
-
-**Interfaces:**
-- Produces (exported from `assets/js/handbook.js`, `module.exports` in Node, `window.Handbook` in browsers):
- - `escapeHtml(s: string): string`
- - `plain(s: string): string` — drops backticks and `**`, then escapes
- - `inline(md: string): string` — HTML; inline code → plain text; links, bold, italics
- - `sections(md: string): { [heading: string]: string }` — split on `## ` headings
- - `paragraphs(text: string): string` — `<p>` HTML
- - `bullets(text: string): string[]` — inline HTML per `- ` item
- - `cleanName(s: string): string` — drops parentheticals that contain code
- - `table(text: string): Array<{ name: string, value: string, effect: string }>` — all HTML-safe
- - `seeAlso(text: string): Array<{ name: string, href: string, desc: string }>`
- - `settingsLine(items: Array<{ label: string, value: string }>): string`
-
-- [ ] **Step 1: Write the failing tests**
-
-Create `tests/handbook.test.js`:
-
-```js
-// Unit tests for the pure helpers in assets/js/handbook.js.
-// Run from the repo root: node --test "tests/*.test.js"
-const test = require('node:test');
-const assert = require('node:assert/strict');
-const HB = require('../assets/js/handbook.js');
-
-test('escapeHtml escapes markup characters', () => {
- assert.equal(HB.escapeHtml('<a href="x">&</a>'), '&lt;a href=&quot;x&quot;&gt;&amp;&lt;/a&gt;');
-});
-
-test('plain drops code and bold markers and escapes', () => {
- assert.equal(HB.plain('`ease-out` **fast** <b>'), 'ease-out fast &lt;b&gt;');
-});
-
-test('inline shows code as plain text and renders links, bold and italics', () => {
- assert.equal(HB.inline('Use `opacity` on **one** *hero* [card](../scale-in/)'),
- 'Use opacity on <strong>one</strong> <em>hero</em> <a href="../scale-in/">card</a>');
- assert.equal(HB.inline('a < b'), 'a &lt; b');
-});
-
-test('sections splits a README by its ## headings', () => {
- const md = '# Title\r\n\r\n## What it is\r\nLine one\r\nline two\r\n\r\n## When to use it\r\n- A\r\n- B\r\n';
- assert.deepEqual(HB.sections(md), { 'What it is': 'Line one\nline two', 'When to use it': '- A\n- B' });
-});
-
-test('sections keeps ### lines inside the section they belong to', () => {
- assert.deepEqual(HB.sections('## A\n### not a section\nx'), { A: '### not a section\nx' });
-});
-
-test('paragraphs joins wrapped lines and splits on blank lines', () => {
- assert.equal(HB.paragraphs('One\ntwo.\n\nThree `x`.'), '<p>One two.</p><p>Three x.</p>');
- assert.equal(HB.paragraphs(undefined), '');
-});
-
-test('bullets returns the list items as inline HTML', () => {
- assert.deepEqual(HB.bullets('- Hero **copy**\nnot a bullet\n- Toasts'), ['Hero <strong>copy</strong>', 'Toasts']);
-});
-
-test('cleanName drops parentheticals that hold code', () => {
- assert.equal(HB.cleanName('Duration (`--dur`)'), 'Duration');
- assert.equal(HB.cleanName('Perspective (`--persp`, on parent)'), 'Perspective');
- assert.equal(HB.cleanName('Two curtains (split)'), 'Two curtains (split)');
-});
-
-test('table reads Key parameters rows and skips the header and divider', () => {
- const md = '| Parameter | Default | Effect |\n|-----------|---------|--------|\n' +
- '| Duration (`--dur`) | 600ms | Under 150ms **barely** registers |\n| Easing | `ease-out` | Settles gently |';
- assert.deepEqual(HB.table(md), [
- { name: 'Duration', value: '600ms', effect: 'Under 150ms <strong>barely</strong> registers' },
- { name: 'Easing', value: 'ease-out', effect: 'Settles gently' }
- ]);
- assert.deepEqual(HB.table(''), []);
-});
-
-test('seeAlso reads name, link and description', () => {
- const md = '- [Scale In](../scale-in/) — the same entrance without the overshoot\n- [Blur In](../blur-in/)\nText';
- assert.deepEqual(HB.seeAlso(md), [
- { name: 'Scale In', href: '../scale-in/', desc: 'the same entrance without the overshoot' },
- { name: 'Blur In', href: '../blur-in/', desc: '' }
- ]);
-});
-
-test('settingsLine joins label and value pairs and skips empty ones', () => {
- assert.equal(HB.settingsLine([
- { label: 'Duration', value: '600ms' }, { label: 'Easing', value: 'Ease out' }, { label: 'Mode', value: '' }
- ]), 'Duration 600ms, Easing Ease out');
- assert.equal(HB.settingsLine([]), '');
-});
-```
-
-- [ ] **Step 2: Run the tests to verify they fail**
-
-Run: `node --test "tests/*.test.js"`
-Expected: FAIL — `Cannot find module '../assets/js/handbook.js'`.
-
-- [ ] **Step 3: Write the helpers**
-
-Create `assets/js/handbook.js`:
-
-```js
-/* Animation Handbook — shared behaviour for the demo pages.
- * These helpers turn a demo's README.md into the "Read more" section and build
- * the settings line for the copied prompt. They are exported for tests/handbook.test.js. */
-(function (root, factory) {
- var api = factory();
- if (typeof module === 'object' && module.exports) module.exports = api;
- else root.Handbook = api;
-})(typeof self !== 'undefined' ? self : this, function () {
- 'use strict';
-
- function escapeHtml(s) {
- return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
- }
-
- // Text with Markdown code and bold markers removed, safe to insert as HTML.
- function plain(s) {
- return escapeHtml(String(s).replace(/`/g, '').replace(/\*\*/g, ''));
- }
-
- // Inline Markdown from README prose. Inline code becomes plain text: the site shows no code.
- function inline(md) {
- return escapeHtml(md)
- .replace(/`([^`]+)`/g, '$1')
- .replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, '<a href="$2">$1</a>')
- .replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
- .replace(/\*([^*\n]+)\*/g, '<em>$1</em>');
- }
-
- // A README split into { "What it is": "...", ... } by its "## " headings.
- function sections(md) {
- var out = {}, current = null, buf = [];
- String(md).replace(/\r\n?/g, '\n').split('\n').forEach(function (line) {
- var m = /^##\s+(.+?)\s*$/.exec(line);
- if (m) {
- if (current) out[current] = buf.join('\n').trim();
- current = m[1];
- buf = [];
- } else if (current) {
- buf.push(line);
- }
- });
- if (current) out[current] = buf.join('\n').trim();
- return out;
- }
-
- function paragraphs(text) {
- return String(text || '').split(/\n\s*\n/)
- .map(function (p) { return p.trim(); })
- .filter(Boolean)
- .map(function (p) { return '<p>' + inline(p.replace(/\s*\n\s*/g, ' ')) + '</p>'; })
- .join('');
- }
-
- function bullets(text) {
- return String(text || '').split('\n')
- .filter(function (l) { return /^\s*[-*]\s+/.test(l); })
- .map(function (l) { return inline(l.replace(/^\s*[-*]\s+/, '')); });
- }
-
- // "Duration (`--dur`)" becomes "Duration": parentheticals that hold code are dropped.
- function cleanName(s) {
- return plain(String(s).replace(/\s*\(`[^`]*`[^)]*\)/g, ''));
- }
-
- // The Key parameters table as [{ name, value, effect }], without its header and divider rows.
- function table(text) {
- var rows = String(text || '').split('\n')
- .filter(function (l) { return /^\s*\|/.test(l); })
- .map(function (l) {
- return l.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map(function (c) { return c.trim(); });
- });
- return rows.slice(1)
- .filter(function (r) { return !r.every(function (c) { return /^:?-{2,}:?$/.test(c); }); })
- .map(function (r) { return { name: cleanName(r[0] || ''), value: plain(r[1] || ''), effect: inline(r[2] || '') }; });
- }
-
- // "- [Name](../slug/) — description" lines as [{ name, href, desc }].
- function seeAlso(text) {
- return String(text || '').split('\n').map(function (l) {
- var m = /^\s*[-*]\s+\[([^\]]+)\]\(([^)\s]+)\)\s*(?:[—–-]\s*(.*))?$/.exec(l);
- return m ? { name: plain(m[1]), href: m[2], desc: m[3] ? inline(m[3]) : '' } : null;
- }).filter(Boolean);
- }
-
- function settingsLine(items) {
- return (items || [])
- .filter(function (i) { return i && i.label && i.value; })
- .map(function (i) { return i.label + ' ' + i.value; })
- .join(', ');
- }
-
- return {
- escapeHtml: escapeHtml, plain: plain, inline: inline, sections: sections, paragraphs: paragraphs,
- bullets: bullets, cleanName: cleanName, table: table, seeAlso: seeAlso, settingsLine: settingsLine
- };
-});
-```
-
-- [ ] **Step 4: Run the tests to verify they pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS — 11 tests, 0 failures.
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add assets/js/handbook.js tests/handbook.test.js
-git commit -m "feat: add the shared demo-page script's README and settings helpers"
-```
-
----
-
-### Task 2: Migration tool for legacy demo pages
-
-**Files:**
-- Create: `tools/migrate-demo.js`
-- Create: `tests/fixtures/legacy-demo.html`
-- Test: `tests/migrate.test.js`
-
-**Interfaces:**
-- Consumes: `escapeHtml` from `assets/js/handbook.js` (Task 1).
-- Produces:
- - `migrate(html: string, cfg: { category: string, name: string }, demo: Demo): string` — throws `Error` whose message starts with the step name when a step does not match exactly once, or `"already migrated"`.
- - `Demo` = `{ slug: string, number: string, prev: { href: string, name: string } | null, next: same | null, autoplay: boolean, attrs?: { [id: string]: string }, edits?: Array<[string, string]>, lede?: string, prompt: string }`
- - CLI: `node tools/migrate-demo.js <config.json> [slug ...]` rewrites `animations/<category>/<slug>/index.html` in place.
- - Output markup contract used by Tasks 3–4: `<body class="hb">` (plus `data-hb-autoplay`), `<nav class="hb-bar">` with `.hb-home` and `.hb-pager` links (`rel="prev"` / `rel="next"`, names in `.hb-name`), `<main class="hb-view">` holding the untouched `.stage` and `<aside class="hb-side">`, which contains `<header class="hb-head">` (`.hb-cat`, `h1`, `.hb-lede`), `<section class="hb-settings">` (`h2.hb-label` + the old controls) and `<div class="hb-take">` with `<section class="hb-prompt-box">` (`h2.hb-label#hb-prompt-title` + `p.hb-prompt`).
-
-- [ ] **Step 1: Write the legacy fixture**
-
-Create `tests/fixtures/legacy-demo.html` (a trimmed copy of the legacy skeleton every demo shares):
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <title>Sample Demo — Animation Handbook</title>
- <style>
- @font-face{font-family:'Bricolage';src:url('../../../assets/fonts/brico-700.woff2') format('woff2');font-weight:700;font-display:swap}
- @font-face{font-family:'PlexMono';src:url('../../../assets/fonts/plex-400.woff2') format('woff2');font-weight:400;font-display:swap}
- :root{--bg:#0b0b0d;--ui-accent:#5fd88a;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px}
- body{padding:24px}
- </style>
-<style id="ah-inject">
-.ah-bar{position:fixed}
-</style>
-</head>
-<body>
-<div class="ah-bar" role="navigation" aria-label="Animation Handbook"><a class="ah-home" href="../../../">← Animation Handbook</a><span class="ah-actions"><a class="ah-hideSm" href="../a/" rel="prev" title="Previous">‹ Prev</a><button type="button" id="ah-copy" class="ah-hideSm">Copy source</button></span></div>
-<header>
- <h1>Sample Demo</h1>
- <p>Uses `code` words in its summary.</p>
-</header>
-<div class="layout">
- <div class="stage"><div class="card" id="card">Card</div></div>
- <aside>
- <p class="note">A technical note that now lives in the README.</p>
- <div><div class="lbl" id="dur-lbl">Duration</div>
- <div class="sr"><input type="range" id="dur-sl" aria-labelledby="dur-lbl" min="100" max="2000" value="600"><span class="sv" id="dur-v">600ms</span></div>
- </div>
- <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog"><span>Auto-loop</span></label>
- <div class="btn-row">
- <button class="act pri" id="btn-in">Play in</button>
- <button class="act" id="btn-rst">Reset</button>
- </div>
- </aside>
-</div>
-<script>
- document.getElementById('btn-in').addEventListener('click',()=>{});
-</script>
-<script>(function(){var b=document.getElementById("ah-copy");if(!b)return;})();</script>
-</body>
-</html>
-```
-
-- [ ] **Step 2: Write the failing tests**
-
-Create `tests/migrate.test.js`:
-
-```js
-// Tests for tools/migrate-demo.js. Run from the repo root: node --test "tests/*.test.js"
-const test = require('node:test');
-const assert = require('node:assert/strict');
-const fs = require('node:fs');
-const path = require('node:path');
-const { migrate } = require('../tools/migrate-demo.js');
-
-const legacy = fs.readFileSync(path.join(__dirname, 'fixtures', 'legacy-demo.html'), 'utf8');
-const cfg = { category: '02-entrance-and-exit', name: 'Entrance & Exit' };
-const demo = {
- slug: 'sample-demo', number: '02.12',
- prev: { href: '../flip-in/', name: 'Flip In' }, next: null,
- autoplay: true,
- attrs: { 'btn-in': 'data-hb-replay', 'btn-rst': 'data-hb-reset', 'loop-tog': 'data-hb-skip data-hb-loop' },
- edits: [['<span>Auto-loop</span>', '<span>Loop it</span>']],
- lede: 'Moves a card into view.',
- prompt: 'Add a <b> & [x] prompt.'
-};
-const out = migrate(legacy, cfg, demo);
-
-test('removes the legacy chrome, fonts and font variables', () => {
- for (const gone of ['ah-inject', 'ah-bar', 'ah-copy', 'Copy source', 'Bricolage', 'PlexMono', '--disp', '--mono', 'class="note"', 'class="layout"', '<header>']) {
- assert.ok(!out.includes(gone), `still contains ${gone}`);
- }
-});
-
-test('links the shared stylesheet and script at the end of <head>', () => {
- assert.ok(out.includes('<link rel="stylesheet" href="../../../assets/css/handbook.css">\n<script src="../../../assets/js/handbook.js" defer></script>\n</head>'));
-});
-
-test('marks the body and builds the top bar', () => {
- assert.ok(out.includes('<body class="hb" data-hb-autoplay>'));
- assert.ok(out.includes('<a class="hb-home" href="../../../">← <span>Animation Handbook</span></a>'));
- assert.ok(out.includes('<a href="../flip-in/" rel="prev" aria-label="Previous: Flip In">‹ <span class="hb-name">Flip In</span></a>'));
- assert.ok(!out.includes('rel="next"'));
-});
-
-test('moves the title into the side column with the number, category and plain lede', () => {
- assert.ok(out.includes('<main class="hb-view">'));
- assert.ok(out.includes('<aside class="hb-side">'));
- assert.ok(out.includes('<p class="hb-cat">02.12 · Entrance &amp; Exit</p>'));
- assert.ok(out.includes('<h1>Sample Demo</h1>'));
- assert.ok(out.includes('<p class="hb-lede">Moves a card into view.</p>'));
- assert.ok(out.includes('<section class="hb-settings" aria-label="Settings">'));
- assert.ok(out.includes('</aside>\n</main>\n'));
-});
-
-test('adds the escaped prompt and keeps the controls and demo script', () => {
- assert.ok(out.includes('<p class="hb-prompt">Add a &lt;b&gt; &amp; [x] prompt.</p>'));
- assert.ok(out.includes('id="dur-sl"'));
- assert.ok(out.includes("document.getElementById('btn-in').addEventListener"));
-});
-
-test('applies marker attributes and one-off edits', () => {
- assert.ok(out.includes('id="btn-in" data-hb-replay'));
- assert.ok(out.includes('id="btn-rst" data-hb-reset'));
- assert.ok(out.includes('id="loop-tog" data-hb-skip data-hb-loop'));
- assert.ok(out.includes('<span>Loop it</span>'));
-});
-
-test('keeps the original lede when none is given', () => {
- const kept = migrate(legacy, cfg, { ...demo, lede: undefined });
- assert.ok(kept.includes('<p class="hb-lede">Uses `code` words in its summary.</p>'));
-});
-
-test('refuses edits that do not match exactly once', () => {
- assert.throws(() => migrate(legacy, cfg, { ...demo, edits: [['<span>Nope</span>', 'x']] }), /edit/);
-});
-
-test('refuses to migrate a page twice', () => {
- assert.throws(() => migrate(out, cfg, demo), /already migrated/);
-});
-```
-
-- [ ] **Step 3: Run the tests to verify they fail**
-
-Run: `node --test "tests/*.test.js"`
-Expected: FAIL — `Cannot find module '../tools/migrate-demo.js'`.
-
-- [ ] **Step 4: Write the migration tool**
-
-Create `tools/migrate-demo.js`:
-
-```js
-#!/usr/bin/env node
-// One-time migration of legacy demo pages to the shared demo layout.
-// See docs/superpowers/specs/2026-09-25-demo-page-redesign-design.md.
-// Usage (repo root): node tools/migrate-demo.js tools/migrations/<category>.json [slug ...]
-'use strict';
-const fs = require('node:fs');
-const path = require('node:path');
-const { escapeHtml } = require('../assets/js/handbook.js');
-
-// Replace `find` exactly once; anything else means the page doesn't have the expected shape.
-function replaceOnce(html, find, replacement, step) {
- const count = typeof find === 'string'
- ? html.split(find).length - 1
- : (html.match(new RegExp(find.source, find.flags.includes('g') ? find.flags : find.flags + 'g')) || []).length;
- if (count !== 1) throw new Error(`${step}: expected exactly 1 match, found ${count}`);
- return html.replace(find, typeof replacement === 'function' ? replacement : () => replacement);
-}
-
-function pagerLink(rel, target) {
- if (!target) return '';
- const label = rel === 'prev' ? 'Previous' : 'Next';
- const name = `<span class="hb-name">${escapeHtml(target.name)}</span>`;
- return `<a href="${target.href}" rel="${rel}" aria-label="${label}: ${escapeHtml(target.name)}">` +
- (rel === 'prev' ? `‹ ${name}` : `${name} ›`) + '</a>';
-}
-
-function topBar(demo) {
- return '<nav class="hb-bar" aria-label="Animation Handbook">' +
- '<a class="hb-home" href="../../../">← <span>Animation Handbook</span></a>' +
- `<span class="hb-pager">${pagerLink('prev', demo.prev)}${pagerLink('next', demo.next)}</span></nav>`;
-}
-
-function migrate(html, cfg, demo) {
- if (html.includes('class="hb-view"')) throw new Error('already migrated');
- let out = html.replace(/\r\n/g, '\n');
-
- // Legacy top bar styles, font files and font variables.
- out = replaceOnce(out, /\n<style id="ah-inject">[\s\S]*?<\/style>/, '', 'ah-inject style');
- const fontFace = /^[ \t]*@font-face\{font-family:'(?:Bricolage|PlexMono)'[^\n]*\n/gm;
- if (!fontFace.test(out)) throw new Error('font-face lines: none found');
- out = out.replace(fontFace, '');
- out = replaceOnce(out, /--disp:[^;}]*;?/, '', '--disp variable');
- out = replaceOnce(out, /--mono:[^;}]*;?/, '', '--mono variable');
-
- // Shared assets, body marker and the new top bar.
- out = replaceOnce(out, '</head>',
- '<link rel="stylesheet" href="../../../assets/css/handbook.css">\n' +
- '<script src="../../../assets/js/handbook.js" defer></script>\n</head>', '</head>');
- out = replaceOnce(out, '<body>', `<body class="hb"${demo.autoplay ? ' data-hb-autoplay' : ''}>`, '<body>');
- out = replaceOnce(out, /<div class="ah-bar"[^\n]*<\/div>\n/, topBar(demo) + '\n', 'ah-bar');
- out = replaceOnce(out, /\n<script>\(function\(\)\{var b=document\.getElementById\("ah-copy"\)[^\n]*<\/script>/, '', 'copy-source script');
-
- // The header moves into the side column; the note moves out (its content lives in the README).
- let title = '';
- let lede = '';
- out = replaceOnce(out, /<header>\s*<h1>([\s\S]*?)<\/h1>\s*<p>([\s\S]*?)<\/p>\s*<\/header>\n/,
- (m, h, p) => { title = h.trim(); lede = p.trim(); return ''; }, 'header');
- if (demo.lede) lede = escapeHtml(demo.lede);
- const head =
- ' <header class="hb-head">\n' +
- ` <p class="hb-cat">${demo.number} · ${escapeHtml(cfg.name)}</p>\n` +
- ` <h1>${title}</h1>\n` +
- ` <p class="hb-lede">${lede}</p>\n` +
- ' </header>\n' +
- ' <section class="hb-settings" aria-label="Settings">\n' +
- ' <h2 class="hb-label">Settings</h2>\n';
- out = replaceOnce(out, '<div class="layout">', '<main class="hb-view">', 'layout wrapper');
- out = replaceOnce(out, /(\n[ \t]*)<aside>\n/, (m, indent) => `${indent}<aside class="hb-side">\n${head}`, 'aside open');
- out = replaceOnce(out, /\n[ \t]*<p class="note">[\s\S]*?<\/p>/, '', 'note');
- const take =
- ' </section>\n' +
- ' <div class="hb-take">\n' +
- ' <section class="hb-prompt-box" aria-labelledby="hb-prompt-title">\n' +
- ' <h2 class="hb-label" id="hb-prompt-title">Prompt</h2>\n' +
- ` <p class="hb-prompt">${escapeHtml(demo.prompt)}</p>\n` +
- ' </section>\n' +
- ' </div>\n';
- out = replaceOnce(out, /([ \t]*)<\/aside>\n<\/div>\n/, (m, indent) => `${take}${indent}</aside>\n</main>\n`, 'aside close');
-
- // Markers the shared script looks for, then one-off edits.
- for (const [id, attrs] of Object.entries(demo.attrs || {})) {
- out = replaceOnce(out, `id="${id}"`, `id="${id}" ${attrs}`, `attrs for #${id}`);
- }
- for (const [find, replacement] of demo.edits || []) {
- out = replaceOnce(out, find, replacement, `edit "${find.slice(0, 40)}"`);
- }
- return out;
-}
-
-function main(argv) {
- const [configPath, ...only] = argv;
- if (!configPath) {
- console.error('Usage: node tools/migrate-demo.js <config.json> [slug ...]');
- process.exit(2);
- }
- const cfg = JSON.parse(fs.readFileSync(configPath, 'utf8'));
- const demos = cfg.demos.filter(d => !only.length || only.includes(d.slug));
- if (only.length && demos.length !== only.length) throw new Error(`unknown slug in: ${only.join(', ')}`);
- const root = path.resolve(__dirname, '..');
- for (const demo of demos) {
- const file = path.join(root, 'animations', cfg.category, demo.slug, 'index.html');
- fs.writeFileSync(file, migrate(fs.readFileSync(file, 'utf8'), cfg, demo));
- console.log('migrated', path.relative(root, file));
- }
-}
-
-if (require.main === module) main(process.argv.slice(2));
-module.exports = { migrate, topBar, replaceOnce };
-```
-
-- [ ] **Step 5: Run the tests to verify they pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS — 20 tests (11 from Task 1, 9 new), 0 failures.
-
-- [ ] **Step 6: Commit**
-
-```bash
-git add tools/migrate-demo.js tests/migrate.test.js tests/fixtures/legacy-demo.html
-git commit -m "feat: add a migration tool for moving demos to the shared layout"
-```
-
----
-
-### Task 3: Fonts, shared stylesheet and the first converted page (Bounce In)
-
-**Files:**
-- Create: `assets/fonts/schibsted-latin.woff2`, `assets/fonts/schibsted-latin-ext.woff2` (download)
-- Create: `assets/css/handbook.css`
-- Create: `tools/migrations/02-entrance-and-exit.json`
-- Create: `tests/pages.test.js`
-- Modify: `animations/02-entrance-and-exit/bounce-in/index.html` (by the migration tool)
-
-**Interfaces:**
-- Consumes: the markup contract from Task 2; the category accent `--ui-accent` that every demo already defines in its `:root`.
-- Produces: CSS classes used by Task 4's script: `.hb-clamp`, `.hb-set`, `.hb-copy`, `.hb-more`, `.hb-replay`, `.hb-details`, `.hb-details-in`, `.hb-back`, `.hb-about`, `.hb-extra`, `.hb-full`, `.hb-full-text`, `.hb-related`, `.hb-rel-list`, `.hb-rel`, `.hb-note`; the font family name `'Schibsted Grotesk'` and variable `--hb-font`.
-
-- [ ] **Step 1: Get the user's approval, then download the font files**
-
-Ask the user before downloading: "May I download two font files from Google Fonts (fonts.gstatic.com, SIL Open Font License) into `assets/fonts/`: `schibsted-latin.woff2` (46,752 bytes) and `schibsted-latin-ext.woff2` (20,924 bytes)?" Continue only after a clear yes. Then run:
-
-```bash
-curl -sSfo assets/fonts/schibsted-latin.woff2 "https://fonts.gstatic.com/s/schibstedgrotesk/v7/Jqz55SSPQuCQF3t8uOwiUL-taUTtap9Gayo.woff2"
-curl -sSfo assets/fonts/schibsted-latin-ext.woff2 "https://fonts.gstatic.com/s/schibstedgrotesk/v7/Jqz55SSPQuCQF3t8uOwiUL-taUTtap9Iayoxdg.woff2"
-wc -c assets/fonts/schibsted-latin*.woff2 && head -c 4 assets/fonts/schibsted-latin.woff2 && echo && head -c 4 assets/fonts/schibsted-latin-ext.woff2 && echo
-```
-
-Expected: `46752` and `20924` bytes, and each file starts with `wOF2`.
-
-- [ ] **Step 2: Write the failing page test**
-
-Create `tests/pages.test.js`:
-
-```js
-// Static checks for demo pages that use the shared layout, their READMEs and the home page.
-// Run from the repo root: node --test "tests/*.test.js"
-const test = require('node:test');
-const assert = require('node:assert/strict');
-const fs = require('node:fs');
-const path = require('node:path');
-
-const ROOT = path.resolve(__dirname, '..');
-const ANIM = path.join(ROOT, 'animations');
-const read = f => fs.readFileSync(f, 'utf8');
-const count = (s, sub) => s.split(sub).length - 1;
-const words = s => s.trim().split(/\s+/).length;
-const isDemoDir = dir => fs.existsSync(path.join(dir, 'index.html'));
-
-const demos = fs.readdirSync(ANIM, { withFileTypes: true }).filter(c => c.isDirectory()).flatMap(c =>
- fs.readdirSync(path.join(ANIM, c.name), { withFileTypes: true }).filter(d => d.isDirectory())
- .map(d => ({ cat: c.name, slug: d.name, dir: path.join(ANIM, c.name, d.name) })));
-const converted = demos.filter(d => read(path.join(d.dir, 'index.html')).includes('<main class="hb-view">'));
-
-const PILOT = '02-entrance-and-exit';
-const PILOT_AUTOPLAY = new Set(['fade-in-out', 'slide-in', 'slide-up-reveal', 'scale-in', 'clip-path-reveal',
- 'split-text-reveal', 'letter-by-letter-stagger', 'word-by-word-reveal', 'blur-in', 'flip-in', 'bounce-in', 'rotate-in']);
-
-test('Bounce In uses the shared layout', () => {
- assert.ok(converted.some(d => d.cat === PILOT && d.slug === 'bounce-in'));
-});
-
-for (const d of converted) {
- test(`${d.cat}/${d.slug} uses the shared layout correctly`, () => {
- const html = read(path.join(d.dir, 'index.html'));
- assert.ok(html.includes('<link rel="stylesheet" href="../../../assets/css/handbook.css">'), 'shared stylesheet');
- assert.ok(html.includes('<script src="../../../assets/js/handbook.js" defer></script>'), 'shared script');
- assert.match(html, /<body class="hb"( data-hb-autoplay)?>/);
- for (const legacy of ['ah-bar', 'ah-copy', 'ah-inject', 'Copy source', 'Bricolage', 'PlexMono', 'class="note"', 'class="layout"']) {
- assert.ok(!html.includes(legacy), `legacy markup left: ${legacy}`);
- }
- for (const part of ['<nav class="hb-bar"', '<main class="hb-view">', '<aside class="hb-side">', '<section class="hb-settings"', '<p class="hb-prompt">']) {
- assert.equal(count(html, part), 1, `exactly one ${part}`);
- }
- assert.match(html, /<p class="hb-cat">\d{2}\.\d{2} · [^<]+<\/p>/);
- const prompt = html.match(/<p class="hb-prompt">([^<]*)<\/p>/)[1];
- assert.ok(words(prompt) >= 60 && words(prompt) <= 130, `prompt has ${words(prompt)} words`);
- assert.ok(prompt.trim().endsWith('Match the settings listed below.'), 'prompt ending');
- assert.ok(!prompt.includes('`'), 'prompt contains no code');
- assert.equal(count(html, 'data-hb-replay'), 1, 'one replay control');
- assert.ok(count(html, 'data-hb-reset') <= 1, 'at most one reset control');
- if (d.cat === PILOT) assert.equal(html.includes('data-hb-autoplay'), PILOT_AUTOPLAY.has(d.slug), 'autoplay flag');
- for (const [, href] of html.matchAll(/<a href="([^"]+)" rel="(?:prev|next)"/g)) {
- assert.ok(isDemoDir(path.resolve(d.dir, href)), `pager link ${href}`);
- }
- });
-}
-```
-
-Run: `node --test "tests/*.test.js"`
-Expected: FAIL — `Bounce In uses the shared layout`.
-
-- [ ] **Step 3: Write the shared stylesheet**
-
-Create `assets/css/handbook.css`:
-
-```css
-/* Animation Handbook — shared page chrome for the demo pages.
- Linked after each demo's own <style>, so these rules win where they overlap.
- The animation itself keeps its own styles; only the layout around it lives here. */
-
-@font-face{font-family:'Schibsted Grotesk';src:url('../fonts/schibsted-latin-ext.woff2') format('woff2');font-weight:400 900;font-style:normal;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('../fonts/schibsted-latin.woff2') format('woff2');font-weight:400 900;font-style:normal;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{
- --hb-font:'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;
- --disp:var(--hb-font);--mono:var(--hb-font);
- --hb-bg:#0b0b0d;--hb-panel:#111114;--hb-panel-2:#0d0d10;
- --hb-ink:#f4f4f2;--hb-dim:#adadb2;--hb-muted:#77777e;--hb-line:rgba(255,255,255,.085);
- --hb-accent:var(--ui-accent,#6ea8ff);--hb-bar:48px;
-}
-
-body.hb{margin:0;padding:0;background:var(--hb-bg);color:var(--hb-ink);font-family:var(--hb-font);-webkit-font-smoothing:antialiased}
-body.hb :focus-visible{outline:2px solid var(--hb-accent);outline-offset:2px}
-
-/* Top bar */
-.hb-bar{position:sticky;top:0;z-index:50;height:var(--hb-bar);display:flex;align-items:center;justify-content:space-between;gap:8px;
- padding:0 clamp(6px,1.6vw,16px);background:rgba(11,11,13,.88);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
- border-bottom:1px solid var(--hb-line);font:500 11px/1 var(--hb-font);letter-spacing:.1em;text-transform:uppercase}
-.hb-bar a{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;min-width:44px;padding:0 8px;
- border-radius:6px;color:var(--hb-muted);text-decoration:none}
-.hb-bar a:hover{color:var(--hb-ink)}
-.hb-bar .hb-home{color:var(--hb-ink)}
-.hb-pager{display:flex}
-
-/* First screen: the stage fills the view, the side column sits beside it */
-.hb-view{display:grid;grid-template-columns:minmax(0,1fr) clamp(300px,27vw,370px);grid-template-rows:minmax(0,1fr);
- grid-template-areas:"stage side";gap:clamp(10px,1.2vw,16px);padding:clamp(10px,1.2vw,16px);box-sizing:border-box;
- height:calc(100vh - var(--hb-bar));height:calc(100dvh - var(--hb-bar));min-height:560px}
-.hb-view>.stage{grid-area:stage;width:auto;height:auto;min-width:0;min-height:0;flex:none;margin:0}
-.hb-replay{grid-area:stage;align-self:end;justify-self:end;position:relative;z-index:3;margin:12px;min-height:44px;padding:0 16px;
- border:1px solid var(--hb-line);border-radius:999px;background:rgba(17,17,20,.85);color:var(--hb-dim);font:500 12px/1 var(--hb-font);cursor:pointer}
-.hb-replay:hover{color:var(--hb-ink);border-color:rgba(255,255,255,.25)}
-
-.hb-view>.hb-side{grid-area:side;width:auto;min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;gap:18px;
- padding:18px 18px 0;background:var(--hb-panel);border:1px solid var(--hb-line);border-radius:10px}
-.hb-head{margin:0;flex:none}
-.hb-cat{margin:0;font:500 11px/1.3 var(--hb-font);letter-spacing:.14em;text-transform:uppercase;color:var(--hb-accent)}
-.hb-side .hb-head h1{margin:8px 0 0;font:800 clamp(28px,2.6vw,36px)/1 var(--hb-font);letter-spacing:-.03em;color:var(--hb-ink)}
-.hb-side .hb-lede{margin:8px 0 0;font:400 13px/1.6 var(--hb-font);color:var(--hb-dim)}
-.hb-label{margin:0 0 8px;font:500 11px/1 var(--hb-font);letter-spacing:.14em;text-transform:uppercase;color:var(--hb-muted)}
-
-/* Settings: the demo's own controls, restyled compactly */
-.hb-settings{display:flex;flex-direction:column;gap:10px;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#2a2a30 transparent}
-.hb-settings .lbl{margin:0;font:500 12px/1.3 var(--hb-font);letter-spacing:0;text-transform:none;color:var(--hb-dim)}
-.hb-settings div:has(>.sr){display:grid;grid-template-columns:1fr auto;grid-template-areas:"label value" "slider slider";column-gap:10px}
-.hb-settings div:has(>.sr)>.lbl{grid-area:label}
-.hb-settings .sr{display:contents}
-.hb-settings .sr input[type=range]{grid-area:slider;width:100%;min-height:30px;margin:0;accent-color:var(--hb-accent);cursor:pointer}
-.hb-settings .sv{grid-area:value;width:auto;font:500 12px/1.3 var(--hb-font);color:var(--hb-ink);text-align:right}
-.hb-settings div:has(>select){display:flex;align-items:center;justify-content:space-between;gap:10px}
-.hb-settings select,.hb-settings input[type=text],.hb-settings textarea{min-height:32px;padding:6px 8px;border:1px solid var(--hb-line);
- border-radius:6px;background:var(--hb-panel-2);color:var(--hb-ink);font:500 12px/1.4 var(--hb-font)}
-.hb-settings input[type=text],.hb-settings textarea{width:100%;font-weight:400}
-.hb-settings .seg{display:flex;flex-wrap:wrap;gap:4px}
-.hb-settings .seg button{flex:1 1 0;min-width:0;min-height:36px;padding:6px 4px;border:1px solid var(--hb-line);border-radius:6px;
- background:none;color:var(--hb-muted);font:500 12px/1.2 var(--hb-font);cursor:pointer}
-.hb-settings .seg button.on{border-color:var(--hb-accent);color:var(--hb-accent);background:color-mix(in srgb,var(--hb-accent) 12%,transparent)}
-.hb-settings .tog{display:flex;flex-direction:row-reverse;align-items:center;justify-content:space-between;gap:10px;min-height:36px;
- font:500 12px/1.3 var(--hb-font);color:var(--hb-dim);cursor:pointer}
-.hb-settings .tog input{appearance:none;-webkit-appearance:none;flex:none;width:36px;height:20px;margin:0;border-radius:999px;cursor:pointer;
- background:radial-gradient(circle at 10px 50%,var(--hb-ink) 6.5px,transparent 7px) #2a2a30}
-.hb-settings .tog input:checked{background:radial-gradient(circle at 26px 50%,#0b0b0d 6.5px,transparent 7px) var(--hb-accent)}
-.hb-settings .kv{display:flex;justify-content:space-between;gap:10px;font:400 12px/1.4 var(--hb-font);color:var(--hb-muted)}
-.hb-settings .kv .v{color:var(--hb-ink)}
-.hb-settings .div{height:1px;margin:2px 0;background:var(--hb-line)}
-.hb-settings .btn-row{display:flex;gap:6px}
-.hb-settings .act{flex:1;min-height:36px;padding:0 6px;border:1px solid var(--hb-line);border-radius:6px;background:none;
- color:var(--hb-ink);font:500 12px/1 var(--hb-font);cursor:pointer}
-.hb-settings .act.pri{border-color:var(--hb-accent);color:var(--hb-accent)}
-
-/* Prompt box and Read more stay visible at the bottom of the column; the settings above scroll on their own */
-.hb-take{margin-top:auto;flex:none;display:flex;flex-direction:column;gap:10px;padding:12px 0 18px;background:var(--hb-panel);border-top:1px solid var(--hb-line)}
-.hb-prompt-box{padding:12px;border:1px solid var(--hb-line);border-radius:8px;background:var(--hb-panel-2)}
-.hb-prompt{margin:0;font:400 13px/1.6 var(--hb-font);color:var(--hb-ink)}
-.hb-clamp{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
-.hb-set{margin:8px 0 0;font:500 12px/1.5 var(--hb-font);color:var(--hb-accent)}
-.hb-copy{display:block;width:100%;margin-top:10px;min-height:44px;border:0;border-radius:6px;background:var(--hb-ink);color:#0b0b0d;
- font:600 12px/1 var(--hb-font);letter-spacing:.04em;cursor:pointer}
-.hb-copy:hover{background:#fff}
-.hb-more{width:100%;min-height:44px;border:1px solid var(--hb-line);border-radius:6px;background:none;color:var(--hb-dim);
- font:500 12px/1 var(--hb-font);cursor:pointer}
-.hb-more:hover{color:var(--hb-ink);border-color:rgba(255,255,255,.25)}
-
-/* Read more: the explanation below the first screen */
-.hb-details{border-top:1px solid var(--hb-line);scroll-margin-top:var(--hb-bar)}
-.hb-details-in{max-width:1120px;margin:0 auto;padding:clamp(20px,3vw,40px) clamp(16px,3vw,32px) 96px;display:grid;
- grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:clamp(20px,4vw,56px)}
-.hb-details .hb-back{grid-column:1/-1;justify-self:start;display:inline-flex;align-items:center;min-height:44px;color:var(--hb-muted);
- text-decoration:none;font:500 11px/1 var(--hb-font);letter-spacing:.1em;text-transform:uppercase}
-.hb-details .hb-back:hover{color:var(--hb-ink)}
-.hb-details h2{margin:0 0 10px;font:700 20px/1.2 var(--hb-font);letter-spacing:-.01em;color:var(--hb-ink)}
-.hb-details section+section{margin-top:34px}
-.hb-details p,.hb-details li,.hb-details dd{margin:0;font:400 14px/1.75 var(--hb-font);color:var(--hb-dim)}
-.hb-details p+p{margin-top:10px}
-.hb-details ul{margin:0;padding:0;list-style:none}
-.hb-details li{position:relative;padding-left:18px}
-.hb-details li+li{margin-top:4px}
-.hb-details li::before{content:"–";position:absolute;left:0;color:var(--hb-accent)}
-.hb-details a{color:var(--hb-ink)}
-.hb-details dl{margin:0;display:grid;grid-template-columns:minmax(120px,auto) 1fr;gap:12px 20px}
-.hb-details dt{font:500 14px/1.5 var(--hb-font);color:var(--hb-ink)}
-.hb-details dt small{display:block;font:400 12px/1.4 var(--hb-font);color:var(--hb-muted)}
-.hb-full{padding:16px;border:1px solid var(--hb-line);border-radius:10px;background:var(--hb-panel)}
-.hb-details .hb-full-text{color:var(--hb-ink);line-height:1.7}
-.hb-details .hb-set{margin-top:8px;font:500 12px/1.5 var(--hb-font);color:var(--hb-accent)}
-.hb-rel{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--hb-line);
- border-radius:8px;text-decoration:none}
-.hb-rel+.hb-rel{margin-top:8px}
-.hb-rel:hover{border-color:rgba(255,255,255,.25)}
-.hb-rel b{display:block;font:700 16px/1.3 var(--hb-font);color:var(--hb-ink)}
-.hb-rel small{display:block;margin-top:2px;font:400 12px/1.5 var(--hb-font);color:var(--hb-muted)}
-.hb-rel i{font-style:normal;color:var(--hb-muted)}
-.hb-details .hb-note{color:var(--hb-muted)}
-
-@media(max-width:1024px){.hb-view{grid-template-columns:minmax(0,1fr) 300px}}
-@media(max-width:760px){.hb-details-in{grid-template-columns:1fr}}
-@media(max-width:600px){
- .hb-bar .hb-name{display:none}
- .hb-view{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto;grid-template-areas:"stage" "side";height:auto;min-height:0}
- .hb-view>.stage{height:calc(100vh * .56);height:calc(100svh * .56);min-height:320px}
- .hb-view>.hb-side{overflow:visible}
- .hb-settings{overflow:visible}
- .hb-settings .sr input[type=range],.hb-settings .seg button,.hb-settings .act,.hb-settings .tog,.hb-settings select{min-height:44px}
-}
-```
-
-- [ ] **Step 4: Write the pilot config with Bounce In**
-
-Create `tools/migrations/02-entrance-and-exit.json`:
-
-```json
-{
- "category": "02-entrance-and-exit",
- "name": "Entrance & Exit",
- "demos": [
- {
- "slug": "bounce-in",
- "number": "02.12",
- "prev": { "href": "../flip-in/", "name": "Flip In" },
- "next": { "href": "../rotate-in/", "name": "Rotate In" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
- "edits": [
- [" <div class=\"div\"></div>\n <div class=\"lbl\">Live keyframes</div>\n <div class=\"kf-block\" id=\"kf-display\">", " <div class=\"kf-block\" id=\"kf-display\" hidden>"]
- ],
- "lede": "Overshoots its final size and position, then springs back to rest.",
- "prompt": "Add a bounce-in entrance to [the element you want to animate]. When it appears, it should start small and a little below its final spot, grow slightly past full size, dip just under it, then settle, as if it landed with a small spring. Each bounce is smaller than the one before, like energy running out, and one bounce usually looks best. Unless the settings turn it off, fade it in at the same time. Animate only its position, size and opacity so it stays smooth. If the visitor has reduced motion turned on, show the element without the bounce. Match the settings listed below."
- }
- ]
-}
-```
-
-(The edit removes the "Live keyframes" code readout from view. The element stays in the page, hidden, because the demo's script still writes to it.)
-
-- [ ] **Step 5: Convert Bounce In**
-
-Run: `node tools/migrate-demo.js tools/migrations/02-entrance-and-exit.json bounce-in`
-Expected: `migrated animations\02-entrance-and-exit\bounce-in\index.html` (separator may be `/`).
-
-- [ ] **Step 6: Run the tests to verify they pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS — all tests, including `Bounce In uses the shared layout` and `02-entrance-and-exit/bounce-in uses the shared layout correctly`.
-
-- [ ] **Step 7: Check the layout in the browser**
-
-Start the site (Verification kit). Open `http://localhost:8731/animations/02-entrance-and-exit/bounce-in/` at 1280×800, 768×1024 and mobile. Confirm by eye or with `read_page`:
-- the top bar shows `← Animation Handbook`, `‹ Flip In`, `Rotate In ›` (arrows only on mobile)
-- the stage fills the left side; the side column shows `02.12 · Entrance & Exit`, `Bounce In`, the plain lede, Settings (restyled sliders with the value on the right, segmented buttons, switch-style toggles) and the Prompt box with the full prompt (the three-line clamp, settings line and buttons arrive in Task 4)
-- the text is Schibsted Grotesk: in `javascript_tool`, `getComputedStyle(document.querySelector('h1')).fontFamily` starts with `"Schibsted Grotesk"` and `document.fonts.check('800 20px "Schibsted Grotesk"')` is `true`
-- `read_console_messages` with `onlyErrors: true` shows no errors, and pressing **Play in** still plays the bounce
-
-- [ ] **Step 8: Commit**
-
-```bash
-git add assets/fonts/schibsted-latin.woff2 assets/fonts/schibsted-latin-ext.woff2 assets/css/handbook.css tools/migrations/02-entrance-and-exit.json tests/pages.test.js animations/02-entrance-and-exit/bounce-in/index.html
-git commit -m "feat: add the shared demo layout and fonts, and convert Bounce In"
-```
-
----
-
-### Task 4: Shared script — prompt box, Read more, Replay and auto-play
-
-**Files:**
-- Modify: `assets/js/handbook.js` (replace the whole file)
-
-**Interfaces:**
-- Consumes: Task 1 helpers; Task 2 markup contract; Task 3 CSS classes; demo markers `data-hb-replay`, `data-hb-reset`, `data-hb-loop`, `data-hb-skip`, `data-hb-label`, `body[data-hb-autoplay]`.
-- Produces (added exports): `readSettings(doc: Document, scope: Element): Array<{ label, value }>`, `boot(doc: Document, win: Window): void`. Runs `boot` automatically in browsers.
-
-- [ ] **Step 1: Run the unit tests (the helpers must keep passing)**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS. These tests guard the helpers while the file is rewritten.
-
-- [ ] **Step 2: Replace `assets/js/handbook.js` with the full version**
-
-```js
-/* Animation Handbook — shared behaviour for the demo pages.
- * Builds the prompt box (settings line + Copy prompt), "Read more" with the
- * explanation from the demo's README.md, and the stage's Replay button.
- * The pure helpers are exported for tests/handbook.test.js. */
-(function (root, factory) {
- var api = factory();
- if (typeof module === 'object' && module.exports) { module.exports = api; return; }
- root.Handbook = api;
- if (typeof document === 'undefined') return;
- if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', function () { api.boot(document, root); });
- } else {
- api.boot(document, root);
- }
-})(typeof self !== 'undefined' ? self : this, function () {
- 'use strict';
-
- /* ---------- Pure helpers ---------- */
-
- function escapeHtml(s) {
- return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
- }
-
- // Text with Markdown code and bold markers removed, safe to insert as HTML.
- function plain(s) {
- return escapeHtml(String(s).replace(/`/g, '').replace(/\*\*/g, ''));
- }
-
- // Inline Markdown from README prose. Inline code becomes plain text: the site shows no code.
- function inline(md) {
- return escapeHtml(md)
- .replace(/`([^`]+)`/g, '$1')
- .replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, '<a href="$2">$1</a>')
- .replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
- .replace(/\*([^*\n]+)\*/g, '<em>$1</em>');
- }
-
- // A README split into { "What it is": "...", ... } by its "## " headings.
- function sections(md) {
- var out = {}, current = null, buf = [];
- String(md).replace(/\r\n?/g, '\n').split('\n').forEach(function (line) {
- var m = /^##\s+(.+?)\s*$/.exec(line);
- if (m) {
- if (current) out[current] = buf.join('\n').trim();
- current = m[1];
- buf = [];
- } else if (current) {
- buf.push(line);
- }
- });
- if (current) out[current] = buf.join('\n').trim();
- return out;
- }
-
- function paragraphs(text) {
- return String(text || '').split(/\n\s*\n/)
- .map(function (p) { return p.trim(); })
- .filter(Boolean)
- .map(function (p) { return '<p>' + inline(p.replace(/\s*\n\s*/g, ' ')) + '</p>'; })
- .join('');
- }
-
- function bullets(text) {
- return String(text || '').split('\n')
- .filter(function (l) { return /^\s*[-*]\s+/.test(l); })
- .map(function (l) { return inline(l.replace(/^\s*[-*]\s+/, '')); });
- }
-
- // "Duration (`--dur`)" becomes "Duration": parentheticals that hold code are dropped.
- function cleanName(s) {
- return plain(String(s).replace(/\s*\(`[^`]*`[^)]*\)/g, ''));
- }
-
- // The Key parameters table as [{ name, value, effect }], without its header and divider rows.
- function table(text) {
- var rows = String(text || '').split('\n')
- .filter(function (l) { return /^\s*\|/.test(l); })
- .map(function (l) {
- return l.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map(function (c) { return c.trim(); });
- });
- return rows.slice(1)
- .filter(function (r) { return !r.every(function (c) { return /^:?-{2,}:?$/.test(c); }); })
- .map(function (r) { return { name: cleanName(r[0] || ''), value: plain(r[1] || ''), effect: inline(r[2] || '') }; });
- }
-
- // "- [Name](../slug/) — description" lines as [{ name, href, desc }].
- function seeAlso(text) {
- return String(text || '').split('\n').map(function (l) {
- var m = /^\s*[-*]\s+\[([^\]]+)\]\(([^)\s]+)\)\s*(?:[—–-]\s*(.*))?$/.exec(l);
- return m ? { name: plain(m[1]), href: m[2], desc: m[3] ? inline(m[3]) : '' } : null;
- }).filter(Boolean);
- }
-
- function settingsLine(items) {
- return (items || [])
- .filter(function (i) { return i && i.label && i.value; })
- .map(function (i) { return i.label + ' ' + i.value; })
- .join(', ');
- }
-
- /* ---------- Page behaviour ---------- */
-
- var CONTROLS = 'input[type=range], input[type=checkbox], select, .seg, .swatches';
-
- function text(node) { return node ? node.textContent.replace(/\s+/g, ' ').trim() : ''; }
-
- function labelFor(doc, control) {
- var own = control.getAttribute('data-hb-label');
- if (own) return own;
- var by = control.getAttribute('aria-labelledby');
- if (by && doc.getElementById(by)) return text(doc.getElementById(by));
- var tog = control.closest('.tog');
- if (tog) return text(tog.querySelector('span') || tog);
- for (var p = control.previousElementSibling; p; p = p.previousElementSibling) {
- if (p.classList.contains('lbl')) return text(p);
- }
- return control.parentElement ? text(control.parentElement.querySelector(':scope > .lbl')) : '';
- }
-
- function valueFor(control) {
- if (control.matches('input[type=range]')) {
- var row = control.closest('.sr');
- var shown = row && row.querySelector('.sv');
- return shown ? text(shown) : control.value;
- }
- if (control.matches('input[type=checkbox]')) return control.checked ? 'on' : 'off';
- if (control.matches('select')) return control.selectedOptions[0] ? text(control.selectedOptions[0]) : control.value;
- var active = control.querySelector('.on');
- return active ? (active.getAttribute('aria-label') || text(active)) : '';
- }
-
- // The demo's current settings in page order, skipping playback controls and anything marked data-hb-skip.
- function readSettings(doc, scope) {
- return Array.prototype.filter.call(scope.querySelectorAll(CONTROLS), function (control) {
- return !control.closest('[data-hb-skip], [hidden], .btn-row');
- }).map(function (control) {
- return { label: labelFor(doc, control), value: valueFor(control) };
- });
- }
-
- function make(doc, tag, className, html) {
- var node = doc.createElement(tag);
- node.className = className;
- if (html) node.innerHTML = html;
- return node;
- }
-
- function renderAbout(md) {
- var s = sections(md), html = '';
- if (s['What it is']) html += '<section><h2>What it is</h2>' + paragraphs(s['What it is']) + '</section>';
- var uses = bullets(s['When to use it']);
- if (uses.length) {
- html += '<section><h2>When to use it</h2><ul>' +
- uses.map(function (u) { return '<li>' + u + '</li>'; }).join('') + '</ul></section>';
- }
- var params = table(s['Key parameters']);
- if (params.length) {
- html += '<section><h2>What the controls do</h2><dl>' + params.map(function (p) {
- return '<dt>' + p.name + (p.value ? '<small>default ' + p.value + '</small>' : '') + '</dt><dd>' + p.effect + '</dd>';
- }).join('') + '</dl></section>';
- }
- return { html: html, related: seeAlso(s['See also']) };
- }
-
- function loadReadme(doc, win, details) {
- var about = details.querySelector('.hb-about');
- var fallback = '<p class="hb-note">The full explanation is in <a href="README.md">README.md</a>.</p>';
- if (win.location.protocol === 'file:' || !win.fetch) { about.innerHTML = fallback; return; }
- win.fetch('README.md').then(function (res) {
- if (!res.ok) throw new Error('README ' + res.status);
- return res.text();
- }).then(function (md) {
- var out = renderAbout(md);
- about.innerHTML = out.html || fallback;
- if (!out.related.length) return;
- var box = details.querySelector('.hb-related');
- box.querySelector('.hb-rel-list').innerHTML = out.related.map(function (r) {
- return '<a class="hb-rel" href="' + escapeHtml(r.href) + '"><span><b>' + r.name + '</b>' +
- (r.desc ? '<small>' + r.desc + '</small>' : '') + '</span><i aria-hidden="true">→</i></a>';
- }).join('');
- box.hidden = false;
- }).catch(function () { about.innerHTML = fallback; });
- }
-
- function boot(doc, win) {
- var view = doc.querySelector('.hb-view');
- var side = view && view.querySelector('.hb-side');
- var promptEl = side && side.querySelector('.hb-prompt');
- if (!promptEl) return;
-
- var settings = side.querySelector('.hb-settings');
- var title = text(side.querySelector('h1'));
- var promptText = text(promptEl);
- var reduce = win.matchMedia ? win.matchMedia('(prefers-reduced-motion: reduce)') : null;
- var lines = [];
-
- function currentLine() { return settings ? settingsLine(readSettings(doc, settings)) : ''; }
- function copyText() {
- var line = currentLine();
- return promptText + (line ? '\n\nSettings from the demo: ' + line + '.' : '');
- }
- function refreshLines() {
- var line = currentLine();
- lines.forEach(function (node) { node.textContent = line ? 'Your settings: ' + line : ''; node.hidden = !line; });
- }
- function settingsNode() { var node = make(doc, 'p', 'hb-set'); lines.push(node); return node; }
- function copyButton() {
- var button = make(doc, 'button', 'hb-copy', 'Copy prompt');
- button.type = 'button';
- button.addEventListener('click', function () {
- function show(label) {
- button.textContent = label;
- win.setTimeout(function () { button.textContent = 'Copy prompt'; }, 1500);
- }
- function selectInstead() {
- var range = doc.createRange();
- range.selectNodeContents(promptEl);
- var selection = win.getSelection();
- selection.removeAllRanges();
- selection.addRange(range);
- show(/Mac|iPhone|iPad/.test(win.navigator.platform || win.navigator.userAgent) ? 'Press ⌘C to copy' : 'Press Ctrl+C to copy');
- }
- var clip = win.navigator.clipboard;
- if (clip && clip.writeText) clip.writeText(copyText()).then(function () { show('Copied ✓'); }, selectInstead);
- else selectInstead();
- });
- return button;
- }
- function scrollBehavior() { return reduce && reduce.matches ? 'auto' : 'smooth'; }
-
- // Prompt box: three-line preview, the live settings line and Copy prompt.
- promptEl.classList.add('hb-clamp');
- var box = promptEl.closest('.hb-prompt-box') || promptEl.parentElement;
- box.appendChild(settingsNode());
- box.appendChild(copyButton());
-
- // Read more: the explanation, full prompt and related animations below the first screen.
- var details = make(doc, 'section', 'hb-details',
- '<div class="hb-details-in">' +
- '<a class="hb-back" href="#top">↑ Back to the demo</a>' +
- '<div class="hb-about"><p class="hb-note">Loading the explanation…</p></div>' +
- '<div class="hb-extra">' +
- '<section><h2>Full prompt</h2><div class="hb-full"><p class="hb-full-text"></p></div></section>' +
- '<section class="hb-related" hidden><h2>Related animations</h2><div class="hb-rel-list"></div></section>' +
- '</div>' +
- '</div>');
- details.id = 'details';
- details.hidden = true;
- details.setAttribute('aria-label', 'About ' + title);
- details.querySelector('.hb-full-text').textContent = promptText;
- var full = details.querySelector('.hb-full');
- full.appendChild(settingsNode());
- full.appendChild(copyButton());
- view.insertAdjacentElement('afterend', details);
-
- var more = make(doc, 'button', 'hb-more');
- more.type = 'button';
- more.setAttribute('aria-controls', 'details');
- (side.querySelector('.hb-take') || side).appendChild(more);
- function setOpen(open, scroll) {
- details.hidden = !open;
- more.setAttribute('aria-expanded', String(open));
- more.textContent = open ? 'Show less ↑' : 'Read more about ' + title + ' ↓';
- if (open && scroll) details.scrollIntoView({ behavior: scrollBehavior(), block: 'start' });
- }
- setOpen(false, false);
- more.addEventListener('click', function () { setOpen(details.hidden, true); });
- details.querySelector('.hb-back').addEventListener('click', function (e) {
- e.preventDefault();
- win.scrollTo({ top: 0, behavior: scrollBehavior() });
- });
- if (win.location.hash === '#details') win.setTimeout(function () { setOpen(true, true); }, 300);
- loadReadme(doc, win, details);
-
- // Replay, auto-play and "changing a setting replays it" all press the demo's own buttons.
- var replayCtl = doc.querySelector('[data-hb-replay]');
- var resetCtl = doc.querySelector('[data-hb-reset]');
- var loopCtl = doc.querySelector('[data-hb-loop]');
- function replay() {
- if (resetCtl) resetCtl.click();
- win.requestAnimationFrame(function () {
- win.requestAnimationFrame(function () { replayCtl.click(); });
- });
- }
- if (replayCtl) {
- var replayButton = make(doc, 'button', 'hb-replay', '↻ Replay');
- replayButton.type = 'button';
- replayButton.setAttribute('aria-label', 'Replay the animation');
- replayButton.addEventListener('click', replay);
- view.appendChild(replayButton);
- if (doc.body.hasAttribute('data-hb-autoplay')) win.setTimeout(function () { replayCtl.click(); }, 400);
- }
-
- var timer = 0;
- function onSettingsChange(e) {
- var target = e.target;
- if (e.type === 'click' && !target.closest('.seg, .swatches')) return;
- if (target.closest('.btn-row, [data-hb-loop]')) return;
- win.setTimeout(refreshLines, 0);
- if (!replayCtl || (loopCtl && loopCtl.checked)) return;
- win.clearTimeout(timer);
- timer = win.setTimeout(replay, 250);
- }
- if (settings) {
- ['input', 'change', 'click'].forEach(function (type) { settings.addEventListener(type, onSettingsChange); });
- }
- refreshLines();
- }
-
- return {
- escapeHtml: escapeHtml, plain: plain, inline: inline, sections: sections, paragraphs: paragraphs,
- bullets: bullets, cleanName: cleanName, table: table, seeAlso: seeAlso, settingsLine: settingsLine,
- readSettings: readSettings, boot: boot
- };
-});
-```
-
-- [ ] **Step 3: Run the unit tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS — all tests.
-
-- [ ] **Step 4: Check Bounce In in the browser**
-
-Reload `http://localhost:8731/animations/02-entrance-and-exit/bounce-in/` and run the Page check (Verification kit) at 1280×800, 768×1024 and mobile. Expected values are listed in the kit; for Bounce In, the initial settings line is `Your settings: Overshoot intensity 60%, Duration 1100ms, Bounces 1× Single, Combine with fade on`. Also confirm by hand:
-- the card bounces in on its own about 0.4s after load
-- **↻ Replay** (bottom-right of the stage) replays it; changing Overshoot or picking **2× Double** replays it after a short pause
-- turning on **Auto-loop**, then changing a setting, does not stop the loop
-- `http://localhost:8731/animations/02-entrance-and-exit/bounce-in/#details` opens with the details already expanded
-Take desktop, phone and reduced-motion screenshots (Verification kit) and compare them with `samples/demo-page-design.html`: same structure and proportions. Under reduced motion the card is visible without bouncing.
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add assets/js/handbook.js
-git commit -m "feat: add the prompt box, Read more, Replay and auto-play to the shared script"
-```
-
----
-
-### Task 5: Plain-language README pass for the 13 pilot demos
-
-**Files:**
-- Modify: `animations/02-entrance-and-exit/<slug>/README.md` for all 13 slugs below
-- Modify: `tests/pages.test.js`
-
-**Interfaces:**
-- Consumes: `sections`, `table` from `assets/js/handbook.js`.
-- Produces: READMEs whose "What it is" and "Key parameters" contain no backticks, with parameter names that match the on-page control labels.
-
-- [ ] **Step 1: Add the failing README checks**
-
-Append to `tests/pages.test.js`:
-
-```js
-const { sections, table } = require('../assets/js/handbook.js');
-const PILOT_SLUGS = ['fade-in-out', 'slide-in', 'slide-up-reveal', 'scale-in', 'clip-path-reveal', 'curtain-reveal',
- 'split-text-reveal', 'letter-by-letter-stagger', 'word-by-word-reveal', 'blur-in', 'flip-in', 'bounce-in', 'rotate-in'];
-
-for (const slug of PILOT_SLUGS) {
- test(`README for ${slug} is ready for the site`, () => {
- const dir = path.join(ANIM, PILOT, slug);
- const s = sections(read(path.join(dir, 'README.md')));
- for (const h of ['What it is', 'When to use it', 'Key parameters', 'See also']) assert.ok(s[h], `section ${h}`);
- assert.ok(!s['What it is'].includes('`'), 'What it is has no code');
- assert.ok(!s['Key parameters'].includes('`'), 'Key parameters has no code');
- assert.ok(table(s['Key parameters']).length > 0, 'Key parameters has rows');
- for (const [, href] of s['See also'].matchAll(/\]\(([^)\s]+)\)/g)) {
- assert.ok(isDemoDir(path.resolve(dir, href)), `See also link ${href}`);
- }
- });
-}
-
-for (const d of converted.filter(c => c.cat === PILOT)) {
- test(`${d.slug}: every Key parameters name is a control on the page`, () => {
- const html = read(path.join(d.dir, 'index.html'));
- const panel = html.slice(html.indexOf('<section class="hb-settings"'), html.indexOf('<div class="hb-take">')).replace(/<[^>]+>/g, ' ');
- const rows = sections(read(path.join(d.dir, 'README.md')))['Key parameters'].split('\n').slice(2);
- for (const row of rows) {
- const name = (row.split('|')[1] || '').trim();
- if (name) assert.ok(panel.includes(name), `control label "${name}"`);
- }
- });
-}
-```
-
-Run: `node --test "tests/*.test.js"`
-Expected: FAIL — the README checks for the 13 slugs (their sections still contain backticks) and the Bounce In control-name check (`Duration (--dur)` is not a label).
-
-- [ ] **Step 2: Replace "What it is" and "Key parameters" in each README**
-
-In each file, replace the body under `## What it is` (up to the next `## ` heading) and the body under `## Key parameters` (up to the next `## ` heading) with the text below. Leave every other section unchanged. Keep one blank line after each heading and before the next heading.
-
-**`fade-in-out/README.md`**
-
-```markdown
-## What it is
-
-A fade changes an element's opacity between invisible and fully visible: it fades in to appear and fades out to leave. It is the simplest entrance animation and one of the cheapest to run, because the browser only blends a layer it has already drawn. Since nothing moves or changes shape, a fade reads as a neutral appearance rather than a movement.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Duration | 600ms | Under 150ms barely registers; over a second feels slow for interface elements |
-| Easing | Ease out | Starts fast and settles gently, the natural feel for an entrance |
-| Hold time | 0.8s | How long the element stays visible before Auto-loop fades it out again |
-| Auto-loop | off | Repeats in, hold and out so you can watch it again |
-```
-
-**`slide-in/README.md`**
-
-```markdown
-## What it is
-
-A slide-in moves an element from a short distance away into its final place. The motion has a direction (from the top, bottom, left or right), so the element seems to arrive from somewhere. Paired with a fade it feels like a natural entrance; on its own it can feel mechanical.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Direction | Top | Which edge the element travels in from |
-| Distance | 200px | Short distances (20 to 40px) suit subtle interface motion; long ones feel dramatic |
-| Duration | 600ms | Longer distances need more time so the speed still feels believable |
-| Easing | Ease out | Slows down into place; Springy adds a small overshoot |
-| Combine with fade | on | A slide alone looks mechanical; the fade makes it read as an arrival |
-```
-
-**`slide-up-reveal/README.md`**
-
-```markdown
-## What it is
-
-A slide-up reveal makes a line of text rise into view from behind an invisible edge, as if it is coming up from underneath a surface. The text moves, but everything below the line stays hidden, so only its arrival is visible. It is the classic entrance for headlines and hero copy.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Technique | Move | Two ways to build it that look identical: moving the text up, or clipping it from below |
-| Duration | 700ms | How long each line takes to rise |
-| Easing | Smooth | Slows smoothly to a stop; Springy adds a slight settle |
-| Line stagger | 60ms | Delay between lines; 40 to 80ms reads as a cascade |
-| Multi-line (3 lines) | on | Shows three lines so you can see the stagger |
-```
-
-**`scale-in/README.md`**
-
-```markdown
-## What it is
-
-A scale-in grows an element from a little smaller than its final size up to full size, usually while it fades in. The anchor point decides where it grows from: its own center, an edge or a corner. With a springy curve the slight overshoot makes the arrival feel physical, as if the element lands in place.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Start scale | 0.80 | Close to 1 is subtle; below 0.5 reads as a big zoom |
-| Duration | 500ms | A springy curve needs room to overshoot and settle; under 300ms cuts the bounce short |
-| Easing | Springy | Adds the overshoot; Ease out gives a calmer arrival |
-| Transform origin | Center | The point the element grows from |
-| Combine with fade | on | Stops the element flashing at full strength while it is still tiny |
-```
-
-**`clip-path-reveal/README.md`**
-
-```markdown
-## What it is
-
-A clip-path reveal uncovers an element by growing a mask shape until the whole element shows. The element is fully drawn the entire time; only the visible part grows. Because nothing moves or fades, the content stays crisp and in place while a shape wipes across it, which gives the effect its cinematic, editorial feel.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Shape | Inset | Inset wipes in from an edge, Circle and Ellipse open like an iris, Swipe cuts in at an angle |
-| Direction | Left | For the Inset shape, which side the wipe travels in from |
-| Duration | 800ms | A reveal reads best a little slower than a fade, so the wipe can be seen |
-| Easing | Smooth | The wipe slows to a stop instead of snapping |
-```
-
-**`curtain-reveal/README.md`**
-
-```markdown
-## What it is
-
-A curtain reveal happens in three steps: a solid panel slides across the content to cover it, pauses, then slides off the far side to show it. Unlike a clip-path reveal, the content really is hidden behind the moving panel and then uncovered, so the eye notices a clear before and after. It is theatrical on purpose and suits content that deserves the drama.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Curtain speed | 500ms | Time for one pass; the whole reveal takes about two passes plus the pause |
-| Pause between | 300ms | The beat where the panel covers everything; it is what makes the change register |
-| Direction | Left to right | Which way the panel travels, across or up and down |
-| Two curtains (split) | off | Two panels meet in the middle, then part |
-| Curtain color | Dark | Strong contrast with the content makes the reveal more dramatic |
-```
-
-**`split-text-reveal/README.md`**
-
-```markdown
-## What it is
-
-A split-text reveal breaks text into pieces (characters, words or lines) and animates them one after another with a short delay between each. That delay turns a flat fade into a cascade that flows across the text. It is the basis of most animated headline entrances.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Split mode | Words | Characters give the finest cascade, words a readable rhythm, lines a block reveal |
-| Animation per unit | Fade up | The small entrance each piece plays: fade up, fade, scale or rotate |
-| Stagger delay | 30ms | Delay between pieces; small values ripple, large values feel deliberate |
-| Duration per unit | 500ms | How long each piece takes to animate |
-| Easing | Smooth | The curve each piece uses; Springy adds a small settle |
-```
-
-**`letter-by-letter-stagger/README.md`**
-
-```markdown
-## What it is
-
-A letter-by-letter stagger animates each character a moment after the previous one, so a phrase assembles as a cascade instead of appearing all at once. The demo shows two versions: a cascade where every letter plays a small entrance, and a typewriter that reveals letters one at a time behind a blinking cursor.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Mode | Cascade | Cascade animates every letter in turn; Typewriter types them out behind a cursor |
-| Per-letter animation | Fade up | The entrance each letter plays in Cascade mode: fade up, fade, scale or rotate |
-| Per-letter delay | 35ms | Gap between letters; higher is slower and more theatrical |
-| Duration per letter | 400ms | How long each letter takes to settle |
-| Show cursor (typewriter) | on | The blinking cursor in Typewriter mode |
-```
-
-**`word-by-word-reveal/README.md`**
-
-```markdown
-## What it is
-
-A word-by-word reveal animates each word of a passage in turn, rather than all at once or letter by letter. Words are how people read, so a delay of roughly 80 to 120 milliseconds per word follows the eye through a sentence: slow enough to feel intentional, fast enough that nobody waits.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Per-word delay | 80ms | The reading-speed control; below about 40ms the words blur into one reveal |
-| Per-word animation | Fade up | The entrance each word plays |
-| Duration per word | 450ms | How long each word takes to settle |
-| Easing | Smooth | Springy adds a bounce; Linear feels mechanical |
-| Sentence pauses | off | Adds an extra pause between sentences |
-```
-
-**`blur-in/README.md`**
-
-```markdown
-## What it is
-
-Blur In fades an element into view while it sharpens from a heavy blur to crisp focus, like a camera pulling focus onto a subject. The rising opacity and falling blur feel cinematic because they echo how a real lens resolves an image, unlike the flat look of a plain fade.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Mode | Blur + Fade | The full effect; Blur only and Fade only show each half on its own |
-| Starting blur | 20px | Higher is a more dramatic focus pull; past about 30px it looks like frosted glass |
-| Duration | 700ms | Blur needs a little longer than a plain fade for the lens feel to land |
-| Easing | Ease out | Slowing down mimics a lens settling; Linear feels robotic |
-| Slight upward drift | on | A small rise while it sharpens, as if it is settling into place |
-```
-
-**`flip-in/README.md`**
-
-```markdown
-## What it is
-
-Flip In swings an element from edge-on into full view in 3D, like a hinged panel turning toward you. The key detail is that the 3D perspective is set on the element's container, not on the card itself; without it, the turn collapses into a flat squash with no sense of depth.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Flip axis | Y (horiz) | Which way it swings: around a vertical hinge, a horizontal one, or both |
-| Starting rotation | 90° | The angle it starts from; 90° starts fully edge-on |
-| Perspective | 1000px | How far away the viewer seems; lower is more dramatic, higher is subtler |
-| Duration | 600ms | How long the swing takes; a Springy curve adds a satisfying settle |
-| Easing | Ease out | Slows the swing as it comes to face you |
-| Transform origin | Center | Where the hinge sits; an edge makes it swing from that side |
-| Combine with fade | on | Fades it in while it turns |
-```
-
-**`bounce-in/README.md`**
-
-```markdown
-## What it is
-
-Bounce In brings an element up from small and low, overshoots its final size and position, then springs back to rest, like something landing with momentum. A real bounce isn't one smooth curve: it's a few hand-placed steps, each going a little past the target and coming back.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Overshoot intensity | 60% | How far past full size it grows; 0% means no bounce, 100% is exaggerated |
-| Duration | 1100ms | Bounces need room to breathe; too short and the spring reads as a jitter |
-| Bounces | 1× Single | How many times it overshoots; almost always one, since more looks cartoonish |
-| Combine with fade | on | Whether it fades in while it bounces or is visible from the start |
-```
-
-**`rotate-in/README.md`**
-
-```markdown
-## What it is
-
-Rotate In spins an element around its center as it enters, usually while it grows from small, so it reads as arriving rather than just turning in place. The spin is easiest to follow when the shape looks right at every angle, so it suits round or symmetric marks such as icons, stars, gears and badges, not text or wide rectangles.
-```
-
-```markdown
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Starting rotation | -180° | The angle it starts from; a larger angle means more spin |
-| Extra full rotations | 0× | Adds whole extra turns without changing where it lands |
-| Direction | Counter-clockwise | Which way it spins |
-| Duration | 600ms | Time for the whole spin |
-| Easing | Springy | The overshoot makes the spin land rather than glide to a stop |
-| Combine with scale | on | Growing from small turns a spin into an arrival |
-| Combine with fade | on | Fades it in as it spins |
-```
-
-- [ ] **Step 3: Run the tests to verify they pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS — including the 13 README checks and `bounce-in: every Key parameters name is a control on the page`.
-
-- [ ] **Step 4: Check the rendered explanation**
-
-Reload Bounce In in the browser, click **Read more about Bounce In**. "What it is" shows the new plain paragraph; "What the controls do" lists Overshoot intensity, Duration, Bounces and Combine with fade with their defaults.
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add animations/02-entrance-and-exit/*/README.md tests/pages.test.js
-git commit -m "docs: rewrite the Entrance & Exit explanations in plain language"
-```
-
----
-
-### Task 6: Convert Fade In/Out, Slide In, Slide Up Reveal, Scale In, Clip-Path Reveal and Curtain Reveal
-
-**Files:**
-- Modify: `tools/migrations/02-entrance-and-exit.json`
-- Modify: `animations/02-entrance-and-exit/{fade-in-out,slide-in,slide-up-reveal,scale-in,clip-path-reveal,curtain-reveal}/index.html` (by the tool)
-
-**Interfaces:**
-- Consumes: `migrate` CLI (Task 2), shared CSS/JS (Tasks 3–4), README pass (Task 5).
-- Produces: six more converted pages.
-
-- [ ] **Step 1: Add a failing expectation**
-
-In `tests/pages.test.js`, replace the test `Bounce In uses the shared layout` with:
-
-```js
-test('the converted Entrance & Exit demos include this batch', () => {
- const done = new Set(converted.filter(d => d.cat === PILOT).map(d => d.slug));
- for (const slug of ['bounce-in', 'fade-in-out', 'slide-in', 'slide-up-reveal', 'scale-in', 'clip-path-reveal', 'curtain-reveal']) {
- assert.ok(done.has(slug), `${slug} is converted`);
- }
-});
-```
-
-Run: `node --test "tests/*.test.js"`
-Expected: FAIL — `fade-in-out is converted`.
-
-- [ ] **Step 2: Add the six entries to the config**
-
-Append these objects to the `demos` array in `tools/migrations/02-entrance-and-exit.json` (after the Bounce In entry, separated by commas):
-
-```json
-{
- "slug": "fade-in-out",
- "number": "02.01",
- "prev": null,
- "next": { "href": "../slide-in/", "name": "Slide In" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop", "hold-sl": "data-hb-skip" },
- "edits": [],
- "lede": "Goes from invisible to visible to enter, and back again to leave.",
- "prompt": "Add a fade-in and fade-out to [the element you want to show and hide]. When it appears, it should go smoothly from fully transparent to fully visible, and when it leaves it should do the reverse. Nothing moves or changes size; only the opacity changes, which keeps the animation smooth because the browser doesn't need to repaint. Reserve the element's space while it is invisible so the layout doesn't jump, and make sure a hidden element can't be clicked or focused. If the visitor has reduced motion turned on, show and hide it instantly or with a very short fade. Match the settings listed below."
-},
-{
- "slug": "slide-in",
- "number": "02.02",
- "prev": { "href": "../fade-in-out/", "name": "Fade In / Fade Out" },
- "next": { "href": "../slide-up-reveal/", "name": "Slide Up Reveal" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
- "edits": [
- ["<button data-dir=\"top\" class=\"on\">↑ Top</button>", "<button data-dir=\"top\" class=\"on\" aria-label=\"From the top\">↑ Top</button>"],
- ["<button data-dir=\"bottom\">↓ Bot</button>", "<button data-dir=\"bottom\" aria-label=\"From the bottom\">↓ Bot</button>"],
- ["<button data-dir=\"left\">← Left</button>", "<button data-dir=\"left\" aria-label=\"From the left\">← Left</button>"],
- ["<button data-dir=\"right\">→ Right</button>", "<button data-dir=\"right\" aria-label=\"From the right\">→ Right</button>"]
- ],
- "lede": "Travels into place from one edge, with or without a fade.",
- "prompt": "Add a slide-in entrance to [the element you want to animate]. It should start a short distance away from its final position, on the side given in the settings, and travel into place, slowing down as it arrives so it feels like it came from somewhere. Unless the settings turn it off, fade it in during the slide too, because a slide on its own tends to look mechanical. Give longer distances a little more time so the speed still feels natural. Move it without changing the layout, so nothing around it shifts. If the visitor has reduced motion turned on, skip the travel and simply show it. Match the settings listed below."
-},
-{
- "slug": "slide-up-reveal",
- "number": "02.03",
- "prev": { "href": "../slide-in/", "name": "Slide In" },
- "next": { "href": "../scale-in/", "name": "Scale In / Zoom In" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop", "method-seg": "data-hb-skip", "multi-tog": "data-hb-skip" },
- "edits": [
- ["<div class=\"kv\"><span>Technique</span><span class=\"v\" id=\"tech-val\">", "<div class=\"kv\" hidden><span>Technique</span><span class=\"v\" id=\"tech-val\">"],
- ["<button data-m=\"translatey\" class=\"on\">translateY</button>", "<button data-m=\"translatey\" class=\"on\">Move</button>"],
- ["<button data-m=\"clippath\">clip-path</button>", "<button data-m=\"clippath\">Clip</button>"]
- ],
- "lede": "Text rises into view from behind an invisible edge.",
- "prompt": "Add a slide-up reveal to [your headline or lines of text]. Each line should rise into place from just below an invisible edge, as if it is coming up from behind a solid surface: the text moves, but anything below the line stays hidden, so viewers only see it arrive. When there are several lines, start each one a moment after the line above it so they cascade. The text must stay readable by screen readers and search engines the whole time. If the visitor has reduced motion turned on, show the text immediately without the rise. Match the settings listed below."
-},
-{
- "slug": "scale-in",
- "number": "02.04",
- "prev": { "href": "../slide-up-reveal/", "name": "Slide Up Reveal" },
- "next": { "href": "../clip-path-reveal/", "name": "Clip-Path Reveal" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
- "edits": [
- ["<button data-o=\"top left\">Top-L</button>", "<button data-o=\"top left\" aria-label=\"Top left\">Top-L</button>"],
- ["<button data-o=\"bottom center\">Bot</button>", "<button data-o=\"bottom center\" aria-label=\"Bottom\">Bot</button>"]
- ],
- "lede": "Grows from slightly smaller to full size, from a point you choose.",
- "prompt": "Add a scale-in entrance to [the element you want to animate]. It should start a little smaller than its final size and grow to full size, anchored at the point given in the settings: its center, or an edge or corner so it seems to grow out of the button that opened it. A springy curve lets it overshoot slightly and settle, which makes the arrival feel physical. Unless the settings turn it off, fade it in while it grows so it never flashes at full strength while it is still tiny. Animate only its size and opacity. If the visitor has reduced motion turned on, show it at full size without the zoom. Match the settings listed below."
-},
-{
- "slug": "clip-path-reveal",
- "number": "02.05",
- "prev": { "href": "../scale-in/", "name": "Scale In / Zoom In" },
- "next": { "href": "../curtain-reveal/", "name": "Curtain Reveal" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop", "outline-tog": "data-hb-skip" },
- "edits": [
- ["<div class=\"kv\"><span>clip-path</span><span class=\"v\" id=\"cp-val\">", "<div class=\"kv\" hidden><span>clip-path</span><span class=\"v\" id=\"cp-val\">"],
- ["<button data-d=\"left\" class=\"on\">←</button>", "<button data-d=\"left\" class=\"on\" aria-label=\"From the left\">←</button>"],
- ["<button data-d=\"right\">→</button>", "<button data-d=\"right\" aria-label=\"From the right\">→</button>"],
- ["<button data-d=\"top\">↑</button>", "<button data-d=\"top\" aria-label=\"From the top\">↑</button>"],
- ["<button data-d=\"bottom\">↓</button>", "<button data-d=\"bottom\" aria-label=\"From the bottom\">↓</button>"],
- ["<button data-d=\"center\">⊙</button>", "<button data-d=\"center\" aria-label=\"From the center\">⊙</button>"]
- ],
- "lede": "A shape uncovers the element while it stays perfectly still.",
- "prompt": "Add a mask reveal to [the image or block you want to reveal]. The element should stay completely still and fully drawn while a shape uncovers it, like a window opening: an edge wipe that travels in from one side, a circle or ellipse that opens from the middle, or an angled swipe. Nothing moves, fades or changes size; only the visible area grows until the whole element shows. Let the wipe slow down as it finishes instead of stopping abruptly. The content must stay accessible even while part of it is hidden. If the visitor has reduced motion turned on, show it fully without the wipe. Match the settings listed below."
-},
-{
- "slug": "curtain-reveal",
- "number": "02.06",
- "prev": { "href": "../clip-path-reveal/", "name": "Clip-Path Reveal" },
- "next": { "href": "../split-text-reveal/", "name": "Split Text Reveal" },
- "autoplay": false,
- "attrs": { "btn-play": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
- "edits": [
- ["<button data-ax=\"h\" data-dir=\"ltr\" class=\"on\">→ L→R</button>", "<button data-ax=\"h\" data-dir=\"ltr\" class=\"on\" aria-label=\"Left to right\">→ L→R</button>"],
- ["<button data-ax=\"h\" data-dir=\"rtl\">← R→L</button>", "<button data-ax=\"h\" data-dir=\"rtl\" aria-label=\"Right to left\">← R→L</button>"],
- ["<button data-ax=\"v\" data-dir=\"ttb\">↓ Top</button>", "<button data-ax=\"v\" data-dir=\"ttb\" aria-label=\"Top to bottom\">↓ Top</button>"],
- ["<button data-ax=\"v\" data-dir=\"btt\">↑ Bot</button>", "<button data-ax=\"v\" data-dir=\"btt\" aria-label=\"Bottom to top\">↑ Bot</button>"]
- ],
- "lede": "A colored panel covers the content, then slides away to reveal it.",
- "prompt": "Add a curtain reveal to [the content you want to reveal]. A solid colored panel should slide across and cover the content completely, pause for a beat, then keep going and slide off the far side, leaving the content visible. The pause is what makes the change register, so keep it. In split mode, two panels come in from opposite sides, meet in the middle, then part. Pick a panel color that contrasts strongly with the content. Move the panels rather than resizing them so the motion stays smooth. If the visitor has reduced motion turned on, show the content without the curtain. Match the settings listed below."
-}
-```
-
-Notes for this batch: Curtain Reveal's stage shows its content on arrival (it is not empty), so under the spec's rule it does not get `data-hb-autoplay`; it plays when ↻ Replay or Play reveal is pressed. The `hidden` readouts show CSS code; they stay in the page because the demo scripts write to them. The aria-labels give arrow-only buttons readable names, which the settings line uses.
-
-- [ ] **Step 3: Convert the six pages**
-
-Run: `node tools/migrate-demo.js tools/migrations/02-entrance-and-exit.json fade-in-out slide-in slide-up-reveal scale-in clip-path-reveal curtain-reveal`
-Expected: six `migrated …` lines and no error.
-
-- [ ] **Step 4: Run the tests to verify they pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS — including the six new per-page checks and their control-name checks.
-
-- [ ] **Step 5: Check each page in the browser**
-
-For each of the six pages, run the Page check at 1280×800 and mobile (Verification kit) and confirm no console errors. By hand:
-- Fade In / Fade Out, Slide In, Slide Up Reveal, Scale In, Clip-Path Reveal play on their own after load; Curtain Reveal shows its content and plays when ↻ Replay is pressed
-- Slide Up Reveal's Technique buttons read **Move** / **Clip** and no CSS text shows in the panel; Clip-Path Reveal shows no clip-path value in the panel
-- the settings line uses readable words, e.g. Slide In: `Direction From the top`, Clip-Path Reveal: `Direction (inset) From the left`
-- **Play out** still plays each exit animation and **Reset** still resets
-
-- [ ] **Step 6: Commit**
-
-```bash
-git add tools/migrations/02-entrance-and-exit.json tests/pages.test.js animations/02-entrance-and-exit/fade-in-out/index.html animations/02-entrance-and-exit/slide-in/index.html animations/02-entrance-and-exit/slide-up-reveal/index.html animations/02-entrance-and-exit/scale-in/index.html animations/02-entrance-and-exit/clip-path-reveal/index.html animations/02-entrance-and-exit/curtain-reveal/index.html
-git commit -m "feat: convert six more Entrance & Exit demos to the shared layout"
-```
-
----
-
-### Task 7: Convert Split Text Reveal, Letter-by-Letter Stagger, Word-by-Word Reveal, Blur In, Flip In and Rotate In
-
-**Files:**
-- Modify: `tools/migrations/02-entrance-and-exit.json`
-- Modify: `animations/02-entrance-and-exit/{split-text-reveal,letter-by-letter-stagger,word-by-word-reveal,blur-in,flip-in,rotate-in}/index.html` (by the tool)
-- Modify: `tests/pages.test.js`
-
-**Interfaces:**
-- Consumes: as Task 6.
-- Produces: all 13 Entrance & Exit demos converted.
-
-- [ ] **Step 1: Make the batch check require the whole category**
-
-In `tests/pages.test.js`, replace the test `the converted Entrance & Exit demos include this batch` with:
-
-```js
-test('every Entrance & Exit demo uses the shared layout', () => {
- const left = demos.filter(d => d.cat === PILOT && !converted.includes(d)).map(d => d.slug);
- assert.deepEqual(left, []);
-});
-```
-
-Run: `node --test "tests/*.test.js"`
-Expected: FAIL — the remaining six slugs are listed.
-
-- [ ] **Step 2: Add the six entries to the config**
-
-Append to the `demos` array in `tools/migrations/02-entrance-and-exit.json`:
-
-```json
-{
- "slug": "split-text-reveal",
- "number": "02.07",
- "prev": { "href": "../curtain-reveal/", "name": "Curtain Reveal" },
- "next": { "href": "../letter-by-letter-stagger/", "name": "Letter-by-Letter Stagger" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
- "edits": [
- ["<button data-a=\"fade-up\" class=\"on\">↑Fade</button>", "<button data-a=\"fade-up\" class=\"on\" aria-label=\"Fade up\">↑Fade</button>"]
- ],
- "lede": "Text breaks into pieces that animate in one after another.",
- "prompt": "Add a split-text reveal to [your headline]. Break the text into pieces (characters, words or lines) and animate each piece into view one after another with a short delay between them, so the text flows in as a cascade instead of appearing all at once. Every piece plays the same small entrance, such as fading up from slightly below. Screen readers should still read the text as one normal sentence, not as separate pieces, and the text must not reflow or jump while it animates. If the visitor has reduced motion turned on, show the text immediately. Match the settings listed below."
-},
-{
- "slug": "letter-by-letter-stagger",
- "number": "02.08",
- "prev": { "href": "../split-text-reveal/", "name": "Split Text Reveal" },
- "next": { "href": "../word-by-word-reveal/", "name": "Word-by-Word Reveal" },
- "autoplay": true,
- "attrs": { "btn-play": "data-hb-replay", "btn-rst": "data-hb-reset" },
- "edits": [
- ["<button data-a=\"fade-up\" class=\"on\">↑Fade</button>", "<button data-a=\"fade-up\" class=\"on\" aria-label=\"Fade up\">↑Fade</button>"]
- ],
- "lede": "A phrase assembles one letter at a time, as a cascade or a typewriter.",
- "prompt": "Add a letter-by-letter entrance to [a short phrase or headline]. In cascade mode, every letter plays a small entrance a moment after the previous one, so the phrase assembles from left to right. In typewriter mode, the letters appear one at a time behind a blinking cursor, as if someone is typing. Use it only on short phrases, because long text becomes tedious to wait for. Screen readers should hear the whole phrase once, not letter by letter. If the visitor has reduced motion turned on, show the full phrase immediately. Match the settings listed below."
-},
-{
- "slug": "word-by-word-reveal",
- "number": "02.09",
- "prev": { "href": "../letter-by-letter-stagger/", "name": "Letter-by-Letter Stagger" },
- "next": { "href": "../blur-in/", "name": "Blur In" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
- "edits": [
- [">↑ Fade up</option>", ">Fade up</option>"]
- ],
- "lede": "Words appear one after another at a comfortable reading pace.",
- "prompt": "Add a word-by-word reveal to [the paragraph or quote you want to reveal]. Each word should appear a moment after the one before it, at roughly the pace people read, so the text builds up as if it is being spoken. If sentence pauses are on, wait a little longer at the end of each sentence before continuing. Keep the delay short enough that nobody waits for text they could already read. The full text must stay readable by screen readers and must not reflow while it appears. If the visitor has reduced motion turned on, show all the text at once. Match the settings listed below."
-},
-{
- "slug": "blur-in",
- "number": "02.10",
- "prev": { "href": "../word-by-word-reveal/", "name": "Word-by-Word Reveal" },
- "next": { "href": "../flip-in/", "name": "Flip In" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
- "edits": [
- ["<span>+ Slight upward translate</span>", "<span>Slight upward drift</span>"]
- ],
- "lede": "Fades in while sharpening from blurred to crisp, like a camera focusing.",
- "prompt": "Add a blur-in entrance to [the element you want to animate]. It should start blurred and transparent, then sharpen into focus while it fades in, like a camera pulling focus onto the subject. It can also drift up slightly as it settles. Use it on one focal element at a time, not on a list or grid, because blur is expensive for the browser to draw. Remove the blur completely once the animation ends. If the visitor has reduced motion turned on, show the element sharp and visible without the effect. Match the settings listed below."
-},
-{
- "slug": "flip-in",
- "number": "02.11",
- "prev": { "href": "../blur-in/", "name": "Blur In" },
- "next": { "href": "../bounce-in/", "name": "Bounce In" },
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
- "edits": [],
- "lede": "Swings into view in 3D, like a hinged card turning toward you.",
- "prompt": "Add a 3D flip-in entrance to [the card you want to animate]. The card should start turned edge-on, like a door seen from the side, and swing toward the viewer until it faces them flat. Give the card's container a 3D perspective so the swing has real depth; without it, the flip looks like a flat squash. The hinge can sit in the middle or along one edge, and the card can fade in while it turns. If the visitor has reduced motion turned on, show the card facing forward without the flip. Match the settings listed below."
-},
-{
- "slug": "rotate-in",
- "number": "02.13",
- "prev": { "href": "../bounce-in/", "name": "Bounce In" },
- "next": null,
- "autoplay": true,
- "attrs": { "btn-in": "data-hb-replay", "btn-rst": "data-hb-reset", "loop-tog": "data-hb-skip data-hb-loop" },
- "edits": [
- ["<button data-x=\"0\" class=\"on\">0×</button>", "<button data-x=\"0\" class=\"on\" aria-label=\"No extra turns\">0×</button>"],
- ["<button data-x=\"1\">+1×</button>", "<button data-x=\"1\" aria-label=\"One extra turn\">+1×</button>"],
- ["<button data-x=\"2\">+2×</button>", "<button data-x=\"2\" aria-label=\"Two extra turns\">+2×</button>"],
- ["<button data-d=\"ccw\" class=\"on\">↺ CCW</button>", "<button data-d=\"ccw\" class=\"on\" aria-label=\"Counter-clockwise\">↺ CCW</button>"],
- ["<button data-d=\"cw\">↻ CW</button>", "<button data-d=\"cw\" aria-label=\"Clockwise\">↻ CW</button>"]
- ],
- "lede": "Spins into place while growing, best for icons, stars and badges.",
- "prompt": "Add a rotate-in entrance to [the icon or badge you want to animate]. It should spin around its center as it appears, growing from small to full size at the same time, so it looks like it is arriving rather than just turning. Let it overshoot slightly and settle, so the spin lands instead of gliding to a stop. Use this on round or symmetric shapes like icons, stars, gears and badges; it looks wrong on text or wide rectangles. If the visitor has reduced motion turned on, show it in place without spinning. Match the settings listed below."
-}
-```
-
-Notes for this batch: Letter-by-Letter Stagger has no Auto-loop control; its **Replay** button is the replay control. Text inputs ("Edit text") are left out of the settings line automatically.
-
-- [ ] **Step 3: Convert the six pages**
-
-Run: `node tools/migrate-demo.js tools/migrations/02-entrance-and-exit.json split-text-reveal letter-by-letter-stagger word-by-word-reveal blur-in flip-in rotate-in`
-Expected: six `migrated …` lines and no error.
-
-- [ ] **Step 4: Run the tests to verify they pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS — including `every Entrance & Exit demo uses the shared layout`.
-
-- [ ] **Step 5: Check each page in the browser**
-
-For each of the six pages, run the Page check at 1280×800 and mobile and confirm no console errors. By hand:
-- each one plays on its own after load
-- typing in **Edit text** (Split Text, Letter-by-Letter, Word-by-Word) replays the text after a short pause, and the typed text is not in the settings line
-- Blur In's toggle reads **Slight upward drift**; Rotate In's settings line reads `Extra full rotations No extra turns, Direction Counter-clockwise`
-- Rotate In's top bar shows only `‹ Bounce In`
-
-- [ ] **Step 6: Commit**
-
-```bash
-git add tools/migrations/02-entrance-and-exit.json tests/pages.test.js animations/02-entrance-and-exit/split-text-reveal/index.html animations/02-entrance-and-exit/letter-by-letter-stagger/index.html animations/02-entrance-and-exit/word-by-word-reveal/index.html animations/02-entrance-and-exit/blur-in/index.html animations/02-entrance-and-exit/flip-in/index.html animations/02-entrance-and-exit/rotate-in/index.html
-git commit -m "feat: finish converting the Entrance & Exit demos to the shared layout"
-```
-
----
-
-### Task 8: Home page — Schibsted Grotesk and the new intro line
-
-**Files:**
-- Modify: `index.html` (lines 50–54 `@font-face`, lines 61–62 font variables, the `.wordmark` rule, every `var(--mono)`, the `.lede` paragraph)
-- Modify: `tests/pages.test.js`
-
-**Interfaces:**
-- Consumes: `assets/fonts/schibsted-latin*.woff2` (Task 3).
-- Produces: the home page in Schibsted Grotesk; CSS variable `--text` replaces `--mono` in `index.html`.
-
-- [ ] **Step 1: Add the failing home page check**
-
-Append to `tests/pages.test.js`:
-
-```js
-test('the home page uses Schibsted Grotesk and the new intro line', () => {
- const html = read(path.join(ROOT, 'index.html'));
- assert.ok(html.includes("url('assets/fonts/schibsted-latin.woff2')"), 'Latin font file');
- assert.ok(html.includes("url('assets/fonts/schibsted-latin-ext.woff2')"), 'Latin Extended font file');
- for (const old of ['Bricolage', 'PlexMono', 'var(--mono)', '--mono:']) assert.ok(!html.includes(old), `still uses ${old}`);
- assert.ok(html.includes('See 129 web animations move, learn when to use each one, and copy a prompt to build it.'));
-});
-```
-
-Run: `node --test "tests/*.test.js"`
-Expected: FAIL — `Latin font file`.
-
-- [ ] **Step 2: Replace the font faces**
-
-In `index.html`, replace these five lines:
-
-```css
-@font-face{font-family:'Bricolage';src:url('assets/fonts/brico-400.woff2') format('woff2');font-weight:400;font-display:swap}
-@font-face{font-family:'Bricolage';src:url('assets/fonts/brico-700.woff2') format('woff2');font-weight:700;font-display:swap}
-@font-face{font-family:'Bricolage';src:url('assets/fonts/brico-800.woff2') format('woff2');font-weight:800;font-display:swap}
-@font-face{font-family:'PlexMono';src:url('assets/fonts/plex-400.woff2') format('woff2');font-weight:400;font-display:swap}
-@font-face{font-family:'PlexMono';src:url('assets/fonts/plex-500.woff2') format('woff2');font-weight:500;font-display:swap}
-```
-
-with:
-
-```css
-@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}
-```
-
-- [ ] **Step 3: Switch the font variables and wordmark spacing**
-
-Replace:
-
-```css
- --disp:'Bricolage','Arial Narrow',sans-serif;
- --mono:'PlexMono',ui-monospace,"Cascadia Mono",Menlo,Consolas,monospace;
-```
-
-with:
-
-```css
- --disp:'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;
- --text:'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;
-```
-
-Then replace every `var(--mono)` in `index.html` with `var(--text)` (12 places):
-
-```bash
-sed -i 's/var(--mono)/var(--text)/g' index.html && grep -o 'var(--text)' index.html | wc -l
-```
-
-Expected: `12`.
-
-In the `.wordmark` rule, change `letter-spacing:-.045em` to `letter-spacing:-.035em` (Schibsted Grotesk's heavy weight is wider-set than Bricolage and collides at the old spacing).
-
-- [ ] **Step 4: Update the intro line**
-
-Replace:
-
-```html
- <p class="lede">A reference of 129 web animation techniques. Every entry is a live demo you can open in the browser and read how it works.</p>
-```
-
-with:
-
-```html
- <p class="lede">See 129 web animations move, learn when to use each one, and copy a prompt to build it.</p>
-```
-
-- [ ] **Step 5: Run the tests to verify they pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS — all tests.
-
-- [ ] **Step 6: Check the home page**
-
-Open `http://localhost:8731/` at 1280×800 and mobile. Confirm: the wordmark, headings, chips, search and card text are Schibsted Grotesk (`getComputedStyle(document.querySelector('.wordmark')).fontFamily` starts with `"Schibsted Grotesk"`), the wordmark letters do not touch, nothing overflows horizontally, and `read_console_messages` shows no errors. Take a desktop and a phone screenshot (Verification kit, with the home URL).
-
-- [ ] **Step 7: Commit**
-
-```bash
-git add index.html tests/pages.test.js
-git commit -m "feat: set the home page in Schibsted Grotesk and mention prompts in the intro"
-```
-
----
-
-### Task 9: Pilot verification and handoff for review
-
-**Files:**
-- No code changes expected. Any fix found here goes into the file that owns the problem, with its own commit.
-
-**Interfaces:**
-- Consumes: everything above.
-- Produces: evidence for the user's pilot review.
-
-- [ ] **Step 1: Run the full test suite**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS, 0 failures. Record the pass count.
-
-- [ ] **Step 2: Browser matrix for all 13 pilot pages**
-
-For every page in `animations/02-entrance-and-exit/`, run the Page check at 1280×800, 768×1024 and mobile, and `read_console_messages` with `onlyErrors: true`. Every expected value in the Verification kit must hold for every page at every size. Fix any failure in the file that owns it, then rerun the tests:
-- shared behaviour or styling: `assets/js/handbook.js` or `assets/css/handbook.css`
-- a page's markers, edits, lede or prompt: fix its entry in `tools/migrations/02-entrance-and-exit.json`, restore the original page with `git checkout 2fbdc00 -- animations/02-entrance-and-exit/<slug>/index.html` (commit `2fbdc00` is the spec commit, before any page was converted), then run `node tools/migrate-demo.js tools/migrations/02-entrance-and-exit.json <slug>` again
-- explanation text: the demo's `README.md`
-
-- [ ] **Step 3: Reduced-motion check**
-
-For Fade In / Fade Out, Bounce In and Rotate In, take a desktop screenshot with `--force-prefers-reduced-motion` (Verification kit). Expected: the element is visible in its final state; nothing is mid-animation.
-
-- [ ] **Step 4: Offline check**
-
-Open `animations/02-entrance-and-exit/bounce-in/index.html` directly from disk (`file:///…`) in Chrome. Expected: the demo, settings and prompt work; **Read more** shows "The full explanation is in README.md." with a working link.
-
-- [ ] **Step 5: Screenshots for the user**
-
-Take these screenshots (Verification kit) and send them to the user with `SendUserFile`:
-- Bounce In, desktop, first screen
-- Bounce In, desktop, with `#details` (details open)
-- Curtain Reveal, desktop
-- Word-by-Word Reveal, phone
-- Home page, desktop
-
-- [ ] **Step 6: Stop for review**
-
-Report to the user: the pages converted, the test results, anything that needed a per-demo fix, and the screenshots. Ask them to review the pilot at `http://localhost:8731/animations/02-entrance-and-exit/fade-in-out/` onward. Do not convert any other category; the next plan covers the remaining six categories after the user approves the pilot.
-
----
-
-## Self-review notes
-
-- Spec coverage: page anatomy (Tasks 3–4), content sources (Tasks 2, 4, 5), README pass (Task 5), prompts and settings line (Tasks 3, 4, 6, 7), behaviour — auto-play, Replay, settings replay, copy fallback, offline (Tasks 4, 9), shared assets (Tasks 1–4), fonts (Tasks 3, 8), home page (Task 8), pilot rollout and verification (Tasks 6, 7, 9). Out of this plan by design: the other six categories, CLAUDE.md/CONTRIBUTING.md updates, deleting the old font files and `samples/demo-page-design.html` (spec rollout steps 3–4, next plan).
-- Spec refinement: the spec listed 7 demos that open empty; the pilot audit found that every Entrance & Exit demo whose status starts as "hidden" opens empty, so 12 of 13 get auto-play (Curtain Reveal's stage already shows its content).
-
----
-
-## Follow-ups for the next plan (from the pilot's reviews)
-
-Carry these into the plan for the remaining six categories:
-
-- **Before converting more pages:** switch the migration template's `<section class="hb-settings" aria-label="Settings">` to `aria-labelledby` (the visible h2 is announced twice today) and patch the 13 pilot pages in the same commit. Have the tool strip the demos' legacy chrome CSS (`header`, `.layout`, `aside`, `.note` and the control classes) that the shared stylesheet now outranks.
-- **Shared script:** reject protocol-relative `//host` links in `isSafeHref`; make the copy fallback select the full prompt plus the settings line; split `boot()` into named setup functions when it is next touched.
-- **Tests:** generalise the README checks from the pilot list to every converted page and assert that every See also line parses. Commit the verification kit's page check as a reusable script, extended with a 1366×657 size, CSS-hidden controls, keyboard selection and text-input touch targets.
-- **Layout:** at 601–700px wide the 300px side column is wider than the stage; decide a narrower tablet column. The details grid's 760px breakpoint is intentional; record it in CLAUDE.md.
-- **Content:** decide how demos with no settings end their prompt (the tests require "Match the settings listed below."). Update the pilot pages' meta, Open Graph and JSON-LD descriptions, and the home page's JSON-LD wording, to match the new plain summaries. Ask the user whether Curtain Reveal should also play on arrival.
-- **Wrap-up (already in the spec):** update CLAUDE.md and CONTRIBUTING.md (page template, shared assets, prompt guide, fonts, `node --test "tests/*.test.js"`, the migration tool); delete the old font files and `samples/demo-page-design.html`.
-- **Release:** keep this work off `main` until enough categories are converted that the home page's "copy a prompt" line is true, or ship the font switch without that line.
diff --git a/docs/superpowers/plans/2026-09-27-demo-page-guided-steps-pilot.md b/docs/superpowers/plans/2026-09-27-demo-page-guided-steps-pilot.md
deleted file mode 100644
index c42e3a61..00000000
--- a/docs/superpowers/plans/2026-09-27-demo-page-guided-steps-pilot.md
+++ /dev/null
@@ -1,1336 +0,0 @@
-# Guided-Steps Demo Page — Rotate In Pilot Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Rebuild the Rotate In demo page as the approved "guided steps" page (Watch it → Try it → Copy the prompt → About → Similar animations) so the user can approve it before every other page follows.
-
-**Architecture:** Two new shared files hold the page chrome: `assets/css/demo-page.css` (layout and look) and `assets/js/demo-page.js` (a UMD script whose pure helpers are unit-tested in Node and whose `boot` adds "Your settings" chips, Copy prompt, the README sections, autoplay and replay-on-change). The Rotate In page is rewritten against that template; its own inline script still drives the animation and wires the player bar and plain-language settings. The first redesign's `handbook.css`/`handbook.js` stay untouched for the other twelve Entrance & Exit pages.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build step); Node's built-in test runner for tests; headless Chrome or the in-app browser for visual checks.
-
-**Spec:** `docs/superpowers/specs/2026-09-27-demo-page-guided-steps-design.md`
-
-## Global Constraints
-
-- Plain HTML + CSS + vanilla JS only. No build step, no frameworks, no npm packages, no CDN scripts or fonts.
-- Only `animations/02-entrance-and-exit/rotate-in/` moves to the new template. The other twelve Entrance & Exit pages, `assets/css/handbook.css`, `assets/js/handbook.js`, `tests/handbook.test.js`, `tools/` and the home page `index.html` stay unchanged.
-- New shared files: `assets/css/demo-page.css` and `assets/js/demo-page.js` (UMD: pure helpers exported for Node tests, auto-boot in the browser).
-- Layout: one centred column with 960px of content at most; stage height `clamp(300px, 100svh - 420px, 440px)` so the stage and player bar fit on a laptop's first screen, and 300px at ≤ 600px; settings two per row from 760px, one per row below.
-- Breakpoints: phone ≤ 600px, tablet 601–1024px, desktop ≥ 1025px.
-- Touch targets at least 44×44px on phones; hover rules only inside `@media (hover: hover)`.
-- Animate only `transform` and `opacity`; respect `prefers-reduced-motion`.
-- Each chip reads `<label>: <value>`. The copied text is the prompt, a blank line, then `Settings from the demo: ` + the chips joined with `, ` + `.`
-- The Copy prompt button shows "Copied" for 1.5 seconds; if the clipboard is blocked it selects the prompt and shows "Press Ctrl+C to copy" (or "Press ⌘C to copy" on a Mac).
-- Autoplay about 400ms after load (Loop turned on; with reduced motion, Replay is pressed once instead). A setting change replays about 250ms after the last change. Slow motion makes the spins three times slower and leaves the pauses as they are.
-- Words on the page are plain; never "stunning", "amazing" or "powerful"; no code anywhere on the page.
-- The category colour comes from the page's `--ui-accent` (`#5fd88a` for Entrance & Exit).
-- Fonts: Schibsted Grotesk from `assets/fonts/schibsted-latin.woff2` and `assets/fonts/schibsted-latin-ext.woff2`.
-- Run tests with `node --test "tests/*.test.js"` from the repo root (`node --test tests/` fails on this machine).
-- Commit messages: a lower-case prefix (`feat:`, `test:`, `docs:`, `fix:`) and a plain sentence.
-
-## File structure
-
-| File | Responsibility |
-|---|---|
-| `assets/js/demo-page.js` (new) | Pure helpers (HTML escaping, the README Markdown subset, See also parsing, the settings line, prompt highlighting) and the page behaviour (`readSettings`, `boot`) |
-| `assets/css/demo-page.css` (new) | Fonts, colour tokens, top bar, the column, step headers, stage frame, player bar, switches, settings, More options, prompt card, chips, About, related cards, footer, responsive and reduced-motion rules |
-| `tests/demo-page.test.js` (new) | Unit tests for the pure helpers |
-| `tests/pages.test.js` (modify) | Accept both layouts; static checks for guided-steps pages |
-| `animations/02-entrance-and-exit/rotate-in/index.html` (rewrite) | The pilot page: markup in the new template and the demo's own script |
-| `animations/02-entrance-and-exit/rotate-in/README.md` (rewrite) | Key parameters, How it works and See also brought in line with the new settings |
-
-A static server for the site runs at `http://127.0.0.1:8731`. If nothing answers there, start one from the repo root with `python -m http.server 8731 --bind 127.0.0.1` (in the background).
-
----
-
-### Task 1: Pure helpers for the new page script
-
-**Files:**
-- Create: `assets/js/demo-page.js`
-- Test: `tests/demo-page.test.js`
-
-**Interfaces:**
-- Consumes: nothing.
-- Produces: `require('../assets/js/demo-page.js')` in Node, `window.DemoPage` in the browser, with:
- - `escapeHtml(s: string): string`
- - `plain(s: string): string` — Markdown code and bold markers removed, HTML-escaped
- - `isSafeHref(href: string): boolean` — true only for relative paths, `#` anchors and `http(s):` URLs; false for `//host`
- - `inline(md: string): string` — inline Markdown to HTML; code becomes plain text; unsafe links become their label
- - `sections(md: string): { [heading: string]: string }` — README split by `## ` headings
- - `paragraphs(text: string): string` — `<p>` per blank-line-separated block
- - `seeAlso(text: string): Array<{ name: string, href: string, desc: string }>`
- - `settingsLine(items: Array<{ label: string, value: string }>): string` — `"Speed: Normal, Fades in: on"`
- - `markFill(text: string): string` — escaped HTML with each `[...]` wrapped in `<mark class="hb-fill">`
-
-- [ ] **Step 1: Write the failing tests**
-
-Create `tests/demo-page.test.js`:
-
-```js
-// Unit tests for the pure helpers in assets/js/demo-page.js.
-// Run from the repo root: node --test "tests/*.test.js"
-const test = require('node:test');
-const assert = require('node:assert/strict');
-const DP = require('../assets/js/demo-page.js');
-
-test('escapeHtml escapes markup characters', () => {
- assert.equal(DP.escapeHtml('<a href="x">&</a>'), '&lt;a href=&quot;x&quot;&gt;&amp;&lt;/a&gt;');
-});
-
-test('plain drops code and bold markers and escapes', () => {
- assert.equal(DP.plain('`ease-out` **fast** <b>'), 'ease-out fast &lt;b&gt;');
-});
-
-test('isSafeHref allows relative, anchor and http(s) links only', () => {
- for (const ok of ['../scale-in/', 'README.md', '#top', '/animation-handbook/', 'https://example.com/p', 'http://example.com']) {
- assert.equal(DP.isSafeHref(ok), true, ok);
- }
- for (const bad of ['javascript:alert(1)', 'data:text/html,x', '//evil.example/x', 'mailto:[email protected]']) {
- assert.equal(DP.isSafeHref(bad), false, bad);
- }
-});
-
-test('inline shows code as plain text and renders links, bold and italics', () => {
- assert.equal(DP.inline('Use `opacity` on **one** *hero* [card](../scale-in/)'),
- 'Use opacity on <strong>one</strong> <em>hero</em> <a href="../scale-in/">card</a>');
- assert.equal(DP.inline('a < b'), 'a &lt; b');
-});
-
-test('inline links only safe targets and keeps parentheses around links', () => {
- assert.ok(!DP.inline('[x](javascript:alert(1))').includes('<a'), 'no link for javascript: URLs');
- assert.ok(!DP.inline('[x](//evil.example/)').includes('<a'), 'no link for protocol-relative URLs');
- assert.equal(DP.inline('[a](https://example.com/p)'), '<a href="https://example.com/p">a</a>');
- assert.equal(DP.inline('(see [Scale In](../scale-in/))'), '(see <a href="../scale-in/">Scale In</a>)');
-});
-
-test('sections splits a README by its ## headings', () => {
- const md = '# Title\r\n\r\n## What it is\r\nLine one\r\nline two\r\n\r\n## When to use it\r\n- A\r\n- B\r\n';
- assert.deepEqual(DP.sections(md), { 'What it is': 'Line one\nline two', 'When to use it': '- A\n- B' });
-});
-
-test('sections keeps ### lines inside the section they belong to', () => {
- assert.deepEqual(DP.sections('## A\n### not a section\nx'), { A: '### not a section\nx' });
-});
-
-test('paragraphs joins wrapped lines and splits on blank lines', () => {
- assert.equal(DP.paragraphs('One\ntwo.\n\nThree `x`.'), '<p>One two.</p><p>Three x.</p>');
- assert.equal(DP.paragraphs(undefined), '');
-});
-
-test('seeAlso reads name, link and description', () => {
- const md = '- [Scale In](../scale-in/) — grows from small, with no spin\n- [Blur In](../blur-in/)\nText';
- assert.deepEqual(DP.seeAlso(md), [
- { name: 'Scale In', href: '../scale-in/', desc: 'grows from small, with no spin' },
- { name: 'Blur In', href: '../blur-in/', desc: '' }
- ]);
-});
-
-test('settingsLine writes "label: value" pairs and skips incomplete ones', () => {
- assert.equal(DP.settingsLine([
- { label: 'Speed', value: 'Normal' }, { label: 'Fades in', value: 'on' },
- { label: 'Mode', value: '' }, { label: '', value: 'x' }
- ]), 'Speed: Normal, Fades in: on');
- assert.equal(DP.settingsLine([]), '');
- assert.equal(DP.settingsLine(undefined), '');
-});
-
-test('markFill highlights the parts in square brackets and escapes the rest', () => {
- assert.equal(DP.markFill('Add it to [the icon you want] & <go>.'),
- 'Add it to <mark class="hb-fill">[the icon you want]</mark> &amp; &lt;go&gt;.');
- assert.equal(DP.markFill('No brackets here.'), 'No brackets here.');
-});
-```
-
-- [ ] **Step 2: Run the tests to see them fail**
-
-Run: `node --test "tests/*.test.js"`
-Expected: `tests/demo-page.test.js` fails with `Cannot find module '../assets/js/demo-page.js'`; the other test files still pass.
-
-- [ ] **Step 3: Write the helpers**
-
-Create `assets/js/demo-page.js`:
-
-```js
-/* Animation Handbook — shared behaviour for the guided-steps demo pages.
- * The pure helpers are exported for tests/demo-page.test.js. */
-(function (root, factory) {
- var api = factory();
- if (typeof module === 'object' && module.exports) { module.exports = api; return; }
- root.DemoPage = api;
-})(typeof self !== 'undefined' ? self : this, function () {
- 'use strict';
-
- /* ---------- Pure helpers ---------- */
-
- function escapeHtml(s) {
- return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
- }
-
- // Text with Markdown code and bold markers removed, safe to insert as HTML.
- function plain(s) {
- return escapeHtml(String(s).replace(/`/g, '').replace(/\*\*/g, ''));
- }
-
- // Only relative paths, "#" anchors and http(s) URLs are link targets. Anything else, including
- // protocol-relative "//host" links, is rendered as plain text instead.
- function isSafeHref(href) {
- href = String(href);
- return /^(?:https?:|#|\.{0,2}\/|[\w.-]+(?:\/|$))/i.test(href) && !/^\/\//.test(href) &&
- !/^[a-z][a-z0-9+.-]*:/i.test(href.replace(/^https?:/i, ''));
- }
-
- // Inline Markdown from README prose. Inline code becomes plain text: the site shows no code.
- function inline(md) {
- return escapeHtml(md)
- .replace(/`([^`]+)`/g, '$1')
- .replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, function (m, label, href) {
- return isSafeHref(href) ? '<a href="' + href + '">' + label + '</a>' : label;
- })
- .replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
- .replace(/\*([^*\n]+)\*/g, '<em>$1</em>');
- }
-
- // A README split into { "What it is": "...", ... } by its "## " headings.
- function sections(md) {
- var out = {}, current = null, buf = [];
- String(md).replace(/\r\n?/g, '\n').split('\n').forEach(function (line) {
- var m = /^##\s+(.+?)\s*$/.exec(line);
- if (m) {
- if (current) out[current] = buf.join('\n').trim();
- current = m[1];
- buf = [];
- } else if (current) {
- buf.push(line);
- }
- });
- if (current) out[current] = buf.join('\n').trim();
- return out;
- }
-
- function paragraphs(text) {
- return String(text || '').split(/\n\s*\n/)
- .map(function (p) { return p.trim(); })
- .filter(Boolean)
- .map(function (p) { return '<p>' + inline(p.replace(/\s*\n\s*/g, ' ')) + '</p>'; })
- .join('');
- }
-
- // "- [Name](../slug/) — description" lines as [{ name, href, desc }].
- function seeAlso(text) {
- return String(text || '').split('\n').map(function (l) {
- var m = /^\s*[-*]\s+\[([^\]]+)\]\(([^)\s]+)\)\s*(?:[—–-]\s*(.*))?$/.exec(l);
- return m ? { name: plain(m[1]), href: m[2], desc: m[3] ? inline(m[3]) : '' } : null;
- }).filter(Boolean);
- }
-
- // [{ label: 'Speed', value: 'Normal' }, ...] as "Speed: Normal, ...", skipping incomplete pairs.
- function settingsLine(items) {
- return (items || [])
- .filter(function (i) { return i && i.label && i.value; })
- .map(function (i) { return i.label + ': ' + i.value; })
- .join(', ');
- }
-
- // The prompt as HTML with each [part to fill in] highlighted.
- function markFill(text) {
- return escapeHtml(text).replace(/\[[^\]\n]+\]/g, function (part) {
- return '<mark class="hb-fill">' + part + '</mark>';
- });
- }
-
- return {
- escapeHtml: escapeHtml, plain: plain, isSafeHref: isSafeHref, inline: inline, sections: sections,
- paragraphs: paragraphs, seeAlso: seeAlso, settingsLine: settingsLine, markFill: markFill
- };
-});
-```
-
-- [ ] **Step 4: Run the tests to see them pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes (the 62 existing ones plus the 11 new ones in `tests/demo-page.test.js`).
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add assets/js/demo-page.js tests/demo-page.test.js
-git commit -m "feat: add the helpers for the guided-steps demo page"
-```
-
----
-
-### Task 2: The page stylesheet and the Rotate In page
-
-**Files:**
-- Create: `assets/css/demo-page.css`
-- Rewrite: `animations/02-entrance-and-exit/rotate-in/index.html`
-- Rewrite: `animations/02-entrance-and-exit/rotate-in/README.md`
-- Rewrite: `tests/pages.test.js`
-
-**Interfaces:**
-- Consumes: `assets/js/demo-page.js` from Task 1 (the page links it; until Task 3 it only defines `window.DemoPage`).
-- Produces, for Task 3 (the shared script relies on these exact class names and markers):
- - `<main class="hb-page">` wrapping everything between the top bar and the footer
- - `<section class="hb-step hb-watch">` containing `.stage` and `<div class="hb-player">` with `[data-hb-replay]` (button), `input[data-hb-loop]` and `input[data-hb-slowmo]` (checkboxes)
- - `<section class="hb-step hb-try">` containing every setting; settings inside `<details class="hb-options">` count too
- - `<p class="hb-prompt">` (plain text only), `<div class="hb-chips-box" hidden>` with `<ul class="hb-chips">`, `<button class="hb-copy" type="button">` with `<span class="hb-copy-label">`
- - `<div class="hb-what-text">` (starts with a link to README.md), `<section class="hb-related" hidden>` with `<div class="hb-rel-list">`
- - CSS hooks the script toggles: `.hb-prompt.is-clamped`, `.hb-prompt-more`, `.hb-copy.is-done`, `mark.hb-fill`, `a.hb-rel` (with `<b>` name and `<span>` description)
- - The demo's Replay button restarts the animation and keeps looping when Loop is on; switching Loop on starts looping; Slow motion takes effect on the next play.
-
-- [ ] **Step 1: Write the failing page checks**
-
-Replace `tests/pages.test.js` with:
-
-```js
-// Static checks for demo pages that use the shared layouts, their READMEs and the home page.
-// Run from the repo root: node --test "tests/*.test.js"
-const test = require('node:test');
-const assert = require('node:assert/strict');
-const fs = require('node:fs');
-const path = require('node:path');
-const { sections, table } = require('../assets/js/handbook.js');
-
-const ROOT = path.resolve(__dirname, '..');
-const ANIM = path.join(ROOT, 'animations');
-const read = f => fs.readFileSync(f, 'utf8');
-const count = (s, sub) => s.split(sub).length - 1;
-const words = s => s.trim().split(/\s+/).length;
-const isDemoDir = dir => fs.existsSync(path.join(dir, 'index.html'));
-// The part of s from the first `from` up to the next `to` after it ('' when `from` is missing).
-const between = (s, from, to) => {
- const start = s.indexOf(from);
- if (start < 0) return '';
- const end = s.indexOf(to, start + from.length);
- return s.slice(start, end < 0 ? undefined : end);
-};
-
-const demos = fs.readdirSync(ANIM, { withFileTypes: true }).filter(c => c.isDirectory()).flatMap(c =>
- fs.readdirSync(path.join(ANIM, c.name), { withFileTypes: true }).filter(d => d.isDirectory())
- .map(d => ({ cat: c.name, slug: d.name, dir: path.join(ANIM, c.name, d.name) })));
-const pageOf = d => read(path.join(d.dir, 'index.html'));
-const converted = demos.filter(d => pageOf(d).includes('<main class="hb-view">'));
-const steps = demos.filter(d => pageOf(d).includes('<main class="hb-page">'));
-
-const PILOT = '02-entrance-and-exit';
-const PILOT_AUTOPLAY = new Set(['fade-in-out', 'slide-in', 'slide-up-reveal', 'scale-in', 'clip-path-reveal',
- 'split-text-reveal', 'letter-by-letter-stagger', 'word-by-word-reveal', 'blur-in', 'flip-in', 'bounce-in', 'rotate-in']);
-
-test('every Entrance & Exit demo uses one of the shared layouts', () => {
- const left = demos.filter(d => d.cat === PILOT && !converted.includes(d) && !steps.includes(d)).map(d => d.slug);
- assert.deepEqual(left, []);
-});
-
-test('Rotate In uses the guided-steps page', () => {
- assert.ok(steps.some(d => d.cat === PILOT && d.slug === 'rotate-in'));
-});
-
-for (const d of converted) {
- test(`${d.cat}/${d.slug} uses the shared layout correctly`, () => {
- const html = pageOf(d);
- assert.ok(html.includes('<link rel="stylesheet" href="../../../assets/css/handbook.css">'), 'shared stylesheet');
- assert.ok(html.includes('<script src="../../../assets/js/handbook.js" defer></script>'), 'shared script');
- assert.match(html, /<body class="hb"( data-hb-autoplay)?>/);
- for (const legacy of ['ah-bar', 'ah-copy', 'ah-inject', 'Copy source', 'Bricolage', 'PlexMono', 'class="note"', 'class="layout"']) {
- assert.ok(!html.includes(legacy), `legacy markup left: ${legacy}`);
- }
- for (const part of ['<nav class="hb-bar"', '<main class="hb-view">', '<aside class="hb-side">', '<section class="hb-settings"', '<p class="hb-prompt">']) {
- assert.equal(count(html, part), 1, `exactly one ${part}`);
- }
- assert.match(html, /<p class="hb-cat">\d{2}\.\d{2} · [^<]+<\/p>/);
- const prompt = html.match(/<p class="hb-prompt">([^<]*)<\/p>/)[1];
- assert.ok(words(prompt) >= 60 && words(prompt) <= 130, `prompt has ${words(prompt)} words`);
- assert.ok(prompt.trim().endsWith('Match the settings listed below.'), 'prompt ending');
- assert.ok(!prompt.includes('`'), 'prompt contains no code');
- assert.equal(count(html, 'data-hb-replay'), 1, 'one replay control');
- assert.ok(count(html, 'data-hb-reset') <= 1, 'at most one reset control');
- if (d.cat === PILOT) assert.equal(html.includes('data-hb-autoplay'), PILOT_AUTOPLAY.has(d.slug), 'autoplay flag');
- for (const [, href] of html.matchAll(/<a href="([^"]+)" rel="(?:prev|next)"/g)) {
- assert.ok(isDemoDir(path.resolve(d.dir, href)), `pager link ${href}`);
- }
- });
-}
-
-for (const d of steps) {
- test(`${d.cat}/${d.slug} uses the guided-steps page correctly`, () => {
- const html = pageOf(d);
- assert.ok(html.includes('<link rel="stylesheet" href="../../../assets/css/demo-page.css">'), 'page stylesheet');
- assert.ok(html.includes('<script src="../../../assets/js/demo-page.js" defer></script>'), 'page script');
- assert.match(html, /<body class="hb"( data-hb-autoplay)?>/);
- for (const old of ['handbook.css', 'handbook.js', 'hb-view', 'hb-side', 'hb-take', 'ah-bar', 'Copy source', 'Read more',
- 'class="note"', 'class="kv"', 'class="lbl"', 'class="btn-row"', 'Bricolage', 'PlexMono']) {
- assert.ok(!html.includes(old), `old markup left: ${old}`);
- }
- for (const part of ['<nav class="hb-bar"', '<main class="hb-page">', '<header class="hb-head">',
- '<section class="hb-step hb-watch"', '<div class="hb-player">', '<section class="hb-step hb-try"',
- '<section class="hb-step hb-prompt-step"', '<p class="hb-prompt">', '<ul class="hb-chips">',
- '<button class="hb-copy" type="button">', '<section class="hb-about"', '<ul class="hb-tags hb-good">',
- '<ul class="hb-tags hb-avoid">', '<section class="hb-related"', '<footer class="hb-foot">']) {
- assert.equal(count(html, part), 1, `exactly one ${part}`);
- }
- assert.match(html, /<p class="hb-cat">\d{2}\.\d{2} · [^<]+<\/p>/);
- const prompt = html.match(/<p class="hb-prompt">([^<]*)<\/p>/)[1];
- assert.ok(words(prompt) >= 60 && words(prompt) <= 130, `prompt has ${words(prompt)} words`);
- assert.ok(prompt.trim().endsWith('Match the settings listed below.'), 'prompt ending');
- assert.ok(!prompt.includes('`'), 'prompt contains no code');
- const player = between(html, '<div class="hb-player">', '</div>');
- assert.equal(count(html, 'data-hb-replay'), 1, 'one Replay control');
- assert.ok(player.includes('data-hb-replay'), 'Replay is in the player bar');
- for (const marker of ['data-hb-loop', 'data-hb-slowmo']) {
- assert.ok(count(html, marker) <= 1, `at most one ${marker}`);
- assert.equal(count(player, marker), count(html, marker), `${marker} is in the player bar`);
- }
- const tryIt = between(html, '<section class="hb-step hb-try"', '<section class="hb-step hb-prompt-step"');
- const main = between(tryIt, '<div class="hb-settings">', '<details class="hb-options">');
- const mainCount = count(main, 'class="hb-setting"');
- assert.ok(mainCount >= 1 && mainCount <= 3, `${mainCount} main settings`);
- assert.equal(count(tryIt, 'class="hb-hint"'), count(tryIt, 'class="hb-setting"'), 'every setting has one hint');
- const good = count(between(html, '<ul class="hb-tags hb-good">', '</ul>'), '<li>');
- const avoid = count(between(html, '<ul class="hb-tags hb-avoid">', '</ul>'), '<li>');
- assert.ok(good >= 3 && good <= 5, `${good} Good for tags`);
- assert.ok(avoid >= 1 && avoid <= 3, `${avoid} Avoid on tags`);
- for (const [, href] of html.matchAll(/<a href="([^"]+)" rel="(?:prev|next)"/g)) {
- assert.ok(isDemoDir(path.resolve(d.dir, href)), `pager link ${href}`);
- }
- });
-
- test(`${d.slug}: every Key parameters name is a setting in Try it`, () => {
- const tryIt = between(pageOf(d), '<section class="hb-step hb-try"', '<section class="hb-step hb-prompt-step"')
- .replace(/<[^>]+>/g, ' ');
- const rows = sections(read(path.join(d.dir, 'README.md')))['Key parameters'].split('\n').slice(2);
- for (const row of rows) {
- const name = (row.split('|')[1] || '').trim();
- if (name) assert.ok(tryIt.includes(name), `setting "${name}"`);
- }
- });
-}
-
-const PILOT_SLUGS = ['fade-in-out', 'slide-in', 'slide-up-reveal', 'scale-in', 'clip-path-reveal', 'curtain-reveal',
- 'split-text-reveal', 'letter-by-letter-stagger', 'word-by-word-reveal', 'blur-in', 'flip-in', 'bounce-in', 'rotate-in'];
-
-for (const slug of PILOT_SLUGS) {
- test(`README for ${slug} is ready for the site`, () => {
- const dir = path.join(ANIM, PILOT, slug);
- const s = sections(read(path.join(dir, 'README.md')));
- for (const h of ['What it is', 'When to use it', 'Key parameters', 'See also']) assert.ok(s[h], `section ${h}`);
- assert.ok(!s['What it is'].includes('`'), 'What it is has no code');
- assert.ok(!s['Key parameters'].includes('`'), 'Key parameters has no code');
- assert.ok(table(s['Key parameters']).length > 0, 'Key parameters has rows');
- for (const [, href] of s['See also'].matchAll(/\]\(([^)\s]+)\)/g)) {
- assert.ok(isDemoDir(path.resolve(dir, href)), `See also link ${href}`);
- }
- });
-}
-
-for (const d of converted.filter(c => c.cat === PILOT)) {
- test(`${d.slug}: every Key parameters name is a control on the page`, () => {
- const html = pageOf(d);
- const panel = html.slice(html.indexOf('<section class="hb-settings"'), html.indexOf('<div class="hb-take">')).replace(/<[^>]+>/g, ' ');
- const rows = sections(read(path.join(d.dir, 'README.md')))['Key parameters'].split('\n').slice(2);
- for (const row of rows) {
- const name = (row.split('|')[1] || '').trim();
- if (name) assert.ok(panel.includes(name), `control label "${name}"`);
- }
- });
-}
-
-test('the home page uses Schibsted Grotesk and the new intro line', () => {
- const html = read(path.join(ROOT, 'index.html'));
- assert.ok(html.includes("url('assets/fonts/schibsted-latin.woff2')"), 'Latin font file');
- assert.ok(html.includes("url('assets/fonts/schibsted-latin-ext.woff2')"), 'Latin Extended font file');
- for (const old of ['Bricolage', 'PlexMono', 'var(--mono)', '--mono:']) assert.ok(!html.includes(old), `still uses ${old}`);
- assert.ok(html.includes('See 129 web animations move, learn when to use each one, and copy a prompt to build it.'));
-});
-```
-
-- [ ] **Step 2: Run the tests to see the new check fail**
-
-Run: `node --test "tests/*.test.js"`
-Expected: exactly one failure, `Rotate In uses the guided-steps page`; everything else passes.
-
-- [ ] **Step 3: Create the page stylesheet**
-
-Create `assets/css/demo-page.css`:
-
-```css
-/* Animation Handbook — page chrome for the guided-steps demo pages.
- Linked after each demo's own <style>, so these rules win where they overlap.
- The animation keeps its own styles; this file lays out the page around it:
- top bar, header, the three steps, About, related cards and footer. */
-
-@font-face{font-family:'Schibsted Grotesk';src:url('../fonts/schibsted-latin-ext.woff2') format('woff2');font-weight:400 900;font-style:normal;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('../fonts/schibsted-latin.woff2') format('woff2');font-weight:400 900;font-style:normal;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{
- --hb-font:'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;
- --disp:var(--hb-font);--mono:var(--hb-font);
- --hb-bg:#0b0b0d;--hb-panel:#111114;
- --hb-ink:#f4f4f2;--hb-text:#e6e6e8;--hb-soft:#d6d6da;--hb-dim:#adadb2;--hb-muted:#8a8a92;
- --hb-line:rgba(255,255,255,.085);--hb-edge:rgba(255,255,255,.16);--hb-edge-2:rgba(255,255,255,.36);
- --hb-accent:var(--ui-accent,#6ea8ff);--hb-bar:56px;
-}
-
-body.hb{margin:0;padding:0;background:var(--hb-bg);color:var(--hb-ink);font-family:var(--hb-font);-webkit-font-smoothing:antialiased}
-body.hb :focus-visible{outline:2px solid var(--hb-accent);outline-offset:3px}
-/* Demo styles often set display on their own classes; keep the hidden attribute authoritative. */
-body.hb [hidden]{display:none!important}
-.hb-ic{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
-
-/* Top bar */
-.hb-bar{position:sticky;top:0;z-index:50;box-sizing:border-box;height:var(--hb-bar);display:flex;align-items:center;justify-content:space-between;gap:12px;
- padding:0 clamp(8px,3vw,40px);background:rgba(11,11,13,.9);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-bottom:1px solid var(--hb-line)}
-.hb-bar a{display:inline-flex;align-items:center;gap:8px;min-height:44px;min-width:44px;padding:0 8px;border-radius:8px;color:var(--hb-dim);
- text-decoration:none;font:500 15px/1 var(--hb-font)}
-.hb-bar .hb-home{color:var(--hb-ink);font-weight:700;font-size:16px;letter-spacing:-.01em}
-.hb-mark{width:26px;height:26px;flex:none}
-.hb-mark .g{fill:var(--hb-bg);stroke:var(--hb-ink);stroke-width:1.8}
-.hb-mark .b{fill:var(--hb-ink)}
-.hb-pager{display:flex;gap:4px}
-.hb-bar .hb-ic{width:16px;height:16px}
-
-/* The page: one centred column */
-.hb-page{box-sizing:border-box;width:100%;max-width:1040px;margin:0 auto;
- padding:clamp(24px,4vw,40px) clamp(16px,4vw,40px) clamp(40px,6vw,64px);display:flex;flex-direction:column;gap:clamp(32px,4vw,40px)}
-.hb-head{margin:0;display:flex;flex-direction:column;gap:8px}
-.hb-cat{margin:0;font:600 14px/1.3 var(--hb-font);letter-spacing:.04em;color:var(--hb-accent)}
-.hb-page h1{margin:0;font:800 clamp(40px,6vw,64px)/1 var(--hb-font);letter-spacing:-.035em;color:var(--hb-ink)}
-.hb-lede{margin:0;font:400 clamp(17px,2vw,20px)/1.5 var(--hb-font);color:var(--hb-dim)}
-
-/* Steps */
-.hb-step{display:flex;flex-direction:column;gap:clamp(16px,2.4vw,24px)}
-.hb-step+.hb-step{padding-top:clamp(28px,4vw,36px);border-top:1px solid var(--hb-line)}
-.hb-watch{gap:16px}
-.hb-step-head{display:flex;align-items:flex-start;gap:14px}
-.hb-num{flex:none;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;
- background:var(--hb-accent);color:#0b0b0d;font:800 16px/1 var(--hb-font)}
-.hb-step-head h2{margin:0;font:700 clamp(22px,2.6vw,26px)/1.2 var(--hb-font);letter-spacing:-.015em;color:var(--hb-ink)}
-.hb-step-head p{margin:4px 0 0;font:400 16px/1.5 var(--hb-font);color:var(--hb-dim)}
-
-/* Step 1: stage and player bar. 420px is roughly everything above and below the stage on the
- first screen, so on a laptop the stage and the player bar are both visible on arrival. */
-.hb-page .stage{box-sizing:border-box;width:100%;min-width:0;min-height:0;margin:0;flex:none;
- height:clamp(300px,calc(100vh - 420px),440px);height:clamp(300px,calc(100svh - 420px),440px);
- border:1px solid rgba(255,255,255,.1);border-radius:12px;overflow:hidden}
-.hb-page .stage.hb-dots{background-image:radial-gradient(rgba(255,255,255,.075) 1px,transparent 1.5px);background-size:24px 24px;background-position:center}
-.hb-player{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
-.hb-play,.hb-toggle{box-sizing:border-box;display:inline-flex;align-items:center;gap:10px;min-height:44px;padding:0 18px;
- border:1px solid rgba(255,255,255,.18);border-radius:8px;background:none;color:var(--hb-ink);font:500 15px/1 var(--hb-font);cursor:pointer}
-
-/* Switches: a checkbox drawn as a track and knob (gradients, so no pseudo-elements on the input) */
-.hb-switch{appearance:none;-webkit-appearance:none;flex:none;width:32px;height:20px;margin:0;border-radius:999px;cursor:pointer;
- background:radial-gradient(circle at 10px 50%,var(--hb-ink) 6.5px,transparent 7px) rgba(255,255,255,.22)}
-.hb-switch:checked{background:radial-gradient(circle at 22px 50%,#0b0b0d 6.5px,transparent 7px) var(--hb-accent)}
-.hb-toggle:has(:focus-visible),.hb-switch-row:has(:focus-visible){outline:2px solid var(--hb-accent);outline-offset:3px}
-.hb-toggle .hb-switch:focus-visible,.hb-switch-row .hb-switch:focus-visible{outline:none}
-
-/* Step 2: settings */
-.hb-settings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 32px}
-.hb-setting{display:flex;flex-direction:column;gap:10px;min-width:0}
-.hb-setting-name{margin:0;font:600 17px/1.3 var(--hb-font);color:var(--hb-ink)}
-.hb-hint{margin:0;font:400 14px/1.45 var(--hb-font);color:var(--hb-muted)}
-.hb-page .seg{display:flex;flex-wrap:wrap;gap:8px}
-.hb-page .seg button{box-sizing:border-box;min-height:44px;padding:0 16px;border:1px solid var(--hb-edge);border-radius:8px;background:none;
- color:var(--hb-soft);font:500 15px/1.2 var(--hb-font);cursor:pointer;transition:background-color .15s,border-color .15s,color .15s}
-.hb-page .seg button.on,.hb-page .seg button[aria-pressed="true"]{border-color:var(--hb-accent);color:var(--hb-accent);
- background:color-mix(in srgb,var(--hb-accent) 12%,transparent)}
-.hb-switch-row{box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:52px;padding:0 16px;
- border:1px solid rgba(255,255,255,.14);border-radius:8px;font:500 15px/1.3 var(--hb-font);color:var(--hb-ink);cursor:pointer}
-.hb-options>summary{display:inline-flex;align-items:center;gap:6px;min-height:44px;list-style:none;cursor:pointer;
- font:600 15px/1 var(--hb-font);color:var(--hb-accent)}
-.hb-options>summary::-webkit-details-marker{display:none}
-.hb-options>summary .hb-ic{transition:transform .2s}
-.hb-options[open]>summary .hb-ic{transform:rotate(180deg)}
-.hb-options .hb-less,.hb-options[open] .hb-more-label{display:none}
-.hb-options[open] .hb-less{display:inline}
-.hb-options>.hb-settings{margin-top:16px}
-
-/* Step 3: the prompt card */
-.hb-card{display:flex;flex-direction:column;gap:20px;padding:clamp(18px,3vw,28px);border:1px solid rgba(255,255,255,.12);border-radius:12px;background:var(--hb-panel)}
-.hb-prompt{margin:0;font:400 17px/1.65 var(--hb-font);color:var(--hb-text)}
-.hb-fill{padding:1px 5px;border-radius:4px;background:rgba(255,255,255,.1);color:var(--hb-ink)}
-.hb-prompt-more{display:none;align-self:flex-start;min-height:44px;margin-top:-12px;padding:0;border:0;background:none;
- color:var(--hb-accent);font:600 15px/1 var(--hb-font);cursor:pointer}
-.hb-chips-box{display:flex;flex-direction:column;gap:10px}
-.hb-chips-title{margin:0;font:400 14px/1.4 var(--hb-font);color:var(--hb-muted)}
-.hb-chips{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
-.hb-chips li{padding:6px 12px;border-radius:999px;background:color-mix(in srgb,var(--hb-accent) 12%,transparent);color:var(--hb-accent);
- font:500 14px/1.3 var(--hb-font)}
-.hb-copy-row{display:flex;flex-wrap:wrap;align-items:center;gap:12px 20px}
-.hb-copy-row .hb-hint{flex:1 1 260px}
-.hb-copy{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:52px;padding:0 26px;border:0;
- border-radius:8px;background:var(--hb-ink);color:#0b0b0d;font:700 16px/1 var(--hb-font);cursor:pointer}
-.hb-copy .hb-i-done,.hb-copy.is-done .hb-i-copy{display:none}
-.hb-copy.is-done .hb-i-done{display:inline}
-
-/* About and related animations */
-.hb-about{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:clamp(24px,5vw,48px);padding-top:clamp(28px,4vw,36px);
- border-top:1px solid var(--hb-line)}
-.hb-about h2,.hb-related h2{margin:0 0 12px;font:700 22px/1.2 var(--hb-font);letter-spacing:-.01em;color:var(--hb-ink)}
-.hb-about h3{margin:20px 0 12px;font:600 16px/1.3 var(--hb-font);color:var(--hb-dim)}
-.hb-what-text p{margin:0;font:400 16px/1.7 var(--hb-font);color:var(--hb-dim)}
-.hb-what-text p+p{margin-top:12px}
-.hb-what-text a{color:var(--hb-ink)}
-.hb-tags{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
-.hb-tags li{padding:8px 14px;border:1px solid rgba(255,255,255,.14);border-radius:999px;font:400 15px/1.2 var(--hb-font);color:var(--hb-soft)}
-.hb-avoid li{border-style:dashed;color:var(--hb-muted)}
-.hb-rel-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}
-.hb-rel{display:flex;flex-direction:column;gap:6px;padding:18px 20px;border:1px solid rgba(255,255,255,.12);border-radius:10px;text-decoration:none}
-.hb-rel b{font:700 18px/1.25 var(--hb-font);color:var(--hb-ink)}
-.hb-rel span{font:400 14px/1.45 var(--hb-font);color:var(--hb-muted)}
-
-/* Footer */
-.hb-foot{box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;
- padding:16px clamp(16px,4vw,40px) 24px;border-top:1px solid var(--hb-line);font:400 14px/1.4 var(--hb-font);color:var(--hb-muted)}
-.hb-foot a{display:inline-flex;align-items:center;min-height:44px;color:var(--hb-dim);text-decoration:none}
-
-@media(hover:hover){
- .hb-bar a:hover{color:var(--hb-ink)}
- .hb-play:hover,.hb-toggle:hover,.hb-switch-row:hover{border-color:var(--hb-edge-2)}
- .hb-page .seg button:hover{border-color:rgba(255,255,255,.34);color:var(--hb-ink)}
- .hb-page .seg button.on:hover,.hb-page .seg button[aria-pressed="true"]:hover{border-color:var(--hb-accent);color:var(--hb-accent)}
- .hb-options>summary:hover,.hb-prompt-more:hover{color:color-mix(in srgb,var(--hb-accent) 70%,#fff)}
- .hb-copy:hover{background:#fff}
- .hb-rel:hover{border-color:color-mix(in srgb,var(--hb-accent) 55%,transparent)}
- .hb-foot a:hover{color:var(--hb-ink)}
-}
-
-@media(max-width:759px){
- .hb-settings,.hb-about{grid-template-columns:minmax(0,1fr)}
-}
-@media(max-width:600px){
- .hb-bar .hb-dir{display:none}
- .hb-page .stage{height:300px}
- .hb-step-head{gap:12px}
- .hb-num{width:30px;height:30px;font-size:15px}
- .hb-step-head p{font-size:15px}
- .hb-player{gap:8px}
- .hb-play,.hb-toggle{gap:8px;padding:0 12px;font-size:14px}
- .hb-page .seg button{flex:1 1 0;min-width:0;padding:0 8px}
- .hb-prompt{font-size:16px;line-height:1.6}
- .hb-prompt.is-clamped{display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden}
- .hb-prompt-more{display:inline-flex;align-items:center}
- .hb-copy{width:100%}
-}
-@media(prefers-reduced-motion:reduce){
- .hb-page .seg button,.hb-options>summary .hb-ic{transition:none}
-}
-```
-
-- [ ] **Step 4: Rewrite the Rotate In page**
-
-Replace `animations/02-entrance-and-exit/rotate-in/index.html` with:
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Rotate In — Animation Handbook</title>
- <meta name="description" content="Spins into place while it grows. Best for icons, stars and badges.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/rotate-in/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Rotate In — Animation Handbook">
- <meta property="og:description" content="Spins into place while it grows. Best for icons, stars and badges.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/rotate-in/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Rotate In — Animation Handbook">
- <meta name="twitter:description" content="Spins into place while it grows. Best for icons, stars and badges.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Rotate In", "name": "Rotate In", "description": "Spins into place while it grows. Best for icons, stars and badges.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/rotate-in/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Rotate In"}</script>
- <style>
- :root{--ui-accent:#5fd88a;--dur:600ms;--ease:cubic-bezier(.34,1.56,.64,1);--rot-start:-180deg;--scale-start:0;--opacity-dur:var(--dur)}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{display:flex;align-items:center;justify-content:center;background:#0b0b0d}
- .icon{width:150px;height:150px;display:flex;align-items:center;justify-content:center;
- opacity:0;transform:rotate(var(--rot-start)) scale(var(--scale-start));
- transition:transform var(--dur) var(--ease),opacity var(--opacity-dur) var(--ease);will-change:transform,opacity}
- .icon.in{opacity:1;transform:rotate(0deg) scale(1)}
- .icon svg{width:100%;height:100%}
- @media(prefers-reduced-motion:reduce){.icon{transition:opacity 300ms linear!important;transform:none!important}}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css">
- <script src="../../../assets/js/demo-page.js" defer></script>
-</head>
-<body class="hb" data-hb-autoplay>
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../bounce-in/" rel="prev" aria-label="Previous: Bounce In"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span class="hb-dir">Previous:</span> <span class="hb-name">Bounce In</span></a></span>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">02.13 · Entrance &amp; Exit</p>
- <h1>Rotate In</h1>
- <p class="hb-lede">Spins into place while it grows. Best for icons, stars and badges.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Watch it</h2><p>It plays by itself. Turn on slow motion to see each part of the movement.</p></div>
- </div>
- <div class="stage hb-dots">
- <div class="icon" id="icon" role="img" aria-label="A round icon spinning into place">
- <svg viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <circle cx="50" cy="50" r="18" fill="#58a6ff" opacity=".9"/>
- <circle cx="50" cy="50" r="28" stroke="#58a6ff" stroke-width="3" opacity=".4"/>
- <path d="M50 14 L54 22 L63 20 L60 29 L68 33 L60 37 L63 46 L54 44 L50 52 L46 44 L37 46 L40 37 L32 33 L40 29 L37 20 L46 22Z" fill="#58a6ff" opacity=".7"/>
- </svg>
- </div>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-play" data-hb-replay><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Replay</button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="loop-tog" data-hb-loop><span>Loop</span></label>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo><span>Slow motion</span></label>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and the animation plays again.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="spin-lbl">How much it spins</p>
- <div class="seg" id="spin-seg" role="group" aria-labelledby="spin-lbl">
- <button type="button" data-turn="90" aria-pressed="false">¼ turn</button>
- <button type="button" data-turn="180" class="on" aria-pressed="true">½ turn</button>
- <button type="button" data-turn="360" aria-pressed="false">Full turn</button>
- </div>
- <p class="hb-hint">A bigger spin feels more playful.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="speed-lbl">Speed</p>
- <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">
- <button type="button" data-ms="1000" aria-pressed="false">Slow</button>
- <button type="button" data-ms="600" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-ms="350" aria-pressed="false">Fast</button>
- </div>
- <p class="hb-hint">Slow is easy to follow. Fast feels snappy.</p>
- </div>
- </div>
- <details class="hb-options">
- <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="dir-lbl">Spin direction</p>
- <div class="seg" id="dir-seg" role="group" aria-labelledby="dir-lbl">
- <button type="button" data-dir="-1" class="on" aria-pressed="true">Clockwise</button>
- <button type="button" data-dir="1" aria-pressed="false">Counter-clockwise</button>
- </div>
- <p class="hb-hint">Which way it turns as it lands.</p>
- </div>
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Bounce at the end</span><input class="hb-switch" type="checkbox" role="switch" id="bounce-tog" checked></label>
- <p class="hb-hint">Goes slightly too far, then settles.</p>
- </div>
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Grows from small</span><input class="hb-switch" type="checkbox" role="switch" id="scale-tog" checked></label>
- <p class="hb-hint">Makes the spin look like an arrival.</p>
- </div>
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Fades in</span><input class="hb-switch" type="checkbox" role="switch" id="fade-tog" checked></label>
- <p class="hb-hint">Softens the first moment.</p>
- </div>
- </div>
- </details>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add a rotate-in entrance to [the icon or badge you want to animate]. It should spin around its center as it appears. Growing from small at the same time makes it look like it is arriving rather than just turning, and a slight overshoot at the end makes the spin land instead of gliding to a stop. Use this on round or symmetric shapes like icons, stars, gears and badges; it looks wrong on text or wide rectangles. If the visitor has reduced motion turned on, show it in place without spinning. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Icons</li><li>Badges and stars</li><li>Logos</li><li>Small decorations</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Text</li><li>Wide boxes and cards</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="#top">Back to top ↑</a></footer>
-<script>
- const icon=document.getElementById('icon');
- const vars=document.documentElement.style;
- const loopTog=document.getElementById('loop-tog'),slowTog=document.getElementById('slow-tog');
- const bounceTog=document.getElementById('bounce-tog'),scaleTog=document.getElementById('scale-tog'),fadeTog=document.getElementById('fade-tog');
- const motionOk=!window.matchMedia('(prefers-reduced-motion:reduce)').matches;
- const SPRINGY='cubic-bezier(.34,1.56,.64,1)',SMOOTH='cubic-bezier(.2,.7,.3,1)';
- let turn=180,ms=600,dir=-1,timers=[];
-
- function dur(){return slowTog.checked?ms*3:ms}
- function apply(){
- vars.setProperty('--rot-start',dir*turn+'deg');
- vars.setProperty('--dur',dur()+'ms');
- vars.setProperty('--ease',bounceTog.checked?SPRINGY:SMOOTH);
- vars.setProperty('--scale-start',scaleTog.checked?'0':'1');
- vars.setProperty('--opacity-dur',fadeTog.checked?'var(--dur)':'0s');
- }
- function later(fn,wait){timers.push(setTimeout(fn,wait))}
- function spinIn(){
- // snap back to the starting pose without a transition so every play starts from the beginning
- icon.style.setProperty('transition','none','important');
- icon.classList.remove('in');void icon.offsetWidth;
- icon.style.removeProperty('transition');
- icon.classList.add('in');
- }
- // One play spins in. While Loop is on it then waits, spins out, waits and plays again;
- // switching Loop off lets the icon finish landed. Slow motion stretches the spins, not the waits.
- function cycle(){
- apply();spinIn();
- if(!loopTog.checked||!motionOk)return;
- later(()=>{
- if(!loopTog.checked)return;
- icon.classList.remove('in');
- later(cycle,dur()+500);
- },dur()+900);
- }
- function play(){timers.forEach(clearTimeout);timers=[];cycle()}
-
- document.getElementById('btn-play').addEventListener('click',play);
- loopTog.addEventListener('change',()=>{if(loopTog.checked)play()});
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);
- }));
- }
- choices('spin-seg',d=>{turn=+d.turn});
- choices('speed-seg',d=>{ms=+d.ms});
- choices('dir-seg',d=>{dir=+d.dir});
- apply();
-</script>
-</body>
-</html>
-```
-
-- [ ] **Step 5: Rewrite the Rotate In README**
-
-Replace `animations/02-entrance-and-exit/rotate-in/README.md` with:
-
-````markdown
-# Rotate In
-
-## What it is
-
-Rotate In spins an element around its center as it enters, usually while it grows from small, so it reads as arriving rather than just turning in place. The spin is easiest to follow when the shape looks right at every angle, so it suits round or symmetric marks such as icons, stars, gears and badges, not text or wide rectangles.
-
-## When to use it
-- Icon and badge reveals — achievement unlocks, status indicators, loading-to-done transitions
-- Logos or emblems where a spin reinforces a "coming together" moment
-- Small decorative elements that can absorb an energetic entrance
-- Anywhere the resting shape is symmetric enough that a mid-spin frame still looks intentional
-
-## How it works
-The element starts rotated and scaled down, then transitions both back to their resting values when the `.in` class is added. A springy easing gives the spin a slight overshoot so it feels like it lands:
-
-```css
-.icon{
- opacity:0;
- transform:rotate(var(--rot-start)) scale(var(--scale-start));
- transition:transform var(--dur) var(--ease),
- opacity var(--opacity-dur) var(--ease)}
-.icon.in{opacity:1;transform:rotate(0deg) scale(1)}
-```
-
-Every setting only changes a custom property. The starting angle is the chosen amount of turn, signed by the direction, and switching the bounce off swaps the springy curve for a smooth one:
-
-```js
-function apply(){
- vars.setProperty('--rot-start',dir*turn+'deg');
- vars.setProperty('--dur',dur()+'ms');
- vars.setProperty('--ease',bounceTog.checked?SPRINGY:SMOOTH);
- vars.setProperty('--scale-start',scaleTog.checked?'0':'1');
- vars.setProperty('--opacity-dur',fadeTog.checked?'var(--dur)':'0s');
-}
-```
-
-A negative starting angle spins clockwise into place and a positive one counter-clockwise; either way the element lands at `rotate(0deg)`. Each play first snaps the icon back to its starting pose with the transition switched off, so a replay always spins in from the beginning. Slow motion multiplies the duration by three.
-
-## Key parameters
-
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| How much it spins | ½ turn | How far it turns on the way in: a quarter turn, half a turn or a full turn |
-| Speed | Normal | How long the spin takes: slow is 1000ms, normal 600ms and fast 350ms |
-| Spin direction | Clockwise | Which way it turns as it lands |
-| Bounce at the end | on | Goes slightly past its resting angle and settles back, so the spin lands instead of gliding to a stop |
-| Grows from small | on | Starts tiny and grows while it spins, which turns a spin into an arrival |
-| Fades in | on | Fades in as it spins instead of appearing at once |
-
-## Production notes
-- **Symmetry matters**: rotating text or a rectangle looks like it fell over, not like it entered. The demo deliberately uses a symmetric icon so every intermediate frame reads correctly.
-- **Scale sells the arrival**: rotation alone spins the element where it already is; adding `scale(0) → scale(1)` makes it feel like it travels in from nothing. The two combined are what create the "landing" quality.
-- **Decouple opacity timing**: the demo gives the fade its own duration (`--opacity-dur`), so you can, for example, fade in quickly while the spin continues — a fully-transparent spin start can otherwise look like a glitch.
-- **Reduced motion**: the icon drops to a plain 300ms opacity fade with no rotation or scale when `prefers-reduced-motion` is set, and the demo does not loop.
-- **Framer Motion**: animate `rotate` and `scale` together in a variant, with a spring transition for the landing overshoot.
-- **GSAP**: tween `rotation` and `scale` with a `back.out` ease; `back` provides the overshoot in one keyword.
-
-## See also
-- [Flip In](../flip-in/) — swings in like a card turning over
-- [Scale In](../scale-in/) — grows from small, with no spin
-- [Bounce In](../bounce-in/) — lands with a springy bounce
-````
-
-- [ ] **Step 6: Run the tests to see them pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes, including `Rotate In uses the guided-steps page`, `02-entrance-and-exit/rotate-in uses the guided-steps page correctly` and `rotate-in: every Key parameters name is a setting in Try it`.
-
-- [ ] **Step 7: Look at the page**
-
-With the static server on port 8731 running, take a full-page screenshot and open it with the Read tool:
-
-```bash
-PROFILE="$(cygpath -w "$(mktemp -d)")"
-OUT="$(cygpath -w "$(mktemp -d)")\\rotate-in-task2.png"
-"/c/Program Files/Google/Chrome/Application/chrome.exe" --headless=new --disable-gpu --hide-scrollbars \
- --run-all-compositor-stages-before-draw --virtual-time-budget=3000 --user-data-dir="$PROFILE" \
- --window-size=1280,2600 --screenshot="$OUT" "http://127.0.0.1:8731/animations/02-entrance-and-exit/rotate-in/"
-echo "$OUT"
-```
-
-Expected at this stage (the shared script has no `boot` yet): the top bar, header, three numbered steps, the framed stage (the icon is not shown yet because nothing has played), the player bar, two settings side by side with hints, "More options", the prompt card with the Copy prompt button, What it is with the README link, Good for and Avoid on tags, and the footer. Nothing overlaps and nothing runs off the right edge.
-
-- [ ] **Step 8: Commit**
-
-```bash
-git add assets/css/demo-page.css animations/02-entrance-and-exit/rotate-in/index.html animations/02-entrance-and-exit/rotate-in/README.md tests/pages.test.js
-git commit -m "feat: rebuild the Rotate In page as the guided-steps pilot"
-```
-
----
-
-### Task 3: The page behaviour in the shared script
-
-**Files:**
-- Modify (replace the whole file): `assets/js/demo-page.js`
-- Test: `tests/demo-page.test.js`
-
-**Interfaces:**
-- Consumes: the helpers from Task 1 (`escapeHtml`, `isSafeHref`, `sections`, `paragraphs`, `seeAlso`, `settingsLine`, `markFill`) and the markup, class names and markers listed under Task 2's "Produces".
-- Produces: `readSettings(doc: Document, scope: Element, win: Window): Array<{ label: string, value: string }>` and `boot(doc: Document, win: Window): void`, both exported; in the browser the script boots itself.
-
-- [ ] **Step 1: Write the failing test**
-
-Append to `tests/demo-page.test.js`:
-
-```js
-test('the module exports boot and readSettings without touching a DOM', () => {
- assert.equal(typeof DP.boot, 'function');
- assert.equal(typeof DP.readSettings, 'function');
-});
-```
-
-- [ ] **Step 2: Run the tests to see it fail**
-
-Run: `node --test "tests/*.test.js"`
-Expected: one failure, `the module exports boot and readSettings without touching a DOM` (`'undefined' !== 'function'`).
-
-- [ ] **Step 3: Add the page behaviour**
-
-Replace `assets/js/demo-page.js` with:
-
-```js
-/* Animation Handbook — shared behaviour for the guided-steps demo pages.
- * Fills in "Your settings", Copy prompt, the README's "What it is" and "Similar
- * animations", plays the demo on arrival and replays it when a setting changes.
- * The pure helpers are exported for tests/demo-page.test.js. */
-(function (root, factory) {
- var api = factory();
- if (typeof module === 'object' && module.exports) { module.exports = api; return; }
- root.DemoPage = api;
- if (typeof document === 'undefined') return;
- if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', function () { api.boot(document, root); });
- } else {
- api.boot(document, root);
- }
-})(typeof self !== 'undefined' ? self : this, function () {
- 'use strict';
-
- /* ---------- Pure helpers ---------- */
-
- function escapeHtml(s) {
- return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
- }
-
- // Text with Markdown code and bold markers removed, safe to insert as HTML.
- function plain(s) {
- return escapeHtml(String(s).replace(/`/g, '').replace(/\*\*/g, ''));
- }
-
- // Only relative paths, "#" anchors and http(s) URLs are link targets. Anything else, including
- // protocol-relative "//host" links, is rendered as plain text instead.
- function isSafeHref(href) {
- href = String(href);
- return /^(?:https?:|#|\.{0,2}\/|[\w.-]+(?:\/|$))/i.test(href) && !/^\/\//.test(href) &&
- !/^[a-z][a-z0-9+.-]*:/i.test(href.replace(/^https?:/i, ''));
- }
-
- // Inline Markdown from README prose. Inline code becomes plain text: the site shows no code.
- function inline(md) {
- return escapeHtml(md)
- .replace(/`([^`]+)`/g, '$1')
- .replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, function (m, label, href) {
- return isSafeHref(href) ? '<a href="' + href + '">' + label + '</a>' : label;
- })
- .replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
- .replace(/\*([^*\n]+)\*/g, '<em>$1</em>');
- }
-
- // A README split into { "What it is": "...", ... } by its "## " headings.
- function sections(md) {
- var out = {}, current = null, buf = [];
- String(md).replace(/\r\n?/g, '\n').split('\n').forEach(function (line) {
- var m = /^##\s+(.+?)\s*$/.exec(line);
- if (m) {
- if (current) out[current] = buf.join('\n').trim();
- current = m[1];
- buf = [];
- } else if (current) {
- buf.push(line);
- }
- });
- if (current) out[current] = buf.join('\n').trim();
- return out;
- }
-
- function paragraphs(text) {
- return String(text || '').split(/\n\s*\n/)
- .map(function (p) { return p.trim(); })
- .filter(Boolean)
- .map(function (p) { return '<p>' + inline(p.replace(/\s*\n\s*/g, ' ')) + '</p>'; })
- .join('');
- }
-
- // "- [Name](../slug/) — description" lines as [{ name, href, desc }].
- function seeAlso(text) {
- return String(text || '').split('\n').map(function (l) {
- var m = /^\s*[-*]\s+\[([^\]]+)\]\(([^)\s]+)\)\s*(?:[—–-]\s*(.*))?$/.exec(l);
- return m ? { name: plain(m[1]), href: m[2], desc: m[3] ? inline(m[3]) : '' } : null;
- }).filter(Boolean);
- }
-
- // [{ label: 'Speed', value: 'Normal' }, ...] as "Speed: Normal, ...", skipping incomplete pairs.
- function settingsLine(items) {
- return (items || [])
- .filter(function (i) { return i && i.label && i.value; })
- .map(function (i) { return i.label + ': ' + i.value; })
- .join(', ');
- }
-
- // The prompt as HTML with each [part to fill in] highlighted.
- function markFill(text) {
- return escapeHtml(text).replace(/\[[^\]\n]+\]/g, function (part) {
- return '<mark class="hb-fill">' + part + '</mark>';
- });
- }
-
- /* ---------- Page behaviour ---------- */
-
- var CONTROLS = 'input[type=range], input[type=checkbox], select, .seg, .swatches';
-
- function text(node) { return node ? node.textContent.replace(/\s+/g, ' ').trim() : ''; }
-
- function labelFor(doc, control) {
- var own = control.getAttribute('data-hb-label');
- if (own) return own;
- var by = control.getAttribute('aria-labelledby');
- if (by && doc.getElementById(by)) return text(doc.getElementById(by));
- var wrap = control.closest('label');
- if (wrap) return text(wrap);
- var byFor = control.id && doc.querySelector('label[for="' + control.id + '"]');
- return byFor ? text(byFor) : '';
- }
-
- function valueFor(control) {
- if (control.matches('input[type=range]')) {
- var row = control.closest('.sr');
- var shown = row && row.querySelector('.sv');
- return shown ? text(shown) : (control.getAttribute('aria-valuetext') || control.value);
- }
- if (control.matches('input[type=checkbox]')) return control.checked ? 'on' : 'off';
- if (control.matches('select')) return control.selectedOptions[0] ? text(control.selectedOptions[0]) : control.value;
- var active = control.querySelector('.on, [aria-pressed="true"]');
- return active ? (active.getAttribute('aria-label') || text(active)) : '';
- }
-
- // A control counts unless it, or anything between it and the scope, is hidden, skipped or
- // display:none. Controls inside a closed More options still count: <details> hides them another way.
- function isShown(control, scope, win) {
- for (var node = control; node && node !== scope; node = node.parentElement) {
- if (node.hidden || node.hasAttribute('data-hb-skip')) return false;
- if (win.getComputedStyle(node).display === 'none') return false;
- }
- return true;
- }
-
- // The demo's current settings in page order, as [{ label, value }].
- function readSettings(doc, scope, win) {
- return Array.prototype.filter.call(scope.querySelectorAll(CONTROLS), function (control) {
- return isShown(control, scope, win);
- }).map(function (control) {
- return { label: labelFor(doc, control), value: valueFor(control) };
- });
- }
-
- function boot(doc, win) {
- var page = doc.querySelector('.hb-page');
- var promptEl = page && page.querySelector('.hb-prompt');
- if (!promptEl) return;
-
- var tryStep = page.querySelector('.hb-try');
- var chipsBox = page.querySelector('.hb-chips-box');
- var chips = chipsBox && chipsBox.querySelector('.hb-chips');
- var copyBtn = page.querySelector('.hb-copy');
- var replayCtl = page.querySelector('[data-hb-replay]');
- var loopCtl = page.querySelector('[data-hb-loop]');
- var slowCtl = page.querySelector('[data-hb-slowmo]');
- var reduce = win.matchMedia ? win.matchMedia('(prefers-reduced-motion: reduce)') : null;
- var promptText = text(promptEl);
-
- function settings() {
- if (!tryStep) return [];
- return readSettings(doc, tryStep, win).filter(function (s) { return s.label && s.value; });
- }
- function copyText() {
- var line = settingsLine(settings());
- return promptText + (line ? '\n\nSettings from the demo: ' + line + '.' : '');
- }
- function replay() { if (replayCtl) replayCtl.click(); }
-
- // The prompt: highlight the part to fill in; on phones show five lines until "Show the full prompt".
- function setUpPrompt() {
- promptEl.innerHTML = markFill(promptText);
- promptEl.id = promptEl.id || 'hb-prompt';
- promptEl.classList.add('is-clamped');
- var toggle = doc.createElement('button');
- toggle.type = 'button';
- toggle.className = 'hb-prompt-more';
- toggle.setAttribute('aria-controls', promptEl.id);
- toggle.setAttribute('aria-expanded', 'false');
- toggle.textContent = 'Show the full prompt';
- toggle.addEventListener('click', function () {
- var open = !promptEl.classList.toggle('is-clamped');
- toggle.setAttribute('aria-expanded', String(open));
- toggle.textContent = open ? 'Show less' : 'Show the full prompt';
- });
- promptEl.insertAdjacentElement('afterend', toggle);
- }
-
- function refreshChips() {
- if (!chips) return;
- var items = settings();
- chips.innerHTML = items.map(function (s) {
- return '<li>' + escapeHtml(s.label) + ': ' + escapeHtml(s.value) + '</li>';
- }).join('');
- chipsBox.hidden = !items.length;
- }
-
- function setUpCopy() {
- var label = copyBtn.querySelector('.hb-copy-label') || copyBtn;
- var timer = 0;
- function show(message, done) {
- label.textContent = message;
- copyBtn.classList.toggle('is-done', done);
- win.clearTimeout(timer);
- timer = win.setTimeout(function () {
- label.textContent = 'Copy prompt';
- copyBtn.classList.remove('is-done');
- }, 1500);
- }
- function selectInstead() {
- var range = doc.createRange();
- range.selectNodeContents(promptEl);
- var selection = win.getSelection();
- selection.removeAllRanges();
- selection.addRange(range);
- show(/Mac|iPhone|iPad/.test(win.navigator.platform || win.navigator.userAgent) ? 'Press ⌘C to copy' : 'Press Ctrl+C to copy', false);
- }
- copyBtn.addEventListener('click', function () {
- var clip = win.navigator.clipboard;
- if (clip && clip.writeText) clip.writeText(copyText()).then(function () { show('Copied', true); }, selectInstead);
- else selectInstead();
- });
- }
-
- // What it is and Similar animations from the README. Opened from disk, the README link stays.
- function loadReadme() {
- var what = page.querySelector('.hb-what-text');
- var related = page.querySelector('.hb-related');
- if (!what || win.location.protocol === 'file:' || !win.fetch) return;
- win.fetch('README.md').then(function (res) {
- if (!res.ok) throw new Error('README ' + res.status);
- return res.text();
- }).then(function (md) {
- var s = sections(md);
- if (s['What it is']) what.innerHTML = paragraphs(s['What it is']);
- var list = related && related.querySelector('.hb-rel-list');
- var cards = seeAlso(s['See also']).filter(function (r) { return isSafeHref(r.href); });
- if (!list || !cards.length) return;
- list.innerHTML = cards.map(function (r) {
- var desc = r.desc.replace(/^[a-z]/, function (c) { return c.toUpperCase(); });
- return '<a class="hb-rel" href="' + escapeHtml(r.href) + '"><b>' + r.name + '</b>' +
- (desc ? '<span>' + desc + '</span>' : '') + '</a>';
- }).join('');
- related.hidden = false;
- }).catch(function () {});
- }
-
- // Changing a setting updates the chips and replays the animation shortly after the last change.
- var replayTimer = 0;
- function onSettingsChange(e) {
- if (e.type === 'click' && !e.target.closest('.seg, .swatches')) return;
- win.setTimeout(refreshChips, 0);
- win.clearTimeout(replayTimer);
- replayTimer = win.setTimeout(replay, 250);
- }
-
- setUpPrompt();
- if (copyBtn) setUpCopy();
- if (tryStep) ['input', 'change', 'click'].forEach(function (type) { tryStep.addEventListener(type, onSettingsChange); });
- if (slowCtl) slowCtl.addEventListener('change', replay);
- if (doc.body.hasAttribute('data-hb-autoplay')) {
- win.setTimeout(function () {
- if (loopCtl && !(reduce && reduce.matches)) {
- if (!loopCtl.checked) loopCtl.click();
- } else {
- replay();
- }
- }, 400);
- }
- refreshChips();
- loadReadme();
- }
-
- return {
- escapeHtml: escapeHtml, plain: plain, isSafeHref: isSafeHref, inline: inline, sections: sections,
- paragraphs: paragraphs, seeAlso: seeAlso, settingsLine: settingsLine, markFill: markFill,
- readSettings: readSettings, boot: boot
- };
-});
-```
-
-- [ ] **Step 4: Run the tests to see them pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes.
-
-- [ ] **Step 5: Look at the page**
-
-With the static server on port 8731 running, take the same full-page screenshot as in Task 2 (name it `rotate-in-task3.png`) and open it with the Read tool.
-
-Expected now: the icon is visible on the stage (autoplay ran), the Loop switch is on, the prompt has its bracketed part highlighted, "Your settings" shows six chips (How much it spins: ½ turn · Speed: Normal · Spin direction: Clockwise · Bounce at the end: on · Grows from small: on · Fades in: on), What it is shows the README paragraph, and Similar animations shows three cards (Flip In, Scale In, Bounce In) with capitalised descriptions.
-
-- [ ] **Step 6: Commit**
-
-```bash
-git add assets/js/demo-page.js tests/demo-page.test.js
-git commit -m "feat: add chips, copy, README sections and autoplay to the guided-steps page"
-```
-
----
-
-### Task 4: Check the pilot in a real browser
-
-The controller runs this task in the in-app browser (`preview_start` with the `static-site` configuration opens port 8731), because its screenshots go to the user. Anything found here is fixed in `assets/css/demo-page.css`, `assets/js/demo-page.js` or the Rotate In page, the tests are re-run, and the fix is committed.
-
-**Files:**
-- Modify only if a check fails: `assets/css/demo-page.css`, `assets/js/demo-page.js`, `animations/02-entrance-and-exit/rotate-in/index.html`
-
-**Interfaces:**
-- Consumes: everything from Tasks 1–3.
-- Produces: screenshots for the user at desktop, tablet and phone sizes.
-
-- [ ] **Step 1: Open the page**
-
-Open `http://127.0.0.1:8731/animations/02-entrance-and-exit/rotate-in/` and read the console. Expected: no errors.
-
-- [ ] **Step 2: Run the layout check at each size**
-
-At 1280×800, 768×1024 and 375×812, reload and run:
-
-```js
-(() => {
- const r = el => el.getBoundingClientRect();
- const small = [...document.querySelectorAll('.hb-bar a, button, summary, label.hb-toggle, label.hb-switch-row, .hb-foot a, .hb-rel')]
- .filter(el => el.getClientRects().length)
- .filter(el => r(el).width < 44 || r(el).height < 44)
- .map(el => `${el.tagName.toLowerCase()}.${el.className} ${Math.round(r(el).width)}x${Math.round(r(el).height)}`);
- return {
- overflowX: document.documentElement.scrollWidth > innerWidth,
- smallTargets: small,
- stageAndPlayerOnFirstScreen: r(document.querySelector('.hb-player')).bottom <= innerHeight,
- settingsColumns: getComputedStyle(document.querySelector('.hb-settings')).gridTemplateColumns.split(' ').length,
- chips: [...document.querySelectorAll('.hb-chips li')].map(li => li.textContent),
- whatItIs: document.querySelector('.hb-what-text').textContent.trim().slice(0, 40),
- related: [...document.querySelectorAll('.hb-rel b')].map(b => b.textContent),
- loopOn: document.querySelector('[data-hb-loop]').checked
- };
-})()
-```
-
-Expected at every size: `overflowX` false, `smallTargets` empty, six chips, `whatItIs` starting "Rotate In spins an element", `related` `["Flip In","Scale In","Bounce In"]`, `loopOn` true. `stageAndPlayerOnFirstScreen` true at 1280×800. `settingsColumns` 2 at 1280 and 768, 1 at 375.
-
-- [ ] **Step 3: Try every control (1280×800)**
-
-- "Full turn": the icon replays with a full turn; the chip reads "How much it spins: Full turn".
-- "Fast", then "Slow": the replay speed changes; the Speed chip follows.
-- Open More options: the label reads "Fewer options"; "Counter-clockwise" reverses the spin; each switch changes the chip to "off" and the replay loses the bounce, the growth or the fade.
-- Slow motion on: the next spin is three times slower; the pauses between loops are unchanged.
-- Loop off: the icon finishes landed and stays; Replay then plays it once.
-- Copy prompt: the button reads "Copied" with a tick, then "Copy prompt" again after 1.5s; the clipboard holds the prompt, a blank line and `Settings from the demo: How much it spins: …, Speed: …, Spin direction: …, Bounce at the end: …, Grows from small: …, Fades in: ….`
-
-- [ ] **Step 4: Phone checks (375×812)**
-
-- The top bar shows "‹ Bounce In" without the word "Previous:".
-- Settings sit one per row and their choices fill the width.
-- The prompt shows five lines and "Show the full prompt"; tapping it shows the whole prompt and "Show less".
-- The Copy prompt button fills the card's width.
-
-- [ ] **Step 5: Reduced motion**
-
-Emulate `prefers-reduced-motion: reduce` and reload. Expected: Loop stays off, the icon fades in once without spinning, and changing a setting fades it in again.
-
-- [ ] **Step 6: Screenshots and commit**
-
-Take screenshots at 1280×800 (first screen and full page), 768×1024 and 375×812 for the user. If anything was fixed, run `node --test "tests/*.test.js"` (all pass) and commit only the files that changed, with a message that names the fix, for example:
-
-```bash
-git add assets/css/demo-page.css
-git commit -m "fix: keep the player bar on one line on phones"
-```
diff --git a/docs/superpowers/plans/2026-09-27-demo-page-rollout-entrance-exit.md b/docs/superpowers/plans/2026-09-27-demo-page-rollout-entrance-exit.md
deleted file mode 100644
index 57ca3b6d..00000000
--- a/docs/superpowers/plans/2026-09-27-demo-page-rollout-entrance-exit.md
+++ /dev/null
@@ -1,795 +0,0 @@
-# Guided-Steps Rollout: Entrance & Exit — Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Move the other twelve Entrance & Exit pages to the approved guided-steps page, with settings rewritten in plain words, and extend the shared template with what they need.
-
-**Architecture:** Task 1 extends the shared files (`assets/css/demo-page.css`, `assets/js/demo-page.js`) and the page checks; Task 2 adds a browser check tool; Task 3 writes a content sheet that decides, page by page, the plain-language settings, hints, tags and wording; Tasks 4–9 convert two pages each from the first redesign's layout to the guided-steps page by following the sheet and the Rotate In reference page; Task 10 checks the whole category in a browser.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build step); Node's built-in test runner; Node plus the local Chrome (DevTools protocol) for the browser check tool.
-
-**Specs:** `docs/superpowers/specs/2026-09-27-demo-page-guided-steps-design.md` (the page) and `docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md` (the rollout rules). **Reference page:** `animations/02-entrance-and-exit/rotate-in/index.html` and its `README.md`.
-
-## Global Constraints
-
-- Plain HTML + CSS + vanilla JS only. No build step, no frameworks, no npm packages, no CDN scripts or fonts.
-- In scope: the twelve pages in `animations/02-entrance-and-exit/` other than `rotate-in`, their READMEs, their cards on the home page (`index.html`, descriptions only), the shared files and the tests. Rotate In only gains `data-hb-kind="once"` and its new home card description. No other category changes. `assets/css/handbook.css`, `assets/js/handbook.js` and `tests/handbook.test.js` stay as they are (they are deleted at the rollout's wrap-up, not here).
-- Every Entrance & Exit page is the **plays-once** kind: `<body class="hb" data-hb-kind="once" data-hb-autoplay>`, step 1 "Watch it", a player bar with Replay (and Loop and Slow motion wherever the content sheet says so). Curtain Reveal plays on arrival like the others.
-- Stage: the page owns width, border, corners and height (`--hb-stage-h`, `--hb-stage-h-phone`); overflow, background, alignment and perspective belong to the demo.
-- Settings follow the rules: plain labels, named choices over numbers, switches for on/off, one hint each, two or three main settings, the rest under More options, playback is not a setting, no readouts. Colour pickers become named swatches; radio groups become choice buttons.
-- Each chip reads `<label>: <value>`; the copied text is the prompt, a blank line, then `Settings from the demo: ` + the chips joined with `, ` + `.`
-- Prompts: 60–130 words, fill-in parts in square brackets, end with "Match the settings listed below.", no code, nothing stated as fixed that a setting controls, a reduced-motion sentence.
-- Touch targets at least 44×44px on phones; hover rules only inside `@media (hover: hover)`; animate only `transform` and `opacity` (and `filter`/`clip-path` where the technique itself is about them); respect `prefers-reduced-motion`.
-- Words on the page are plain; never "stunning", "amazing" or "powerful"; no code anywhere on the page.
-- The category colour is `--ui-accent: #5fd88a`.
-- Tests: `node --test "tests/*.test.js"` from the repo root (the directory form fails on this machine).
-- Browser check: a static server runs at `http://127.0.0.1:8731` (start one from the repo root with `python -m http.server 8731 --bind 127.0.0.1` if nothing answers); run `node tools/check-pages.mjs <page folders>`.
-- Commit messages: a lower-case prefix (`feat:`, `test:`, `docs:`, `fix:`) and a plain sentence.
-
-## File structure
-
-| File | Change |
-|---|---|
-| `assets/css/demo-page.css` | Next link and phone top bar, stage ownership, styles for sliders, menus, swatches and text fields |
-| `assets/js/demo-page.js` | `shorten`; settings reader for sliders (`.hb-value`), text fields, label fallback; console warning for incomplete settings |
-| `tests/demo-page.test.js` | tests for `shorten` |
-| `tests/pages.test.js` | page kind, labels and one choice per group, README checks and home card description for every guided-steps page |
-| `tools/check-pages.mjs` (new) | browser check tool |
-| `docs/superpowers/plans/2026-09-27-entrance-exit-content.md` (new) | the content sheet for the twelve pages |
-| `animations/02-entrance-and-exit/*/index.html`, `README.md` | the twelve conversions |
-| `index.html` (home) | card descriptions for the thirteen Entrance & Exit pages |
-
----
-
-### Task 1: Extend the shared template and the page checks
-
-**Files:**
-- Modify: `assets/css/demo-page.css`, `assets/js/demo-page.js`, `animations/02-entrance-and-exit/rotate-in/index.html` (body tag only), `index.html` (the `rotate-in` card description only)
-- Test: `tests/demo-page.test.js`, `tests/pages.test.js`
-
-**Interfaces:**
-- Consumes: the current guided-steps files.
-- Produces, for Tasks 4–9: the markup patterns in the table below, `data-hb-kind="once"` on the body, `shorten(text, max)` in `demo-page.js`, and page checks that every converted page must pass.
-
-| Control | Markup the shared files support after this task |
-|---|---|
-| Choice buttons | `<p class="hb-setting-name" id="X-lbl">Label</p><div class="seg" id="X-seg" role="group" aria-labelledby="X-lbl"><button type="button" class="on" aria-pressed="true">…</button>…</div>` |
-| Switch | `<label class="hb-switch-row"><span>Label</span><input class="hb-switch" type="checkbox" role="switch" id="X-tog"></label>` |
-| Slider | `<div class="hb-setting-top"><label class="hb-setting-name" for="X-sl">Label</label><output class="hb-value" for="X-sl" id="X-v">Medium</output></div><input type="range" id="X-sl" …>` |
-| Menu | `<label class="hb-setting-name" for="X-sel">Label</label><select class="hb-select" id="X-sel">…</select>` |
-| Swatches | `<p class="hb-setting-name" id="X-lbl">Label</p><div class="swatches" id="X-sw" role="group" aria-labelledby="X-lbl"><button type="button" class="on" aria-pressed="true" aria-label="Coral" style="background:#ff6f61"></button>…</div>` |
-| Text | `<label class="hb-setting-name" for="X-in">Your text</label><input class="hb-text" type="text" id="X-in" value="…">` (or `<textarea class="hb-text" id="X-in">`) |
-
-Each control sits in its own `<div class="hb-setting">` followed by one `<p class="hb-hint">`. In every group, `class` is the first attribute (`<div class="seg" …>`, `<div class="swatches" …>`), which the page checks rely on.
-
-- [ ] **Step 1: Write the failing tests**
-
-Append to `tests/demo-page.test.js`:
-
-```js
-test('shorten squeezes whitespace and cuts long text with an ellipsis', () => {
- assert.equal(DP.shorten(' Hello \n world ', 40), 'Hello world');
- assert.equal(DP.shorten('abcdefghij', 5), 'abcd…');
- assert.equal(DP.shorten('abc de', 5), 'abc…');
- assert.equal(DP.shorten('', 5), '');
-});
-```
-
-Replace `tests/pages.test.js` with:
-
-```js
-// Static checks for demo pages that use the shared layouts, their READMEs and the home page.
-// Run from the repo root: node --test "tests/*.test.js"
-const test = require('node:test');
-const assert = require('node:assert/strict');
-const fs = require('node:fs');
-const path = require('node:path');
-const { sections, table } = require('../assets/js/handbook.js');
-
-const ROOT = path.resolve(__dirname, '..');
-const ANIM = path.join(ROOT, 'animations');
-const read = f => fs.readFileSync(f, 'utf8');
-const count = (s, sub) => s.split(sub).length - 1;
-const words = s => s.trim().split(/\s+/).length;
-const isDemoDir = dir => fs.existsSync(path.join(dir, 'index.html'));
-// The part of s from the first `from` up to the next `to` after it ('' when `from` is missing).
-const between = (s, from, to) => {
- const start = s.indexOf(from);
- if (start < 0) return '';
- const end = s.indexOf(to, start + from.length);
- return s.slice(start, end < 0 ? undefined : end);
-};
-const decode = s => s.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
-
-const demos = fs.readdirSync(ANIM, { withFileTypes: true }).filter(c => c.isDirectory()).flatMap(c =>
- fs.readdirSync(path.join(ANIM, c.name), { withFileTypes: true }).filter(d => d.isDirectory())
- .map(d => ({ cat: c.name, slug: d.name, dir: path.join(ANIM, c.name, d.name) })));
-const pageOf = d => read(path.join(d.dir, 'index.html'));
-const converted = demos.filter(d => pageOf(d).includes('<main class="hb-view">'));
-const steps = demos.filter(d => pageOf(d).includes('<main class="hb-page">'));
-const HOME = read(path.join(ROOT, 'index.html'));
-
-const PILOT = '02-entrance-and-exit';
-const PILOT_AUTOPLAY = new Set(['fade-in-out', 'slide-in', 'slide-up-reveal', 'scale-in', 'clip-path-reveal',
- 'split-text-reveal', 'letter-by-letter-stagger', 'word-by-word-reveal', 'blur-in', 'flip-in', 'bounce-in', 'rotate-in']);
-
-test('every Entrance & Exit demo uses one of the shared layouts', () => {
- const left = demos.filter(d => d.cat === PILOT && !converted.includes(d) && !steps.includes(d)).map(d => d.slug);
- assert.deepEqual(left, []);
-});
-
-test('Rotate In uses the guided-steps page', () => {
- assert.ok(steps.some(d => d.cat === PILOT && d.slug === 'rotate-in'));
-});
-
-for (const d of converted) {
- test(`${d.cat}/${d.slug} uses the shared layout correctly`, () => {
- const html = pageOf(d);
- assert.ok(html.includes('<link rel="stylesheet" href="../../../assets/css/handbook.css">'), 'shared stylesheet');
- assert.ok(html.includes('<script src="../../../assets/js/handbook.js" defer></script>'), 'shared script');
- assert.match(html, /<body class="hb"( data-hb-autoplay)?>/);
- for (const legacy of ['ah-bar', 'ah-copy', 'ah-inject', 'Copy source', 'Bricolage', 'PlexMono', 'class="note"', 'class="layout"']) {
- assert.ok(!html.includes(legacy), `legacy markup left: ${legacy}`);
- }
- for (const part of ['<nav class="hb-bar"', '<main class="hb-view">', '<aside class="hb-side">', '<section class="hb-settings"', '<p class="hb-prompt">']) {
- assert.equal(count(html, part), 1, `exactly one ${part}`);
- }
- assert.match(html, /<p class="hb-cat">\d{2}\.\d{2} · [^<]+<\/p>/);
- const prompt = html.match(/<p class="hb-prompt">([^<]*)<\/p>/)[1];
- assert.ok(words(prompt) >= 60 && words(prompt) <= 130, `prompt has ${words(prompt)} words`);
- assert.ok(prompt.trim().endsWith('Match the settings listed below.'), 'prompt ending');
- assert.ok(!prompt.includes('`'), 'prompt contains no code');
- assert.equal(count(html, 'data-hb-replay'), 1, 'one replay control');
- assert.ok(count(html, 'data-hb-reset') <= 1, 'at most one reset control');
- if (d.cat === PILOT) assert.equal(html.includes('data-hb-autoplay'), PILOT_AUTOPLAY.has(d.slug), 'autoplay flag');
- for (const [, href] of html.matchAll(/<a href="([^"]+)" rel="(?:prev|next)"/g)) {
- assert.ok(isDemoDir(path.resolve(d.dir, href)), `pager link ${href}`);
- }
- });
-}
-
-for (const d of steps) {
- test(`${d.cat}/${d.slug} uses the guided-steps page correctly`, () => {
- const html = pageOf(d);
- assert.ok(html.includes('<link rel="stylesheet" href="../../../assets/css/demo-page.css">'), 'page stylesheet');
- assert.ok(html.includes('<script src="../../../assets/js/demo-page.js" defer></script>'), 'page script');
- const body = html.match(/<body class="hb" data-hb-kind="(once|loop|scroll|do)"( data-hb-autoplay)?>/);
- assert.ok(body, 'the body declares the page kind');
- const kind = body[1];
- for (const old of ['handbook.css', 'handbook.js', 'hb-view', 'hb-side', 'hb-take', 'ah-bar', 'Copy source', 'Read more',
- 'class="note"', 'class="kv"', 'class="lbl"', 'class="btn-row"', 'Bricolage', 'PlexMono']) {
- assert.ok(!html.includes(old), `old markup left: ${old}`);
- }
- for (const part of ['<nav class="hb-bar"', '<main class="hb-page">', '<header class="hb-head">',
- '<section class="hb-step hb-watch"', '<div class="hb-player">', '<section class="hb-step hb-try"',
- '<section class="hb-step hb-prompt-step"', '<p class="hb-prompt">', '<ul class="hb-chips">',
- '<button class="hb-copy" type="button">', '<section class="hb-about"', '<ul class="hb-tags hb-good">',
- '<ul class="hb-tags hb-avoid">', '<section class="hb-related"', '<footer class="hb-foot">']) {
- assert.equal(count(html, part), 1, `exactly one ${part}`);
- }
- assert.match(html, /<p class="hb-cat">\d{2}\.\d{2} · [^<]+<\/p>/);
- const prompt = html.match(/<p class="hb-prompt">([^<]*)<\/p>/)[1];
- assert.ok(words(prompt) >= 60 && words(prompt) <= 130, `prompt has ${words(prompt)} words`);
- assert.ok(prompt.trim().endsWith('Match the settings listed below.'), 'prompt ending');
- assert.ok(!prompt.includes('`'), 'prompt contains no code');
- const player = between(html, '<div class="hb-player">', '</div>');
- if (kind === 'once') {
- assert.equal(count(html, 'data-hb-replay'), 1, 'one Replay control');
- assert.ok(player.includes('data-hb-replay'), 'Replay is in the player bar');
- }
- for (const marker of ['data-hb-loop', 'data-hb-slowmo']) {
- assert.ok(count(html, marker) <= 1, `at most one ${marker}`);
- assert.equal(count(player, marker), count(html, marker), `${marker} is in the player bar`);
- const input = (html.match(new RegExp(`<input[^>]*${marker}[^>]*>`)) || [''])[0];
- assert.ok(!/\schecked\b/.test(input), `${marker} switch starts unchecked`);
- }
- const tryIt = between(html, '<section class="hb-step hb-try"', '<section class="hb-step hb-prompt-step"');
- const main = between(tryIt, '<div class="hb-settings">', '<details class="hb-options">');
- const mainCount = count(main, 'class="hb-setting"');
- assert.ok(mainCount >= 1 && mainCount <= 3, `${mainCount} main settings`);
- assert.equal(count(tryIt, 'class="hb-hint"'), count(tryIt, 'class="hb-setting"'), 'every setting has one hint');
- const good = count(between(html, '<ul class="hb-tags hb-good">', '</ul>'), '<li>');
- const avoid = count(between(html, '<ul class="hb-tags hb-avoid">', '</ul>'), '<li>');
- assert.ok(good >= 3 && good <= 5, `${good} Good for tags`);
- assert.ok(avoid >= 1 && avoid <= 3, `${avoid} Avoid on tags`);
- for (const [, href] of html.matchAll(/<a href="([^"]+)" rel="(?:prev|next)"/g)) {
- assert.ok(isDemoDir(path.resolve(d.dir, href)), `pager link ${href}`);
- }
- });
-
- test(`${d.slug}: every setting has a label and every choice group has one choice made`, () => {
- const tryIt = between(pageOf(d), '<section class="hb-step hb-try"', '<section class="hb-step hb-prompt-step"');
- for (const [, cls, attrs, inner] of tryIt.matchAll(/<div class="(seg|swatches)"([^>]*)>([\s\S]*?)<\/div>/g)) {
- const labelledBy = (attrs.match(/aria-labelledby="([^"]+)"/) || [])[1];
- assert.ok(/role="group"/.test(attrs), `a ${cls} group has role="group"`);
- assert.ok(labelledBy && tryIt.includes(`id="${labelledBy}"`), `a ${cls} group is labelled`);
- assert.equal(count(inner, 'aria-pressed="true"'), 1, `${labelledBy} has exactly one choice made`);
- }
- for (const [, name, attrs] of tryIt.matchAll(/<(input|select|textarea)\b([^>]*)>/g)) {
- if (/type="checkbox"/.test(attrs)) continue;
- const id = (attrs.match(/\sid="([^"]+)"/) || [])[1];
- assert.ok(id && new RegExp(`<label[^>]*\\sfor="${id}"`).test(tryIt), `${name} ${id || '(no id)'} has a label`);
- }
- assert.equal(count(tryIt, 'type="checkbox"'), count(tryIt, 'class="hb-switch-row"'), 'every switch sits in a labelled switch row');
- });
-
- test(`${d.slug}: README is ready for the site`, () => {
- const s = sections(read(path.join(d.dir, 'README.md')));
- for (const h of ['What it is', 'When to use it', 'Key parameters', 'See also']) assert.ok(s[h], `section ${h}`);
- assert.ok(!s['What it is'].includes('`'), 'What it is has no code');
- assert.ok(!s['Key parameters'].includes('`'), 'Key parameters has no code');
- assert.ok(table(s['Key parameters']).length > 0, 'Key parameters has rows');
- const links = [...s['See also'].matchAll(/^\s*[-*]\s+\[[^\]]+\]\(([^)\s]+)\)(.*)$/gm)];
- assert.ok(links.length > 0, 'See also has links');
- for (const [, href, rest] of links) {
- assert.ok(isDemoDir(path.resolve(d.dir, href)), `See also link ${href}`);
- assert.match(rest, /^\s*[—–-]\s*\S/, `See also ${href} has a short description`);
- }
- });
-
- test(`${d.slug}: every Key parameters name is a setting in Try it`, () => {
- const tryIt = between(pageOf(d), '<section class="hb-step hb-try"', '<section class="hb-step hb-prompt-step"')
- .replace(/<[^>]+>/g, ' ');
- const rows = sections(read(path.join(d.dir, 'README.md')))['Key parameters'].split('\n').slice(2);
- for (const row of rows) {
- const name = (row.split('|')[1] || '').trim();
- if (name) assert.ok(tryIt.includes(name), `setting "${name}"`);
- }
- });
-
- test(`${d.slug}: the home page card uses the page's description`, () => {
- const lede = decode(pageOf(d).match(/<p class="hb-lede">([^<]*)<\/p>/)[1]);
- const entry = HOME.match(new RegExp(`\\['${d.slug}','(?:[^'\\\\]|\\\\.)*','((?:[^'\\\\]|\\\\.)*)'\\]`));
- assert.ok(entry, 'home page entry');
- assert.equal(entry[1].replace(/\\'/g, "'"), lede);
- });
-}
-
-for (const d of converted.filter(c => c.cat === PILOT)) {
- test(`README for ${d.slug} is ready for the site`, () => {
- const s = sections(read(path.join(d.dir, 'README.md')));
- for (const h of ['What it is', 'When to use it', 'Key parameters', 'See also']) assert.ok(s[h], `section ${h}`);
- assert.ok(!s['What it is'].includes('`'), 'What it is has no code');
- assert.ok(!s['Key parameters'].includes('`'), 'Key parameters has no code');
- assert.ok(table(s['Key parameters']).length > 0, 'Key parameters has rows');
- for (const [, href] of s['See also'].matchAll(/\]\(([^)\s]+)\)/g)) {
- assert.ok(isDemoDir(path.resolve(d.dir, href)), `See also link ${href}`);
- }
- });
-
- test(`${d.slug}: every Key parameters name is a control on the page`, () => {
- const html = pageOf(d);
- const panel = html.slice(html.indexOf('<section class="hb-settings"'), html.indexOf('<div class="hb-take">')).replace(/<[^>]+>/g, ' ');
- const rows = sections(read(path.join(d.dir, 'README.md')))['Key parameters'].split('\n').slice(2);
- for (const row of rows) {
- const name = (row.split('|')[1] || '').trim();
- if (name) assert.ok(panel.includes(name), `control label "${name}"`);
- }
- });
-}
-
-test('the home page uses Schibsted Grotesk and the new intro line', () => {
- assert.ok(HOME.includes("url('assets/fonts/schibsted-latin.woff2')"), 'Latin font file');
- assert.ok(HOME.includes("url('assets/fonts/schibsted-latin-ext.woff2')"), 'Latin Extended font file');
- for (const old of ['Bricolage', 'PlexMono', 'var(--mono)', '--mono:']) assert.ok(!HOME.includes(old), `still uses ${old}`);
- assert.ok(HOME.includes('See 129 web animations move, learn when to use each one, and copy a prompt to build it.'));
-});
-```
-
-- [ ] **Step 2: Run the tests to see them fail**
-
-Run: `node --test "tests/*.test.js"`
-Expected failures, and only these: `shorten squeezes whitespace…` (`DP.shorten is not a function`), `02-entrance-and-exit/rotate-in uses the guided-steps page correctly` (the body declares no kind), and `rotate-in: the home page card uses the page's description` (the card still has the old text).
-
-- [ ] **Step 3: Extend the settings reader**
-
-In `assets/js/demo-page.js`:
-
-1. Directly after the `markFill` function, add:
-
-```js
- // Text squeezed onto one line and cut to max characters (ending with an ellipsis), for chips.
- function shorten(text, max) {
- var s = String(text).replace(/\s+/g, ' ').trim();
- return s.length > max ? s.slice(0, max - 1).trimEnd() + '…' : s;
- }
-```
-
-2. Replace `var CONTROLS = 'input[type=range], input[type=checkbox], select, .seg, .swatches';` with:
-
-```js
- var CONTROLS = 'input[type=range], input[type=checkbox], input[type=text], textarea, select, .seg, .swatches';
-```
-
-3. In `labelFor`, replace the last two lines:
-
-```js
- var byFor = control.id && doc.querySelector('label[for="' + control.id + '"]');
- return byFor ? text(byFor) : '';
-```
-
-with:
-
-```js
- var byFor = control.id && doc.querySelector('label[for="' + control.id + '"]');
- if (byFor) return text(byFor);
- var setting = control.closest('.hb-setting');
- return setting ? text(setting.querySelector('.hb-setting-name')) : '';
-```
-
-4. In `valueFor`, replace the range branch:
-
-```js
- if (control.matches('input[type=range]')) {
- var row = control.closest('.sr');
- var shown = row && row.querySelector('.sv');
- return shown ? text(shown) : (control.getAttribute('aria-valuetext') || control.value);
- }
-```
-
-with:
-
-```js
- if (control.matches('input[type=range]')) {
- var setting = control.closest('.hb-setting');
- var shown = setting && setting.querySelector('.hb-value');
- return shown ? text(shown) : (control.getAttribute('aria-valuetext') || control.value);
- }
- if (control.matches('input[type=text], textarea')) return shorten(control.value, 40);
-```
-
-5. In `readSettings`, replace `return { label: labelFor(doc, control), value: valueFor(control) };` with:
-
-```js
- return { label: labelFor(doc, control), value: valueFor(control), control: control };
-```
-
-6. In `boot`, directly after the `refreshChips` function, add:
-
-```js
- // For page authors: a control without a label or a value is left out of the chips and the copied prompt.
- function warnIncomplete() {
- if (!tryStep || !win.console) return;
- readSettings(doc, tryStep, win).forEach(function (s) {
- if (!s.label || !s.value) win.console.warn('Your settings: this control has no ' + (s.label ? 'value' : 'label') + ' and is left out', s.control);
- });
- }
-```
-
-and at the end of `boot`, replace:
-
-```js
- refreshChips();
- loadReadme();
-```
-
-with:
-
-```js
- refreshChips();
- warnIncomplete();
- loadReadme();
-```
-
-7. In the returned object, add `shorten: shorten,` after `markFill: markFill,`.
-
-- [ ] **Step 4: Extend the stylesheet**
-
-In `assets/css/demo-page.css`:
-
-1. Replace the stage rule (the three lines starting `.hb-page .stage{box-sizing:border-box;`) with:
-
-```css
-.hb-page .stage{box-sizing:border-box;width:100%;min-width:0;margin:0;flex:none;
- height:var(--hb-stage-h,clamp(300px,calc(100vh - 420px),440px));height:var(--hb-stage-h,clamp(300px,calc(100svh - 420px),440px));
- border:1px solid rgba(255,255,255,.1);border-radius:12px}
-/* Overflow belongs to the demo: this default has zero specificity, so a demo's own .stage rule wins
- (scroll demos scroll inside their stage). A demo that needs another height sets --hb-stage-h or --hb-stage-h-phone. */
-:where(.hb-page .stage){min-height:0;overflow:hidden}
-```
-
-2. Directly after the line `.hb-options>.hb-settings{margin-top:16px}`, add:
-
-```css
-.hb-setting-top{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
-.hb-value{font:600 15px/1.3 var(--hb-font);color:var(--hb-accent);white-space:nowrap}
-.hb-page .hb-setting input[type=range]{width:100%;min-height:44px;margin:0;accent-color:var(--hb-accent);cursor:pointer}
-.hb-select,.hb-text{box-sizing:border-box;width:100%;min-height:44px;padding:0 12px;border:1px solid var(--hb-edge);border-radius:8px;
- background:var(--hb-panel);color:var(--hb-ink);font:500 16px/1.3 var(--hb-font)}
-textarea.hb-text{min-height:88px;padding:10px 12px;resize:vertical}
-.hb-page .swatches{display:flex;flex-wrap:wrap;gap:10px}
-.hb-page .swatches button{box-sizing:border-box;width:44px;height:44px;padding:0;border:2px solid transparent;border-radius:50%;
- box-shadow:inset 0 0 0 1px rgba(255,255,255,.18);cursor:pointer}
-.hb-page .swatches button[aria-pressed="true"]{border-color:var(--hb-ink);box-shadow:inset 0 0 0 3px var(--hb-bg)}
-```
-
-3. Inside `@media(hover:hover){ … }`, after the `.hb-page .seg button.on:hover…` line, add:
-
-```css
- .hb-page .swatches button:not([aria-pressed="true"]):hover{border-color:var(--hb-edge-2)}
- .hb-select:hover,.hb-text:hover{border-color:var(--hb-edge-2)}
-```
-
-4. In the short-screen block (`@media(min-width:601px) and (max-height:760px)`), replace:
-
-```css
- .hb-page .stage{height:clamp(260px,calc(100vh - 330px),440px);height:clamp(260px,calc(100svh - 330px),440px)}
-```
-
-with:
-
-```css
- .hb-page .stage{height:var(--hb-stage-h,clamp(260px,calc(100vh - 330px),440px));height:var(--hb-stage-h,clamp(260px,calc(100svh - 330px),440px))}
-```
-
-5. In the phone block (`@media(max-width:600px)`), replace ` .hb-page .stage{height:300px}` with:
-
-```css
- .hb-page .stage{height:var(--hb-stage-h-phone,300px)}
- /* With both Previous and Next, phones show only the two chevrons; each link keeps its full name as its label */
- .hb-pager:has(a + a) a > span{display:none}
-```
-
-- [ ] **Step 5: Declare Rotate In's kind and update its home card**
-
-In `animations/02-entrance-and-exit/rotate-in/index.html`, replace `<body class="hb" data-hb-autoplay>` with `<body class="hb" data-hb-kind="once" data-hb-autoplay>`.
-
-In `index.html` (the home page), replace:
-
-```
- ['rotate-in','Rotate In','Spins while entering — best on radially-symmetric shapes like icons, stars, and gears.'],
-```
-
-with:
-
-```
- ['rotate-in','Rotate In','Spins into place while it grows. Best for icons, stars and badges.'],
-```
-
-- [ ] **Step 6: Run the tests to see them pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes.
-
-- [ ] **Step 7: Check that Rotate In still looks and works the same**
-
-With the static server running, take a desktop screenshot (headless Chrome, `--virtual-time-budget=1600`, 1280×800) of `http://127.0.0.1:8731/animations/02-entrance-and-exit/rotate-in/` and open it with the Read tool: the page looks as before (badge on the stage, player bar visible).
-
-- [ ] **Step 8: Commit**
-
-```bash
-git add assets/js/demo-page.js assets/css/demo-page.css tests/demo-page.test.js tests/pages.test.js animations/02-entrance-and-exit/rotate-in/index.html index.html
-git commit -m "feat: extend the guided-steps template for the Entrance & Exit rollout"
-```
-
----
-
-### Task 2: A browser check tool
-
-**Files:**
-- Create: `tools/check-pages.mjs`
-
-**Interfaces:**
-- Consumes: a static server for the repo and the local Chrome.
-- Produces: `node tools/check-pages.mjs [--base URL] [--out DIR] <page folder>...` — prints one line per page and screen setup (`ok` or `FAIL — problems`), saves screenshots in DIR (a new temp folder by default, printed at the end), exits with 1 when anything fails.
-
-- [ ] **Step 1: Write the tool**
-
-Create `tools/check-pages.mjs`:
-
-```js
-#!/usr/bin/env node
-// Browser check for guided-steps demo pages: a development tool, not part of the site.
-// Needs the local Chrome and a static server for the repo (python -m http.server 8731 --bind 127.0.0.1).
-// Usage: node tools/check-pages.mjs [--base http://127.0.0.1:8731] [--out <folder>] <page folder>...
-// e.g. node tools/check-pages.mjs animations/02-entrance-and-exit/fade-in-out
-// Each page is loaded at five screen setups; problems are printed and screenshots saved. Exit code 1 on any problem.
-import { spawn } from 'node:child_process';
-import { mkdtempSync, mkdirSync, writeFileSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { join } from 'node:path';
-
-const CHROME = process.env.CHROME || 'C:/Program Files/Google/Chrome/Application/chrome.exe';
-const PORT = Number(process.env.CDP_PORT || 9333);
-const args = process.argv.slice(2);
-function option(name, fallback) {
- const i = args.indexOf(name);
- if (i < 0) return fallback;
- const value = args[i + 1];
- args.splice(i, 2);
- return value;
-}
-const BASE = option('--base', 'http://127.0.0.1:8731').replace(/\/$/, '');
-const OUT = option('--out', mkdtempSync(join(tmpdir(), 'hb-check-')));
-const pages = args.map(p => p.replace(/\\/g, '/').replace(/^\.?\//, '').replace(/\/?(index\.html)?$/, '/'));
-if (!pages.length) {
- console.error('Usage: node tools/check-pages.mjs [--base URL] [--out DIR] <page folder>...');
- process.exit(2);
-}
-mkdirSync(OUT, { recursive: true });
-
-const SETUPS = [
- { name: 'desktop', width: 1280, height: 800, full: true },
- { name: 'laptop', width: 1366, height: 657 },
- { name: 'tablet', width: 768, height: 1024 },
- { name: 'phone', width: 375, height: 812, mobile: true, scale: 2 },
- { name: 'phone-reduced', width: 375, height: 812, mobile: true, scale: 2, reduce: true }
-];
-
-// Runs inside the page. Returns the page kind, the Loop switch state and the problems found.
-const CHECK = `(() => {
- const r = el => el.getBoundingClientRect();
- const phone = innerWidth <= 600;
- const problems = [];
- if (document.documentElement.scrollWidth > innerWidth + 1) problems.push('horizontal overflow');
- if (phone) {
- const small = [...document.querySelectorAll('.hb-bar a, .hb-page button, .hb-page summary, .hb-page select, .hb-page input[type=range], .hb-page .hb-text, label.hb-toggle, label.hb-switch-row, .hb-foot a, .hb-rel')]
- .filter(el => el.getClientRects().length && !el.closest('.stage'))
- .filter(el => { const b = r(el); return b.width < 44 || b.height < 44; })
- .map(el => el.tagName.toLowerCase() + (el.className ? '.' + String(el.className).split(' ')[0] : '') + ' ' + Math.round(r(el).width) + 'x' + Math.round(r(el).height));
- if (small.length) problems.push('small targets: ' + small.join(', '));
- }
- const player = document.querySelector('.hb-player');
- if (innerWidth >= 1025 && player && r(player).bottom > innerHeight) problems.push('player bar below the first screen');
- const tryIt = document.querySelector('.hb-try');
- const shown = el => { for (let n = el; n && n !== tryIt; n = n.parentElement) { if (n.hidden || n.hasAttribute('data-hb-skip') || getComputedStyle(n).display === 'none') return false; } return true; };
- const controls = tryIt ? [...tryIt.querySelectorAll('input[type=range], input[type=checkbox], input[type=text], textarea, select, .seg, .swatches')].filter(shown).length : 0;
- const chips = document.querySelectorAll('.hb-chips li').length;
- if (chips !== controls) problems.push('chips ' + chips + ' vs settings ' + controls);
- if (!document.querySelector('.hb-what-text p')) problems.push('What it is is empty');
- const loop = document.querySelector('[data-hb-loop]');
- return { kind: document.body.dataset.hbKind || '', loop: loop ? loop.checked : null, problems };
-})()`;
-
-const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
-const chrome = spawn(CHROME, ['--headless=new', '--disable-gpu', '--hide-scrollbars', `--remote-debugging-port=${PORT}`,
- `--user-data-dir=${mkdtempSync(join(tmpdir(), 'hb-chrome-'))}`, 'about:blank'], { stdio: 'ignore' });
-
-async function pageSocket() {
- for (let i = 0; i < 50; i++) {
- try {
- const list = await (await fetch(`http://127.0.0.1:${PORT}/json/list`)).json();
- const page = list.find(t => t.type === 'page');
- if (page) return page.webSocketDebuggerUrl;
- } catch {}
- await sleep(200);
- }
- throw new Error('Chrome did not start (set CHROME to its path if it is not in the default place)');
-}
-
-const ws = new WebSocket(await pageSocket());
-await new Promise(resolve => ws.addEventListener('open', resolve, { once: true }));
-let nextId = 0;
-const pending = new Map();
-const listeners = new Set();
-ws.addEventListener('message', event => {
- const msg = JSON.parse(event.data);
- if (msg.id && pending.has(msg.id)) { pending.get(msg.id)(msg); pending.delete(msg.id); } else listeners.forEach(fn => fn(msg));
-});
-const send = (method, params = {}) => new Promise((resolve, reject) => {
- const id = ++nextId;
- pending.set(id, msg => (msg.error ? reject(new Error(`${method}: ${msg.error.message}`)) : resolve(msg.result)));
- ws.send(JSON.stringify({ id, method, params }));
-});
-const evaluate = async expression => (await send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true })).result.value;
-
-const errors = [];
-listeners.add(msg => {
- if (msg.method === 'Runtime.exceptionThrown') errors.push(msg.params.exceptionDetails.exception?.description || msg.params.exceptionDetails.text);
- if (msg.method === 'Runtime.consoleAPICalled' && (msg.params.type === 'error' || msg.params.type === 'warning')) {
- errors.push(msg.params.args.map(a => a.value ?? a.description).join(' '));
- }
- if (msg.method === 'Log.entryAdded' && msg.params.entry.level === 'error') errors.push(msg.params.entry.text + ' ' + (msg.params.entry.url || ''));
-});
-await send('Page.enable');
-await send('Runtime.enable');
-await send('Log.enable');
-
-let failures = 0;
-for (const page of pages) {
- for (const setup of SETUPS) {
- errors.length = 0;
- await send('Emulation.setDeviceMetricsOverride', { width: setup.width, height: setup.height, deviceScaleFactor: setup.scale || 1, mobile: !!setup.mobile });
- await send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-reduced-motion', value: setup.reduce ? 'reduce' : 'no-preference' }] });
- const loaded = new Promise(resolve => {
- const onLoad = msg => { if (msg.method === 'Page.loadEventFired') { listeners.delete(onLoad); resolve(); } };
- listeners.add(onLoad);
- });
- await send('Page.navigate', { url: `${BASE}/${page}` });
- await loaded;
- await sleep(2000);
- const result = await evaluate(CHECK);
- const problems = [...result.problems, ...errors.map(e => 'console: ' + e)];
- if (result.kind === 'once' && result.loop !== null) {
- if (setup.reduce && result.loop) problems.push('Loop switched on under reduced motion');
- if (!setup.reduce && !result.loop) problems.push('did not start playing on arrival (Loop is off)');
- }
- const name = page.replace(/\/$/, '').split('/').pop();
- const shot = await send('Page.captureScreenshot', { format: 'png' });
- writeFileSync(join(OUT, `${name}-${setup.name}.png`), Buffer.from(shot.data, 'base64'));
- if (setup.full) {
- const { cssContentSize } = await send('Page.getLayoutMetrics');
- const full = await send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true,
- clip: { x: 0, y: 0, width: setup.width, height: Math.ceil(cssContentSize.height), scale: 1 } });
- writeFileSync(join(OUT, `${name}-${setup.name}-full.png`), Buffer.from(full.data, 'base64'));
- }
- if (problems.length) failures++;
- console.log(`${problems.length ? 'FAIL' : 'ok '} ${name} ${setup.name}${problems.length ? ' — ' + problems.join('; ') : ''}`);
- }
-}
-console.log(`Screenshots: ${OUT}`);
-ws.close();
-chrome.kill();
-process.exit(failures ? 1 : 0);
-```
-
-- [ ] **Step 2: Run it on Rotate In**
-
-Run: `node tools/check-pages.mjs animations/02-entrance-and-exit/rotate-in`
-Expected: five `ok` lines (desktop, laptop, tablet, phone, phone-reduced) and the screenshots folder. Open `rotate-in-phone.png` and `rotate-in-desktop.png` with the Read tool: the badge is on the stage and nothing overlaps.
-
-- [ ] **Step 3: Check that it catches problems**
-
-Run it on a page that still uses the first redesign's layout: `node tools/check-pages.mjs animations/02-entrance-and-exit/fade-in-out; echo "exit $?"`. Expected: `FAIL` lines (that page has no "What it is" section on the page yet) and `exit 1`.
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add tools/check-pages.mjs
-git commit -m "feat: add a browser check tool for guided-steps pages"
-```
-
----
-
-### Task 3: The content sheet for the twelve pages
-
-**Files:**
-- Create: `docs/superpowers/plans/2026-09-27-entrance-exit-content.md`
-
-**Interfaces:**
-- Consumes: each page's current `index.html` and `README.md`; the Rotate In page and README as the model; the settings rules and markup table in Task 1.
-- Produces: one section per page that Tasks 4–9 follow exactly.
-
-This task decides words and settings; it writes no code. Read each page's current `index.html` (controls, their ranges and defaults, the demo's script) and `README.md` before writing its section.
-
-- [ ] **Step 1: Write one section per page, in this format**
-
-```markdown
-## <slug> — <Title>
-
-- **Description:** <one sentence, at most 80 characters, plain words; used as the lede, the meta descriptions and the home card>
-- **Watch it help line:** default | <custom line, when the default does not fit>
-- **Player bar:** Replay · Loop · Slow motion (say which, and why any is left out)
-- **Loop sequence:** <what one cycle does, e.g. "plays in, holds 900ms, plays out, waits 500ms">
-- **Slow motion:** <which durations and timers are multiplied by 3>
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-
-- **Removed:** <old controls that go away and why (playback controls, readouts, notes)>
-- **Stage:** <what stays on the stage; readouts or captions removed; `hb-dots` yes/no; a stage height variable if needed>
-- **Good for:** <3–5 tags> · **Avoid on:** <1–3 tags>
-- **Prompt:** keep | <the rewritten prompt, 60–130 words, ending "Match the settings listed below.">
-- **README Key parameters:** <one row per setting: Parameter | Default | Effect, names exactly as on the page>
-- **README See also:** <each existing link with one plain phrase after " — ">
-- **README How it works:** <what must change so the snippets match the new code, or "unchanged">
-```
-
-Rules for the content:
-
-- **Settings:** follow the rules in Global Constraints. Replace number settings with named choices where the numbers carry no meaning for a visitor: Duration (ms) becomes Speed (Slow · Normal · Fast, keeping the old default as Normal and roughly 1.6× and 0.6× of it for Slow and Fast); Easing becomes Feel with plain names (for example Smooth, Springy, Even, Gentle); Transform origin becomes "Grows from" or "Turns around" with plain places; Distance, Start scale, Starting blur, Perspective and stagger delays become three or four named steps (for example Short · Medium · Far). Keep a slider only when sliding through values is the point (say why), and give it a plain value in `output.hb-value`. "Combine with fade" becomes the switch "Fades in". Text inputs become "Your text". Choose the two or three settings that change the effect most as the main ones.
-- **Sets in the demo:** say exactly which variable, class or code value each choice sets (for example "--dur 1000ms / 600ms / 350ms"), so the implementer does not have to guess.
-- **Every choice must be something the demo can already do**; do not invent new behaviour, and do not drop a setting that changes the technique itself (move it to More options instead).
-- **Prompt:** keep the page's current prompt unless it states as fixed something a setting now controls; then reword that part the way Rotate In's prompt was reworded.
-- **Tags:** short nouns, like Rotate In's ("Icons", "Badges and stars"; "Text", "Wide boxes and cards").
-- **Hints:** one short sentence each, at most 60 characters, saying what it changes or how it feels.
-
-The pages, in order: fade-in-out, slide-in, slide-up-reveal, scale-in, clip-path-reveal, curtain-reveal, split-text-reveal, letter-by-letter-stagger, word-by-word-reveal, blur-in, flip-in, bounce-in.
-
-- [ ] **Step 2: Check the sheet**
-
-For each section: at most three main settings; every setting has a hint of at most 60 characters; every choice has its "Sets in the demo" value; the prompt (kept or rewritten) is 60–130 words and ends with "Match the settings listed below."; the Key parameters names match the Setting names exactly.
-
-- [ ] **Step 3: Commit**
-
-```bash
-git add docs/superpowers/plans/2026-09-27-entrance-exit-content.md
-git commit -m "docs: content sheet for the Entrance & Exit rollout"
-```
-
----
-
-### How to convert a page (Tasks 4–9)
-
-Each of Tasks 4–9 converts two pages. For each page, follow its section of the content sheet exactly, and use Rotate In (`animations/02-entrance-and-exit/rotate-in/index.html`) as the reference for every part of the page that is not the demo itself.
-
-1. **Read** the page's current `index.html` and `README.md`, its content-sheet section, and the Rotate In page.
-2. **Head:** keep the title, canonical link, icons and Open Graph and Twitter tags; set every description (meta, `og:description`, `twitter:description`, JSON-LD `description`) to the sheet's Description. Replace the `handbook.css`/`handbook.js` links with `<link rel="stylesheet" href="../../../assets/css/demo-page.css">` and `<script src="../../../assets/js/demo-page.js" defer></script>`, placed after the page's own `<style>` exactly as on Rotate In.
-3. **The demo's `<style>`:** keep `:root` variables (with `--ui-accent:#5fd88a`), the reset line and every rule the stage content needs; delete the old layout rules (`header`, `.layout`, `aside`, `.note`, `.lbl`, `.kv`, `.div`, `.sr`, `.sv`, `select`, `.seg`, `.tog`, `.btn-row`, `button.act`, the old mobile layout block) and rules for removed readouts. Keep the demo's reduced-motion rule.
-4. **Body:** `<body class="hb" data-hb-kind="once" data-hb-autoplay>`, then the top bar, `main.hb-page`, the footer and the script, in Rotate In's structure:
- - Top bar: the home link as on Rotate In, and the pager with this page's Previous and Next links (keep the targets the page has today). A Previous link is `<a href="../<prev>/" rel="prev" aria-label="Previous: <Name>"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span><Name></span></a>`; a Next link is `<a href="../<next>/" rel="next" aria-label="Next: <Name>"><span><span class="hb-dir">Next: </span><Name></span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a>`.
- - Header: the page's category line (`02.NN · Entrance &amp; Exit`), its title, and the Description as the lede.
- - Step 1: "Watch it" with the help line, the `.stage` (add `hb-dots` if the sheet says so) holding the demo's animated content without removed readouts or captions, then the player bar with the sheet's controls, using Rotate In's markup (switches unchecked).
- - Step 2: "Try it", the main settings in `div.hb-settings`, the rest in `details.hb-options` exactly as on Rotate In, each control in the markup from Task 1's table, with its hint.
- - Step 3: the prompt card exactly as on Rotate In, with the sheet's prompt.
- - About (What it is with the README link as fallback; Good for and Avoid on tags), Similar animations and the footer exactly as on Rotate In.
-5. **Script:** rewrite the page's script so that:
- - the Replay button (`id="btn-play"`, `data-hb-replay`) plays from the start, and keeps looping when Loop is on;
- - the Loop switch (`data-hb-loop`) starts the sheet's loop sequence when switched on, and when switched off lets the current cycle finish with the element shown (Rotate In's `cycle()`/`play()` pattern);
- - the Slow motion switch (`data-hb-slowmo`) multiplies the sheet's durations and the timers that wait for them by 3, taking effect on the next play;
- - every setting sets what its "Sets in the demo" column says; choice buttons toggle `.on` and `aria-pressed` (Rotate In's `choices()` helper); sliders update their `output.hb-value` with the plain value;
- - nothing else remains of the old controls, readouts or `data-hb-reset`/`data-hb-skip` markers;
- - reduced motion still gives the demo's reduced version, and no loop runs under reduced motion.
- The shared script replays the demo after every setting change and turns Loop on at arrival; the page's script must not do either itself.
-6. **README:** replace the Key parameters table with the sheet's rows, bring How it works in line with the new code, and give each See also line its plain phrase. Leave What it is, When to use it and Production notes as they are unless they name a removed control.
-7. **Home page:** in `index.html`, set the page's card description (the third string of its `['<slug>','<Title>','…']` entry) to the Description, escaping any `'` as `\'`.
-8. **Check:** run `node --test "tests/*.test.js"` (all pass) and `node tools/check-pages.mjs animations/02-entrance-and-exit/<slug>` (five `ok` lines). Open the page's desktop and phone screenshots with the Read tool and compare them with Rotate In's: same structure, the animation visible on the stage, nothing overlapping or cut off.
-9. **Commit** each page on its own: `feat: move <Title> to the guided-steps page`.
-
-### Task 4: Fade In/Out and Slide In
-
-**Files:** `animations/02-entrance-and-exit/fade-in-out/{index.html,README.md}`, `animations/02-entrance-and-exit/slide-in/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-- [ ] **Step 1:** Convert `fade-in-out` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `slide-in` the same way; run the checks; commit.
-
-### Task 5: Slide Up Reveal and Scale In
-
-**Files:** `animations/02-entrance-and-exit/slide-up-reveal/{index.html,README.md}`, `animations/02-entrance-and-exit/scale-in/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-Keep each line's own `overflow: hidden` wrapper in Slide Up Reveal: the reveal depends on it.
-
-- [ ] **Step 1:** Convert `slide-up-reveal` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `scale-in` the same way; run the checks; commit.
-
-### Task 6: Clip-Path Reveal and Curtain Reveal
-
-**Files:** `animations/02-entrance-and-exit/clip-path-reveal/{index.html,README.md}`, `animations/02-entrance-and-exit/curtain-reveal/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-Curtain Reveal gains `data-hb-autoplay` and plays on arrival. Its colour choices become swatches with colour names.
-
-- [ ] **Step 1:** Convert `clip-path-reveal` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `curtain-reveal` the same way; run the checks; commit.
-
-### Task 7: Split Text Reveal and Letter-by-Letter Stagger
-
-**Files:** `animations/02-entrance-and-exit/split-text-reveal/{index.html,README.md}`, `animations/02-entrance-and-exit/letter-by-letter-stagger/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-Both pages have a text field ("Your text"): rebuilding the letters or words when the text changes stays the page's job; the shared script replays after the change.
-
-- [ ] **Step 1:** Convert `split-text-reveal` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `letter-by-letter-stagger` the same way; run the checks; commit.
-
-### Task 8: Word-by-Word Reveal and Blur In
-
-**Files:** `animations/02-entrance-and-exit/word-by-word-reveal/{index.html,README.md}`, `animations/02-entrance-and-exit/blur-in/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-- [ ] **Step 1:** Convert `word-by-word-reveal` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `blur-in` the same way; run the checks; commit.
-
-### Task 9: Flip In and Bounce In
-
-**Files:** `animations/02-entrance-and-exit/flip-in/{index.html,README.md}`, `animations/02-entrance-and-exit/bounce-in/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-Flip In keeps `perspective` on its `.stage` (the demo's own rule; the shared stylesheet no longer overrides it). Bounce In builds its keyframes in a `<style>` element from its settings; keep that approach.
-
-- [ ] **Step 1:** Convert `flip-in` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `bounce-in` the same way; run the checks; commit.
-
----
-
-### Task 10: Check the whole category in a browser
-
-The controller runs this task; its screenshots go to the user.
-
-- [ ] **Step 1:** Run `node tools/check-pages.mjs animations/02-entrance-and-exit/*/` (all thirteen pages). Expected: every line `ok`.
-- [ ] **Step 2:** Open each page's desktop and phone screenshots. Expected: the same structure as Rotate In on every page, the animation visible on the stage, settings readable, no overlap.
-- [ ] **Step 3:** In the in-app browser, on three pages (one with a slider, one with swatches, one with a text field), change every setting and confirm the chips follow and the demo replays; press Copy prompt and confirm the copied text ends with the settings line.
-- [ ] **Step 4:** Anything found goes to one fix dispatch with the complete list; the fixes are reviewed and committed like any task.
diff --git a/docs/superpowers/plans/2026-09-27-entrance-exit-content.md b/docs/superpowers/plans/2026-09-27-entrance-exit-content.md
deleted file mode 100644
index e10df4a3..00000000
--- a/docs/superpowers/plans/2026-09-27-entrance-exit-content.md
+++ /dev/null
@@ -1,586 +0,0 @@
-# Entrance & Exit — Content Sheet
-
-This sheet decides, page by page, how the twelve Entrance & Exit pages that still use the first redesign's layout present their settings and words on the guided-steps page. Tasks 4–9 of `2026-09-27-demo-page-rollout-entrance-exit.md` follow each section exactly; Rotate In (`animations/02-entrance-and-exit/rotate-in/`) is the reference for everything a section does not mention.
-
-How to read a section:
-
-- **Sets in the demo** lists one value per choice, in the same order as the choices. A Speed row sets both the script's `dur` (used by the timers) and the CSS `--dur`.
-- **Shown only when …** in the Control column means the setting's whole `div.hb-setting` gets the `hidden` attribute while it has no effect, so it also drops out of "Your settings".
-- Switches in Try it keep their default in the markup (`checked` when the default is on), as on Rotate In. Only the player bar's Loop and Slow motion start unchecked.
-- Loop timings follow today's loop code: "holds X" is the wait after the entrance's own duration, "waits Y" the wait after the exit's.
-- **Feel** uses the same plain names on every page: Smooth (slows to a stop), Springy (goes a little past, then settles), Gentle (eases in and out), Even (one steady speed). The exact curve behind each name is in the row.
-
----
-
-## fade-in-out — Fade In / Fade Out
-
-- **Description:** Fades in to appear and fades out to leave. Best for pop-ups and tooltips.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** plays in, holds 800ms, plays out, waits 300ms (today's loop with Hold time at its default of 0.8s)
-- **Slow motion:** `--dur` and the `dur` part of both loop timers; the 800ms hold and 300ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow is easy to follow. Fast feels snappy. | `dur` / `--dur`: 1000ms / 600ms / 350ms |
-| Feel | Choice buttons | Smooth · Gentle · Even | Smooth | How the fade speeds up and slows down. | `--ease`: `ease-out` / `ease-in-out` / `linear` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:** Play in, Play out, Reset and Auto-loop (the player bar replaces them); Hold time (it only paced the loop, which now holds a fixed 800ms); the Status and Opacity readouts; the Duration slider and Easing menu (now Speed and Feel). Feel keeps three of the five old curves: Springy goes (opacity cannot go past fully visible, so it only looked like a faster fade) and the second smooth curve goes (it looked nearly the same as Ease out, which is now Smooth).
-- **Stage:** the card stays. Card text: title "Fade In", line "Nothing moves or changes size; it only goes from see-through to solid." (the current title and line use developer terms: opacity, compositor, re-painting, performant). `hb-dots`: yes. Default height.
-- **Good for:** Pop-ups · Tooltips · Loaded content · Image swaps · **Avoid on:** Side panels · Urgent alerts
-- **Prompt:** keep
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the fade takes: slow is 1000ms, normal 600ms and fast 350ms; under 150ms a fade barely registers |
- | Feel | Smooth | Smooth starts quickly and settles gently, the natural feel for an entrance; Gentle eases in and out; Even keeps one steady pace |
-
-- **README See also:**
- - [Slide In](../slide-in/) — travels in from one edge as it fades
- - [Scale In / Zoom In](../scale-in/) — grows from smaller to full size
- - [Blur In](../blur-in/) — sharpens from a blur as it fades in
- - [Clip-Path Reveal](../clip-path-reveal/) — a shape uncovers it, with no fade
-- **README How it works:** unchanged
-
----
-
-## slide-in — Slide In
-
-- **Description:** Travels into place from one edge. Best for side panels and notifications.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** plays in, holds 800ms, plays out, waits 400ms
-- **Slow motion:** `--dur` and the `dur` part of both loop timers; the 800ms hold and 400ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Comes in from | Choice buttons | Top · Bottom · Left · Right | Top | The edge it travels in from. | `dir`: `'top'` / `'bottom'` / `'left'` / `'right'`, then `applyDir()` (sets `--tx`/`--ty` and the card's arrow ↑ ↓ ← →) |
-| How far it travels | Choice buttons | Short · Medium · Far | Medium | Short feels subtle; far feels dramatic. | `dist`: 50 / 200 / 400 (px), then `applyDir()` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow is easy to follow. Fast feels snappy. | `dur` / `--dur`: 1000ms / 600ms / 350ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Springy · Gentle · Even | Smooth | Springy goes a little past its spot, then settles. | `--ease`: `ease-out` / `cubic-bezier(.34,1.56,.64,1)` / `ease-in-out` / `linear` |
-| Fades in | Switch | on / off | on | A slide on its own can look mechanical. | `withFade` true / false, then `applyDir()` (sets `--fade` to `0` / `1`) |
-
-- **Removed:** Play in, Play out, Reset and Auto-loop; the Status and Translate readouts; the arrow diagram under Direction (the card's own arrow stays); the Distance and Duration sliders and the Easing menu (now How far it travels, Speed and Feel); the second smooth curve (nearly the same as Ease out, which is now Smooth).
-- **Stage:** the card stays, and its arrow icon still follows Comes in from. Card text unchanged. `hb-dots`: yes. Default height.
-- **Good for:** Side panels · Notifications · Menus · List items · **Avoid on:** Crowded layouts · Long text
-- **Prompt:** rewritten. The old one stated "a short distance away" and "slowing down as it arrives" as fixed; How far it travels and Feel now control them.
-
- > Add a slide-in entrance to [the element you want to animate]. It should start away from its final position, on the side and at the distance given in the settings, and travel into place so it feels like it came from somewhere; slowing down as it arrives makes the landing feel natural. Unless the settings turn it off, fade it in during the slide too, because a slide on its own tends to look mechanical. Give longer distances a little more time so the speed still feels natural. Move it without changing the layout, so nothing around it shifts. If the visitor has reduced motion turned on, skip the travel and simply show it. Match the settings listed below.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Comes in from | Top | Which edge it travels in from |
- | How far it travels | Medium | How far away it starts: short is 50px, medium 200px and far 400px; short distances suit subtle interface motion, long ones feel dramatic |
- | Speed | Normal | How long the slide takes: slow is 1000ms, normal 600ms and fast 350ms; longer distances need more time so the speed still feels believable |
- | Feel | Smooth | Smooth slows down into place; Springy adds a small overshoot; Gentle eases in and out; Even keeps one steady pace |
- | Fades in | on | A slide alone looks mechanical; the fade makes it read as an arrival |
-
-- **README See also:**
- - [Fade In / Fade Out](../fade-in-out/) — the plain fade, with no travel
- - [Slide Up Reveal](../slide-up-reveal/) — text rises from behind an invisible edge
- - [Scale In / Zoom In](../scale-in/) — grows into place instead of moving
- - [Bounce In](../bounce-in/) — lands with a springy bounce
-- **README How it works:** unchanged (the choices feed the same `applyDir()` code)
-
----
-
-## slide-up-reveal — Slide Up Reveal
-
-- **Description:** Text rises into view from behind an invisible edge. Best for headlines.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** plays in, holds 1000ms, plays out (the lines drop back behind the edge), waits 400ms. As today, each timer starts with its play (the lines drop `dur` + 1000ms after the rise starts, and the next cycle starts `dur` + 400ms after the drop starts), so the line delays run inside them.
-- **Slow motion:** `--dur`, `--stagger` and the `dur` part of both loop timers; the 1000ms hold and 400ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each line takes to rise. | `dur` / `--dur`: 1100ms / 700ms / 400ms |
-| Delay between lines | Choice buttons | Short · Medium · Long | Medium | Longer delays make the cascade easier to see. | `--stagger`: 30ms / 60ms / 120ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Reveal style | Choice buttons | Slide · Wipe | Slide | Slide moves the text up; Wipe uncovers it in place. | the stage's `data-method`: `translatey` / `clippath` |
-| Feel | Choice buttons | Smooth · Springy · Even | Smooth | Springy goes a little past, then settles. | `--ease`: `cubic-bezier(.2,.7,.3,1)` / `cubic-bezier(.34,1.56,.64,1)` / `linear` |
-
-- **Removed:** Play in, Play out, Reset and Auto-loop; the Status readout and the hidden Technique readout; the Multi-line (3 lines) switch, so the stage always shows all three lines (the three lines are what show the cascade, and the switch was already left out of the copied settings); the Duration and Line stagger sliders and the Easing menu (now Speed, Delay between lines and Feel); Ease out (nearly the same as Smooth). The old Technique buttons become Reveal style and now count in "Your settings", because they change how the effect is built.
-- **Stage:** the three lines stay, each inside its own `overflow: hidden` wrapper (the reveal depends on it). `hb-dots`: yes. Default height.
-- **Good for:** Headlines · Section titles · Taglines · **Avoid on:** Long paragraphs · Buttons
-- **Prompt:** rewritten. The old one said "the text moves", which is no longer always true: Reveal style can uncover the text in place.
-
- > Add a slide-up reveal to [your headline or lines of text]. Each line should rise into view from just below an invisible edge, as if it is coming up from behind a solid surface, so viewers only see it arrive and never see it below the line. The text can slide up behind the edge or be uncovered in place from the bottom up; both look almost the same. When there are several lines, start each one a moment after the line above it so they cascade. The text must stay readable by screen readers and search engines the whole time. If the visitor has reduced motion turned on, show the text immediately without the rise. Match the settings listed below.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long each line takes to rise: slow is 1100ms, normal 700ms and fast 400ms |
- | Delay between lines | Medium | The wait before each next line starts: short is 30ms, medium 60ms and long 120ms; 40 to 80ms reads as a cascade |
- | Reveal style | Slide | Two ways to build it that look almost the same: sliding the text up behind a hidden edge, or wiping it into view in place |
- | Feel | Smooth | Smooth slows to a stop; Springy adds a slight settle; Even keeps one steady pace |
-
-- **README See also:**
- - [Split Text Reveal](../split-text-reveal/) — text appears piece by piece, not line by line
- - [Curtain Reveal](../curtain-reveal/) — a colored panel covers it, then slides away
- - [Clip-Path Reveal](../clip-path-reveal/) — a shape uncovers any element
- - [Slide In](../slide-in/) — travels in from any edge, with nothing hiding it
-- **README How it works:** snippets unchanged; in the first paragraph, "and the demo toggles between them" becomes "and the Reveal style setting switches between them (Slide is Method A, Wipe is Method B)"
-
----
-
-## scale-in — Scale In / Zoom In
-
-- **Description:** Grows from smaller to full size. Best for pop-ups and menus.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** plays in, holds 800ms, plays out, waits 400ms
-- **Slow motion:** `--dur` and the `dur` part of both loop timers; the 800ms hold and 400ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Starting size | Choice buttons | A bit smaller · Half size · From nothing | A bit smaller | Starting smaller makes a bigger zoom. | `--ss`: `0.8` / `0.5` / `0` |
-| Grows from | Choice buttons | Center · Top left · Top · Bottom | Center | Grow from a corner to look like it came from a button. | `--origin`: `center` / `top left` / `top center` / `bottom center` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow is easy to follow. Fast feels snappy. | `dur` / `--dur`: 800ms / 500ms / 300ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Springy · Gentle · Even | Springy | Springy grows a little too big, then settles. | `--ease`: `cubic-bezier(.2,.7,.3,1)` / `cubic-bezier(.34,1.56,.64,1)` / `ease-in-out` / `linear` |
-| Fades in | Switch | on / off | on | Stops it flashing in at full strength while tiny. | `--fade-opacity`: `0` (on) / `1` (off) |
-
-- **Removed:** Play in, Play out, Reset and Auto-loop; the Status and Scale readouts; the Start scale and Duration sliders and the Easing menu (now Starting size, Speed and Feel); Ease out (nearly the same as Smooth).
-- **Stage:** the card stays. Card text: title unchanged; line becomes "A springy finish makes it land. Try growing it from a corner." (the current line names "easing" and "transform-origins"). `hb-dots`: yes. Default height.
-- **Good for:** Pop-ups and dialogs · Menus · Cards in a grid · Checkmarks · **Avoid on:** Long text · Full-page sections
-- **Prompt:** rewritten, one change: "start a little smaller than its final size" becomes "start smaller than its final size", because Starting size now sets how much smaller.
-
- > Add a scale-in entrance to [the element you want to animate]. It should start smaller than its final size and grow to full size, anchored at the point given in the settings: its center, or an edge or corner so it seems to grow out of the button that opened it. A springy curve lets it overshoot slightly and settle, which makes the arrival feel physical. Unless the settings turn it off, fade it in while it grows so it never flashes at full strength while it is still tiny. Animate only its size and opacity. If the visitor has reduced motion turned on, show it at full size without the zoom. Match the settings listed below.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Starting size | A bit smaller | How small it starts: a bit smaller is 80% of full size, half size 50% and from nothing 0%; close to full size is subtle, below half reads as a big zoom |
- | Grows from | Center | The point it grows from: the center, the top left corner, the top edge or the bottom edge |
- | Speed | Normal | How long it takes: slow is 800ms, normal 500ms and fast 300ms; a springy curve needs room to overshoot and settle |
- | Feel | Springy | Springy overshoots and settles; Smooth and Gentle arrive more calmly; Even keeps one steady pace |
- | Fades in | on | Stops the element flashing at full strength while it is still tiny |
-
-- **README See also:**
- - [Fade In / Fade Out](../fade-in-out/) — the plain fade, with no size change
- - [Bounce In](../bounce-in/) — a bigger, springier landing
- - [Slide In](../slide-in/) — travels into place instead of growing
- - [Flip In](../flip-in/) — swings in like a card turning over
-- **README How it works:** unchanged
-
----
-
-## clip-path-reveal — Clip-Path Reveal
-
-- **Description:** A growing shape uncovers it while it stays still. Best for images and banners.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** plays in, holds 800ms, plays out, waits 400ms. Every play first snaps to the hidden clip of the current shape with the transition off (today's `resetHidden()`), so changing Shape or Starts from never tweens between two clip shapes.
-- **Slow motion:** `--dur` and the `dur` part of both loop timers; the 800ms hold and 400ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shape | Choice buttons | Edge wipe · Circle · Oval | Edge wipe | The shape that opens to reveal it. | `shape`: `'inset'` / `'circle'` / `'ellipse'`, then `applyClips()` (sets `--cp-out`/`--cp-in` from `CLIPS`) |
-| Starts from | Choice buttons; shown only when Shape is Edge wipe (as today) | Left · Right · Top · Bottom · Center | Left | Which side the wipe begins on. | `dir`: `'left'` / `'right'` / `'top'` / `'bottom'` / `'center'` (`CLIPS.inset[dir]`), then `applyClips()` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | A reveal reads best a little slower than a fade. | `dur` / `--dur`: 1300ms / 800ms / 500ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Even | Smooth | Smooth slows at the end; Even keeps one pace. | `--ease`: `cubic-bezier(.2,.7,.3,1)` / `linear` |
-
-- **Removed:** Play in, Play out, Reset and Auto-loop; the Status readout and the hidden clip-path readout; the Show clip-path boundary switch and the dashed `.clip-outline` element (a teaching overlay, not part of the effect, and already left out of the copied settings); the Swipe shape and its `polygon` entry in `CLIPS` (its values draw a straight wipe from the left, exactly like Edge wipe from the left, not the angled cut the README describes); the Duration slider and Easing menu (now Speed and Feel); Springy (its overshoot happens outside the element, so it only looked like a wipe that stops early) and Ease out (nearly the same as Smooth).
-- **Stage:** the surface stays (gradient, grid, label "Clip-Path Reveal", title "Unmasked"); the `.clip-outline` element goes. `hb-dots`: yes. Default height (the 4:3 surface is at most 300px tall).
-- **Good for:** Images · Banners · Full-width panels · **Avoid on:** Small buttons · Form fields
-- **Prompt:** rewritten. "Let the wipe slow down as it finishes" stated the Feel as fixed, and the old list offered an angled swipe the demo does not show.
-
- > Add a mask reveal to [the image or block you want to reveal]. The element should stay completely still and fully drawn while a shape uncovers it, like a window opening: an edge wipe that starts from one side or from the center, or a circle or oval that opens from the middle. Nothing moves, fades or changes size; only the visible area grows until the whole element shows. A wipe that slows down as it finishes looks calmer than one that stops abruptly. The content must stay accessible even while part of it is hidden. If the visitor has reduced motion turned on, show it fully without the wipe. Match the settings listed below.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Shape | Edge wipe | Edge wipe uncovers it from one side or from the center; Circle and Oval open from the middle like an iris |
- | Starts from | Left | For the edge wipe, where the reveal begins: left, right, top, bottom or center |
- | Speed | Normal | How long the reveal takes: slow is 1300ms, normal 800ms and fast 500ms; a reveal reads best a little slower than a fade |
- | Feel | Smooth | Smooth slows to a stop instead of snapping; Even keeps one steady pace |
-
-- **README See also:**
- - [Curtain Reveal](../curtain-reveal/) — a colored panel covers it, then slides away
- - [Slide Up Reveal](../slide-up-reveal/) — text rises from behind an invisible edge
- - [Split Text Reveal](../split-text-reveal/) — text appears piece by piece
- - [Fade In / Fade Out](../fade-in-out/) — a plain fade instead of a shape
-- **README How it works:** delete the `polygon:` line from the `CLIPS` snippet (Swipe is gone); everything else unchanged
-
----
-
-## curtain-reveal — Curtain Reveal
-
-- **Description:** A colored panel covers it, then slides away. Best for intros and logos.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion. The body gains `data-hb-autoplay`, so it plays on arrival like the other pages.
-- **Loop sequence:** the panel covers the content (Speed), holds (Pause while covered), slides off the far side (Speed), waits 500ms; with Both sides, the two halves meet in the middle and part back to their own sides. Every play first snaps the panels back off-stage with the transition off (today's `clearCurtains()`).
-- **Slow motion:** `--dur`, the two timers that wait for a pass, and the `pause` timer (the hold is part of the effect); the 500ms wait between cycles stays
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Comes in from | Choice buttons | Left · Right · Top · Bottom · Both sides | Left | Both sides sends two panels that meet in the middle. | `axis` / `dirMode` / `twin`: `'h'`, `'ltr'`, false / `'h'`, `'rtl'`, false / `'v'`, `'ttb'`, false / `'v'`, `'btt'`, false / `'h'`, `'ltr'`, true |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the curtain slides across. | `dur` / `--dur`: 800ms / 500ms / 300ms |
-| Pause while covered | Choice buttons | None · Short · Long | Short | The pause is what makes the change register. | `pause`: 0 / 300 / 800 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Curtain color | Swatches (the color name is each button's `aria-label`) | Dark · Ink blue · Warm red · Off-white · Gold | Dark | Strong contrast with the content feels more dramatic. | `--curtain-color`: `#111827` / `#1e3a5f` / `#5c1a1a` / `#f0ede8` / `#8a6e14` |
-
-- **Removed:** Play reveal, Reset and Auto-loop; the Status readout; the enter / pause / exit timeline on the stage (a live readout); the Two curtains (split) switch, which becomes the Both sides choice of Comes in from (the split only worked with left and right, so half of the old combinations did nothing); the Curtain speed and Pause between sliders (now Speed and Pause while covered); the swatch `div`s and their key handling (the swatches become buttons).
-- **Stage:** the two panels and the content (badge "Curtain Reveal", title "Unveiled", its line) stay; the `.tl` timeline goes. `hb-dots`: yes. Default height.
-- **Good for:** Page intros · Logos · Section changes · Portfolio pieces · **Avoid on:** Buttons and menus · Things shown often
-- **Prompt:** rewritten. The old one said to always keep the pause, which Pause while covered now controls, and its "split mode" is now the Both sides choice.
-
- > Add a curtain reveal to [the content you want to reveal]. A solid colored panel should slide across and cover the content completely, hold for the pause given in the settings, then keep going and slide off the far side, leaving the content visible. The pause is what makes the change register. When the panels come in from both sides, two panels meet in the middle, then part. Pick a panel color that contrasts strongly with the content. Move the panels rather than resizing them so the motion stays smooth. If the visitor has reduced motion turned on, show the content without the curtain. Match the settings listed below.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Comes in from | Left | Which way the panel travels; Both sides sends two panels that meet in the middle, then part |
- | Speed | Normal | Time for one pass: slow is 800ms, normal 500ms and fast 300ms; the whole reveal takes about two passes plus the pause |
- | Pause while covered | Short | How long the panel covers everything: none, short (300ms) or long (800ms); the pause is what makes the change register |
- | Curtain color | Dark | The panel's color; strong contrast with the content makes the reveal more dramatic |
-
-- **README See also:**
- - [Clip-Path Reveal](../clip-path-reveal/) — a shape uncovers it, with no panel
- - [Slide Up Reveal](../slide-up-reveal/) — text rises from behind an invisible edge
- - [Slide In](../slide-in/) — travels into place from one edge
- - [Split Text Reveal](../split-text-reveal/) — text appears piece by piece
-- **README How it works:** snippets unchanged. After the JS snippet, add: "Both sides uses two half-width panels that start off opposite edges, meet in the middle and go back." If the new script cancels the pending timers at the start of each play instead of keeping the `busy` flag (Rotate In's `play()`), reword the Production notes line "Guard against re-entry" to say that each play clears the timers of the one before, so a second trigger cannot desync the stages.
-
----
-
-## split-text-reveal — Split Text Reveal
-
-- **Description:** Text breaks into pieces that appear one after another. Best for headlines.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** plays in, holds 800ms, plays out, waits 400ms. As today, a play lasts pieces × Delay between pieces + Speed, and the hold and the wait are counted from its end.
-- **Slow motion:** `--dur`, `--stagger` and the play length in both loop timers; the 800ms hold and 400ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Split into | Choice buttons | Letters · Words · Lines | Words | Letters ripple finely; lines arrive in blocks. | `mode`: `'chars'` / `'words'` / `'lines'`, then `split()` |
-| How each piece appears | Choice buttons | Fade up · Fade · Grow · Flip | Fade up | The small entrance every piece plays. | `anim` and the target's `data-anim`: `fade-up` / `fade` / `scale` / `rotate` |
-| Delay between pieces | Choice buttons | Short · Medium · Long | Medium | Short ripples quickly; long feels deliberate. | `stagger` / `--stagger`: 10ms / 30ms / 100ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each piece takes to appear. | `dur` / `--dur`: 800ms / 500ms / 300ms |
-| Feel | Choice buttons | Smooth · Springy · Even | Smooth | Springy goes a little past, then settles. | `--ease`: `cubic-bezier(.2,.7,.3,1)` / `cubic-bezier(.34,1.56,.64,1)` / `linear` |
-| Your text | Text (`input.hb-text`) | any text | Design beyond the obvious | Type your own words to see them split. | `txtIn.value`, then `split()` on input (an empty field falls back to "Design beyond the obvious") |
-
-- **Removed:** Play in, Play out, Reset and Auto-loop; the Status and Total time readouts; the Stagger delay and Duration per unit sliders and the Easing menu (now Delay between pieces, Speed and Feel); Ease out (nearly the same as Smooth). The Edit text field becomes Your text.
-- **Stage:** the text stays. `hb-dots`: yes. Height: typed text has to fit, so set `--hb-stage-h: auto` and `--hb-stage-h-phone: auto` on `:root` and give the demo's `.stage` rule `min-height: clamp(300px, calc(100vh - 420px), 440px)` followed by `min-height: clamp(300px, calc(100svh - 420px), 440px)`, plus `min-height: 300px` under 600px wide. The default text keeps the usual stage size; a longer text grows the stage instead of being cut off.
-- **Good for:** Headlines · Taglines · Short quotes · **Avoid on:** Body text · Buttons and labels
-- **Prompt:** keep
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Split into | Words | Letters give the finest cascade, words a readable rhythm, lines a block reveal |
- | How each piece appears | Fade up | The small entrance each piece plays: fade up, fade, grow or flip |
- | Delay between pieces | Medium | The wait between pieces: short is 10ms, medium 30ms and long 100ms; small values ripple, large values feel deliberate |
- | Speed | Normal | How long each piece takes: slow is 800ms, normal 500ms and fast 300ms |
- | Feel | Smooth | The curve each piece uses; Springy adds a small settle, Even keeps one steady pace |
- | Your text | Design beyond the obvious | The text that is split and revealed |
-
-- **README See also:**
- - [Slide Up Reveal](../slide-up-reveal/) — whole lines rise from behind an invisible edge
- - [Letter-by-Letter Stagger](../letter-by-letter-stagger/) — one letter at a time, or typed out
- - [Word-by-Word Reveal](../word-by-word-reveal/) — one word at a time, at a reading pace
- - [Fade In / Fade Out](../fade-in-out/) — the whole text fades in at once
-
- Two link texts change to the pages' real titles: "Letter-by-Letter Stagger" and "Word-by-Word Reveal" (today they read "Letter By Letter Stagger" and "Word By Word Reveal").
-- **README How it works:** unchanged
-
----
-
-## letter-by-letter-stagger — Letter-by-Letter Stagger
-
-- **Description:** A phrase appears letter by letter, or is typed out. Best for short headlines.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion. Loop is new on this page (it had Replay and Reset only); it only repeats the page's existing steps: play, then the reset that rebuilds the letters hidden.
-- **Loop sequence:** plays in, holds 1000ms, clears at once (today's reset: the letters are rebuilt hidden, with no exit animation), waits 400ms. Playing in lasts letters × Delay between letters, plus Speed in Cascade.
-- **Slow motion:** `--dur`, `--stagger`, the Typewriter's per-letter timers (`i × stagger`) and its end timer, and the play length in the loop timers; the 1000ms hold and 400ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Style | Choice buttons | Cascade · Typewriter | Cascade | Cascade animates each letter; Typewriter types them. | `mode` and the target's `data-mode`: `cascade` / `typewriter`, then rebuild; also shows How each letter appears and Speed only in Cascade, Blinking cursor only in Typewriter |
-| Delay between letters | Choice buttons | Short · Medium · Long | Medium | Longer delays feel slower and more theatrical. | `stagger` / `--stagger`: 20ms / 35ms / 80ms |
-| How each letter appears | Choice buttons; shown only in Cascade (as today) | Fade up · Fade · Grow · Flip | Fade up | The small entrance every letter plays. | `anim` and the target's `data-anim`: `fade-up` / `fade` / `scale` / `rotate` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons; shown only in Cascade (Typewriter letters appear without a transition) | Slow · Normal · Fast | Normal | How long each letter takes to settle. | `dur` / `--dur`: 650ms / 400ms / 250ms |
-| Blinking cursor | Switch; shown only in Typewriter | on / off | on | A cursor leads the letters as they are typed. | `cursorTog.checked` true / false: `buildSpans()` adds the `.cursor` span or not |
-| Your text | Text (`input.hb-text`, keeps `maxlength="60"`) | any text up to 60 characters | Hello, world. | Short phrases work best, up to 60 characters. | `txtIn.value`, then `buildSpans()` (an empty field falls back to "Hello, world.") |
-
-- **Removed:** the panel's Replay and Reset buttons (the player bar's Replay replaces them); the Status and Total time readouts; the Per-letter delay and Duration per letter sliders (now Delay between letters and Speed). The Edit text field becomes Your text, and the cursor switch loses "(typewriter)" from its label because it now shows only in Typewriter.
-- **Stage:** the text and the cursor stay. `hb-dots`: yes. Height: as on Split Text Reveal (`--hb-stage-h: auto`, `--hb-stage-h-phone: auto` and the stage's own `min-height`), so 60 characters always fit.
-- **Good for:** Short headlines · Names and logos · Chat messages · Loading screens · **Avoid on:** Long text · Buttons and labels
-- **Prompt:** rewritten. The old one said the typewriter always types behind a blinking cursor, which Blinking cursor now controls; "mode" becomes "style" to match the setting.
-
- > Add a letter-by-letter entrance to [a short phrase or headline]. In the cascade style, every letter plays a small entrance a moment after the previous one, so the phrase assembles from left to right. In the typewriter style, the letters appear one at a time as if someone is typing, with a blinking cursor when the settings include one. Use it only on short phrases, because long text becomes tedious to wait for. Screen readers should hear the whole phrase once, not letter by letter. If the visitor has reduced motion turned on, show the full phrase immediately. Match the settings listed below.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Style | Cascade | Cascade animates every letter in turn; Typewriter types them out |
- | Delay between letters | Medium | The gap between letters: short is 20ms, medium 35ms and long 80ms; higher is slower and more theatrical |
- | How each letter appears | Fade up | In Cascade, the entrance each letter plays: fade up, fade, grow or flip |
- | Speed | Normal | In Cascade, how long each letter takes to settle: slow is 650ms, normal 400ms and fast 250ms |
- | Blinking cursor | on | In Typewriter, a blinking cursor leads the letters |
- | Your text | Hello, world. | The phrase that is animated, up to 60 characters |
-
-- **README See also:**
- - [Word-by-Word Reveal](../word-by-word-reveal/) — one word at a time, better for longer text
- - [Split Text Reveal](../split-text-reveal/) — text breaks into letters, words or lines
- - [Blur In](../blur-in/) — sharpens from a blur as it fades in
-
- One link text changes to the page's real title: "Split Text Reveal" (today it reads "Split-Text Reveal").
-- **README How it works:** unchanged
-
----
-
-## word-by-word-reveal — Word-by-Word Reveal
-
-- **Description:** Words appear one after another at a reading pace. Best for quotes and intros.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** plays in, holds 1000ms, plays out, waits 400ms. As today, a play lasts the last word's delay + Speed, and the hold and the wait are counted from its end.
-- **Slow motion:** `--dur`, the CSS `--stagger` and the play length in both loop timers. Keep the unmultiplied `stagger` when computing each word's `--i`, so the sentence pauses stretch too. The 1000ms hold and 400ms wait stay.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Delay between words | Choice buttons | Short · Medium · Long | Medium | Medium matches a comfortable reading pace. | `stagger` / `--stagger`: 40ms / 80ms / 150ms, then `buildWords()` |
-| How each word appears | Choice buttons | Fade up · Fade · Grow · Blur · Flip | Fade up | The small entrance every word plays. | the target's `data-anim`: `fade-up` / `fade` / `scale` / `blur` / `rotate` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each word takes to settle. | `dur` / `--dur`: 700ms / 450ms / 270ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Springy · Even | Smooth | Springy adds a small bounce as each word lands. | `--ease`: `cubic-bezier(.2,.7,.3,1)` / `cubic-bezier(.34,1.56,.64,1)` / `linear` |
-| Pauses between sentences | Switch | on / off | off | Waits a little longer before each new sentence. | `punctTog.checked` true / false, then `buildWords()` (adds `si × 200ms` to each word's delay) |
-| Your text | Text (`textarea.hb-text`) | any text, one sentence per line | the three current sentences | Put each sentence on its own line. | `txtIn.value`, then `buildWords()` |
-
-- **Removed:** Play in, Play out, Reset and Auto-loop; the Status and Total time readouts; the Per-word delay and Duration per word sliders and the two menus (now Delay between words, Speed, How each word appears and Feel); Ease out (nearly the same as Smooth). The Edit text box becomes Your text.
-- **Stage:** the text stays. `hb-dots`: yes. Height: as on Split Text Reveal (`--hb-stage-h: auto`, `--hb-stage-h-phone: auto` and the stage's own `min-height`), so a longer passage grows the stage.
-- **Good for:** Quotes · Short paragraphs · Captions · Story sections · **Avoid on:** Long articles · Buttons and labels
-- **Prompt:** rewritten. "At roughly the pace people read" stated the pace as fixed; Delay between words now sets it.
-
- > Add a word-by-word reveal to [the paragraph or quote you want to reveal]. Each word should appear a moment after the one before it, so the text builds up as if it is being spoken; a delay close to the pace people read feels most natural. If pauses between sentences are on, wait a little longer at the end of each sentence before continuing. Keep the delay short enough that nobody waits for text they could already read. The full text must stay readable by screen readers and must not reflow while it appears. If the visitor has reduced motion turned on, show all the text at once. Match the settings listed below.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Delay between words | Medium | The reading-speed control: short is 40ms, medium 80ms and long 150ms; below about 40ms the words blur into one reveal |
- | How each word appears | Fade up | The entrance each word plays: fade up, fade, grow, blur or flip |
- | Speed | Normal | How long each word takes to settle: slow is 700ms, normal 450ms and fast 270ms |
- | Feel | Smooth | Smooth slows each word into place; Springy adds a bounce; Even feels mechanical |
- | Pauses between sentences | off | Adds an extra pause between sentences |
- | Your text | Three sample sentences | The passage that is revealed, one sentence per line |
-
-- **README See also:**
- - [Letter-by-Letter Stagger](../letter-by-letter-stagger/) — one letter at a time, for short phrases
- - [Split Text Reveal](../split-text-reveal/) — text breaks into letters, words or lines
- - [Fade In / Out](../fade-in-out/) — the whole text fades in at once
-
- One link text changes to the page's real title: "Split Text Reveal" (today it reads "Split-Text Reveal").
-- **README How it works:** snippets unchanged if the new script keeps the name `punctTog` for the Pauses between sentences switch (otherwise rename it in the snippet); in the last paragraph, 'The "sentence pauses" option' becomes 'The Pauses between sentences switch'
-
----
-
-## blur-in — Blur In
-
-- **Description:** Comes into focus from a blur, like a camera. Best for featured cards and photos.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** plays in, holds 900ms, plays out, waits 400ms
-- **Slow motion:** `--dur` and the `dur` part of both loop timers; the 900ms hold and 400ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| How blurry it starts | Choice buttons | Slight · Medium · Heavy | Medium | Heavy looks more dramatic, almost like frosted glass. | `--blur-start`: 8px / 20px / 35px |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | A little slower lets the focus pull land. | `dur` / `--dur`: 1100ms / 700ms / 400ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| What changes | Choice buttons | Blur and fade · Blur only · Fade only | Blur and fade | Try each half on its own to see what it adds. | the card's `data-mode`: `blur-fade` / `blur-only` / `fade-only`; also shows Drifts up only with Blur and fade |
-| Feel | Choice buttons | Smooth · Gentle · Even | Smooth | Smooth slows at the end, like a lens settling. | `--ease`: `ease-out` / `ease-in-out` / `linear` |
-| Drifts up | Switch; shown only with Blur and fade (the other two keep the card still) | on / off | on | A small rise, as if it settles into place. | `--ty`: `-8px` (on) / `0px` (off) |
-
-- **Removed:** Play in, Play out, Reset and Auto-loop; the Status and blur readouts; the Starting blur and Duration sliders and the Easing menu (now How blurry it starts, Speed and Feel); the second smooth curve (nearly the same as Ease out, which is now Smooth). The Mode buttons become What changes.
-- **Stage:** the card stays. Card text: title "Focus Pull" unchanged; line becomes "It sharpens and fades in at the same time, like a camera finding focus." (the current line uses "opacity" and advice meant for developers). `hb-dots`: yes. Default height.
-- **Good for:** Featured cards · Photos · Pop-ups · Portfolio pieces · **Avoid on:** Lists and grids · Small text
-- **Prompt:** rewritten. The old one stated "start blurred and transparent, then sharpen into focus while it fades in" as fixed; What changes now decides whether it blurs, fades or both.
-
- > Add a blur-in entrance to [the element you want to animate]. It should come into view like a camera pulling focus onto the subject: sharpening from a blur makes it feel like a lens finding its subject, and fading in at the same time makes it feel like it is arriving. It can also drift up slightly as it settles. Use it on one focal element at a time, not on a list or grid, because blur is expensive for the browser to draw. Remove the blur completely once the animation ends. If the visitor has reduced motion turned on, show the element sharp and visible without the effect. Match the settings listed below.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | How blurry it starts | Medium | How much blur it starts with: slight is 8px, medium 20px and heavy 35px; past about 30px it looks like frosted glass |
- | Speed | Normal | How long it takes: slow is 1100ms, normal 700ms and fast 400ms; blur needs a little longer than a plain fade for the lens feel to land |
- | What changes | Blur and fade | The full effect; Blur only and Fade only show each half on its own |
- | Feel | Smooth | Smooth slows down like a lens settling; Gentle eases in and out; Even feels robotic |
- | Drifts up | on | A small rise while it sharpens, as if it is settling into place; only with Blur and fade |
-
-- **README See also:**
- - [Fade In / Out](../fade-in-out/) — the fade on its own, with no blur
- - [Scale In](../scale-in/) — grows from smaller to full size
- - [Flip In](../flip-in/) — swings in like a card turning over
-- **README How it works:** snippets unchanged; "The blur-only and fade-only modes exist to show" becomes "The Blur only and Fade only choices of What changes exist to show"
-
----
-
-## flip-in — Flip In
-
-- **Description:** Swings into view in 3D, like a card turning over. Best for cards and tiles.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** plays in, holds 800ms, plays out, waits 400ms
-- **Slow motion:** `--dur` and the `dur` part of both loop timers; the 800ms hold and 400ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Swing direction | Choice buttons | Sideways · Up and down · Diagonal | Sideways | Sideways turns like a door, up and down like a flap. | `axis`: `'Y'` / `'X'` / `'both'`, then `applyRot()` (sets `--rot-y`/`--rot-x`) |
-| Hinge | Choice buttons | Center · Top · Bottom · Left | Center | An edge hinge makes it swing from that side. | `--origin`: `center` / `top center` / `bottom center` / `left center` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow is easy to follow. Fast feels snappy. | `dur` / `--dur`: 1000ms / 600ms / 350ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| How far it turns | Choice buttons | A little · ¼ turn · ½ turn | ¼ turn | ¼ turn starts edge-on; ½ turn starts facing away. | `rot`: 45 / 90 / 180 (degrees), then `applyRot()` |
-| 3D depth | Choice buttons | Subtle · Medium · Strong | Medium | Strong looks closer and more dramatic. | `--persp` (read by the stage's own `perspective` rule): 2000px / 1000px / 400px |
-| Feel | Choice buttons | Smooth · Springy · Gentle · Even | Smooth | Springy swings a little past, then settles. | `--ease`: `ease-out` / `cubic-bezier(.34,1.56,.64,1)` / `ease-in-out` / `linear` |
-| Fades in | Switch | on / off | on | Softens the first moment. | on: remove the card's inline `opacity` (it starts at 0); off: `card.style.opacity = '1'` |
-
-- **Removed:** Play in, Play out, Reset and Auto-loop; the Status and Rotation readouts; the Starting rotation, Perspective and Duration sliders and the Easing menu (now How far it turns, 3D depth, Speed and Feel); the second smooth curve (nearly the same as Ease out, which is now Smooth); the inline `stage.style.perspective` line (the stage's own rule already reads `--persp`).
-- **Stage:** the card stays, and the stage keeps its own `perspective: var(--persp)` rule. Card text: title "3D Flip" unchanged; line becomes "The depth comes from the space around the card. Without it, the turn looks like a flat squash." (the current line names rotateY). `hb-dots`: yes. Default height.
-- **Good for:** Cards · Flashcards and tiles · Dashboard panels · Onboarding steps · **Avoid on:** Text blocks · Full-page sections
-- **Prompt:** rewritten. "Start turned edge-on, like a door seen from the side" stated the starting angle as fixed; How far it turns now sets it.
-
- > Add a 3D flip-in entrance to [the card you want to animate]. The card should start turned away from the viewer and swing toward them until it faces them flat. Give the card's container a 3D perspective so the swing has real depth; without it, the flip looks like a flat squash. The hinge can sit in the middle or along one edge, and the card can fade in while it turns. If the visitor has reduced motion turned on, show the card facing forward without the flip. Match the settings listed below.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Swing direction | Sideways | Which way it swings: sideways around an upright hinge like a door, up and down like a flap, or diagonally |
- | Hinge | Center | Where it turns from; an edge makes it swing from that side |
- | Speed | Normal | How long the swing takes: slow is 1000ms, normal 600ms and fast 350ms |
- | How far it turns | ¼ turn | The angle it starts from: a little (45°), a quarter turn (90°, edge-on) or half a turn (180°, facing away) |
- | 3D depth | Medium | How close the viewer seems: subtle is 2000px, medium 1000px and strong 400px; closer is more dramatic |
- | Feel | Smooth | Smooth slows the swing as it comes to face you; Springy adds a settle; Gentle eases in and out; Even keeps one steady pace |
- | Fades in | on | Fades it in while it turns |
-
-- **README See also:**
- - [Scale In](../scale-in/) — grows into place, flat on the page
- - [Rotate In](../rotate-in/) — spins flat instead of turning in 3D
- - [Blur In](../blur-in/) — sharpens from a blur as it fades in
-- **README How it works:** snippets unchanged. The sentence before the JS snippet becomes: "The Swing direction setting decides which rotation carries the starting angle: Sideways uses rotateY (an upright hinge, like a door), Up and down uses rotateX (a flat hinge, like a flap) and Diagonal uses both:". The last sentence becomes: "The Hinge setting moves transform-origin to an edge (top, bottom, left) so the card swings from that side rather than pivoting around its center."
-
----
-
-## bounce-in — Bounce In
-
-- **Description:** Lands with a springy bounce. Best for badges and success messages.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Loop sequence:** bounces in (Speed), holds 800ms, shrinks out (half of Speed), waits 400ms
-- **Slow motion:** `--dur` (the exit animation is half of it) and the `dur` part of both loop timers; the 800ms hold and 400ms wait stay
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Bounce strength | Choice buttons | Soft · Medium · Strong | Medium | How far it grows past full size before settling. | the intensity passed to `buildKF()`: 30 / 60 / 100 |
-| Number of bounces | Choice buttons | One · Two · Three | One | One usually looks best; more looks cartoonish. | `bounces`: 1 / 2 / 3, then `buildKF()` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Too fast and the bounce looks like a jitter. | `dur` / `--dur`: 1800ms / 1100ms / 650ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Fades in | Switch | on / off | on | Softens the first moment. | `fadeTog.checked` true / false: `buildKF()` writes `opacity: 0` / `1` at 0% |
-
-- **Removed:** Play in, Play out, Reset and Auto-loop; the Status readout; the hidden keyframe display (it showed code); the Overshoot intensity and Duration sliders (now Bounce strength and Speed). Keep the `<style id="kf-style">` element that `buildKF()` writes into.
-- **Stage:** the card stays. Card text: title "Bounce Landing" unchanged; line becomes "A real bounce goes past its size and back, a little less each time." (the current line names cubic-bezier and keyframes). `hb-dots`: yes. Default height.
-- **Good for:** Success messages · Badges · Small pop-ups · Playful brands · **Avoid on:** Formal content · Large panels
-- **Prompt:** keep
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Bounce strength | Medium | How far past full size it grows: soft about 5%, medium 9% and strong 15%, with smaller dips back under |
- | Number of bounces | One | How many times it overshoots; almost always one, since more looks cartoonish |
- | Speed | Normal | How long it takes: slow is 1800ms, normal 1100ms and fast 650ms; too short and the spring reads as a jitter |
- | Fades in | on | Whether it fades in while it bounces or is visible from the start |
-
-- **README See also:**
- - [Scale In](../scale-in/) — grows into place without the bounce
- - [Rotate In](../rotate-in/) — spins into place while it grows
- - [Slide In](../slide-in/) — travels into place from one edge
-- **README How it works:** snippets unchanged; "computed from an intensity slider" becomes "computed from the Bounce strength choice (an intensity of 30, 60 or 100)", and "changing intensity or bounce count" becomes "changing Bounce strength or Number of bounces"
diff --git a/docs/superpowers/plans/2026-09-28-demo-page-rollout-text-typography.md b/docs/superpowers/plans/2026-09-28-demo-page-rollout-text-typography.md
deleted file mode 100644
index fe11c59a..00000000
--- a/docs/superpowers/plans/2026-09-28-demo-page-rollout-text-typography.md
+++ /dev/null
@@ -1,641 +0,0 @@
-# Guided-Steps Rollout: Text & Typography — Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Move the fourteen Text & Typography pages to the guided-steps page, add the "loops" kind of page (Pause, and Slow motion for demos that run forever), and fix the text issues carried over from Entrance & Exit.
-
-**Architecture:** Task 1 fixes the carried-over text issues on three Entrance & Exit pages. Task 2 teaches the shared files (`assets/css/demo-page.css`, `assets/js/demo-page.js`), the page checks and the browser tool about loop pages. Task 3 writes the content sheet that decides each page's kind, plain settings, words and prompt. Tasks 4–10 convert two pages each. Task 11 checks both converted categories in a browser.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build step); Node's built-in test runner; `tools/check-pages.mjs` (Node and the local Chrome).
-
-**Specs:** `docs/superpowers/specs/2026-09-27-demo-page-guided-steps-design.md`, `docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md`. **Reference pages:** the thirteen Entrance & Exit pages (`animations/02-entrance-and-exit/*/`), all live in the guided-steps design; `rotate-in` is the model for plays-once pages.
-
-## Global Constraints
-
-- Plain HTML + CSS + vanilla JS only. No build step, no frameworks, no npm packages, no CDN scripts or fonts.
-- In scope: the fourteen pages in `animations/05-text-typography/`, their READMEs and home-page cards; `split-text-reveal`, `word-by-word-reveal` and the `letter-by-letter-stagger` README in Entrance & Exit (Task 1 only); the version number on the Entrance & Exit pages' shared-file links (Task 2 only); the shared files, the tests and the browser tool. `assets/css/handbook.css`, `assets/js/handbook.js` and `tests/handbook.test.js` stay as they are.
-- Two kinds of page in this category:
- - **Plays once:** `<body class="hb" data-hb-kind="once" data-hb-autoplay>`; Watch it help line "It plays by itself. Turn on slow motion to see each part of the movement."; player bar Replay · Loop · Slow motion; Try it help line "Change a setting and the animation plays again." — exactly as on the Entrance & Exit pages.
- - **Loops:** `<body class="hb" data-hb-kind="loop">` (no autoplay attribute); Watch it help line "It moves by itself. Pause it to look closely." or, with Slow motion, "It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement."; player bar Pause (and Slow motion where it works), no Replay and no Loop; Try it help line "Change a setting and see the difference as it moves."
-- The Pause button is exactly `<button class="hb-play" type="button" id="btn-pause" data-hb-pause="css" data-state="playing"><svg class="hb-ic hb-i-pause" viewBox="0 0 24 24" aria-hidden="true"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg><svg class="hb-ic hb-i-play" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3l14 9-14 9z"/></svg><span class="hb-pause-label">Pause</span></button>`, with `data-hb-pause` written without a value when the page's own script runs the loop (see Task 2). It has no `aria-pressed`: its label already says what it will do.
-- Reduced motion (user ruling): Loop and Slow motion are shown switched off and cannot be switched on, with a short note; Replay, Pause and Play still work; loops start paused (the shared script does this).
-- Stage font (user ruling): stage text uses the site font (it inherits it; no `font-family` on stage text); only an effect about typing may use a typewriter font, which is the system stack `ui-monospace,'SFMono-Regular',Menlo,Consolas,'Liberation Mono',monospace`. No `@font-face` in any page; the old `Bricolage` and `PlexMono` faces go.
-- Replay must restart the animation on the animated pieces themselves (rebuild or reset the pieces, force a reflow with `void el.offsetWidth`, then show them), never only on their container.
-- Every player switch and every input, select and textarea in Try it has `autocomplete="off"`.
-- The shared files are linked as `../../../assets/css/demo-page.css?v=3` and `../../../assets/js/demo-page.js?v=3` on every guided-steps page (this plan changes both files, so the number goes from 2 to 3 everywhere).
-- Settings rules: plain labels, named choices over numbers, switches for on/off, one hint each (at most 60 characters), one to three main settings, the rest under More options, playback is not a setting, no readouts; colour pickers become named swatches; radio groups become choice buttons; text values appear quoted in "Your settings".
-- Prompts: 60–130 words, fill-in parts in square brackets, end with "Match the settings listed below.", no code, nothing stated as fixed that a setting controls, a reduced-motion sentence, a touch equivalent for any hover.
-- Touch targets at least 44×44px on phones; hover rules only inside `@media (hover: hover)`; stage text contrast at least 4.5:1; no horizontal scroll from 320px up.
-- Words on the page are plain; never "stunning", "amazing" or "powerful"; no code anywhere on the page.
-- Text & Typography pages keep `--ui-accent:#ff6f8b` (the category colour) and the category line `05.NN · Text &amp; Typography`.
-- Tests: `node --test "tests/*.test.js"` from the repo root (the directory form does not work on this machine). Browser check: `node tools/check-pages.mjs <page or category folder>` with the static server at `http://127.0.0.1:8731` (start one from the repo root with `python -m http.server 8731 --bind 127.0.0.1` if nothing answers).
-- Scratch files go in `.superpowers/scratch/` (ignored by git). Never delete with a wildcard or a command substitution in the path.
-- Commit messages: a lower-case prefix (`feat:`, `test:`, `docs:`, `fix:`) and a plain sentence.
-
----
-
-### Task 1: Carried-over text fixes in Entrance & Exit
-
-**Files:**
-- Modify: `animations/02-entrance-and-exit/split-text-reveal/index.html`, `animations/02-entrance-and-exit/split-text-reveal/README.md`
-- Modify: `animations/02-entrance-and-exit/word-by-word-reveal/index.html`, `animations/02-entrance-and-exit/word-by-word-reveal/README.md`
-- Modify: `animations/02-entrance-and-exit/letter-by-letter-stagger/README.md`
-
-**Interfaces:**
-- Produces: the word-keeping pattern (letters of one word inside one `span` that cannot break) that Tasks 4–10 reuse for any text they split into letters.
-
-Today the words in Split Text Reveal (Words mode) and Word-by-Word Reveal are separated by a space *and* a `margin-right:0.28em`, so the gaps look loose; in Split Text's Letters mode every letter is its own inline block, so a line can break in the middle of a word; and the Letter-by-Letter README shows a raw non-breaking space where the page's source has the escape `'\u00a0'`.
-
-- [ ] **Step 1: Split Text Reveal — one space between words, words kept whole**
-
-In the `<style>` of `split-text-reveal/index.html`, replace these three lines:
-
-```css
- /* word spacing */
- [data-mode="words"] .unit{margin-right:0.28em}
- [data-mode="chars"] .unit{margin-right:0.01em}
-```
-
-with:
-
-```css
- /* Letters mode: the letters of one word sit in one box that never breaks, so lines break only between words */
- .unit-word{display:inline-block;white-space:nowrap}
- [data-mode="chars"] .unit{margin-right:0.01em}
-```
-
-In `split()`, replace the Letters branch:
-
-```js
- if(mode==='chars'){
- let unitIdx=0;
- [...text].forEach(c=>{
- if(c===' '){target.appendChild(document.createTextNode(' '));return;}
- const s=document.createElement('span');s.className='unit';s.style.setProperty('--i',unitIdx++);
- s.textContent=c;target.appendChild(s);
- });
- } else {
-```
-
-with:
-
-```js
- if(mode==='chars'){
- let unitIdx=0;
- text.split(/\s+/).filter(Boolean).forEach((word,wi,all)=>{
- const w=document.createElement('span');w.className='unit-word';
- [...word].forEach(c=>{
- const s=document.createElement('span');s.className='unit';s.style.setProperty('--i',unitIdx++);
- s.textContent=c;w.appendChild(s);
- });
- target.appendChild(w);
- if(wi<all.length-1)target.appendChild(document.createTextNode(' '));
- });
- } else {
-```
-
-The letters keep their order and their `--i` values (spaces never had one), so the timing is unchanged.
-
-In `split-text-reveal/README.md`, replace the How it works snippet that starts with `[...text].forEach(c => {` (the eight lines of that fenced block) with the same logic in the README's spacing:
-
-```js
-text.split(/\s+/).filter(Boolean).forEach((word, wi, all) => {
- const w = document.createElement('span');
- w.className = 'unit-word'; // keeps the word's letters on one line
- [...word].forEach(c => {
- const s = document.createElement('span');
- s.className = 'unit';
- s.style.setProperty('--i', unitIdx++); // drives its transition-delay
- s.textContent = c;
- w.appendChild(s);
- });
- target.appendChild(w);
- if (wi < all.length - 1) target.appendChild(document.createTextNode(' '));
-});
-```
-
-- [ ] **Step 2: Word-by-Word Reveal — one space between words**
-
-In `word-by-word-reveal/index.html`, change `.word{display:inline-block;margin-right:0.28em;` to `.word{display:inline-block;` (the rest of the rule stays). In `word-by-word-reveal/README.md`, make the same change in the How it works snippet (line 28: `.word{display:inline-block;margin-right:0.28em;opacity:0;` becomes `.word{display:inline-block;opacity:0;`).
-
-- [ ] **Step 3: Letter-by-Letter README escape**
-
-In `letter-by-letter-stagger/README.md` line 20, the character between the quotes after `c===' '?` is a raw non-breaking space (bytes `C2 A0`). Replace the quoted raw character with the six characters `\u00a0` so the line reads exactly as in the page's source:
-
-```js
- s.textContent=c===' '?'\u00a0':c; // a lone plain space would collapse inside its inline-block
-```
-
-Confirm with `LC_ALL=C grep -c $'\xc2\xa0' animations/02-entrance-and-exit/letter-by-letter-stagger/README.md` (prints `0`).
-
-- [ ] **Step 4: Check**
-
-Run `node --test "tests/*.test.js"` (all pass) and `node tools/check-pages.mjs animations/02-entrance-and-exit/split-text-reveal animations/02-entrance-and-exit/word-by-word-reveal` (ten `ok` lines; start the static server first if needed). Then, with a throwaway script in `.superpowers/scratch/` that drives headless Chrome over the DevTools protocol the way `tools/check-pages.mjs` does, open Split Text Reveal at 320×800, choose Letters in "Split into", type `Motion design makes interfaces easier to understand` into "Your text", wait for the reveal to finish, and confirm: every `.unit-word` sits on one line (its `getClientRects().length` is 1 and all its letters share one `top`), and the gap between the last letter of one word and the first letter of the next equals the width of a space in the stage font (measure a `' '` in a hidden span with the same font; within 1px). Do the same gap check on Word-by-Word Reveal between two `.word` spans. Report the measured numbers.
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add animations/02-entrance-and-exit/split-text-reveal/index.html animations/02-entrance-and-exit/split-text-reveal/README.md animations/02-entrance-and-exit/word-by-word-reveal/index.html animations/02-entrance-and-exit/word-by-word-reveal/README.md animations/02-entrance-and-exit/letter-by-letter-stagger/README.md
-git commit -m "fix: keep words whole and spaces even on the Entrance & Exit text pages"
-```
-
----
-
-### Task 2: Loop pages in the shared template, the page checks and the browser tool
-
-**Files:**
-- Modify: `assets/js/demo-page.js`, `assets/css/demo-page.css`
-- Modify: `tests/demo-page.test.js`, `tests/pages.test.js`, `tools/check-pages.mjs`
-- Modify: the thirteen `animations/02-entrance-and-exit/*/index.html` (`?v=2` becomes `?v=3` on both shared-file links)
-- Scratch only (not committed): `.superpowers/scratch/loop-css/` and `.superpowers/scratch/loop-page/`
-
-**Interfaces:**
-- Produces, for Tasks 4–10:
- - The Pause button (markup in Global Constraints). With `data-hb-pause="css"` the shared script pauses the stage's CSS animations itself, by putting the class `hb-paused` on the `.stage` (the stylesheet then holds every CSS animation on the stage and its `::before`/`::after`, overriding the page's own `animation-play-state` only while paused). With `data-hb-pause` without a value, the page pauses its own loop.
- - The event `hb:pause` on `document`, with `event.detail.paused` (`true` or `false`), sent every time the Pause button changes state, in both modes, including when the shared script pauses a loop on arrival under reduced motion. A page whose script runs timers or animation frames listens for it and stops or restarts them; a step already under way may finish. (Superseded for page loops by the owner decision "Pause stops at once": the page freezes its transitions and its one pending timer; see the content sheet preamble.)
- - The Slow motion switch as on Rotate In, with `data-hb-slowmo="css"` when the shared script should slow the stage: while it is on, every CSS animation and transition on the stage runs at a third of its speed (`playbackRate` 1/3, including animations that start later); turning it off restores speed 1. Without a value, the page slows its own timings. A page with both CSS animations and its own timers may use `css` for the animations and also scale its own timers while `slow.checked` is true.
- - Loops start paused under reduced motion (the shared script does it and sends `hb:pause`); a page's own reduced-motion CSS may simplify the looping movement but must not remove or pause it, or Play would do nothing.
- - The reduced-motion note in the player bar: "It starts paused and Slow motion is off because your device is set to reduce motion." (loop with Slow motion), "It starts paused because your device is set to reduce motion." (loop without it); plays-once pages keep "Loop and Slow motion are off because your device is set to reduce motion." On wide screens the note now sits beside the controls instead of on a line of its own.
- - The page checks: a loop page has exactly one Pause button, in the player bar, starting in the playing state, and no Replay, Loop or autoplay; every guided-steps page links the same version of the shared files.
- - The browser tool: on loop pages, the desktop run checks that the stage moves, that Pause stops it (within 300ms — superseded from 1.5 s by the owner decision "Pause stops at once"), that Play starts it again and, with `data-hb-slowmo="css"`, that Slow motion slows every animation on the stage and turning it off restores the speed; the phone run with reduced motion checks that the loop starts paused, stays still and moves after Play.
-
-- [ ] **Step 1: Write the failing unit test**
-
-In `tests/demo-page.test.js`, add at the end:
-
-```js
-test('motionNote says what reduced motion changes in the player bar', () => {
- assert.equal(DP.motionNote({ loop: true, slow: true }), 'Loop and Slow motion are off because your device is set to reduce motion.');
- assert.equal(DP.motionNote({ loop: true }), 'Loop is off because your device is set to reduce motion.');
- assert.equal(DP.motionNote({ slow: true }), 'Slow motion is off because your device is set to reduce motion.');
- assert.equal(DP.motionNote({ pause: true, slow: true }), 'It starts paused and Slow motion is off because your device is set to reduce motion.');
- assert.equal(DP.motionNote({ pause: true }), 'It starts paused because your device is set to reduce motion.');
- assert.equal(DP.motionNote({}), '');
-});
-```
-
-- [ ] **Step 2: Run it to see it fail**
-
-Run: `node --test "tests/*.test.js"`
-Expected: this one test fails with `TypeError: DP.motionNote is not a function`; everything else passes.
-
-- [ ] **Step 3: Add the helper, Pause, CSS slow motion and the new note to `assets/js/demo-page.js`**
-
-1. Replace the file's opening comment (lines 1–5) with:
-
-```js
-/* Animation Handbook — shared behaviour for the guided-steps demo pages.
- * Fills in "Your settings", Copy prompt, the README's "What it is" and "Similar
- * animations", plays the demo on arrival, replays it when a setting changes, runs
- * Pause and CSS slow motion on loop pages, and follows reduced motion (Loop and
- * Slow motion greyed out, loops start paused).
- * The pure helpers are exported for tests/demo-page.test.js. */
-```
-
-2. After the `quoteText` function, add:
-
-```js
- // The reduced-motion note for the player bar, from what the bar holds ({ loop, slow, pause } as booleans);
- // '' when reduced motion changes nothing there.
- function motionNote(has) {
- var off = [has.loop && 'Loop', has.slow && 'Slow motion'].filter(Boolean);
- var parts = [];
- if (has.pause) parts.push('It starts paused');
- if (off.length) parts.push(off.join(' and ') + (off.length > 1 ? ' are' : ' is') + ' off');
- return parts.length ? parts.join(' and ') + ' because your device is set to reduce motion.' : '';
- }
-```
-
-and add `motionNote: motionNote` to the object the factory returns (after `quoteText: quoteText`).
-
-3. In `boot`, directly after `var slowCtl = page.querySelector('[data-hb-slowmo]');`, add:
-
-```js
- var pauseCtl = page.querySelector('[data-hb-pause]');
- var stage = page.querySelector('.stage');
- var player = page.querySelector('.hb-player');
-```
-
-4. Replace the whole reduced-motion block — from the comment `// While the device asks for reduced motion, Loop and Slow motion are switched off and cannot be switched` down to the closing `}` of `followReducedMotion` — with:
-
-```js
- // Loops: Pause stops the demo and Play starts it again. With data-hb-pause="css" a class on the stage holds its
- // CSS animations; the "hb:pause" event goes out either way, so a page that runs its own timers can stop them.
- var paused = false;
- function setPaused(next) {
- paused = next;
- pauseCtl.setAttribute('data-state', paused ? 'paused' : 'playing');
- var label = pauseCtl.querySelector('.hb-pause-label');
- if (label) label.textContent = paused ? 'Play' : 'Pause';
- if (stage && pauseCtl.getAttribute('data-hb-pause') === 'css') stage.classList.toggle('hb-paused', paused);
- doc.dispatchEvent(new win.CustomEvent('hb:pause', { detail: { paused: paused } }));
- }
-
- // Slow motion with data-hb-slowmo="css": while it is on, every CSS animation and transition on the stage runs at a
- // third of its speed, including ones that start later. Without the value, the page slows its own timings.
- var slowing = false;
- function slowStage() {
- var rate = slowCtl.checked ? 1 / 3 : 1;
- stage.getAnimations({ subtree: true }).forEach(function (a) { if (a.playbackRate !== rate) a.playbackRate = rate; });
- slowing = slowCtl.checked;
- if (slowing) win.requestAnimationFrame(slowStage);
- }
-
- // While the device asks for reduced motion, Loop and Slow motion are switched off and cannot be switched on, a
- // loop starts paused, and a note in the player bar says why. Replay and Play still work.
- var playerSwitches = [loopCtl, slowCtl].filter(Boolean);
- var noteEl = null;
- function followReducedMotion() {
- var reduced = !!(reduce && reduce.matches);
- playerSwitches.forEach(function (sw) {
- if (reduced) sw.checked = false;
- sw.disabled = reduced;
- var label = sw.closest('label.hb-toggle');
- if (label) label.classList.toggle('is-disabled', reduced);
- });
- if (reduced && pauseCtl && !paused) setPaused(true);
- var note = reduced ? motionNote({ loop: !!loopCtl, slow: !!slowCtl, pause: !!pauseCtl }) : '';
- if (note && !noteEl && player) {
- noteEl = doc.createElement('p');
- noteEl.className = 'hb-player-note';
- noteEl.textContent = note;
- player.appendChild(noteEl);
- } else if (!note && noteEl) {
- noteEl.parentNode.removeChild(noteEl);
- noteEl = null;
- }
- }
-```
-
-(The note used to be inserted after the last switch; on every existing page that is the end of the player bar, so appending gives the same place.)
-
-5. In the setup lines at the end of `boot`, directly after `if (slowCtl) slowCtl.addEventListener('change', replay);`, add:
-
-```js
- if (pauseCtl) pauseCtl.addEventListener('click', function () { setPaused(!paused); });
- if (slowCtl && stage && stage.getAnimations && slowCtl.getAttribute('data-hb-slowmo') === 'css') {
- slowCtl.addEventListener('change', function () { if (!slowing) slowStage(); });
- }
-```
-
-(`followReducedMotion()` and its two listener lines stay where they are, after these.)
-
-- [ ] **Step 4: Run the tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: all pass, including `motionNote says what reduced motion changes in the player bar`.
-
-- [ ] **Step 5: Add the styles to `assets/css/demo-page.css`**
-
-1. Replace this line:
-
-```css
-.hb-player-note{flex-basis:100%;margin:0;font:400 13px/1.4 var(--hb-font);color:var(--hb-muted)}
-```
-
-with:
-
-```css
-/* The note sits beside the controls when there is room, so it does not push the page down */
-.hb-player-note{flex:1 1 240px;margin:0;font:400 13px/1.4 var(--hb-font);color:var(--hb-muted)}
-/* Pause on loop pages: a pause icon while the demo moves, a play icon while it is paused */
-[data-hb-pause] .hb-i-play,[data-hb-pause][data-state="paused"] .hb-i-pause{display:none}
-[data-hb-pause][data-state="paused"] .hb-i-play{display:inline}
-/* data-hb-pause="css": the shared script puts hb-paused on the stage, which holds every CSS animation on it */
-.hb-page .stage.hb-paused,.hb-page .stage.hb-paused::before,.hb-page .stage.hb-paused::after,
-.hb-page .stage.hb-paused *,.hb-page .stage.hb-paused *::before,.hb-page .stage.hb-paused *::after{animation-play-state:paused!important}
-```
-
-2. In the `@media(max-width:600px)` block, replace:
-
-```css
- /* Three controls do not fit on one line at phone widths: Replay takes the first row, the two switches share the
- second, and the reduced-motion note gets a row of its own */
- .hb-player{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
- .hb-play,.hb-player-note{grid-column:1/-1}
-```
-
-with:
-
-```css
- /* Three controls do not fit on one line at phone widths: Replay takes the first row, the two switches share the
- second, and the reduced-motion note gets a row of its own. On a loop page Pause and Slow motion share one row. */
- .hb-player{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
- .hb-play,.hb-player-note{grid-column:1/-1}
- .hb-player:has(> [data-hb-pause] + .hb-toggle) > .hb-play{grid-column:auto}
-```
-
-- [ ] **Step 6: Page checks for loop pages and for the shared-file version**
-
-In `tests/pages.test.js`, directly after this block:
-
-```js
- if (kind === 'once') {
- assert.equal(count(html, 'data-hb-replay'), 1, 'one Replay control');
- assert.ok(player.includes('data-hb-replay'), 'Replay is in the player bar');
- }
-```
-
-add:
-
-```js
- if (kind === 'loop') {
- assert.equal(count(html, 'data-hb-pause'), 1, 'one Pause control');
- assert.match(player, /<button class="hb-play" type="button" id="btn-pause" data-hb-pause(?:="css")? data-state="playing">/,
- 'Pause is in the player bar and starts in the playing state');
- assert.equal(count(html, 'data-hb-replay') + count(html, 'data-hb-loop') + count(html, 'data-hb-autoplay'), 0,
- 'a loop has no Replay, Loop or autoplay');
- }
-```
-
-and after the closing `}` of the `for (const d of steps)` loop (before the home page font test), add:
-
-```js
-test('every guided-steps page links the same version of the shared files', () => {
- const versions = new Set(steps.flatMap(d => [...pageOf(d).matchAll(/demo-page\.(?:css|js)\?v=(\d+)/g)].map(m => m[1])));
- assert.equal(versions.size, 1, `versions in use: ${[...versions].join(', ')}`);
-});
-```
-
-- [ ] **Step 7: Bump the shared-file version**
-
-On the thirteen Entrance & Exit pages change `demo-page.css?v=2` to `demo-page.css?v=3` and `demo-page.js?v=2` to `demo-page.js?v=3` (for example `sed -i 's/demo-page\.css?v=2/demo-page.css?v=3/; s/demo-page\.js?v=2/demo-page.js?v=3/' animations/02-entrance-and-exit/*/index.html`, then `git diff --stat` shows 13 files, 2 lines each).
-
-Run: `node --test "tests/*.test.js"` — all pass.
-
-- [ ] **Step 8: Teach the browser tool about loops**
-
-In `tools/check-pages.mjs`:
-
-1. In the header comment, replace the two lines `// label or value). On plays-once pages the desktop run also checks that Replay and a setting change visibly move` and `// the stage. Exit code 1 on any problem.` with:
-
-```js
-// label or value). On plays-once pages the desktop run also checks that Replay and a setting change visibly move
-// the stage; on loop pages it checks that the stage moves, that Pause stops it and Play starts it again, and the
-// reduced-motion run checks that the loop starts paused. Exit code 1 on any problem.
-```
-
-2. Directly after the `movementProblems` function, add:
-
-```js
-// True when the stage shows something different from its first capture within ms milliseconds.
-async function stageChanges(ms) {
- const first = await stageShot();
- for (const end = Date.now() + ms; Date.now() < end;) {
- await sleep(200);
- if (await stageShot() !== first) return true;
- }
- return false;
-}
-
-// Loop pages: the stage keeps changing, holds still after Pause (a step already under way may finish first) and moves
-// again after Play. Under reduced motion the loop starts paused and Play still starts it. With data-hb-slowmo="css",
-// Slow motion must slow every animation on the stage and turning it off must restore the speed.
-async function loopProblems(reduced) {
- if (!(await evaluate(`!!document.querySelector('[data-hb-pause]')`))) return ['no Pause button to check'];
- const state = () => evaluate(`document.querySelector('[data-hb-pause]').getAttribute('data-state')`);
- const press = () => evaluate(`document.querySelector('[data-hb-pause]').click()`);
- const problems = [];
- if (reduced) {
- if (await state() !== 'paused') problems.push('the loop does not start paused under reduced motion');
- else if (await stageChanges(1500)) problems.push('the stage moves while paused under reduced motion');
- await press();
- if (!(await stageChanges(4000))) problems.push('Play does not start the loop under reduced motion');
- return problems;
- }
- if (!(await stageChanges(4000))) return ['the loop is not moving'];
- await press();
- await sleep(1500);
- if (await stageChanges(1500)) problems.push('Pause does not stop the stage');
- await press();
- if (!(await stageChanges(4000))) problems.push('Play does not start the stage again');
- if (await evaluate(`!!document.querySelector('[data-hb-slowmo="css"]')`)) {
- const rates = () => evaluate(`document.querySelector('.hb-page .stage').getAnimations({ subtree: true }).map(a => a.playbackRate)`);
- const toggle = () => evaluate(`document.querySelector('[data-hb-slowmo]').click()`);
- await toggle();
- await sleep(200);
- const slow = await rates();
- if (!slow.length || slow.some(r => r >= 1)) problems.push('Slow motion does not slow the stage');
- await toggle();
- await sleep(200);
- if ((await rates()).some(r => r !== 1)) problems.push('turning Slow motion off does not restore the speed');
- }
- return problems;
-}
-```
-
-3. Directly after the line `if (setup.moves && !setup.reduce && result.kind === 'once') problems.push(...await movementProblems());`, add:
-
-```js
- if (result.kind === 'loop' && (setup.moves || setup.reduce)) problems.push(...await loopProblems(!!setup.reduce));
-```
-
-- [ ] **Step 9: Prove it on two scratch loop pages**
-
-Make two folders, `.superpowers/scratch/loop-css/` and `.superpowers/scratch/loop-page/` (three levels below the repo root, like a demo page, so the `../../../assets/…` links work). Copy `animations/02-entrance-and-exit/fade-in-out/index.html` and its `README.md` into each, then edit each `index.html`:
-
-- body: `<body class="hb" data-hb-kind="loop">`;
-- Watch it help line: "It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement.";
-- the stage holds only `<div class="dot"></div>`, and the demo's `<style>` gets `.stage{display:flex;align-items:center;justify-content:center}` and `.dot{width:40px;height:40px;border-radius:50%;background:var(--ui-accent)}`;
-- the player bar holds the Pause button from Global Constraints and the Slow motion switch as on Rotate In;
-- the page's own `<script>` is replaced.
-
-In **loop-css**: `data-hb-pause="css"` and `data-hb-slowmo="css"`; the style adds `@keyframes hb-test-slide{from{transform:translateX(-120px)}to{transform:translateX(120px)}}` and `.dot{animation:hb-test-slide 1.2s ease-in-out infinite alternate}`; the script is empty.
-
-In **loop-page**: `data-hb-pause` and `data-hb-slowmo` without values; the script is:
-
-```html
-<script>
-(()=>{
- const dot=document.querySelector('.dot'), slow=document.querySelector('[data-hb-slowmo]');
- let x=0, dir=1, timer=0;
- function step(){ x+=dir*20; if(Math.abs(x)>=120) dir=-dir; dot.style.transform=`translateX(${x}px)`; timer=setTimeout(step, slow.checked?900:300); }
- document.addEventListener('hb:pause', e=>{ clearTimeout(timer); if(!e.detail.paused) step(); });
- step();
-})();
-</script>
-```
-
-Run: `node tools/check-pages.mjs .superpowers/scratch/loop-css .superpowers/scratch/loop-page`
-Expected: ten `ok` lines. If a problem shows, fix the shared code (not the scratch page) unless the scratch page does not follow this step. Leave the scratch folders in place (they are ignored by git).
-
-- [ ] **Step 10: Run everything and commit**
-
-Run: `node --test "tests/*.test.js"` — all pass. Run: `node tools/check-pages.mjs animations/02-entrance-and-exit` — 65 `ok` lines (nothing changes for plays-once pages except the note's place on wide screens). Then:
-
-```bash
-git add assets/js/demo-page.js assets/css/demo-page.css tests/demo-page.test.js tests/pages.test.js tools/check-pages.mjs animations/02-entrance-and-exit/*/index.html
-git commit -m "feat: support looping demos with Pause and CSS slow motion"
-```
-
----
-
-### Task 3: The content sheet for Text & Typography
-
-**Files:**
-- Create: `docs/superpowers/plans/2026-09-28-text-typography-content.md`
-
-**Interfaces:**
-- Consumes: each page's current `index.html` and `README.md`; the Entrance & Exit content sheet (`docs/superpowers/plans/2026-09-27-entrance-exit-content.md`) and the live Entrance & Exit pages as the model for tone and decisions; the loop-page interfaces from Task 2; "How to convert a page" below.
-- Produces: one section per page that Tasks 4–10 follow exactly.
-
-This task decides words and settings; it writes no code. Read each page's current `index.html` (controls, ranges, defaults and the whole script) and `README.md` before writing its section.
-
-- [ ] **Step 1: Write one section per page, in this format**
-
-```markdown
-## <slug> — <Title>
-
-- **Kind:** once | loop — <why, in one line>
-- **Description:** <one sentence, at most 80 characters, plain words; the lede, the meta descriptions and the home card>
-- **Watch it help line:** default | <custom line, when the default for the kind does not fit>
-- **Player bar:** once: Replay · Loop · Slow motion (say which, and why any is left out) | loop: Pause (css | page) · Slow motion (css | page | none — and why)
-- **Sequence:** once: what one cycle does ("plays in, holds 900ms, plays out, waits 500ms") | loop: what runs, and for "page" which timers or animation frames stop on `hb:pause` and how they start again
-- **Slow motion:** once, or loop with "page": which durations and timers are multiplied by 3 | "css"
-- **Stage font:** site font | typewriter font (only for an effect about typing; say why)
-- **Stage:** what stays on the stage; readouts, captions and notes removed; `hb-dots` yes/no; `hb-grow` when typed text must fit; a height variable if needed
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-
-- **Removed:** <old controls that go away and why (Restart, Apply, Auto-loop, speed sliders reaching zero, readouts, notes)>
-- **Good for:** <3–5 tags> · **Avoid on:** <1–3 tags>
-- **Prompt:** <the prompt, 60–130 words, ending "Match the settings listed below.">
-- **README What it is:** keep | <rewritten in plain words, no code>
-- **README Key parameters:** <one row per setting: Parameter | Default | Effect, names exactly as on the page>
-- **README See also:** <each link, its text equal to the target page's `<h1>`, with one plain phrase after " — ">
-- **README How it works:** <what must change so the snippets match the new code, or "unchanged">
-- **Pager:** Previous and Next, as the page links today
-```
-
-Rules for the content:
-
-- **Settings** follow Global Constraints and the Entrance & Exit sheet's rules: Duration and speed numbers become Speed (Slow · Normal · Fast, keeping the old default as Normal and roughly 1.6× and 0.6× of it for Slow and Fast), easing becomes Feel with plain names, distances, sizes and delays become three or four named steps; keep a slider only when sliding through values is the point (say why) and give it a plain value; colour pickers become named swatches; text inputs become "Your text" (a textarea stays a textarea when each line or word is a separate item, labelled for what it holds, e.g. "Your words, one per line"). Choose the one to three settings that change the effect most as the main ones.
-- **Sets in the demo:** say exactly which variable, class or code value each choice sets (for example "--dur 1000ms / 600ms / 350ms"), so the implementer does not have to guess.
-- **Every choice must be something the demo can already do;** do not invent behaviour, and do not drop a setting that changes the technique itself (move it to More options). A speed setting never reaches zero: Pause does that now.
-- **Kinds:** a demo that cycles forever with no natural end is a loop; a demo that plays through and stops is plays once. Every page in this category is one of the two (there are no do-it pages yet: "Show me" arrives with 3D & Advanced). A loop may use "css" for Pause only if its looping movement is CSS animations (`@keyframes`) on the stage; a loop driven by timers or animation frames uses "page", even when CSS transitions draw each step. A page with both may use "css" and also stop its own timers on `hb:pause` (say so under Sequence).
-- **Reduced motion:** for a loop, say what its reduced-motion CSS keeps (it may simplify the movement but not remove or pause it; the shared script starts the loop paused). For plays once, as on the Entrance & Exit pages.
-- **Variable Font Morph:** it names the `Recursive` font, which the page never loads, so its Casual axis only works where that font is installed. The site font (Schibsted Grotesk) is variable in weight from 400 to 900 and is loaded on every page: the demo morphs its weight, and a slant can stay only as the skew the page already applies. Say in the README's Production notes that a font with more axes (Recursive, for example) adds more to morph.
-- **Tags:** short nouns, like Rotate In's ("Icons", "Badges and stars"; "Text", "Wide boxes and cards").
-- **Prompts:** say what the viewer sees and the one or two rules that make it look right; keep the reduced-motion sentence; never state as fixed what a setting controls.
-
-The pages, in order: enter-exit-typography, kinetic-typography, outline-to-fill, scramble-text, text-clip-path-reveal, typewriter-effect, glitch-text, marquee-ticker, rotate-word-carousel, text-morphing, text-gradient-animation, text-on-path, variable-font-morph, wavy-text.
-
-- [ ] **Step 2: Check the sheet**
-
-For each section: one to three main settings; every setting has a hint of at most 60 characters; every choice has its "Sets in the demo" value; the prompt is 60–130 words and ends with "Match the settings listed below."; the Key parameters names equal the Setting names; every See also link text equals its target's `<h1>` (read the target page); a loop with "css" Pause has only `@keyframes` animations looping on its stage.
-
-- [ ] **Step 3: Commit**
-
-```bash
-git add docs/superpowers/plans/2026-09-28-text-typography-content.md
-git commit -m "docs: content sheet for the Text & Typography rollout"
-```
-
----
-
-### How to convert a page (Tasks 4–10)
-
-Each of Tasks 4–10 converts two pages. For each page, follow its section of the content sheet (`docs/superpowers/plans/2026-09-28-text-typography-content.md`) exactly, and use the live Entrance & Exit pages as the reference for every part of the page that is not the demo itself: `rotate-in` for plays-once pages; for text pieces and typed text, `split-text-reveal` and `letter-by-letter-stagger`.
-
-1. **Read** the page's current `index.html` and `README.md`, its content-sheet section, and `animations/02-entrance-and-exit/rotate-in/index.html`.
-2. **Head:** keep the title, canonical link, icons and Open Graph and Twitter tags; set every description (meta, `og:description`, `twitter:description`, JSON-LD `description`) to the sheet's Description. Link `<link rel="stylesheet" href="../../../assets/css/demo-page.css?v=3">` and `<script src="../../../assets/js/demo-page.js?v=3" defer></script>` after the page's own `<style>`, exactly as on Rotate In.
-3. **The demo's `<style>`:** keep `:root` (with `--ui-accent:#ff6f8b`), the reset line and every rule the stage content needs. Delete the `@font-face` lines, the old layout and control rules (`body` padding, `header`, `.layout`, `aside`, `.note`, `.lbl`, `.kv`, `.div`, `.sr`, `.sv`, `select`, `input[type=text]`, `textarea`, `.seg`, `.tog`, `.btn-row`, `button.rst`, `button.act`, `.preset-btn`, the `.ah-bar` styles, the old mobile block) and rules for removed readouts. Remove `font-family` from stage text so it uses the site font (a typewriter font only where the sheet says so, with the stack from Global Constraints). The stage's height comes from the shared stylesheet: remove `--stage-h` and fixed stage heights; set `--hb-stage-h` or `--hb-stage-h-phone` only if the sheet says so; add `hb-grow` where the sheet says so. Keep the demo's reduced-motion rule; on a loop page it may simplify the movement but must not remove or pause it.
-4. **Body:** `<body class="hb" data-hb-kind="once" data-hb-autoplay>` or `<body class="hb" data-hb-kind="loop">` as the sheet's Kind says, then Rotate In's structure:
- - Top bar: the home link as on Rotate In, and the pager with the sheet's Previous and Next links, in the Entrance & Exit markup: a Previous link is `<a href="../<prev>/" rel="prev" aria-label="Previous: <Name>"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span><Name></span></a>`; a Next link is `<a href="../<next>/" rel="next" aria-label="Next: <Name>"><span><span class="hb-dir">Next: </span><Name></span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a>`. Delete the old injected `.ah-bar` markup and its script.
- - Header: the category line (`05.NN · Text &amp; Typography`, NN as the page has it today), the title, and the Description as the lede.
- - Step 1: "Watch it" with the help line for the kind (or the sheet's), the `.stage` holding only the demo's animated content, then the player bar: plays once — Rotate In's; loop — the Pause button from Global Constraints (`data-hb-pause="css"` or without a value, as the sheet says), followed by Rotate In's Slow motion switch (`data-hb-slowmo="css"` or without a value) when the sheet has Slow motion. Every switch unchecked, with `autocomplete="off"`.
- - Step 2: "Try it" with the help line for the kind, the main settings in `div.hb-settings`, the rest in `details.hb-options` exactly as on Rotate In, each control in the markup table of the rollout spec, with its hint and `autocomplete="off"` on every input, select and textarea.
- - Step 3: the prompt card exactly as on Rotate In, with the sheet's prompt.
- - About (What it is with the README link as fallback; Good for and Avoid on tags), Similar animations and the footer exactly as on Rotate In.
-5. **Script:** rewrite the page's script so that:
- - **plays once:** the Replay button (`id="btn-play"`, `data-hb-replay`) plays from the start and keeps looping when Loop is on; switching Loop off lets the current cycle finish with the text shown (Rotate In's `cycle()`/`play()` pattern); Slow motion multiplies the sheet's durations and the timers that wait for them by 3 (not the pauses), taking effect on the next play; every play restarts the animated pieces themselves (rebuild or reset them hidden, `void el.offsetWidth`, then show them). The shared script replays after every setting change and turns Loop on at arrival; the page's script must not do either itself.
- - **loop, Pause "css":** the looping CSS animations run from page load with no Replay, Loop or autoplay code. If the page also has timers (for example random glitches), it stops them on `document`'s `hb:pause` event when `e.detail.paused` is true and starts them again when it is false.
- - **loop, Pause "page":** the page starts its loop at load and listens for `hb:pause`: paused → freeze at once (cancel its animation frame, or stop its one pending timer keeping the time it had left and pause the stage's running transitions — the owner's decision "Pause stops at once"; the content sheet's preamble has the helper); not paused → carry on from exactly where it stopped. With Slow motion "page", the durations of movements and the timers that wait for a movement to finish are multiplied by 3 while the switch is on; holds between movements keep their length, as on plays-once pages. A `change` on the switch takes effect from the next step at the latest.
- - **every loop:** changing a setting while paused shows the new setting without starting the loop again (for "css" pages the shared class already holds new animations). Register the `hb:pause` listener at the top level of the page's inline script: the shared script runs after it and may pause the loop on arrival, so a listener added later (for example in a `DOMContentLoaded` handler) would miss that.
- - **every page:** the page's script reaches the player controls by their ids (`btn-play`, `loop-tog`, `slow-tog`, `btn-pause`), never by their `data-hb-*` attributes: the page checks count those attribute names anywhere in the file.
- - every setting sets what its "Sets in the demo" column says; choice buttons toggle `.on` and `aria-pressed` (Rotate In's `choices()` helper); sliders update their `output.hb-value` with the plain value; swatches toggle `aria-pressed`; typed text is added with `textContent` or `createTextNode`, never as HTML, and text split into letters keeps each word's letters in one `span` that cannot break (Task 1's `.unit-word` pattern, with one normal space between words);
- - nothing remains of the old controls, readouts, Restart or Apply buttons, or `data-hb-reset`/`data-hb-skip` markers.
-6. **README:** What it is as the sheet says (no code); replace the Key parameters table with the sheet's rows; bring How it works in line with the new code; See also lines as in the sheet. Leave When to use it and Production notes as they are unless they name a removed control or the sheet says otherwise.
-7. **Home page:** in `index.html`, set the page's card description (the third string of its `['<slug>','<Title>','…']` entry) to the Description, escaping any `'` as `\'`.
-8. **Check:** run `node --test "tests/*.test.js"` (all pass) and `node tools/check-pages.mjs animations/05-text-typography/<slug>` (five `ok` lines: it tests Replay and a setting change on plays-once pages, and moving, Pause, Play, CSS slow motion and the reduced-motion start on loops). Open the page's desktop and phone screenshots with the Read tool and compare them with Rotate In's: same structure, the animation visible on the stage, nothing overlapping or cut off.
-9. **Commit** each page on its own: `feat: move <Title> to the guided-steps page`.
-
-### Task 4: Enter/Exit Typography and Kinetic Typography
-
-**Files:** `animations/05-text-typography/enter-exit-typography/{index.html,README.md}`, `animations/05-text-typography/kinetic-typography/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-- [ ] **Step 1:** Convert `enter-exit-typography` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `kinetic-typography` the same way; run the checks; commit.
-
-### Task 5: Outline to Fill and Scramble Text
-
-**Files:** `animations/05-text-typography/outline-to-fill/{index.html,README.md}`, `animations/05-text-typography/scramble-text/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-Outline to Fill shows two ways of filling side by side; keep both in the one stage.
-
-- [ ] **Step 1:** Convert `outline-to-fill` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `scramble-text` the same way; run the checks; commit.
-
-### Task 6: Text Clip-Path Reveal and Typewriter Effect
-
-**Files:** `animations/05-text-typography/text-clip-path-reveal/{index.html,README.md}`, `animations/05-text-typography/typewriter-effect/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-Both take typed text that can run to several lines: use `hb-grow` where the sheet says so.
-
-- [ ] **Step 1:** Convert `text-clip-path-reveal` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `typewriter-effect` the same way; run the checks; commit.
-
-### Task 7: Glitch Text and Marquee Ticker
-
-**Files:** `animations/05-text-typography/glitch-text/{index.html,README.md}`, `animations/05-text-typography/marquee-ticker/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-Both are loops that already use `animation-play-state` for their own hover pause; that keeps working because the shared Pause only adds a class. Marquee Ticker's reduced-motion rule pauses the rows with `!important` today; it must go (the shared script starts the loop paused, and Play must be able to start it).
-
-- [ ] **Step 1:** Convert `glitch-text` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `marquee-ticker` the same way; run the checks; commit.
-
-### Task 8: Rotate Word Carousel and Text Morphing
-
-**Files:** `animations/05-text-typography/rotate-word-carousel/{index.html,README.md}`, `animations/05-text-typography/text-morphing/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-Both loop through words forever on timers; their Restart buttons go (Pause replaces them).
-
-- [ ] **Step 1:** Convert `rotate-word-carousel` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `text-morphing` the same way; run the checks; commit.
-
-### Task 9: Text Gradient Animation and Text on Path
-
-**Files:** `animations/05-text-typography/text-gradient-animation/{index.html,README.md}`, `animations/05-text-typography/text-on-path/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-Text on Path moves its text with animation frames (a "page" loop); its speed setting must not reach zero.
-
-- [ ] **Step 1:** Convert `text-gradient-animation` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `text-on-path` the same way; run the checks; commit.
-
-### Task 10: Variable Font Morph and Wavy Text
-
-**Files:** `animations/05-text-typography/variable-font-morph/{index.html,README.md}`, `animations/05-text-typography/wavy-text/{index.html,README.md}`, `index.html` (their two card descriptions)
-
-- [ ] **Step 1:** Convert `variable-font-morph` by following "How to convert a page" and its content-sheet section; run the checks; commit.
-- [ ] **Step 2:** Convert `wavy-text` the same way; run the checks; commit.
-
-(If the sheet gives a page a different kind than its task's note suggests, follow the sheet.)
-
----
-
-### Task 11: Check both categories in a browser
-
-The controller runs this task; its screenshots go to the user.
-
-- [ ] **Step 1:** Run `node tools/check-pages.mjs animations/02-entrance-and-exit animations/05-text-typography`. Expected: 135 lines, every one `ok`.
-- [ ] **Step 2:** Open the fourteen new pages' desktop and phone screenshots. Expected: the same structure as the Entrance & Exit pages, the demo visible on the stage, settings readable, nothing overlapping.
-- [ ] **Step 3:** In the in-app browser, on two loop pages (one "css", one "page") and two plays-once pages (one with typed text), change every setting and confirm the chips follow and the demo shows the change; press Pause and Play; press Copy prompt and confirm the copied text ends with the settings line.
-- [ ] **Step 4:** Anything found goes to one fix dispatch with the complete list; the fixes are reviewed and committed like any task.
diff --git a/docs/superpowers/plans/2026-09-28-text-typography-content.md b/docs/superpowers/plans/2026-09-28-text-typography-content.md
deleted file mode 100644
index ddf7292f..00000000
--- a/docs/superpowers/plans/2026-09-28-text-typography-content.md
+++ /dev/null
@@ -1,1084 +0,0 @@
-# Text & Typography — Content Sheet
-
-This sheet decides, page by page, how the fourteen Text & Typography pages present their kind, settings, words and prompt on the guided-steps page. Tasks 4–10 of `2026-09-28-demo-page-rollout-text-typography.md` follow each section exactly, together with that plan's "How to convert a page". Rotate In (`animations/02-entrance-and-exit/rotate-in/`) is the reference for everything a section does not mention; Split Text Reveal and Letter-by-Letter Stagger are the reference for text pieces and typed text.
-
-How to read a section:
-
-- **Sets in the demo** lists one value per choice, in the same order as the choices. A Speed row sets both the script's variable (used by the timers) and the CSS variable it names.
-- **Shown only when …** in the Control column means the setting's whole `div.hb-setting` gets the `hidden` attribute while it has no effect, so it also drops out of "Your settings".
-- Switches in Try it keep their default in the markup (`checked` when the default is on), as on Rotate In. Only the player bar's Loop and Slow motion start unchecked.
-- **Plays once:** loop timings follow today's code. "Holds X" is the wait after the play's own movement ends; "waits Y" is the wait after the exit.
-- **Watch it help line: default** means the kind's line from the plan's Global Constraints. For plays-once pages that is "It plays by itself. Turn on slow motion to see each part of the movement." Every loop here has Slow motion, so for loops it is "It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement."
-- **Loops:** "Pause (css)" means `data-hb-pause="css"` and "Pause (page)" means `data-hb-pause` without a value. The same goes for Slow motion and `data-hb-slowmo`. On page loops, Slow motion stretches the movement and the timers that wait for it, but not the holds between movements, as on the plays-once pages. A change on the switch takes effect from the next step at the latest.
-- **Feel** uses the Entrance & Exit names: Smooth (slows to a stop) is `ease-out`, Gentle (eases in and out) is `ease-in-out` and Even (one steady speed) is `linear`.
-- **Swatches** all use one palette, in this order, with the colour's name as each button's `aria-label`: Pink `#ff6f8b` · White `#f4f4f2` · Blue `#58a6ff` · Purple `#d2a8ff` · Green `#56d364` · Orange `#ffa657`.
-- **Stage text** drops Georgia, Arial Narrow and italics, so it uses the site font. Phrases and sentences get `font-weight:700`, as on the Entrance & Exit text stages. Single display words get `800`, unless the section says otherwise. Small grey stage text uses `#8a8a92`, which is 5.9:1 on the stages' `#04060c`. The old `#77777e` is 4.6:1 there, but only 4.0:1 over the `hb-dots` dots.
-- **`hb-dots`** is left off where the stage has its own radial gradient, because `hb-dots` replaces the stage's background image.
-- **Category line:** the pages have none today. NN is the page's position on the home page, which its card already shows (05.01 Kinetic Typography to 05.14 Wavy Text). This is how the Entrance & Exit pages are numbered.
-- **Pause stops at once (owner decision, 2026-09-28).** On the page loops (Rotate Word Carousel, Text Morphing, Variable Font Morph), Pause freezes the loop exactly where it is, even halfway through a change, and Play continues from that point. This replaces "a step under way finishes" and the `sliding` / `morphing` "under way" flags in those sections. Each page keeps one pending timer at a time and freezes it with the time it had left, and freezes the stage's running transitions:
-
- ```js
- // Pause freezes the step under way: its transitions stop where they are and its timer keeps the time it had left.
- let timer=0, next=null, due=0, left=0, held=[], paused=false;
- function wait(fn,ms){ clearTimeout(timer); next=fn; if(paused){ left=ms; return; } due=performance.now()+ms; timer=setTimeout(()=>{ next=null; fn(); },ms); }
- function freeze(){ paused=true; clearTimeout(timer); if(next) left=Math.max(0,due-performance.now()); held=stage.getAnimations({subtree:true}).filter(a=>a.playState==='running'); held.forEach(a=>a.pause()); }
- // A transition that Pause caught at or past its end is finished, not played: play() would rewind it to the start.
- function thaw(){ paused=false; held.forEach(a=>{ if(a.playState!=='paused') return; if(a.currentTime>=a.effect.getComputedTiming().endTime) a.finish(); else a.play(); }); held=[]; if(next) wait(next,left); }
- document.addEventListener('hb:pause',e=>e.detail.paused?freeze():thaw());
- ```
-
- Every timer of the loop goes through `wait()`, so there is always exactly one chain and Play can never start a second one. A setting or typed text that restarts the loop while paused (`start()`) clears `timer` and `next`, shows the first word at rest, and schedules the next step with `wait()`, which only records it; Play then continues from there. `stage` is the page's `.hb-page .stage`.
-
----
-
-## enter-exit-typography — Enter/Exit Typography
-
-- **Kind:** once. One play shows the five phrases in turn and ends with the last one on screen; Loop repeats it.
-- **Description:** Each phrase comes in, stays long enough to read, then leaves. Best for slogans.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Sequence:** Every play starts from the first phrase. Each phrase is first reset hidden: its text is set, its phase classes are removed, `state-hidden` is added and `void phraseEl.offsetWidth` forces a reflow. Then the phrase gets its enter class. The first timer waits Entrance speed + 50ms, then the phrase holds for Time on each phrase. Then it gets its exit class, and the next phrase starts 120ms after the exit (which waits Exit speed + 50ms). The fifth phrase ("Then meaning.") stays on screen after its hold. While Loop is on, the fifth phrase exits too, the stage waits 120ms and the play starts again. Switching Loop off lets the current play finish on the fifth phrase.
-- **Slow motion:** multiplies `--enter-dur` and `--exit-dur` by 3, and the timers that wait for them become Entrance speed × 3 + 50ms and Exit speed × 3 + 50ms. Time on each phrase and the 120ms gaps stay.
-- **Reduced motion:** the demo's rule stays (`.phrase-el` gets no animation, so the phrases swap without movement). As on the Entrance & Exit pages, Replay plays the sequence once.
-- **Stage font:** site font. `.phrase-text` drops Georgia and the italic and gets `font-weight:700`.
-- **Stage:** only the phrase stays (`#phrase-el` with `#phrase-text`). The progress dots (`.prog-dots`, which show which phrase is on screen) go, and so do the Phrase and Phase readouts. `hb-dots`: yes. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Entrance speed | Choice buttons | Slow · Normal · Fast | Normal | How quickly each phrase arrives. | `enter` / `--enter-dur`: 800ms / 500ms / 300ms |
-| Time on each phrase | Choice buttons | Short · Medium · Long | Medium | How long each phrase holds still to be read. | `hold`: 1200 / 2000 / 3200 (ms) |
-| Exit speed | Choice buttons | Slow · Normal · Fast | Normal | Exits usually run a little faster than entrances. | `exit` / `--exit-dur`: 650ms / 400ms / 250ms |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The panel's Replay button and Loop checkbox. The player bar replaces them, and the shared script turns Loop on at arrival.
- - The note.
- - The Phrase and Phase readouts, and the progress dots on the stage.
- - The Enter Duration, Hold Duration and Exit Duration sliders. They become Entrance speed, Time on each phrase and Exit speed.
- - The unused `--hold-dur` variable.
-- **Good for:** Intros · Brand statements · Hero messages · Screens and signage · **Avoid on:** Long sentences · Key information
-- **Prompt:**
-
- > Add an enter-and-exit text sequence to [the short phrases you want to show]. Show one phrase at a time in the same place: each phrase comes in, holds still long enough to be read, then leaves before the next one arrives. Give each phrase its own way in and out, such as sliding, growing, blurring or wiping, and let each exit lead into the next entrance so the sequence feels connected. Leave the last phrase on screen when the sequence ends. Screen readers should hear each phrase as it appears. If the visitor has reduced motion turned on, swap the phrases without movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Enter/exit typography shows short phrases one at a time in the same place. Each phrase comes in, holds still long enough to be read, then leaves before the next one arrives. Every phrase has its own way in and out, such as sliding, growing, blurring or wiping, and the last one stays on screen when the sequence ends.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Entrance speed | Normal | How long each phrase takes to arrive: slow is 800ms, normal 500ms and fast 300ms; fast feels energetic, slow feels deliberate |
- | Time on each phrase | Medium | How long each phrase holds still: short is 1200ms, medium 2000ms and long 3200ms; it must be longer than it takes to read the phrase |
- | Exit speed | Normal | How long each phrase takes to leave: slow is 650ms, normal 400ms and fast 250ms; exits are usually shorter than entrances |
-
-- **README See also:**
- - [Kinetic Typography](../kinetic-typography/) — words that each move in their own way
- - [Rotate Word Carousel](../rotate-word-carousel/) — one word in a sentence keeps changing
- - [Text Morphing](../text-morphing/) — one word changes into the next, letter by letter
-- **README How it works:** keep the two snippets at the top. Delete the sentence "The sequences loop by resetting `idx` to 0 after the last phrase:" and the snippet under it. Put this paragraph in their place: "One play shows the phrases in order and leaves the last one on screen. While Loop is on, the last phrase exits too and the play starts again from the first."
-- **README Production notes:** unchanged
-- **Category line:** `05.10 · Text &amp; Typography`
-- **Pager:** Previous: Outline to Fill (`../outline-to-fill/`) · Next: Rotate Word Carousel (`../rotate-word-carousel/`)
-
----
-
-## kinetic-typography — Kinetic Typography
-
-- **Kind:** once. One play runs the six phrases and ends with the last one on screen; Loop repeats it.
-- **Description:** Words arrive and leave one by one, each moving its own way. Best for intros.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Sequence:** Every play starts from the first phrase, and each phrase's spans are rebuilt hidden before its enter class goes on. Each phrase:
- - enters with its own animation (the `enter` class in `PHRASES`); its sub-line starts 200ms after the word;
- - holds for its own `hold` (900 to 2200ms);
- - exits with its `exit` class, and the next phrase enters 120ms later.
-
- The step timer waits 500ms + hold, and the exit timer waits 520ms. The sixth phrase ("MEANING.") stays on screen after its hold. While Loop is on, the sixth phrase exits too, the stage waits 800ms and the play starts again. Switching Loop off lets the current play finish on the sixth phrase. Speed divides all of these times, as today's `ms()` does.
-- **Slow motion:**
- - `--spd` is set to `speed / 3`, so every entrance and exit animation lasts three times as long.
- - The timers that wait for them are multiplied by 3: the 500ms part of each step timer and the 520ms exit timer.
- - The sub-line's 200ms delay is multiplied by 3 as well.
- - The holds, the 120ms gaps and the 800ms wait stay (they are still divided by Speed).
-- **Reduced motion:** the demo's rule stays (`.kw` gets no animation, so the phrases swap without movement). Replay plays the sequence once.
-- **Stage font:** site font. `.kw` drops Georgia and gets `font-weight:800`. `.kw.sub` drops `font-family:monospace` and gets its own `font-weight:600`, the weight of the site's small spaced capitals (such as the category line). It is also a `.kw`, so without this it would take the 800. It keeps its capitals and letter spacing, and its grey becomes `#8a8a92`.
-- **Stage:** only the phrase stays (`#phrase`). The counter ("1 / 6"), the progress bar (`.beat-bar`) and the Phrase and State readouts go. `hb-dots`: yes. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Changes the pace of the whole sequence. | `speed` / `--spd`: 0.6 / 1 / 1.7 |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - Play / Restart. The player bar's Replay replaces it.
- - Loop sequence. It becomes the player bar's Loop.
- - Show progress bar, and the bar itself. It shows progress; it is not part of the effect.
- - The counter on the stage, and the Phrase and State readouts.
- - The note.
- - The Playback Speed slider. It becomes Speed.
-- **Good for:** Intros · Splash screens · Story sections · Presentations · **Avoid on:** Forms and menus · Long text
-- **Prompt:**
-
- > Add a kinetic typography sequence to [the short phrases you want to show]. Show one phrase at a time and give each an entrance and an exit that fit its meaning: a heavy word can drop in large, a soft word can simply fade, a quick word can slide. Hold each phrase long enough to be read, and use size and color so the key words stand out. Leave the final phrase on screen when the sequence ends. Screen readers should hear each phrase as plain text. If the visitor has reduced motion turned on, show the phrases without movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Kinetic typography is text in motion, where the way each word moves matches what it means. A short sequence shows one phrase at a time, and each phrase gets its own way in and out: a heavy word can drop in large, a soft word can simply fade. It comes from film titles and motion graphics, where moving words tell a story on their own.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | The pace of the whole sequence: slow plays it at 0.6× speed, normal at 1× and fast at 1.7×; entrances, holds and exits all scale together |
-
-- **README See also:**
- - [Enter/Exit Typography](../enter-exit-typography/) — each phrase comes in, holds and leaves
- - [Rotate Word Carousel](../rotate-word-carousel/) — one word in a sentence keeps changing
- - [Text Clip-Path Reveal](../text-clip-path-reveal/) — lines of text are uncovered one by one
-- **README How it works:** replace the `run` snippet with this version, which keeps the last phrase on screen unless Loop is on (`loop` stands for the Loop switch):
-
- ```js
- function run(idx = 0) {
- showPhrase(idx);
- const last = idx === PHRASES.length - 1;
- if (last && !loop) return; // the final phrase stays on screen
- setTimeout(() => {
- exitPhrase(idx, () => run((idx + 1) % PHRASES.length));
- }, ENTER_DUR + PHRASES[idx].hold);
- }
- ```
-
- The sentence "Playback speed is controlled via a CSS custom property used in every `calc()`:" becomes "The Speed setting is a CSS custom property used in every `calc()`; the timers divide by the same value:".
-- **README Production notes:** unchanged
-- **Category line:** `05.01 · Text &amp; Typography`
-- **Pager:** Previous: none · Next: Typewriter Effect (`../typewriter-effect/`)
-
----
-
-## outline-to-fill — Outline to Fill
-
-- **Kind:** once. Both words fill and stay filled; Loop repeats it.
-- **Description:** Hollow letters fill with color, as a wipe or a fade. Best for big headlines.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Sequence:** Every play starts with `reset()`: both words go back to hollow with their transitions off, and `void fillLayer.offsetWidth` forces a reflow. Then `filled` goes on the fill layer and on the fade wrapper, so both words fill at the same time over Speed. While Loop is on, one cycle is: fills, holds 1400ms, snaps back to hollow at once (`reset()`, with no reverse transition), waits 300ms, then plays again. Switching Loop off lets the words finish filled.
-- **Slow motion:** multiplies `--fill-dur` and the `dur` part of the loop timer by 3. The 1400ms hold and the 300ms wait stay.
-- **Reduced motion:** the demo's rule stays: the wipe shows filled at once and the fade swaps with no transition. Replay plays once.
-- **Stage font:** site font. `.otf-text` drops Georgia and the italic and gets `font-weight:800`, so the letters are thick enough to show the fill.
-- **Stage:** both words stay, one above the other, each with its label.
- - The labels read "Wipe" (was "Clip-path Fill") and "Fade" (was "Stroke → Fill Fade").
- - The labels' inline style moves into `.var-label`, and their grey becomes `#8a8a92`.
- - To fit the shared stage (327px tall on a 1366×657 laptop, 300px on phones), `.otf-text` becomes `font-size:clamp(44px,8vw,84px)`. The stage's `gap` and `padding` become 24px, and `fitText()` subtracts 48 instead of 64.
- - `hb-dots`: yes. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Fill direction | Choice buttons | Bottom up · Top down · Left to right · Right to left · From the middle | Bottom up | Where the wipe starts; the fade fills all at once. | `dir`: `'up'` / `'down'` / `'right'` / `'left'` / `'center'`, then `applyDir()` (the fill layer gets no class / `dir-down` / `dir-right` / `dir-left` / `dir-center`) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the letters take to fill. | `dur` / `--fill-dur`: 1500ms / 900ms / 550ms |
-| Outline thickness | Choice buttons | Thin · Medium · Thick | Medium | Thin looks precise; thick looks bold and graphic. | `--stroke-w`: 1px / 2px / 4px |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Gentle · Even | Gentle | Gentle eases in and out; Even keeps one pace. | `--fill-ease`: `ease-out` / `ease-in-out` / `linear` |
-| Outline color | Swatches | Pink · White · Blue · Purple · Green · Orange | Pink | The color of the letters' edges. | `--stroke-color`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-| Fill color | Swatches | Pink · White · Blue · Purple · Green · Orange | Pink | The color that pours into the letters. | `--fill-color`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-| Your text | Text (`input.hb-text`, keeps `maxlength="10"`) | any text up to 10 characters | OUTLINE | Short words work best, up to 10 letters. | `txtIn.value`, upper-cased, then `applyText()` on input (an empty field falls back to "OUTLINE") |
-
-- **Removed:**
- - Replay and Auto-loop. The player bar replaces them.
- - The note.
- - The Fill Duration and Stroke Width sliders. They become Speed and Outline thickness.
- - The Direction and Easing menus. They become Fill direction and Feel.
- - The Stroke and Fill colour pickers. They become the Outline color and Fill color swatches.
- - The developer wording of the two labels.
-- **Good for:** Big headlines · Logos · Posters · Section titles · **Avoid on:** Small text · Body text
-- **Prompt:**
-
- > Add an outline-to-fill effect to [your headline or logo word]. The text should start hollow, with only the outline of each letter showing, then fill with color. The fill can wipe in from one side, like paint, or fade in everywhere at once, like ink soaking through. Draw the outline and the filled text as two layers in exactly the same place so the letters never shift. Use large, heavy letters so there is enough inside each one to fill. The text must stay readable by screen readers. If the visitor has reduced motion turned on, show the filled text straight away. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Outline to fill starts text as hollow letters, with only the outline of each letter showing, then fills them with color, so the text looks as if it is being inked in. There are two ways to do it, and the demo shows both: a wipe that fills the letters from one side, like paint, and a fade that fills them everywhere at once, like ink soaking in.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Fill direction | Bottom up | Where the wipe starts: the bottom, the top, the left, the right or the middle; bottom up reads like filling a container, left to right like writing. The fade has no direction |
- | Speed | Normal | How long the fill takes: slow is 1500ms, normal 900ms and fast 550ms |
- | Outline thickness | Medium | How wide the outline is: thin is 1px, medium 2px and thick 4px; thin looks precise, thick looks bold |
- | Feel | Gentle | Gentle eases in and out; Smooth slows to a stop; Even keeps one steady pace |
- | Outline color | Pink | The color of the letters' outline |
- | Fill color | Pink | The color that fills the letters |
- | Your text | OUTLINE | The word that fills, up to 10 letters, shown in capitals |
-
-- **README See also:**
- - [Text Gradient Animation](../text-gradient-animation/) — colors flow through the letters instead
- - [Text Clip-Path Reveal](../text-clip-path-reveal/) — whole lines are uncovered the same way
- - [Clip-Path Reveal](../../02-entrance-and-exit/clip-path-reveal/) — a shape uncovers any element
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `05.09 · Text &amp; Typography`
-- **Pager:** Previous: Text Gradient Animation (`../text-gradient-animation/`) · Next: Enter/Exit Typography (`../enter-exit-typography/`)
-
----
-
-## scramble-text — Scramble / Glitch Text
-
-- **Kind:** once. The letters decode and stay decoded; Loop repeats it.
-- **Description:** Random symbols lock into the real text, left to right. Best for tech headlines.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Sequence:** Every play rebuilds the letters scrambled (today's `scramble()`, which first clears the previous play's timers and interval).
- - Letter i locks at (i + 1) × Delay between letters. Here i counts letters only; spaces no longer take a step.
- - Until a letter locks, it changes to a new random character every Flicker speed.
- - The flicker stops when the last letter locks.
-
- While Loop is on, the text holds 1200ms after the last letter locks, then the next play starts (every letter scrambles again at once). Switching Loop off lets the text finish decoded.
-- **Slow motion:** multiplies Delay between letters and Flicker speed by 3, so the lock timers and the timer that stops the flicker stretch with them. The 1200ms hold stays.
-- **Reduced motion:** as today, the play shows the final text at once, with no flicker (the demo's rule and its `reduce` branch stay).
-- **Stage font:** site font. `.scramble-text` drops Georgia and gets `font-weight:700`.
-- **Stage:** only the text stays.
- - The "Decoding…" caption goes, and so do the Locked, Remaining and Cycle readouts (`.status-bar`).
- - The letters of each word sit in one `span.unit-word` that cannot break, with one plain space between words. This replaces the `.sp` spacer spans and `word-break:break-all`.
- - The flicker colour `#4a7a4a` becomes `#5f9a5f`: the old one is 4.0:1 on the stage, the new one 6.0:1.
- - `hb-dots`: yes. `hb-grow`, because typed text can wrap to several lines.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Random characters | Choice buttons | Alphabet · Symbols · Numbers · Japanese · Mixed | Symbols | What the letters flicker through before they lock. | `charset`: `'alpha'` / `'symbols'` / `'numeric'` / `'matrix'` / `'all'` (the flicker reads `CHARSETS[charset]` on every change, as today) |
-| Delay between letters | Choice buttons | Short · Medium · Long | Medium | The wait before each next letter locks into place. | `settleMs`: 40 / 70 / 120 (ms) |
-| Flicker speed | Choice buttons | Slow · Normal · Fast | Normal | Fast looks chaotic; slow lets you see each symbol. | `cycleMs`: 65 / 40 / 25 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Your text | Text (`input.hb-text`) | any text | DECODE THE MESSAGE | Short phrases work best. Letters show in capitals. | `txtIn.value`, upper-cased (an empty field falls back to "DECODE THE MESSAGE") |
-
-- **Removed:**
- - Replay and Auto-loop. The player bar replaces them.
- - The note.
- - The "Decoding…" caption and the three readouts.
- - The Cycle Speed and Settle Delay per Char sliders. They become Flicker speed and Delay between letters.
- - The Character Set menu. It becomes Random characters.
- - The Enter-key replay on the text field. Typing now replays by itself.
-- **Good for:** Tech headlines · Loading screens · Game titles · **Avoid on:** Long text · Calm brands
-- **Prompt:**
-
- > Add a scramble effect to [your headline or short phrase]. Each letter should start as a random character and keep flickering through random characters until it locks into the real letter. Lock the letters in reading order, from left to right, so the text becomes readable bit by bit, as if it is being decoded. Capital letters scramble most cleanly. Screen readers should hear the final text once, never the random characters. If the visitor has reduced motion turned on, show the final text immediately. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Scramble text shows every letter as a random character that keeps changing, then locks each one into the real letter. The letters lock one after another from left to right, so the text becomes readable bit by bit, as if a hidden message is being decoded. The random characters can be symbols, letters of the alphabet, numbers, Japanese characters or a mix.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Random characters | Symbols | What the letters flicker through: symbols look like hacking, Japanese characters look like the falling code in science-fiction films, and the alphabet or numbers look like a password being cracked |
- | Delay between letters | Medium | The wait between one letter locking and the next: short is 40ms, medium 70ms and long 120ms; it sets how fast the decoding travels |
- | Flicker speed | Normal | How often the random characters change: slow every 65ms, normal every 40ms and fast every 25ms; faster looks more chaotic |
- | Your text | DECODE THE MESSAGE | The text that is decoded, shown in capitals |
-
-- **README See also:**
- - [Typewriter Effect](../typewriter-effect/) — text typed one character at a time
- - [Kinetic Typography](../kinetic-typography/) — words that each move in their own way
- - [Text Morphing](../text-morphing/) — one word changes into the next, letter by letter
-- **README How it works:** the span-building part of the snippet (from `// Build one span per character` to the end of that `map`) becomes the word-keeping version:
-
- ```js
- // One span per letter; each word's letters sit in one span.unit-word, which keeps the word on one line
- const spans = [];
- targetText.split(' ').filter(Boolean).forEach((word, wi, words) => {
- const w = document.createElement('span');
- w.className = 'unit-word';
- [...word].forEach(c => {
- const s = document.createElement('span');
- s.dataset.char = c; // the letter it locks to
- s.textContent = chars[Math.floor(Math.random() * chars.length)];
- w.appendChild(s);
- spans.push(s);
- });
- el.appendChild(w);
- if (wi < words.length - 1) el.appendChild(document.createTextNode(' '));
- });
- ```
-
- Follow-on edits in the same snippet:
- - Move the `locked` array below this block and size it by `spans.length`.
- - In the settle step, set `s.textContent = s.dataset.char` and count to `spans.length`.
- - Drop the `if (!s) return;` line and the `s &&` check, because every entry is now a letter.
-- **README Production notes:** unchanged
-- **Category line:** `05.03 · Text &amp; Typography`
-- **Pager:** Previous: Typewriter Effect (`../typewriter-effect/`) · Next: Variable Font Morph (`../variable-font-morph/`)
-
----
-
-## text-clip-path-reveal — Text Clip-Path Reveal
-
-- **Kind:** once. The lines are uncovered and stay shown; Loop repeats it.
-- **Description:** Each line of a headline is uncovered in turn. Best for big headlines.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Sequence:** Every play rebuilds the lines hidden (`buildLines()`, then `void headline.offsetWidth`). Line i gets `revealed` 50 + i × Delay between lines ms after the play starts, and uncovers over Speed. While Loop is on, the lines hold 1200ms after the last line finishes, then the next play starts: the lines vanish at once and are uncovered again. Today's loop timer is 50 + delay × (lines − 1) + Speed + 1200ms. Switching Loop off lets the lines finish shown.
-- **Slow motion:** multiplies `--line-dur`, the line delays and the matching parts of the loop timer by 3. The 50ms start and the 1200ms hold stay.
-- **Reduced motion:** the demo's rule stays (all lines show at once). Replay plays once.
-- **Stage font:** site font. `.line-text` drops Georgia and the italic and gets `font-weight:700`.
-- **Stage:** only the lines stay. `hb-dots`: yes. `hb-grow`, because typed lines add height; the stage's own `min-height:var(--stage-h)` goes.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Starts from | Choice buttons | Left · Right · Top | Left | The side each line's wipe begins on. | `dir`: `'ltr'` / `'rtl'` / `'ttb'` (the lines get no class / `dir-rtl` / `dir-ttb`) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each line takes to uncover. | `dur` / `--line-dur`: 1100ms / 700ms / 400ms |
-| Delay between lines | Choice buttons | Short · Medium · Long | Medium | Longer delays make the cascade easier to see. | `stag`: 100 / 180 / 300 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Gentle · Even | Smooth | Smooth slows at the end; Even keeps one pace. | `--ease`: `ease-out` / `ease-in-out` / `linear` |
-| Your lines | Text box (`textarea.hb-text`) | any text, one line per row | Good design / Is honest / Always. (three rows) | Put each line on a row of its own. | `linesIn.value`, then `buildLines()` on input (blank rows are skipped; when no row has text, the three default lines are used) |
-
-- **Removed:**
- - Replay and Auto-loop. The player bar replaces them.
- - The note.
- - The Line Duration and Stagger Between Lines sliders. They become Speed and Delay between lines.
- - The Direction and Easing menus. They become Starts from and Feel.
- - The `cubic-bezier` "Smooth" easing. It was nearly the same as Ease out, which is now Smooth.
- - The Lines box becomes Your lines.
-- **Good for:** Headlines · Taglines · Portfolios · **Avoid on:** Body text · Buttons and labels
-- **Prompt:**
-
- > Add a line-by-line reveal to [your multi-line headline]. Lay out every line in its final place from the start, then uncover each line with a wipe that grows from one side until the whole line shows, starting each line a moment after the one above so the headline cascades in. Nothing moves or changes size; only the visible part of each line grows, so the letter spacing stays exactly as designed. A wipe that slows down as it finishes looks calmer than one that stops abruptly. The text must stay readable by screen readers the whole time. If the visitor has reduced motion turned on, show all the lines at once. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A text clip-path reveal uncovers a headline one line at a time, as if a hidden window opens across each line. Every letter sits in its final place from the start; only the visible part of each line grows. Because the text itself never moves, its spacing stays exactly as designed, which is hard to keep when each letter is animated on its own.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Starts from | Left | The side each line's wipe begins on: left follows the reading order, right suits right-to-left scripts, top works for display headings |
- | Speed | Normal | How long each line takes to uncover: slow is 1100ms, normal 700ms and fast 400ms |
- | Delay between lines | Medium | The wait before each next line starts: short is 100ms, medium 180ms and long 300ms; 100 to 200ms reads as a natural cascade |
- | Feel | Smooth | Smooth slows to a stop, which feels physical; Gentle eases in and out; Even feels mechanical |
- | Your lines | Good design / Is honest / Always. | The headline, one line per row |
-
-- **README See also:**
- - [Clip-Path Reveal](../../02-entrance-and-exit/clip-path-reveal/) — a shape uncovers any element
- - [Curtain Reveal](../../02-entrance-and-exit/curtain-reveal/) — a colored panel covers it, then slides away
- - [Enter/Exit Typography](../enter-exit-typography/) — each phrase comes in, holds and leaves
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `05.05 · Text &amp; Typography`
-- **Pager:** Previous: Variable Font Morph (`../variable-font-morph/`) · Next: Marquee / Ticker (`../marquee-ticker/`)
-
----
-
-## typewriter-effect — Typewriter Effect
-
-- **Kind:** once. The text is typed and stays; Loop repeats it.
-- **Description:** Text types itself out behind a blinking cursor. Best for short taglines.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Sequence:** Every play clears the text and types it from the start (today's `start()`), one character per Speed. When Types like a person is on, each keystroke is up to 20ms earlier or later. With Deletes and retypes on, the play then:
- - waits 500ms;
- - deletes back to the start of the last word (or to 60% of the text, if that is later), at about 30ms a character;
- - types that ending again with " — always." added.
-
- While Loop is on, the text holds 1200ms after typing ends, then the next play starts. Switching Loop off lets the text finish typed.
-- **Slow motion:** multiplies every per-character delay by 3 (typing, deleting and retyping), after the person-like variation is added. The 500ms pause before deleting and the 1200ms hold stay, and the cursor keeps blinking once a second.
-- **Reduced motion:** as today, the play shows the full text at once with a steady cursor (the demo's rule and its `reduceMotion` branch stay).
-- **Stage font:** typewriter font, because the effect imitates typing. `.type-text` uses `ui-monospace,'SFMono-Regular',Menlo,Consolas,'Liberation Mono',monospace` in place of Georgia.
-- **Stage:** only the typed text and its cursor stay. The "Typing…" caption and the Speed and Chars readouts (`.stats`) go. `hb-dots`: yes. `hb-grow`, because typed text can wrap.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | The time between keystrokes. | `spd`: 80 / 50 / 30 (ms per character) |
-| Cursor shape | Choice buttons | Line · Block · Underscore | Line | Block looks like a terminal, line like a text editor. | the cursor's class: `pipe` / `block` / `underscore` (applied to the cursor on screen at once, as today) |
-| Deletes and retypes | Switch | on / off | off | Backs up over the last word and types a new ending. | `retypeTog.checked`: the play calls `deleteAndRetype(text)` / `type(text)` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Types like a person | Switch | on / off | on | Small random pauses make it feel less mechanical. | `jitterTog.checked`: `jitter()` adds up to ±20ms to each delay / returns the delay as it is |
-| Cursor color | Swatches | Pink · White · Blue · Purple · Green · Orange | Pink | Pick a color that stands out from the text. | `--cursor-color`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-| Your text | Text (`input.hb-text`) | any text | Typography is the art and craft of arranging type. Good type communicates before it decorates. | Short lines work best; long text is slow to wait for. | `txtIn.value` (an empty field falls back to the default text) |
-
-- **Removed:**
- - Replay and Auto-loop. The player bar replaces them.
- - The note.
- - The "Typing…" caption and the Speed and Chars readouts.
- - The Typing Speed slider. It becomes Speed.
- - The Cursor Style menu. It becomes Cursor shape.
- - The colour picker. It becomes the Cursor color swatches.
- - "(±20ms)" in the variance label.
- - The text box becomes a one-line Your text, because its line breaks showed as spaces anyway.
-- **Good for:** Taglines · Chat messages · Terminal screens · Short intros · **Avoid on:** Long text · Buttons and labels
-- **Prompt:**
-
- > Add a typewriter effect to [your tagline or short text]. The text should appear one character at a time, as if someone is typing it, with a blinking cursor always just after the last character. Unless the settings turn it off, vary the time between keystrokes slightly so it feels typed by a person rather than a machine. When the settings include it, back up over the last word and type a new ending. Keep it to short text, because long text is slow to wait for. Screen readers should hear the full text once, not each character. If the visitor has reduced motion turned on, show the full text immediately. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > The typewriter effect shows text one character at a time, as if someone is typing it, with a blinking cursor just after the last character. Small random differences in the time between keystrokes make it feel typed by a person rather than a machine, because real typing is never perfectly even.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | The time between keystrokes: slow is 80ms, normal 50ms and fast 30ms; about 80 to 120ms feels like a natural pace |
- | Cursor shape | Line | A block reads as a terminal, a line as a text editor, an underscore as an old computer screen |
- | Deletes and retypes | off | Types the text, backs up over the last word at about 30ms a character, then types it again with a new ending |
- | Types like a person | on | Moves each keystroke up to 20ms earlier or later so the rhythm is uneven, like real typing |
- | Cursor color | Pink | The cursor's color; pick one that stands out from the text |
- | Your text | Two sample sentences | The text that is typed; short lines work best |
-
-- **README See also:**
- - [Scramble / Glitch Text](../scramble-text/) — random symbols lock into the real text
- - [Rotate Word Carousel](../rotate-word-carousel/) — one word in a sentence keeps changing
- - [Enter/Exit Typography](../enter-exit-typography/) — each phrase comes in, holds and leaves
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `05.02 · Text &amp; Typography`
-- **Pager:** Previous: Kinetic Typography (`../kinetic-typography/`) · Next: Scramble / Glitch Text (`../scramble-text/`)
-
----
-
-## glitch-text — Glitch Text
-
-- **Kind:** loop. The glitch has no end; it runs until paused.
-- **Description:** Text tears into red and cyan strips like a broken signal. Best for bold titles.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** The two colored copies (`::before` and `::after`) loop their strip animations forever (`@keyframes slice` and `slice2`, over Speed). The page's `reslice()` runs on its own timer: 120ms plus a random extra of up to about 60 + 320 × Glitch strength ms, as today. It nudges the word sideways and, with a chance equal to Glitch strength, restarts the copies at a random point (through `--phase` and the `reset` class). The page listens for `hb:pause`:
- - `paused` true: `clearTimeout(jitterTimer)` and `glitch.style.transform=''`;
- - `paused` false: `clearTimeout(jitterTimer)`, then `reslice()`.
-
- No second chain of timers can start. `reslice()` runs all at once and ends by setting `jitterTimer` for its own next call, so only one timer is ever pending. Pause clears that timer, and Play clears it again before calling `reslice()`.
-- **Slow motion:** css. While it is on, the page also does two things:
- - it triples `reslice()`'s wait;
- - right after it restarts the copies, it sets their new animations to a third of their speed itself (`glitch.getAnimations({subtree:true})`). This way no restarted copy runs at full speed for a frame before the shared script catches it.
-- **Reduced motion:** the demo's reduced-motion CSS rule goes, because it stopped the strips and Play must be able to move them. `reslice()` keeps its early return under reduced motion, so after Play the strips slide but the word does not shake or restart. `reslice()` still does not start at load under reduced motion, as today (`if(!reduceMQ.matches)reslice()`).
-
- The page's own `reduceMQ` change listener goes, as on Text on a Path. If it stayed, turning reduced motion off while the loop is paused would start the shake on a paused stage. Once reduced motion is off, the shake comes back at the next Play.
-- **Stage font:** site font. `.glitch` drops `var(--disp)` (Arial Narrow) and keeps weight 800.
-- **Stage:** only the word stays; `fit()` and `--n` stay too. `hb-dots`: no, because the stage keeps its radial gradient, which `hb-dots` would replace. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Color split | Choice buttons | Small · Medium · Large | Medium | How far the red and cyan copies sit from the word. | `--offset`: 2px / 4px / 8px |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the torn strips jump around. | `dur` / `--speed`: 3.8s / 2.4s / 1.4s |
-| Glitch strength | Choice buttons | Mild · Medium · Strong | Medium | Stronger shakes more and tears more often. | `intensity`: 0.3 / 0.6 / 0.9 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Glitches only on hover | Switch | on / off | off | Holds still until you point at it or tap it. | the stage's `hover-only` class on / off, and `active` removed either way. `hover-only` is today's `paused` class, renamed so it is not mistaken for Pause; its three CSS rules, the `live` check in `reslice()` and the `pointerdown` handler follow the new name. |
-| Your text | Text (`input.hb-text`, keeps `maxlength="12"`) | any text up to 12 characters | GLITCH | Short words work best, up to 12 letters. | `txtIn.value.trim()` sets the word's text, `data-text` and `--n`, then `fit()` (an empty field falls back to "GLITCH") |
-
-- **Removed:**
- - The note.
- - The RGB offset, Speed and Intensity sliders. They become Color split, Speed and Glitch strength.
- - "Hover-trigger only" becomes Glitches only on hover.
-- **Good for:** Bold titles · Music and games · Error pages · **Avoid on:** Long text · Calm brands
-- **Prompt:**
-
- > Add a glitch effect to [your headline or short word]. Place two copies of the text behind it, one tinted red and one tinted cyan, shifted to either side, and show only thin horizontal strips of each copy, changing which strips show so the colors seem to tear away from the letters like a broken video signal. Every so often, nudge the whole word sideways for a moment and reshuffle the strips so the pattern never repeats. Keep it below a few flickers per second and avoid full-screen flashes. If it only glitches on hover, a tap should start and stop it on touch screens. If the visitor has reduced motion turned on, keep the word still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Glitch text makes a headline look like a broken video signal. A red copy and a cyan copy of the word sit just to either side of it, and only thin horizontal strips of each copy show, changing all the time, so strips of color seem to tear away from the letters. It reads as a digital fault: a signal losing sync, or a tape dropping out.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Color split | Medium | How far the red and cyan copies sit from the word: small is 2px, medium 4px and large 8px |
- | Speed | Normal | How long the strips take to run through their pattern: slow is 3.8s, normal 2.4s and fast 1.4s; shorter looks more frantic |
- | Glitch strength | Medium | How hard the word shakes and how often the strips reshuffle: mild, medium or strong |
- | Glitches only on hover | off | Holds the word still until you point at it; on touch screens a tap starts and stops it |
- | Your text | GLITCH | The word that glitches, up to 12 letters, shown in capitals |
-
-- **README See also:** the first link's text changes from "Scramble Text" to the page's real title.
- - [Scramble / Glitch Text](../scramble-text/) — random symbols lock into the real text
- - [Text Clip-Path Reveal](../text-clip-path-reveal/) — lines of text are uncovered one by one
- - [Kinetic Typography](../kinetic-typography/) — words that each move in their own way
-- **README How it works:** "Hover-trigger mode simply toggles `animation-play-state` via a `:hover` rule gated behind `@media (hover: hover)`." becomes "The Glitches only on hover setting toggles `animation-play-state` through a `:hover` rule gated behind `@media (hover: hover)`, and a tap toggles it on touch screens." Everything else is unchanged.
-- **README Production notes:** the Reduced motion bullet becomes: "**Reduced motion**: the demo starts paused. Once played, it only slides the colored strips; the sideways shake and the random restarts stay off. In production, show these visitors the still word." The rest is unchanged.
-- **Category line:** `05.12 · Text &amp; Typography`
-- **Pager:** Previous: Rotate Word Carousel (`../rotate-word-carousel/`) · Next: Text on a Path (`../text-on-path/`)
-
----
-
-## marquee-ticker — Marquee / Ticker
-
-- **Kind:** loop. The rows scroll forever.
-- **Description:** Text scrolls sideways in an endless loop, with no seam. Best for news tickers.
-- **Watch it help line:** It moves by itself. Pause it, or point at a row (tap it on a phone) to stop just that row.
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** The three rows scroll forever (`@keyframes marqL`; the middle row uses `marqR` and runs the other way). Each row's duration is one copy's width ÷ Speed, so all rows move at the same pace. Pointing at a row stops it (inside `@media (hover: hover)`, as today), and on touch screens a tap stops or restarts it. There are no page timers; the resize rebuild is not part of the loop.
-- **Slow motion:** css
-- **Reduced motion:** the rule `.marq-track{animation-play-state:paused!important}` goes, because it would stop Play from starting the rows. Nothing else changes.
-- **Stage font:** site font. `.marq-item` drops Georgia and the italic and gets `font-weight:700`.
-- **Stage:** only the three rows stay (the script builds them). The "PAUSED" hint on each row goes, with its rules. `hb-dots`: yes. Default height: three rows at the Large size (3 × 96px) fit the 300px phone stage.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the text travels. | `spd`: 50 / 80 / 130 (px per second), then `refreshSpeeds()` |
-| Text size | Choice buttons | Small · Medium · Large | Medium | Large type is the usual choice for brand strips. | `--marq-size`: 32px / 48px / 64px, then `rebuild()` |
-| Space between items | Choice buttons | Tight · Medium · Wide | Medium | The space around the text and the separator. | `--marq-gap`: 24px / 48px / 80px, then `rebuild()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Separator | Choice buttons (this row lists them with commas, because · is one of the marks) | Dot ·, Star ★, Dash —, Sparkle ✦ | Sparkle ✦ | The mark between repeats of the text. | `sep`: `'·'` / `'★'` / `'—'` / `'✦'`, then `rebuild()` |
-| Your text | Text (`input.hb-text`) | any text | Animation Handbook | Type your own words to see them scroll. | `txtIn.value`, then `rebuild()` on input (an empty field falls back to "Animation Handbook") |
-
-- **Removed:**
- - The Apply button. The rows now rebuild as you type.
- - The note.
- - The "PAUSED" hints, which were a readout.
- - The Speed, Font Size and Gap Between Items sliders. They become Speed, Text size and Space between items.
- - The Separator menu. It becomes choice buttons.
-- **Good for:** News tickers · Brand strips · Client lists · **Avoid on:** Important messages · Long sentences
-- **Prompt:**
-
- > Add a marquee to [the text or items you want to scroll]. The text should scroll sideways in an endless loop with no visible jump: place two identical copies side by side, each at least as wide as the space it scrolls through, and move them by exactly one copy's width before starting over. Put a small mark between the repeats. Rows can run in opposite directions for a decorative band. Pointing at a row should stop it so people can read it, and a tap should do the same on touch screens. Screen readers should not announce the moving text again and again. If the visitor has reduced motion turned on, keep the text still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A marquee scrolls a line of text sideways without end, like a news ticker. The text is repeated, and the row moves by exactly the width of one copy before starting over, so an identical copy is always in place and the restart cannot be seen. In the demo, three rows scroll at the same pace, the middle one the other way, and pointing at a row or tapping it stops just that row.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How fast the text travels: slow is 50px, normal 80px and fast 130px per second; news tickers run slower, brand strips faster |
- | Text size | Medium | Small is 32px, medium 48px and large 64px; large type is the usual choice for brand strips |
- | Space between items | Medium | The space around each repeat of the text and its separator: tight is 24px, medium 48px and wide 80px |
- | Separator | Sparkle ✦ | The mark between repeats: a dot, a star, a dash or a sparkle |
- | Your text | Animation Handbook | The text that scrolls |
-
-- **README See also:**
- - [Rotate Word Carousel](../rotate-word-carousel/) — one word in a sentence keeps changing
- - [Kinetic Typography](../kinetic-typography/) — words that each move in their own way
- - [Text on a Path](../text-on-path/) — text scrolls along a curve instead
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `05.06 · Text &amp; Typography`
-- **Pager:** Previous: Text Clip-Path Reveal (`../text-clip-path-reveal/`) · Next: Text Morphing (`../text-morphing/`)
-
----
-
-## rotate-word-carousel — Rotate Word Carousel
-
-- **Kind:** loop. The words take turns forever.
-- **Description:** One word in a sentence keeps swapping for the next. Best for hero headlines.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** The page starts its loop at load (today's `start()`). Every Time on each word, the hold timer calls `cycle()`, which starts a slide. `transitionTo()` slides the word out (Speed), swaps it for the next word at the entry side with the transition off, then slides that word in (Speed). The slide's own `done()` callback then schedules the next hold. The list repeats forever.
-
- A `sliding` flag keeps Play from starting a second chain of timers while a slide is still running:
- - `cycle()` sets `sliding=true` when it starts a slide.
- - The slide's `done()` sets it back to `false`. So does `start()`, because its `run++` aborts a slide without calling `done()`.
- - `done()` schedules the next hold (`timer=setTimeout(cycle,hold)`) only while the loop is not paused. `start()` follows the same rule: while paused it shows the first word and schedules nothing.
-
- **Superseded (owner decision "Pause stops at once"):** the page uses the preamble's wait()/freeze()/thaw() helper; the Pause/Play lines below describe the first design and no longer apply.
- The page listens for `hb:pause`:
- - `paused` true: `clearTimeout(timer)`. This clears the hold timer only; the slide's own timers are not stored in `timer`. A slide already under way finishes, and its `done()` schedules nothing.
- - `paused` false: if `sliding` is true, do nothing; the slide's `done()` will schedule the next hold. If it is false, `clearTimeout(timer)`, then `timer=setTimeout(cycle,hold)`. Only one chain of timers ever runs, so the next Pause always stops the loop.
-- **Slow motion:** while the switch is on, multiplies `--rot-dur` by 3, from the next slide. The two timers inside `transitionTo()` that wait for it become Speed × 3 + 30ms and Speed × 3 + 50ms. Time on each word and the 20ms step stay.
-- **Reduced motion:** the demo's rule stays: the words swap without sliding, one per Time on each word.
-- **Stage font:** site font. `.headline` drops Georgia and gets `font-weight:700`, and `.rot-word` drops the italic.
-- **Stage:** only the sentence and its rotating word stay. The word list under it (`.word-dots`, which shows where the loop is) goes. `hb-dots`: yes. `hb-grow`, because a typed sentence can wrap.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Slide direction | Choice buttons | Up · Down · Left · Right | Up | Which way the words slide. | `dir`: `'up'` / `'down'` / `'left'` / `'right'` (read at each slide, as today) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast one word slides out and the next in. | `dur` / `--rot-dur`: 650ms / 400ms / 250ms |
-| Time on each word | Choice buttons | Short · Medium · Long | Medium | How long each word stays still to be read. | `hold`: 1200 / 2000 / 3200 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Different color per word | Switch | on / off | on | A new color draws the eye to each change. | `colorTog.checked`: `setColor()` adds `wc0`–`wc4` / uses `--word-color` (pink), applied to the word on screen at once |
-| Your sentence | Text (`input.hb-text`) | any text | We craft for | The words that stay still before the changing one. | `sentenceIn.value` sets `#static-text` at once |
-| Your words, one per line | Text box (`textarea.hb-text`) | any words, one per row | Designers / Developers / Humans / Teams / Startups (five rows) | Words of similar length keep the sentence steady. | `wordsIn.value`, then `start()` on input (blank rows are skipped; while paused, `start()` shows the first word and schedules nothing) |
-
-- **Removed:**
- - Restart. Pause replaces it.
- - The note.
- - The word list under the sentence.
- - The Hold Duration and Transition Duration sliders. They become Time on each word and Speed.
- - The Direction menu. It becomes Slide direction.
- - The Static text and Rotating words boxes become Your sentence and Your words, one per line.
-- **Good for:** Hero headlines · Taglines · Service lists · **Avoid on:** Body text · Long word lists
-- **Prompt:**
-
- > Add a rotating word to [your headline, with the word that should change]. Keep the rest of the sentence still and swap only that one word: the current word slides out of sight and the next one slides in from the opposite side, clipped by an invisible box so it seems to come from behind the text. Hold each word long enough to read, then move on, repeating the list forever. Words of similar length keep the sentence from jumping. Screen readers should hear each new word once. If the visitor has reduced motion turned on, swap the words without sliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A rotating word keeps a sentence still while one word in it keeps changing: "We craft for Designers" becomes "We craft for Developers", then "We craft for Humans". The current word slides out of sight and the next one slides in from the other side, so each change is easy to notice while the rest of the line stays readable. It is a common headline on the home pages of studios and software products.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Slide direction | Up | Up and down move the word like a slot machine; left and right slide it sideways |
- | Speed | Normal | How long each slide takes: slow is 650ms, normal 400ms and fast 250ms |
- | Time on each word | Medium | How long each word stays: short is 1200ms, medium 2000ms and long 3200ms; 1.5 to 3 seconds is the readable range |
- | Different color per word | on | A new color for each word draws attention to the change; one color is calmer |
- | Your sentence | We craft for | The part of the headline that stays still |
- | Your words, one per line | Designers, Developers, Humans, Teams, Startups | The words that take turns |
-
-- **README See also:**
- - [Text Morphing](../text-morphing/) — one word changes into the next, letter by letter
- - [Enter/Exit Typography](../enter-exit-typography/) — whole phrases come in, hold and leave
- - [Typewriter Effect](../typewriter-effect/) — text typed one character at a time
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `05.11 · Text &amp; Typography`
-- **Pager:** Previous: Enter/Exit Typography (`../enter-exit-typography/`) · Next: Glitch Text (`../glitch-text/`)
-
----
-
-## text-morphing — Text Morphing
-
-- **Kind:** loop. The words take turns forever.
-- **Description:** One word changes into the next, letter by letter. Best for short labels.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** The page starts its loop at load (today's `start()`). `cycle()` shows the word and sets the hold timer, and the word holds for Time on each word. The hold timer's callback then starts a morph: `morphTo()` slides the current letters out (Speed, each letter Delay between letters after the one before), then builds the next word's letters on the far side and slides them in. The morph's own callback then sets a 100ms timer that calls `cycle()` again. The list repeats forever. `morphTimer` holds each of these timers in turn: the hold, the morph's two steps, then the 100ms step.
-
- A `morphing` flag keeps Pause and Play from starting a second chain of timers while a morph is still running:
- - The hold timer's callback sets `morphing=true` just before it calls `morphTo()`.
- - The morph's callback sets it back to `false`. So does `start()`, because its `clearTimeout(morphTimer)` can abort a morph without calling the callback.
- - The morph's callback schedules the 100ms step to `cycle()` only while the loop is not paused. `start()` follows the same rule: while paused it shows the first word and schedules nothing.
-
- **Superseded (owner decision "Pause stops at once"):** the page uses the preamble's wait()/freeze()/thaw() helper; the Pause/Play lines below describe the first design and no longer apply.
- The page listens for `hb:pause`:
- - `paused` true: if `morphing` is true, do nothing now; the morph finishes and its callback schedules nothing. Clearing `morphTimer` here would stop the morph halfway, with the letters out of sight. If `morphing` is false, `clearTimeout(morphTimer)`, which clears the hold or the 100ms step.
- - `paused` false: if `morphing` is true, do nothing; the morph's callback will schedule the next step. Calling `cycle()` here would start a second chain, and its `showWord()` check would also put the old word back mid-morph. If it is false, `clearTimeout(morphTimer)`, then `cycle()`, so the next morph comes after one hold.
-- **Slow motion:** while the switch is on, multiplies `--morph-dur` and the letter delays by 3, from the next morph. The two timers in `morphTo()` that wait for them become 3 × (Speed + delay × (letters − 1)) + 60ms and 3 × (Speed + delay × (letters − 1)) + 50ms. Time on each word and the 100ms gap stay.
-- **Reduced motion:** the demo's rule stays: the words swap without sliding.
-- **Stage font:** site font. `.morph-char` drops Georgia and gets `font-weight:700`.
-- **Stage:** only the word stays.
- - The "Morphing" caption, the dots (`.cycle-dots`) and the Current word readout go.
- - `hb-dots`: yes. Default height.
- - The word is one line that never wraps, so neither `hb-grow` nor the `.unit-word` pattern applies. `.morph-char` gets `white-space:pre`, so a space typed inside a word keeps its width.
- - **Long words shrink to fit, as on Glitch Text and Wavy Text.** Today the letters are at least 56px, so an 8–10-letter word is cut off at 375px wide.
- - `.morph-char`'s `font-size:clamp(56px,9vw,100px)` moves to `.morph-word`, and the letters inherit it.
- - A `fit()` clears `wordEl.style.fontSize` and measures `room = stage.clientWidth - 64`, which is the stage's 32px padding on each side.
- - When `wordEl.offsetWidth` is wider than `room`, `fit()` sets `wordEl.style.fontSize` to `Math.max(16, parseFloat(getComputedStyle(wordEl).fontSize) * room / wordEl.offsetWidth) + 'px'`.
- - `fit()` runs at the end of `showWord()`, and in `morphTo()` right after the new letters are added, before `void wordEl.offsetWidth`. It also runs on `resize`.
- - `.morph-word` is absolutely positioned and does not wrap, so its `offsetWidth` is the whole word's width.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Slide direction | Choice buttons | Up · Down · Left · Right | Up | Which way the old letters leave and the new ones arrive. | `dir`: `'up'` / `'down'` / `'left'` / `'right'` (read at each morph, as today) |
-| Delay between letters | Choice buttons | None · Short · Long | None | A small delay sends the change across the word as a wave. | `stag`: 0 / 30 / 60 (ms) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each letter takes to slide. | `dur` / `--morph-dur`: 650ms / 400ms / 250ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Time on each word | Choice buttons | Short · Medium · Long | Medium | How long each word stays still to be read. | `hold`: 900 / 1500 / 2400 (ms) |
-| Your words, one per line | Text box (`textarea.hb-text`) | any words, one per row | OCEAN / RIVER / STORM / LIGHT / SOUND (five rows) | Words of the same length morph most cleanly. | `wordsIn.value`, upper-cased, then `start()` on input (blank rows are skipped; while paused, `start()` shows the first word and schedules nothing) |
-
-- **Removed:**
- - Restart. Pause replaces it.
- - The note.
- - The "Morphing" caption and the dots on the stage.
- - The Current word readout.
- - The Morph Duration, Pause Between Words and Stagger Per Char sliders. They become Speed, Time on each word and Delay between letters.
- - The Direction menu. It becomes Slide direction.
- - The Words box becomes Your words, one per line.
-- **Good for:** Short labels · Status words · Hero headlines · **Avoid on:** Long words · Sentences
-- **Prompt:**
-
- > Add a letter-by-letter morph to [the word that should change, and the words it cycles through]. Split each word into letters. To change words, slide the current letters out of sight in one direction, then slide the next word's letters in from the opposite side; a small delay between letters, when the settings include one, sends the change across the word like a wave. Hold each word long enough to read, then morph to the next and repeat the list. Words of similar length look cleanest. Screen readers should hear each new word once, not its letters. If the visitor has reduced motion turned on, swap the words without movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Text morphing changes one word into the next, letter by letter. The letters of the current word slide out of sight, then the letters of the next word slide in from the opposite side; a small delay between letters can send each change across the word like a wave. Each word stays still long enough to read before the next change.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Slide direction | Up | Up and down look like a slot machine; left and right slide sideways |
- | Delay between letters | None | The gap between one letter moving and the next: none, short (30ms) or long (60ms); none moves every letter together, a delay makes a wave |
- | Speed | Normal | How long each letter takes to slide: slow is 650ms, normal 400ms and fast 250ms |
- | Time on each word | Medium | How long each word stays: short is 900ms, medium 1500ms and long 2400ms; it must be long enough to read |
- | Your words, one per line | OCEAN, RIVER, STORM, LIGHT, SOUND | The words that take turns, shown in capitals |
-
-- **README See also:**
- - [Rotate Word Carousel](../rotate-word-carousel/) — the whole word slides, with no letters split
- - [Scramble / Glitch Text](../scramble-text/) — random symbols lock into the real text
- - [Typewriter Effect](../typewriter-effect/) — text typed one character at a time
-- **README How it works:** unchanged
-- **README Production notes:** replace the "Length mismatch" bullet, which describes letters swapping in place (this demo never does that), with: "**Length mismatch**: this demo sidesteps it — the whole old word leaves before the new one arrives, so words of any length work. A morph that swaps letters in place has to fade the extra letters in or out with opacity only, so the letters around them do not jump." The other bullets stay.
-- **Category line:** `05.07 · Text &amp; Typography`
-- **Pager:** Previous: Marquee / Ticker (`../marquee-ticker/`) · Next: Text Gradient Animation (`../text-gradient-animation/`)
-
----
-
-## text-gradient-animation — Text Gradient Animation
-
-- **Kind:** loop. The colors flow forever.
-- **Description:** Colors flow through the letters while the text stays still. Best for headlines.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** The gradient moves forever, over Speed. `@keyframes grad-flow` slides it for Flowing, Diagonal and Two colors, and `@keyframes grad-spin` turns it for Spinning. No page timers.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule goes, because it stopped the gradient and Play must be able to move it.
-- **Stage font:** site font. `.grad-text` drops Georgia and the italic and gets `font-weight:800`.
-- **Stage:** only the word stays. The two captions go ("Gradient" and the line of code under the word). `.grad-text` gets `font-size:clamp(64px,14vw,120px)` in place of `--grad-size`; the Font Size slider and the phone rule that set 64px go. `hb-dots`: yes. `hb-grow`, because typed text can wrap; the stage's own `min-height:var(--stage-h)` goes.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Gradient | Choice buttons | Flowing · Spinning · Diagonal · Two colors | Flowing | How the colors move through the letters. | the word's class: `grad-linear` / `grad-conic` / `grad-multi` / `grad-custom`; also shows First color and Second color only with Two colors |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slower feels calm; faster feels lively. | `--grad-dur`: 6.4s / 4s / 2.4s |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| First color | Swatches; shown only when Gradient is Two colors (the only gradient that uses it) | Pink · White · Blue · Purple · Green · Orange | Blue | The color the gradient starts and ends with. | `--c1`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-| Second color | Swatches; shown only when Gradient is Two colors | Pink · White · Blue · Purple · Green · Orange | Purple | The color in the middle of the gradient. | `--c2`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-| Your text | Text (`input.hb-text`) | any text | Flow | Short words show the flow best. | `txtIn.value` sets the word (an empty field falls back to "Flow") |
-
-- **Removed:**
- - The note.
- - The two captions on the stage.
- - The Gradient Type menu. It becomes Gradient.
- - The Speed slider. It becomes Speed.
- - The Font Size slider. The word now follows the screen size, from 64px on phones to 120px on wide screens, and its size does not change the effect.
- - The Start and End colour pickers. They become the First color and Second color swatches.
-- **Good for:** Headlines · Logos · Hero titles · **Avoid on:** Body text · Small text
-- **Prompt:**
-
- > Add a flowing color gradient to [your headline or logo text]. Fill the letters with a gradient instead of a flat color: paint the gradient as the text's background, show it only inside the letter shapes, and make the text color itself see-through. Then keep moving the gradient behind the letters, or turn it like a color wheel, so color flows through the word while the letters stay still. End the gradient with the color it starts with so the loop has no seam. Give the text a solid fallback color for browsers that cannot clip a background to text. If the visitor has reduced motion turned on, keep the gradient still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Text gradient animation fills the letters with a gradient instead of a flat color, then moves the gradient behind them, so color seems to flow through the word while the letters stay still. The trick is to paint the gradient as the text's background, show that background only inside the letter shapes, and make the text color itself see-through.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Gradient | Flowing | Flowing slides the colors sideways, Spinning turns them like a color wheel, Diagonal slides slanted bands, Two colors flows between two colors of your choice |
- | Speed | Normal | How long one full pass takes: slow is 6.4s, normal 4s and fast 2.4s; slower feels calm, faster feels lively |
- | First color | Blue | With Two colors, the color the gradient starts and ends with |
- | Second color | Purple | With Two colors, the color in the middle |
- | Your text | Flow | The text the colors flow through |
-
-- **README See also:**
- - [Variable Font Morph](../variable-font-morph/) — the letters themselves change weight and lean
- - [Outline to Fill](../outline-to-fill/) — hollow letters fill with color
- - [Kinetic Typography](../kinetic-typography/) — words that each move in their own way
-- **README How it works:** the conic example must match the demo. Replace the sentence "For a conic gradient (rotating color wheel):" and its snippet with "For a gradient that turns like a color wheel, register an angle property so the browser can animate the conic gradient's starting angle:" and this snippet:
-
- ```css
- @property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
-
- .conic-text {
- background-image: conic-gradient(from var(--ang), #58a6ff, #56d364, #d2a8ff, #ffa657, #58a6ff);
- animation: spin 4s linear infinite;
- }
-
- @keyframes spin { to { --ang: 360deg; } }
- ```
-
- The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `05.08 · Text &amp; Typography`
-- **Pager:** Previous: Text Morphing (`../text-morphing/`) · Next: Outline to Fill (`../outline-to-fill/`)
-
----
-
-## text-on-path — Text on a Path
-
-- **Kind:** loop. The text keeps travelling along the curve.
-- **Description:** Text travels along a wave, an arc or a circle. Best for badges and seals.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** The page starts its loop at load (`start()`). On each animation frame, `loop(now)` moves the text along the path by Speed for each 1/60 s that passed (`offset=(offset+speed*dt/FRAME)%unit`, with `dt` clamped to 50ms and reset on Play). The page listens for `hb:pause`:
- - `paused` true: `cancelAnimationFrame(raf)` and `raf=null`;
- - `paused` false: `start()`, which carries on from the current offset.
-
- No second loop can start. `start()` keeps its `if(raf)return` guard; only its `reduce.matches` part goes. `loop()` requests exactly one next frame and stores it in `raf`, and Pause cancels that frame and sets `raf=null`. So Play, even pressed twice, never runs two loops.
-- **Slow motion:** while the switch is on, divides the step per 1/60 s by 3, from the next frame.
-- **Reduced motion:** the page's own checks go (`reduce.matches` in `loop()` and in `start()`, and the `reduce` change listener). The text starts still, because the shared script pauses the loop on arrival, and it moves after Play. The CSS rule `.guide{transition:none}` stays.
-- **Stage font:** site font. `.flow-text` drops `var(--disp)` and keeps weight 800 (the SVG text inherits the site font).
-- **Stage:** only the SVG stays (path, dashed guide and text).
- - The `svg{…}` rule becomes `.stage svg{…}`, so it cannot size the page's icons.
- - `.flow-text`'s `fill:var(--ui-text)` becomes `fill:#f4f4f2`.
- - `hb-dots`: no, because the stage keeps its radial gradient. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Path shape | Choice buttons | Wave · Arc · Circle | Wave | The curve the text follows. | the path's `d`: `PATHS.wave` / `PATHS.arc` / `PATHS.circle`, then `fill()` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the text travels along the curve. | `speed`: 0.25 / 0.4 / 0.65 (% of the path per 1/60 s, time-based) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shows the path | Switch | on / off | on | A dashed line marks the curve under the text. | the guide's `hidden` class off / on |
-| Your text | Text (`input.hb-text`, keeps `maxlength="40"`) | any text up to 40 characters | FOLLOW THE CURVE · | End with a mark such as · so the repeats read well. | `txtIn.value`, then `fill()` on input (an empty field falls back to "FOLLOW THE CURVE · ") |
-
-- **Removed:**
- - The note.
- - The Speed slider, which could reach zero. It becomes Speed, and Pause now stops the text.
- - "Show guide path" becomes Shows the path.
- - The old `.seg` styles. The shared ones take over.
-- **Good for:** Badges and seals · Playful titles · Decorations · **Avoid on:** Long text · Key information
-- **Prompt:**
-
- > Add text that travels along a curve to [your short phrase]. Define the curve once and attach the text to it so every letter sits on the line, then keep moving the point where the text starts so the letters travel along the curve like a ticker bent into shape. Repeat the phrase, with a separator such as a dot, until it covers the whole curve, and wrap around by exactly one copy so the loop has no jump. Keep the curve gentle enough that letters do not crowd on sharp bends. If the visitor has reduced motion turned on, show the text still on the curve. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Text on a path lets a line of type follow a curve instead of a straight line. The curve is defined once and the text is attached to it, so every letter sits on the line. Moving the point where the text starts along the curve makes the letters travel along it, like a ticker bent into a shape.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Path shape | Wave | The curve the text follows: a wave, an arc or a full circle |
- | Speed | Normal | How far the text moves every sixtieth of a second: slow is 0.25%, normal 0.4% and fast 0.65% of the path (15%, 24% and 39% a second) |
- | Shows the path | on | Draws the curve as a dashed line under the text |
- | Your text | FOLLOW THE CURVE · | The phrase that travels; end it with a separator so the repeats read on |
-
-- **README See also:**
- - [Marquee / Ticker](../marquee-ticker/) — text scrolls along a straight line
- - [Kinetic Typography](../kinetic-typography/) — words that each move in their own way
- - [Text Morphing](../text-morphing/) — one word changes into the next, letter by letter
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `05.13 · Text &amp; Typography`
-- **Pager:** Previous: Glitch Text (`../glitch-text/`) · Next: Wavy Text (`../wavy-text/`)
-
----
-
-## variable-font-morph — Variable Font Morph
-
-- **Kind:** loop. The word keeps moving through a set of styles. Today's Auto-morph becomes the loop, and it starts at load.
-- **Description:** A word smoothly turns bold, then light, and leans over. Best for headlines.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** The page starts its loop at load: today's Auto-morph, now without a button. It steps to the next preset every Speed + 800ms (1400ms at Normal, as today). Each step sets `--wght` and `--slnt`, and the word's CSS transition (Speed) draws the morph.
- - `PRESETS` becomes (weight / slant): 400/0, 900/0, 700/−15, 500/0, 400/−15, 900/0, repeating.
- - This is today's list on the site font's 400–900 weights, with the Casual values removed.
- - The fourth preset moves from 400 to 500, so that with Leans as it changes off no step repeats the one before.
-
- The loop is one `setTimeout` chain. `step()` applies the next preset, then sets `stepTimer` for the next `step()`, after Speed + 800ms.
-
- **Superseded (owner decision "Pause stops at once"):** the page uses the preamble's wait()/freeze()/thaw() helper; the Pause/Play lines below describe the first design and no longer apply.
- The page listens for `hb:pause`:
- - `paused` true: `clearTimeout(stepTimer)`. A morph under way finishes; it is a CSS transition.
- - `paused` false: `clearTimeout(stepTimer)`, then `step()`, which applies the next preset at once and schedules the one after.
-
- No second chain can start. A step finishes at once: it only sets two CSS variables, and the CSS transition draws the morph with no callback of its own. So no step is ever still running with a callback that could schedule another timer. Pause clears the one pending timer, and Play clears it again before stepping, so only one timer is ever pending.
-- **Slow motion:** while the switch is on, multiplies `--morph-dur` by 3, and the step wait becomes 3 × Speed + 800ms, from the next step. The 800ms rest stays.
-- **Reduced motion:** the demo's rule `.vf-text{transition:none!important}` stays. After Play, the word jumps from style to style instead of morphing, one step per interval.
-- **Stage font:** site font, as the plan requires. `.vf-text` drops the `Recursive` stack and uses Schibsted Grotesk, which every page already loads and which is variable in weight from 400 to 900.
- - It keeps `font-weight:var(--wght)` and the `skewX` slant.
- - `font-variation-settings` becomes `'wght' var(--wght)`. The Casual and slant axes go, because this font has neither.
- - The transition uses `var(--morph-dur)` instead of 600ms.
- - `:root` keeps `--wght:400;--slnt:0` and gets `--morph-dur:600ms`; `--CASL` goes.
-- **Stage:** only the word stays. The "Variable" caption, the font note under the word (`.vf-sub`), the axis readout (`.axis-row`) and the six preset buttons go. `hb-dots`: yes. `hb-grow`, because typed text can wrap; the stage's own `min-height:var(--stage-h)` goes.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each change of style takes. | `morph` / `--morph-dur`: 1000ms / 600ms / 350ms (the step wait is Speed + 800ms) |
-| Leans as it changes | Switch | on / off | on | Adds a slant to some of the changes. | `leanTog.checked`: each step uses its preset's slant / keeps `--slnt` at 0 (applied to the word on screen at once, so it shows while paused too) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Your text | Text (`input.hb-text`) | any text | Type | Short words show the change best. | `txtIn.value` sets the word (an empty field falls back to "Type") |
-
-- **Removed:**
- - Auto-morph presets / Stop. The loop runs by itself, and Pause stops it.
- - The six preset buttons and the Weight, Casual and Slant sliders. The loop now moves through the presets by itself. Leans as it changes keeps the slant choice. The Casual axis goes, because no loaded font has it.
- - The caption, the font note, the axis readout, and the Font and Axes readouts.
- - The note.
-- **Good for:** Headlines · Logos · Loading text · **Avoid on:** Body text · Small text
-- **Prompt:**
-
- > Add a variable font morph to [your headline or word]. Use a variable font, which holds a whole range of weights in one file, and change the weight smoothly so the letters grow heavier and lighter as you watch, moving through a few styles in turn and resting briefly on each. When the settings include it, the word also leans over during some changes: a font with its own slant does this best, and a slight tilt works for fonts without one. Change the weight through the font itself, not by scaling, so the text stays sharp. If the visitor has reduced motion turned on, keep the word in one style. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A variable font holds a whole range of styles, such as thin to black, in one file, and each style is just a number. Because of that, the browser can move smoothly from one style to another, so a word can grow heavier or lighter as you watch. In the demo, the word moves between the site font's regular and black weights and leans over by being tilted, since this font has no slanted style of its own.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long each change takes: slow is 1000ms, normal 600ms and fast 350ms; the word then rests for 800ms before the next |
- | Leans as it changes | on | Some changes also tilt the word by up to 15 degrees; off, only the weight changes |
- | Your text | Type | The word that changes |
-
-- **README See also:**
- - [Text Gradient Animation](../text-gradient-animation/) — colors flow through the letters instead
- - [Kinetic Typography](../kinetic-typography/) — words that each move in their own way
- - [Outline to Fill](../outline-to-fill/) — hollow letters fill with color
-- **README How it works:** the four snippets are replaced so they match the new code. The prose between them stays.
- - The first CSS snippet becomes:
-
- ```css
- .headline {
- font-weight: 400;
- font-variation-settings: 'wght' 400;
- transition: font-weight 600ms cubic-bezier(.4, 0, .2, 1),
- font-variation-settings 600ms cubic-bezier(.4, 0, .2, 1);
- }
-
- .headline:hover {
- font-weight: 800;
- font-variation-settings: 'wght' 800;
- }
- ```
-
- - The JS snippet becomes:
-
- ```js
- function apply(wght, slnt) {
- const el = document.documentElement;
- el.style.setProperty('--wght', wght); // 400–900 for the site font
- el.style.setProperty('--slnt', slnt); // 0 to –15, drawn as a tilt
- }
- ```
-
- - The second CSS snippet becomes:
-
- ```css
- .headline {
- font-weight: var(--wght);
- font-variation-settings: 'wght' var(--wght);
- transform: skewX(calc(var(--slnt) * 1deg)); /* the site font has no slant axis */
- }
- ```
-
- - The loop snippet becomes the block below. Each preset now holds only a weight and a slant, in that order, so spreading `Object.values` still passes them to `apply(wght, slnt)`:
-
- ```js
- const PRESETS = [
- { wght: 400, slnt: 0 },
- { wght: 900, slnt: 0 },
- { wght: 700, slnt: -15 },
- ];
- let i = 0;
- setInterval(() => { apply(...Object.values(PRESETS[i++ % PRESETS.length])); }, 1400); // Speed + an 800ms rest
- ```
-- **README Production notes:** replace the "Font loading" bullet with: "**Font loading**: the demo uses the site's own font, Schibsted Grotesk, which every page already loads and which is variable in weight from 400 to 900, so the weight morphs smoothly offline. It has no slant axis, so the lean is a `skewX()` tilt. A font with more axes gives you more to morph: Recursive, for example, adds Casual and slant axes. Self-host it with `@font-face` and `font-display: swap`." The rest is unchanged.
-- **Category line:** `05.04 · Text &amp; Typography`
-- **Pager:** Previous: Scramble / Glitch Text (`../scramble-text/`) · Next: Text Clip-Path Reveal (`../text-clip-path-reveal/`)
-
----
-
-## wavy-text — Wavy Text
-
-- **Kind:** loop. The wave rolls forever.
-- **Description:** A wave rolls through the word, letter by letter. Best for playful titles.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** Every letter bobs forever (`@keyframes bob`, over Speed). Each letter starts Delay between letters after the one before, so the wave travels across the word. No page timers.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule that removed the animation goes. The loop starts paused, and Play must be able to move it.
-- **Stage font:** site font. `.wave-text` drops `var(--disp)` and keeps weight 800.
-- **Stage:** only the word stays. The text never wraps (`white-space:pre`, and `fit()` shrinks long words). So the split stays one span per character, spaces included, as today, and the `.unit-word` pattern is not needed. `hb-dots`: no, because the stage keeps its radial gradient. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Wave height | Choice buttons | Low · Medium · High | Medium | How far each letter rises and falls. | `--amp`: 8px / 16px / 28px |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long one rise and fall takes. | `--dur`: 2.6s / 1.6s / 1s |
-| Delay between letters | Choice buttons | Short · Medium · Long | Medium | Longer delays stretch the wave across the word. | `--stagger`: 30ms / 60ms / 120ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Your text | Text (`input.hb-text`, keeps `maxlength="14"`) | any text up to 14 characters | Wavy | Short words work best, up to 14 letters. | `txtIn.value`, then `build()` on input (an empty field falls back to "Wavy") |
-
-- **Removed:**
- - The note.
- - The Amplitude, Wave speed and Per-letter stagger sliders. They become Wave height, Speed and Delay between letters.
-- **Good for:** Playful titles · Games and kids' sites · Loading text · **Avoid on:** Serious content · Long text
-- **Prompt:**
-
- > Add a wavy text effect to [your word or short title]. Split the text into letters and make every letter bob up and down with the same smooth motion, but start each letter a moment after the one before it, so the high point of the wave rolls from the first letter to the last and around again. Keep the letters on one line, and move them only up and down, never changing their size or spacing. Screen readers should read the word once, not letter by letter. If the visitor has reduced motion turned on, keep the letters still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Wavy text sends a wave rolling across a word. Every letter bobs up and down with the same motion, but each one starts a moment after the letter before it, so the highest point travels from the first letter to the last, like a flag rippling or a row of buoys lifted by a passing swell.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Wave height | Medium | How far each letter travels: low is 8px, medium 16px and high 28px; larger makes a taller wave |
- | Speed | Normal | How long one rise and fall takes: slow is 2.6s, normal 1.6s and fast 1s |
- | Delay between letters | Medium | The gap between neighboring letters: short is 30ms, medium 60ms and long 120ms; longer delays stretch the wave |
- | Your text | Wavy | The word that waves, up to 14 letters |
-
-- **README See also:**
- - [Kinetic Typography](../kinetic-typography/) — words that each move in their own way
- - [Typewriter Effect](../typewriter-effect/) — text typed one character at a time
- - [Text Morphing](../text-morphing/) — one word changes into the next, letter by letter
- - [Variable Font Morph](../variable-font-morph/) — the letters change weight and lean
-- **README How it works:** the snippets stay. The last sentence, "Amplitude, duration, and stagger are all CSS variables the controls rewrite live.", becomes "Wave height, Speed and Delay between letters set these three CSS variables."
-- **README Production notes:** the Reduced motion bullet becomes: "**Reduced motion**: under reduced motion the demo starts paused, so the letters stay still until the visitor presses Play. In production, keep the letters still for these visitors." The rest is unchanged.
-- **Category line:** `05.14 · Text &amp; Typography`
-- **Pager:** Previous: Text on a Path (`../text-on-path/`) · Next: none
diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.md
deleted file mode 100644
index 114be9c9..00000000
--- a/docs/superpowers/plans/2026-09-29-3d-content.md
+++ /dev/null
@@ -1,1551 +0,0 @@
-# 3D & Advanced — Content Sheet
-
-This sheet decides, page by page, how the eighteen 3D & Advanced pages present their kind, settings, words and prompt on the guided-steps page. The conversion tasks of `2026-09-29-demo-page-rollout-parallel.md` follow each section exactly, together with "How to convert a page" in `2026-09-28-demo-page-rollout-text-typography.md`, the markup for the do-it and scroll kinds in `2026-09-29-demo-page-kinds-do-and-scroll.md` (Tasks 1–3), and the lessons in the rollout's Global Constraints. Rotate In (`animations/02-entrance-and-exit/rotate-in/`) is the reference for everything a section does not mention. Text on a Path is the reference for a loop driven by animation frames, and Glitch Text and Wavy Text for "css" loops.
-
-## The kinds in this category
-
-| Kind | Pages |
-|---|---|
-| Loop, Pause (page) | 3D Model Orbit, Canvas Particle Effect, Fluid / Liquid Simulation, WebGL Shader Animation, Noise-Based Motion, Ray Marching / SDF Scene, GPGPU Particle System, Cloth / Soft-Body Simulation, Volumetric Smoke / 3D Noise, Morphing Blob |
-| Loop, Pause (css) | Glassmorphism Animated, Chromatic Aberration |
-| Do it | Parallax 3D Tilt (Hover it), 2.5D / Pseudo-3D (Hover it), Image Distortion on Hover (Hover it), 3D Flip Card (Click it) |
-| Scroll | Scroll-Driven 3D Rotation |
-| Plays once | SVG Path Animation |
-
-A page is a loop when something on it moves by itself with no end, even if the pointer also plays a part (the pointer then appears in the help line). A page is a do-it page only when nothing moves until the visitor or Show me moves it: a do-it page has no Pause, so under reduced motion anything that moved by itself could not be stopped. Every page keeps settings, so every page has a Try it step. Of the rollout spec's special cases, only "click demos play one click and return to rest" concerns this category (3D Flip Card).
-
-How to read a section:
-
-- **Sets in the demo** lists one value per choice, in the same order as the choices. A Speed row sets the script's variable and the CSS variable it names.
-- **Shown only when …** in the Control column means the setting's whole `div.hb-setting` gets the `hidden` attribute while it has no effect, so it also drops out of "Your settings".
-- Switches in Try it keep their default in the markup (`checked` when the default is on), as on Rotate In. Only the player bar's switches (Loop, Slow motion) start unchecked.
-- **Help lines.** "Default" for a loop is "It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement." For SVG Path Animation it is Rotate In's line. The Try it help line is the kind's: loops "Change a setting and see the difference as it moves."; SVG Path Animation "Change a setting and the animation plays again."; do-it pages "Change a setting, then try it again or press Show me."; the scroll page "Change a setting, then scroll again or press Play." (on do-it and scroll pages a setting change plays nothing by itself; the shared script only replays pages that have Replay).
-- **Pause (css)** means `data-hb-pause="css"` and **Pause (page)** means `data-hb-pause` without a value. The same goes for Slow motion and `data-hb-slowmo`.
-- **Speed** reads Slow · Normal · Fast, and today's default stays Normal. For a duration, Slow is about 1.6 times and Fast about 0.6 times the default; for a rate (steps a frame, time multipliers), it is the other way round.
-- **Swatches** use the Text & Typography palette, in this order, with each colour's name as its button's `aria-label`: Pink `#ff6f8b` · White `#f4f4f2` · Blue `#58a6ff` · Purple `#d2a8ff` · Green `#56d364` · Orange `#ffa657`. Every single colour picker here defaults to Blue `#58a6ff`, except Volumetric Smoke's, which keeps its own smoke colours (listed in its section).
-- **Category line:** the pages have none today. NN is the page's position on the home page: `06.01 · 3D &amp; Advanced` (3D Model Orbit) to `06.18 · 3D &amp; Advanced` (3D Flip Card).
-- **Titles:** four `<h1>`s differ from their home card names: Fluid / Liquid Simulation (card "Fluid Simulation"), Ray Marching / SDF Scene ("Ray Marching / SDF"), Cloth / Soft-Body Simulation ("Cloth Simulation") and Volumetric Smoke / 3D Noise ("Volumetric Smoke"). The titles stay as they are; pager links and See also links use the `<h1>`, as the page checks require.
-- **Accent:** every page uses `--ui-accent:#3fd6c4`, the colour sixteen of the eighteen pages already have. 3D Flip Card changes from `#b98cff` (its card keeps its purple; see its section) and Morphing Blob, which has none, gets it.
-- **Stage:** every page uses the default height. The old `--stage-h` values (620px; 480px, 420px, 400px or 380px on phones), the phone rules that made Chromatic Aberration, Glassmorphism Animated, Parallax 3D Tilt and SVG Path Animation `height:auto`, 3D Flip Card's own `clamp(360px,52vh,560px)` and Morphing Blob's `min(70vh,620px)`/`56vh` all go. A demo's own `.stage` rule keeps only what its content needs (`position:relative`, its background, flex centring, padding, `perspective`, `touch-action`, `cursor`); `flex:1`, `min-width`, `height`, `border` and `border-radius` go, because the page owns them. The shared `overflow:hidden` applies everywhere except the scroll page, whose own `overflow-y:auto` wins. `hb-dots` is used only on stages that paint one plain dark colour. On the shared stage (960×380 on a 1280×800 screen, 960×327 on a 1366×657 laptop, 707×440 on a tablet, 343×300 on a 375px phone and 288×300 on a 320px phone) three demos needed changes to fit: Glassmorphism Animated (cards in one row on phones), 2.5D / Pseudo-3D (a smaller scene) and 3D Flip Card (a card sized from the stage). Each was previewed at those sizes in headless Chrome.
-- **Small text on stages:** eyebrows and small capitals get 11px and `font-weight:600`; card body text gets 13px at `rgba(255,255,255,.72)`; Georgia, Arial Narrow and italics go. These are the Ambient & Background sheet's card rules.
-- **Class names:** no element on a stage may use the class names `seg` or `swatches`, because the shared stylesheet styles `.hb-page .seg` and `.swatches` for the Try it controls. No stage here uses them; the only `.seg` in this category is 3D Flip Card's old panel, whose rules go with the panel.
-- **Slow motion** multiplies movements and the timers that wait for them, never holds, on every kind of page, including Show me runs (3D Flip Card's 1200ms hold stays 1200ms) and SVG Path Animation's plays (its 1200ms hold stays).
-
----
-
-## Owner decisions and lessons that apply here
-
-- **Stage text uses the site font.** Nothing here is a typing effect.
-- **Pause stops at once, on every loop.** The ten page loops cancel their animation frame on `hb:pause` (the pattern below), which stops them at once. The two "css" loops are held by the shared class `hb-paused`, and neither has page timers. No loop here is a timer chain, so the Text sheet's `wait()`/`freeze()`/`thaw()` helper is not needed.
-- **Reduced motion** greys out Slow motion (and Loop on SVG Path Animation), starts every loop paused, and runs nothing by itself: no Show me on arrival, no automatic scroll, and SVG Path Animation's Replay runs once as on Rotate In. Pause/Play, Show me, Reset, Play and Back to top still work when pressed. See "Reduced motion" below for what that removes from these pages.
-- **Scroll and do-it pages show themselves once on arrival:** the shared script presses Show me or Play 400ms after load (not under reduced motion). The pages do nothing for this.
-- **Long names in the top bar** ("Cloth / Soft-Body Simulation", "Volumetric Smoke / 3D Noise", "Image Distortion on Hover") are cut with "…" by the shared stylesheet; the pages do nothing.
-- **Lessons from the Text & Typography reviews:** the `hb:pause` and `hb:input` listeners are registered at the top level of the page's inline script; the page reaches the player controls by their ids (`btn-pause`, `slow-tog`, `btn-demo`, `btn-reset`, `btn-play`, `loop-tog`), never by `data-hb-*`; a page never calls `pause()` or `play()` on a CSS keyframe animation; SVG Path Animation restarts its paths itself on every play (rebuilt hidden, a forced reflow, then drawn) and uses the pruning `later()`; Chromatic Aberration's typed text follows the typed-text rules (`trim()` decides blankness, blank falls back to the default, `textContent` only).
-
-## Canvas and WebGL loops (Pause "page")
-
-Ten pages move their picture with `requestAnimationFrame`: 3D Model Orbit, Canvas Particle Effect, Fluid / Liquid Simulation, WebGL Shader Animation, Noise-Based Motion, Ray Marching / SDF Scene, GPGPU Particle System, Cloth / Soft-Body Simulation, Volumetric Smoke / 3D Noise and Morphing Blob. Each follows Text on a Path; its section only adds what differs.
-
-- The loop keeps exactly one pending frame in `raf`. The function that starts it, `start()`, returns at once when `raf` is set; otherwise it forgets the time of the last frame and requests a frame. On Cloth / Soft-Body Simulation it is called `resume()`, because that page's own `start()` rebuilds the cloth (see its section).
-- The page listens for `hb:pause`, registered at the top level of its inline script. Paused: `cancelAnimationFrame(raf); raf=null;` and the picture on screen stays. Not paused: `start()` (`resume()` on Cloth), which carries on from the current state. The page keeps its own `paused` flag from this event; the old panel's Pause button, its label code and its flag handling go.
-- Each page's frame gate stays as it is today (`if(dt<16)return`), except on Canvas Particle Effect and GPGPU Particle System, which have no fixed gate any more: they look at every frame the screen offers and draw only when a Trails wash or a physics pass is due (see their sections).
-- **Clocks.** Where the movement follows a clock, the page keeps its own, which adds up each frame's time (capped, and counted afresh from each start), so Play never jumps. Where a speed multiplies the clock inside a shader (Ray Marching's camera, Volumetric Smoke's rise), the page adds up the speed-weighted step itself, so a new speed never makes the picture jump; the sections say which uniform replaces which product.
-- **The first picture:** the page draws a frame at load, before the loop starts, so a loop that is paused on arrival never shows an empty stage. The sections name the call.
-- **While paused,** a setting change or a resize draws the picture again so the change shows, without moving anything (a canvas that fades instead of clearing, as with Trails, is cleared first, so no ghost of the old picture stays under the new one). This is the loop rule "changing a setting while paused shows the new setting without starting the loop again". Most pages already do this ("repaint while paused"); the sections name the function. Listeners that watched the old `aside` for `input` now watch the Try it step for `click` and `change` (choice buttons send `click`).
-- **Slow motion (page):** while the switch is on, each frame moves things a third of the usual step, or adds a third of the frame's time to the page's clock. It takes effect from the next frame. Something that jumps straight to the pointer (3D Model Orbit's Follows the pointer, Fluid / Liquid Simulation's pointer blob) is left alone; something that glides after it or is pushed by it (Morphing Blob's drop, Canvas Particle Effect's dots) moves at a third of its speed like everything else.
-- **Pointer while paused:** the pointer's position is still recorded, but nothing on the stage moves until Play.
-- The fps badges, the counters and the shader-source panels go (the pages show no code). The "WebGL is unavailable" and "shader failed" messages stay, in the site font. Context-loss handling stays exactly as today.
-
-The browser tool (`tools/check-pages.mjs`) runs headless Chrome with `--disable-gpu`. A scratch check in that same Chrome found WebGL, WebGL 2 and `EXT_color_buffer_float` all available, and WebGL canvases appear in its screenshots, so its loop checks (the stage moves, Pause stops it, Play starts it) can see these stages.
-
-## Do-it pages (Show me)
-
-Four pages: Parallax 3D Tilt, 2.5D / Pseudo-3D, Image Distortion on Hover (step 1 "Hover it") and 3D Flip Card (step 1 "Click it").
-
-- The body is `<body class="hb" data-hb-kind="do" data-hb-autoplay>`. Step 1's title and help line are in the section, and every do-it help line ends with ", or press Show me." (a rule for every lane). The player bar holds the Show me button, and the Reset button where the section has one, exactly as in the do-it/scroll plan (Task 2). 3D Flip Card also has Slow motion (css).
-- **Show me** runs one example of the interaction, 2.5 to 3 seconds long, and returns the demo to rest (Image Distortion on Hover's fade ends about three seconds after its run). The run keeps one handle (its animation frame or its timer), so a second press restarts it cleanly and anything can stop it.
-- **Stopping a run:** the page listens for `hb:input` at the top level of its inline script. Only if a run is under way (its own handle is set: its frame or its timer, or on Image Distortion on Hover its start time, because that page's render loop keeps `raf` set while the pointer rests) does it stop the run, leaving the visitor in control; otherwise it does nothing. A tap sends `hb:input` twice, for `pointerdown` and then for `touchstart`, the second after the page's own `pointerdown` handler has acted, so an unconditional stop would undo what the finger has just done (flatten a card, start fading a distortion). Hovering sends no `hb:input` (the shared script sends it for presses, keys, wheels and touches only), so on the three Hover it pages the page's own `pointermove` handler also ends a run that is under way, for trusted events only (`e.isTrusted`), before it acts on the pointer.
-- **Reset** is there only where the demo keeps a state (2.5D / Pseudo-3D's camera, 3D Flip Card's turned card). Parallax 3D Tilt and Image Distortion on Hover return to rest by themselves.
-- **Settings** apply at once to what they change (a depth, a colour) and play nothing; the visitor sees them at the next interaction or Show me.
-- **Reduced motion:** nothing runs on arrival. Show me, Reset and the visitor's own pointer still work, so CSS rules that would stop them go (Parallax 3D Tilt's `transform:none!important`), while rules that only swap an animation for an instant change stay (3D Flip Card's face fade).
-
-## The scroll page
-
-Scroll-Driven 3D Rotation: `<body class="hb" data-hb-kind="scroll" data-hb-autoplay>`, step 1 "Scroll it" with the default help line "Scroll inside the box, or press Play and it scrolls for you.", and the Play and Back to top buttons from the do-it/scroll plan (Task 3). The scroller is the `.stage` itself. No Slow motion.
-
-## Reduced motion for full-stage effects
-
-Today almost every page handles reduced motion itself:
-
-- script checks that draw one still frame and never start the loop (3D Model Orbit, Canvas Particle Effect, Fluid / Liquid Simulation, WebGL Shader Animation, Noise-Based Motion, Ray Marching / SDF Scene, GPGPU Particle System, Image Distortion on Hover, Cloth / Soft-Body Simulation, Volumetric Smoke / 3D Noise, Morphing Blob);
-- CSS rules that remove the keyframe animations (Glassmorphism Animated, Chromatic Aberration), pin a card flat (Parallax 3D Tilt), or switch off every animation and transition on the whole page (`*{…animation:none!important;transition:none!important}` on Fluid / Liquid Simulation and Cloth / Soft-Body Simulation, which would also reach the shared page around the demo).
-
-All of these go:
-
-- the shared script now starts every loop paused under reduced motion, and a visitor who presses Play or Show me has asked to see the effect;
-- the still-frame checks and the removal rules would stop Play or Show me from showing anything, and the browser check fails a loop that does not move after Play;
-- the page-wide rules also change the shared page.
-
-What stays: the still picture (every loop draws a full frame at load and is paused there on arrival), the scroll page's own "no easing under reduced motion" check, SVG Path Animation's rule that shows the drawing complete, and 3D Flip Card's face fade. The prompts keep their reduced-motion sentence, which is about the visitor's own site.
-
-## Heavy effects and their phone fallbacks
-
-CLAUDE.md asks for 60 fps on a mid-range phone, and a reduced-quality fallback on phones for heavy effects. Each section has a **Phone fallback** line: what the demo already does, or the smallest change that keeps it smooth. "On phones" means a screen 600px wide or less, or 500px tall or less, so a phone held sideways counts too: `matchMedia('(max-width:600px),(max-height:500px)')`, or the same two tests written out with `innerWidth` and `innerHeight`. Glassmorphism Animated's card layout is the one exception and looks at the width alone (`@media(max-width:600px)`); held sideways it still measured 182 compositor frames in 3 seconds.
-
-The WebGL pages already draw fewer pixels on phones (a lower pixel ratio, and fewer ray steps on the two ray-marching pages), and GPGPU Particle System starts with fewer particles; those stay, except that Volumetric Smoke needed more (its section has the numbers, measured with GPU rendering on an Intel UHD chip). Their cost is on the graphics chip, which a headless measurement in software cannot stand in for.
-
-The canvas and SVG pages were measured in a scratch run: headless Chrome at 375×812 with pixel ratio 2, the CPU slowed four times (roughly a mid-range phone), the old demos with their stage set to a phone stage (351×300 in the first runs, 343×300, the shared phone stage, in the later Canvas Particle Effect runs), recording how long each animation-frame callback runs and how many frames were drawn in 3 seconds (180 is a full 60 fps). The browser draws the canvas in software there, so frame counts are pessimistic, but they show where the work is.
-
-| Page | What was measured | Callback median | Frames in 3 s |
-|---|---|---|---|
-| Canvas Particle Effect | today's drawing, 250 dots (today's phone default), 100px links | 140 ms | 8 |
-| | today's drawing, 100 dots, 100px links | 18.5 ms | 48 |
-| | today's drawing, 60 dots, 70px links | 3.7 ms | 174 |
-| | links batched in six paths, 40 or 60 dots, 100px links | 1.7–2.4 ms | 159–181 |
-| | links batched, 80, 100 or 120 dots, 100px links | 3.3–3.8 ms | 81–90 |
-| | links batched, 60 dots, 150px links | 2.0–2.1 ms | 114–131 |
-| | links batched, 200 dots, 100px links | 8.1 ms | 30 |
-| | links batched, tablet stage 707×440 (pixel ratio 2, CPU ×4): 60 / 90 / 120 dots | 2.1 / 3.1 / 3.1 ms | 180 / 122 / 111 |
-| | links batched, tablet stage: 250 / 500 dots | 8.4 / 19.4 ms | 33 / 9 |
-| | today's drawing, 1000×440 laptop stage at full CPU, 500 dots | 13.5 ms | 96 |
-| | links batched, 960×380 desktop stage at full CPU and pixel ratio 1: 250 / 500 / 800 dots | 2.6 / 2.9 / 5.0 ms | 181 / 177 / 113 |
-| Cloth / Soft-Body Simulation | 16 × 12 points (today's phone default) | 5.2 ms | 102 |
-| | 24 × 18 | 8.1 ms | 82 |
-| | 40 × 30 | 29.2 ms | 43 |
-| Noise-Based Motion | today's 20 columns on a phone stage (340 dots) | 8.9 ms | 98 |
-| | 12 columns (120 dots) | 3.7 ms | 179 |
-| | the blob | 0.8 ms | 181 |
-| Morphing Blob | 4, 6 or 9 blobs, with the SVG filter | 0.5–0.8 ms | 181 |
-| 2.5D / Pseudo-3D | a continuous camera pan | 0.6 ms | 176 |
-
-Canvas Particle Effect's cost is its links: one `stroke()` per line, thousands a frame. Its section batches the links and draws far fewer dots on phones and tablets; every phone choice draws close to a full 60 frames a second (159 to 181 of 180 frames in 3 s) with Short and Medium links. Frame counts from 40 to 120 dots were measured twice and ranged as shown. Noise-Based Motion places its dots by columns, so a narrow phone stage gets more dots than a laptop; its section places them by spacing instead.
-
-## Pointer and touch
-
-- Loops that follow the pointer take its position from `pointermove`, so a tap did nothing. 3D Model Orbit, Fluid / Liquid Simulation and WebGL Shader Animation also take it from `pointerdown`; Canvas Particle Effect, which uses touch events so a finger keeps working while the page scrolls, also takes it from `touchstart`. Morphing Blob and Cloth / Soft-Body Simulation already handle touch.
-- Stages keep today's `touch-action`: `pan-y` where a sideways drag moves something and an up-and-down drag should still scroll the page (3D Model Orbit, Fluid / Liquid Simulation, WebGL Shader Animation, 2.5D / Pseudo-3D), and `none` where a finger must drag (Cloth / Soft-Body Simulation, Morphing Blob, Image Distortion on Hover's canvas, Parallax 3D Tilt's card).
-- None of these is a CSS `:hover` rule. The only hover-only extra is 3D Flip Card's idle tilt, which stays off on touch screens as today (`@media(hover:none)`); the flip itself works by tap and keyboard.
-
-## Category README
-
-`animations/06-3d-advanced/README.md` says "All demos include an FPS counter and a pause button." After the rollout neither is true (the fps badges go, and do-it and scroll pages have no Pause). It is not part of any page conversion; the lane's final fix wave should correct that sentence.
-
----
-
-## 3d-model-orbit — 3D Model Orbit
-
-- **Kind:** loop. The shape keeps turning; there is no end.
-- **Description:** A lit 3D shape spins, or turns to face your pointer. Best for product views.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the WebGL loop as in the preamble (`render(ts)`, 16ms gate). Each drawn frame:
- - with Movement on Spins, `ry += SY*.01*s` and `rx += SX*.01*s*(Math.sin(clock*.0003)*.5+.5)`, where `s = Math.min(dt,50)/FRAME*(slow ? 1/3 : 1)` is the frame's time in 60 Hz frames (`FRAME = 1000/60`), a third of that while Slow motion is on, and `clock` is the page's own clock (in place of today's `ts`, see the preamble), which adds `s*FRAME` (that is, `Math.min(dt,50)` times 1, or a third) for each drawn frame; the forward roll speeds up and slows down over about 21 seconds;
- - with Follows the pointer, `rx = mouseNY*1.2` and `ry = mouseNX*1.5`;
- - then `draw()`.
-
- **The first picture:** `draw()` runs once at load, after `init()` and `resize()`. **While paused,** every setting and a resize call `draw()` (today's `if(gl&&!raf)draw()` calls, which are now true only while paused).
-- **Slow motion:** while the switch is on, both spin steps are divided by 3 and the page's clock adds a third of each frame's time, so the roll's speed wave takes three times as long too, from the next frame. Following the pointer is not slowed.
-- **Reduced motion:** `motionOk` goes, with its one-frame branch at load and the "still follows the pointer" line in the `pointermove` handler (see the preamble).
-- **Stage font:** no text on the stage; the WebGL message uses the site font.
-- **Stage:** only the canvas. The fps and shape badges (`.hud`) go. `hb-dots`: no (the canvas clears to its own dark blue). Default height. `touch-action:pan-y` stays.
-- **Phone fallback:** none needed. The largest shape, the ring, has 1,280 triangles and each pixel gets one light calculation; the canvas already caps the pixel ratio at 2.
-- **Touch:** `pointerdown` also sets the pointer's position (today only `pointermove` does), so with Follows the pointer a tap turns the shape toward the finger and a sideways drag keeps turning it.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shape | Choice buttons | Cube · Sphere · Ring · Pyramid | Cube | The object that is drawn and lit. | `loadGeometry('cube' / 'sphere' / 'torus' / 'tetra')`, then `rx = .3` (the tilt it starts with) and `ry = 0`, so a ring opens up instead of showing edge-on and the shapes turn visibly (a plain sphere looks much the same from every side); today's menu handler set both to 0; pressing the shape that is already chosen does nothing (it would reset the tilt and turn) |
-| Movement | Choice buttons | Spins · Follows the pointer | Spins | Or it turns to face your pointer or finger. | `MODE`: `'orbit'` / `'mouse'`; also shows Speed and Tumbles as it spins only with Spins |
-| Speed | Choice buttons; shown only when Movement is Spins | Slow · Normal · Fast | Normal | How fast it spins. | `SY`: 0.5 / 0.8 / 1.3 and `SX`: 0.12 / 0.2 / 0.32 (`SX` stays 0 while Tumbles as it spins is off) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Tumbles as it spins | Switch; shown only when Movement is Spins | on / off | on | Also rolls it forward, so the top and bottom show. | on: `SX` as Speed sets it; off: `SX = 0` |
-| Distance | Choice buttons | Close · Medium · Far | Medium | How close the camera is; closer looks bigger. | `DIST`: 2.6 / 3 / 4.2 |
-| Color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The color of the object. | `COLOR` from `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657`, each channel ÷ 255 as today's picker handler does |
-| Edges only | Switch | on / off | off | Draws the triangles' edges instead of a lit surface. | `WIRE` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps and shape badges.
- - The Mode and Object menus. They become Movement and Shape.
- - The Spin X and Spin Y sliders, which could reach zero. They become Speed and Tumbles as it spins.
- - The Camera Distance slider. It becomes Distance. Close is 2.6: closer than about 2.5, the turning cube's corners leave the stage at some angles.
- - The colour picker. It becomes the Color swatches.
- - "Wireframe" becomes Edges only.
-- **Good for:** Product showcases · Hero sections · Logos · 3D previews · **Avoid on:** Long reading pages · Low-power devices
-- **Prompt:**
-
- > Add a spinning 3D object to [the product or shape you want to show]. Draw it with WebGL: store the shape as triangles and light every point with a soft base light, a direct light and a shiny highlight, so it reads as solid. Turn it around its own axis so every side comes into view, or let it turn to face the pointer, which a tap or a sideways drag should also do on touch screens. Change its size by moving the camera closer or further, not by changing the lens. If the visitor has reduced motion turned on, show the object still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A 3D model orbit shows a solid-looking object turning in the browser. The shape is stored as triangles, and WebGL lights every point of it with a soft base light, a direct light and a shiny highlight, so each side reads as solid as it comes into view. It is the basic pattern behind 3D product viewers, drawn here without a 3D library.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Shape | Cube | The object that is drawn: a cube, a sphere, a ring or a four-sided pyramid |
- | Movement | Spins | Spins turns it by itself; Follows the pointer turns it to face your pointer or finger |
- | Speed | Normal | How fast it spins: slow is about 17°, normal 27° and fast 45° a second, on any screen |
- | Tumbles as it spins | on | Also rolls it forward, at a speed that rises and falls, so the top and bottom come into view |
- | Distance | Medium | How far away the camera is: close looks bigger, far looks smaller; the lens stays the same |
- | Color | Blue | The object's color; the lighting adds the shading and the highlight |
- | Edges only | off | Draws the edges of the triangles the shape is made of, instead of its lit surface |
-
-- **README See also:**
- - [Scroll-Driven 3D Rotation](../scroll-driven-3d-rotation/) — scrolling turns the object instead of time
- - [Parallax 3D Tilt](../parallax-3d-tilt/) — a flat card leans in 3D toward the pointer
- - [WebGL Shader Animation](../webgl-shader-animation/) — the same WebGL setup, painting a pattern instead of a shape
-- **README How it works:** unchanged, except the fragment shader's view vector line, which becomes `vec3 V = normalize(-vP);` as on the page (`vP` is already in camera space, so the camera is at the origin); and the vertex shader's uniform comment reads `/* model-view-projection, model-view */`, because `uM` holds the model-view matrix. The frame-rate fix (below) adds a "**Turning**" paragraph and a snippet (`FRAME`, `step`, `ry`, `rx`) after the projection snippet.
-- **README Production notes:** unchanged, except that the frame-rate fix (below) adds a bullet after the first: "**Time, not frames**: a fixed turn per frame would spin the shape twice as fast on a 120 Hz screen and half as fast on a 30 Hz phone. Scale each turn by the time since the last frame, cap that time (this demo uses 50 ms) so a tab that comes back does not lurch, and let a returning tab start from its next frame."
-- **Category line:** `06.01 · 3D &amp; Advanced`
-- **Pager:** Previous: none · Next: Scroll-Driven 3D Rotation (`../scroll-driven-3d-rotation/`)
-- **Frame-rate fix (wrap-up):** each drawn frame turns the shape by `s`, the time since the last drawn frame in 60 Hz frames (`FRAME = 1000/60`, at most 50 ms), a third of that while Slow motion is on, so the spin and the roll keep the same speed on a 30, 60 or 144 Hz screen. Following the pointer is the same at every rate. The 16 ms gate stays, as a cap of 60 drawn frames a second. The first frame after a start, a Play or a return from a hidden tab (a `visibilitychange` listener sets the last frame time back to `null`) only takes the time. README: the "Turning" paragraph and snippet in How it works, the Speed row of Key parameters (now "… a second, on any screen") and a "Time, not frames" Production note.
-
----
-
-## scroll-driven-3d-rotation — Scroll-Driven 3D Rotation
-
-- **Kind:** scroll. Scrolling inside the stage turns the cube; nothing moves on its own.
-- **Description:** Scrolling turns a 3D cube from pose to pose. Best for product tours.
-- **Step 1:** Scroll it — default help line: "Scroll inside the box, or press Play and it scrolls for you."
-- **Scroller:** the `.stage` itself. Its own rule keeps `overflow-y:auto;overflow-x:hidden`, which wins over the shared `overflow:hidden`; no `data-hb-scroller`.
-- **What scrolling shows:** the cube stays pinned in the middle of the stage while the stage scrolls through content four stage-heights tall. The scroll position, from the top to the end, moves the cube through four poses in turn: a quarter turn to the side, a forward tilt, growing larger, then turning round to show its back. It glides between them while Smooth follow is on. Scrolling back runs it in reverse.
-- **Player bar:** Play · Back to top (the shared script runs both). No Slow motion.
-- **Sequence:** unchanged, apart from the frame-rate fix below: `scroll` → `onScroll()` → progress from 0 to 1 → `applyRotation(p)`, then `tick(now)` eases the cube toward its pose while Smooth follow is on (a tenth of the gap left for every 1/60 s), or `render()` sets it at once. The ResizeObserver stays. Back to top jumps the stage to its top, and the `scroll` event that causes brings the cube back to its first pose.
- - `onScroll()` loses its readout lines (the progress bar, the percentage and the Scroll Progress slider).
- - `render()` loses the Rotation X, Rotation Y and Scale readouts.
- - `applyRotation()` loses the chapter dots, name and description.
-- **Reduced motion:** the page's own `reduceMotion` check stays: under reduced motion the cube follows the scroll exactly, with no gliding. The shared script scrolls nothing by itself, and Play still works. The rule `.obj-wrap{transition:none!important}` stays; `.prog-fill`'s goes with the bar.
-- **Stage font:** site font. The face labels keep 11px, 1px letter spacing and their blue; "BOT" becomes "BOTTOM". Each label sits in a `span` inside its face, and the span hides when the face turns away (`backface-visibility:hidden`, with `transform-style:preserve-3d` on the face). The faces are see-through, so without that each label shows, mirrored, behind the one in front of it, and "LEFT" over a reversed "RIGHT" cannot be read at the side pose.
-- **Stage:**
- - `.scroll-content` becomes `height:400%` and `.sticky-wrap` `height:25%` (a quarter of the content is one stage height, the pinned frame), in place of the `--stage-h` sums. Checked: on a phone stage the content is 1,192px and the pinned frame 298px, the stage's inner height.
- - The info panel (Progress, Chapter dots, Stage name and its description) and the progress bar at the top go, so `.obj-panel` fills the frame and centres the cube. The cube is 120px and up to 168px while grown, which fits the 300px phone stage.
- - `hb-dots`: yes. Default height. The stage sets `color-scheme:dark`, so a classic scroll bar (Windows draws a 15px one that stays visible) is dark, not a light grey bar on the dark stage.
-- **Phone fallback:** none needed: one CSS cube of six faces.
-- **Touch:** touch scrolling inside the stage works as it does today.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Turn amount | Choice buttons | Less · Normal · More | Normal | How far each pose turns the cube. | `mult`: 6 / 10 / 16 (every pose's angles × mult ÷ 10), then `onScroll()` |
-| Smooth follow | Switch | on / off | on | The cube glides to catch up instead of jumping. | `smooth-tog` checked: `applyRotation()` eases with `tick()` / sets the pose at once; then `onScroll()` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note.
- - The Scroll Progress slider, a readout that could not be moved, and the Rotation X, Rotation Y and Scale readouts.
- - The info panel on the stage and the progress bar.
- - Reset scroll. Back to top replaces it.
- - The Rotation Multiplier slider. It becomes Turn amount.
- - "Smooth scrub (lerp)" becomes Smooth follow.
-- **Good for:** Product tours · Device launches · Landing pages · Storytelling sections · **Avoid on:** Short pages · Forms and dashboards
-- **Prompt:**
-
- > Add a scroll-driven 3D rotation to [the product or object you want to show]. Pin the object in view while the visitor scrolls through a tall section, and turn the scroll position, from the top of the section to its end, into a series of poses: turned to one side, tilted forward, larger, then turned round to show its back. Blend smoothly between neighboring poses so scrolling back plays it in reverse, and when the settings include it, let the object glide to catch up instead of jumping with the scroll. If the visitor has reduced motion turned on, follow the scroll exactly, with no gliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Scroll-driven 3D rotation ties an object's turn to the scroll position. The object stays pinned in view while the visitor scrolls through a tall section, and each stretch of scrolling moves it on to the next pose: turned, tilted, grown, then showing its back. Scrolling back runs it in reverse, the way many product pages show off a new device.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Turn amount | Normal | How far every pose turns the cube: less is 0.6, normal 1 and more 1.6 times the planned angles; at normal the last pose shows the cube's back |
- | Smooth follow | on | The cube closes a tenth of the gap to its pose for every sixtieth of a second, so it glides after the scroll and catches up in the same time on every screen; off, it follows the scroll exactly |
-
-- **README See also:**
- - [3D Model Orbit](../3d-model-orbit/) — time turns the object instead of scrolling
- - [Scrub Animation](../../01-scroll-based/scrub-animation/) — scroll position drives any animation, without 3D
- - [Sticky Section](../../01-scroll-based/sticky-section/) — the pinning that keeps the object in view
-- **README How it works:** unchanged, except that the frame-rate fix (below) changes the Smooth follow snippet (`FRAME`, `last`, `dt`, `ease = 1 - Math.pow(0.9, dt / FRAME)`) and adds a paragraph after it on the share to close in one frame, and a sentence saying that the first frame after the loop starts again counts as one 1/60 s.
-- **README Production notes:** unchanged, except that the frame-rate fix (below) adds a bullet after the GSAP ScrollTrigger one: "**Time, not frames**: easing that closes a fixed share of the gap on every frame follows the screen's refresh rate. Scale the share by the time since the last frame, as above, and cap that time (this demo uses 50 ms)."
-- **Category line:** `06.02 · 3D &amp; Advanced`
-- **Pager:** Previous: 3D Model Orbit (`../3d-model-orbit/`) · Next: Parallax 3D Tilt (`../parallax-3d-tilt/`)
-- **Frame-rate fix (wrap-up):** `tick(now)` eases the cube by `ease = 1 - .9 ** (dt / FRAME)` of the gap to its pose, with `FRAME = 1000/60` and `dt` the time since the last frame (at most 50 ms), so a tenth of the gap closes for every 1/60 s and the cube catches up in the same time on a 30, 60 or 144 Hz screen. `applyRotation()` sets the last frame time to `null` whenever it starts the loop again, and a first frame with no earlier time counts as one 1/60 s. At 60 Hz nothing changes. README: the snippet and its paragraph, the Smooth follow row of Key parameters and a "Time, not frames" Production note.
-
----
-
-## parallax-3d-tilt — Parallax 3D Tilt
-
-- **Kind:** do it. The card moves only when the pointer, a finger or Show me moves it.
-- **Description:** A card tilts toward your pointer, and a light slides over it. Best for cards.
-- **Step 1:** Hover it — "Move your pointer over the card, drag a finger across it, or press Show me."
-- **Player bar:** Show me. No Reset: the card settles flat by itself when the pointer leaves. No Slow motion: the tilt follows the pointer directly.
-- **Show me:** one run of 3 seconds. A pretend pointer starts from where the card is, circles the card's middle one and a half times, reaching 80% of the way to the edges halfway through, and ends in the middle. For progress p from 0 to 1, `r = 0.4*Math.sin(Math.PI*p)` and `a = 3*Math.PI*p`, and each animation frame calls `tilt(x0*(1-p) + r*Math.cos(a), y0*(1-p) + r*Math.sin(a))`, where x0 and y0 are the card's tilt when the run starts (the last values `tilt()` was given; 0 after `onLeave()`). At the end it calls `onLeave()`, so the card settles flat over Return speed. A second press starts a new run from where the card is, as on 2.5D / Pseudo-3D.
-- **Stopping a run:** on `hb:input`, only if a run is under way (its frame handle is set): cancel the frame and call `onLeave()`; otherwise do nothing, so a tap does not flatten the card under a resting finger. The card's `pointermove` handler also ends a run that is under way the same way, for the visitor's own (trusted) events, then tilts the card to the pointer.
-- **Sequence:** `onMove(e)` becomes `tilt(x, y)` (x and y from −0.5 to 0.5) plus a small `onMove(e)` that works out x and y from the event and calls it. `tilt()` keeps the last x and y it was given (Show me starts from them), and `onLeave()` sets them back to 0. `onMove()` holds x and y between −0.5 and 0.5 (`edge()`): a finger dragged off the card keeps sending its moves to the card, and without the hold the card would lean without limit. Apart from the next bullet, everything else runs as today: `pointerdown` and `pointermove` on the card tilt it, and `pointerleave` and `pointercancel` call `onLeave()`.
-- **Only `transform` and `opacity` change while the card follows the pointer, a finger or Show me (fix round 1).** CLAUDE.md's rule "transform and opacity only — never animate `box-shadow`" governs over "as today" (the coordinator's ruling for this page, following the one on Task 7 that CLAUDE.md's rules govern over the sheet). Today's `tilt()` wrote `card.style.boxShadow` and rewrote the shine's gradient on every frame, and the shadow was part of the card's transition; either repaints the whole card. A trace of 1.5 s of Show me (phone stage, 375×812 at pixel ratio 2) showed 183 paint events and 98 to 135 raster tasks (about 250 ms of raster time); after the change it shows 4 paint events and 16 raster tasks (about 10 to 18 ms), and on a 1280×800 stage 4 paints against 181 to 185.
- - The card keeps its resting CSS shadow (`0 20px 60px rgba(0,0,0,.6)`), which turns with the card. Both writes to `boxShadow` go (`tilt()` and `onLeave()`), and the transition is `transform var(--reset-dur) ease` only.
- - The shine is one fixed gradient on a layer of its own: `.card-shine{position:absolute;left:0;top:0;width:var(--shine-d,0);height:var(--shine-d,0);margin:calc(var(--shine-d,0px) / -2) 0 0 calc(var(--shine-d,0px) / -2);background:radial-gradient(circle closest-side,rgba(255,255,255,.18) 0%,transparent 65%);opacity:0;pointer-events:none;transition:opacity .3s;will-change:transform}`, a square twice as wide as the card's diagonal with its middle on the card's top left corner (the card's overflow clip clips it: `overflow:hidden;overflow:clip`, hidden first for a browser without clip, and clip leaves the card no scroll box, so a drag that selects text cannot move the 376×326px of hidden range the card's contents and orbs span, against the card's 338×238px). `tilt()` reads `W = card.clientWidth` and `H = card.clientHeight` before it writes the card's transform, sets `--shine-d` (`D = 2*Math.hypot(W,H)`) on the card only when it changes, and moves the layer with `shine.style.transform = translate((x+.5)*W px, (y+.5)*H px) scale(2*R/D)`, where `R = Math.hypot((.5+Math.abs(x))*W, (.5+Math.abs(y))*H)` is the radius today's gradient has (a `circle` reaches the farthest corner). The Shine switch, `onLeave()` and the reduced-motion rule still work on the shine's `opacity`.
- - The card and the light look as before. Against the page as it was (shadow and gradient written every frame), at eight poses (two corners, the middle and five others), three pairs of settings (Medium and Medium, Large and Strong, Small and Subtle) and stages of 1280×800, 375×812 (pixel ratio 2) and 1280×590, no pixel of the stage differs by more than 27 levels of a channel, the mean difference is under 1.1 levels, and at most 0.45% of the pixels differ by more than 8 levels. Those pixels lie within 2px of the card's edge or outside it, where the edge blends with the shadow just outside it (in 36 pictures, none deeper inside the card differs by more than 8 levels): at the middle pose the old shadow was centred under the card and the CSS one falls 20px below it.
-- **Reduced motion:** Show me does not run on arrival (the shared script). The demo's reduced-motion rule loses `transform:none!important` on the card and the orbs and `opacity:0!important` on the shine, which would stop Show me and the visitor's own tilt. What stays is `.tilt-card{transition:none!important}` and `.card-shine{transition:none!important}`, so the card snaps flat when the pointer leaves instead of easing back.
-- **Stage font:** site font. `.card-h` drops Georgia and the italic and gets `font-weight:700`. `.card-over` gets 11px, `font-weight:600` (was 9px) and `rgba(255,255,255,.7)` (was .4, which measures 2.3 to 3.8:1); `.card-sub` gets 13px and `rgba(255,255,255,.9)` (was 11px at .55) with `text-wrap:pretty`, so the phone card does not leave "it." alone on a third line. The first choice for `.card-sub`, .72, measured 3.6:1 with the pointer beside the purple orb (its glow and the light both under the words), 4.44:1 beside the blue orb and 5.1:1 at rest; .9, with the purple orb at `rgba(210,168,255,.2)` (was .25), holds at least 4.95:1 for the card line, 5.2:1 for the over-line and 7.4:1 for the title in every pose measured.
-- **Stage:**
- - The card stays, with its shine and its two floating orbs. Card text: over-line "Feature card"; title "Three-dimensional perspective"; line "The card leans toward your pointer, and the light follows it." (was "Mouse position maps to rotateX and rotateY. The highlight follows the virtual light source.").
- - The readout on the card and the "Move or drag the card →" line go.
- - The stage keeps `background:#060a10`, its flex centring and `perspective:var(--perspective)`. `hb-dots`: yes. Default height: the card is 240×240px on phones (30px of room above and below on the 300px stage) and 340×240px on a laptop. Its height is `min(240px,86%)`, which is 240px on every stage of 280px or more and 222px on the 258px stage of a 1280×590 window and of a phone held sideways: with Large and Strong the corners of a 240px card left that stage by up to 6px, now they stay at least 4.2px inside (10.9px with the default settings).
-- **Phone fallback:** none needed: one card moved with 3D transforms.
-- **Touch:** as today: the card has `touch-action:none`, so dragging a finger over it tilts it and a tap tilts it once toward the finger. A finger dragged off the card leans it no more than at its edge (`edge()`, above).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Tilt amount | Choice buttons | Small · Medium · Large | Medium | How far the card leans at its edges. | `maxTilt`: 8 / 15 / 25 (degrees; the pointer's position runs from −0.5 to 0.5, so the card leans half that at its edges) |
-| 3D depth | Choice buttons | Subtle · Medium · Strong | Medium | Strong looks closer and more dramatic. | `--perspective`: 1500px / 1000px / 500px |
-| Shine | Switch | on / off | on | A soft light follows the pointer across the card. | `shineOn` true / false (off also hides the shine at once, as today) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Return speed | Choice buttons | Slow · Normal · Fast | Normal | How quickly the card settles flat again. | `--reset-dur`: 650ms / 400ms / 250ms |
-| Tilts away from the pointer | Switch | on / off | off | Leans the other way, as if you pressed it. | `invert` true / false |
-| Grows a little | Switch | on / off | on | Lifts the card slightly while it tilts. | `scaleOn` true / false (`scale(1.04)` / `scale(1)`) |
-
-- **Removed:**
- - The note.
- - The RotateX and RotateY readouts, and the readout on the card.
- - The card's "Move or drag the card →" line. The help line says it.
- - The Max Tilt Angle, Perspective and Reset Duration sliders. They become Tilt amount, 3D depth and Return speed.
- - "Shine highlight", "Invert tilt" and "Subtle scale on hover" become Shine, Tilts away from the pointer and Grows a little.
-- **Good for:** Feature cards · Pricing cards · Portfolio tiles · Game cards · **Avoid on:** Text-heavy cards · Dense grids
-- **Prompt:**
-
- > Add a 3D tilt to [the card you want to bring to life]. As the pointer moves over the card, rotate the card slightly around its horizontal and vertical axes according to where the pointer is, and give its container a 3D perspective so the tilt has depth. When the settings include it, move a soft light across the card with the pointer, as if it catches the light. On touch screens, dragging a finger across the card should tilt it the same way. When the pointer leaves, let the card settle back flat. If the visitor has reduced motion turned on, keep the card flat. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A 3D tilt makes a flat card lean toward the pointer, as if you were looking at a real card from different angles. The card's container gives the scene depth, and a soft light slides across the card with the pointer, which completes the illusion. The browser's own 3D transforms do it, with no 3D library.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Tilt amount | Medium | How far the card leans at its edges: small is 4°, medium 7.5° and large 12.5°; much more starts to feel unsteady |
- | 3D depth | Medium | How close the viewer seems: subtle is 1500px, medium 1000px and strong 500px; closer makes the lean more dramatic |
- | Shine | on | A soft light follows the pointer across the card, like light catching a real card |
- | Return speed | Normal | How long the card takes to settle flat when the pointer leaves: slow is 650ms, normal 400ms and fast 250ms |
- | Tilts away from the pointer | off | Leans the card away from the pointer instead, as if you were pressing on it |
- | Grows a little | on | Scales the card up by 4% while it tilts, which reads as lifting it toward you |
-
-- **README See also:**
- - [3D Model Orbit](../3d-model-orbit/) — a real 3D object drawn with WebGL
- - [Hover State Animation](../../04-micro-interactions/hover-state/) — flat hover feedback, without the 3D
- - [2.5D / Pseudo-3D](../2-5d-pseudo-3d/) — layers at different depths move with the pointer
-- **README How it works:** two edits, so the prose and the snippet match the demo and Key parameters:
- - "The card's `rotateX`/`rotateY` are computed from cursor position relative to the card's center, normalized to ±maxAngle:" becomes "The card's `rotateX`/`rotateY` are computed from the cursor's position relative to the card's centre, normalized to ±0.5, then scaled by MAX, so the card leans MAX/2 at its edges:".
- - In the first snippet, `scale(1.03)` becomes `scale(1.04)`, matching the demo and Grows a little.
- - The Shine highlight snippet becomes the fixed gradient (CSS) and its `translate()` and `scale()` line; the Reset transition CSS loses `box-shadow 400ms ease`; and after those comes a Show me paragraph with its snippet (the `step()` function that calls `tilt()`), ending "A press, a finger or a wheel turn over the stage, or the pointer moving over the card, cancels the frame and flattens the card, so the visitor is always in control." (nothing in the stage takes focus, so a key press cannot reach it).
-
- The rest is unchanged.
-- **README Production notes:** the Reduced motion bullet becomes: "**Reduced motion**: the demo does not tilt on its own, and the card snaps flat when the pointer leaves instead of easing back. In production, keep the card flat for these visitors." In the Performance bullet, everything after its first sentence becomes: "Keep everything else that follows the pointer to `transform` and `opacity` as well: the demo moves its light as a layer (see Shine highlight) and leaves the card's shadow fixed in CSS, where it turns with the card. Rewriting a gradient or a `box-shadow` on every move repaints the whole card each frame, which shows on phones and adds up across a grid." The rest is unchanged.
-- **Category line:** `06.03 · 3D &amp; Advanced`
-- **Pager:** Previous: Scroll-Driven 3D Rotation (`../scroll-driven-3d-rotation/`) · Next: Canvas Particle Effect (`../canvas-particle-effect/`)
-
----
-
-## canvas-particle-effect — Canvas Particle Effect
-
-- **Kind:** loop. The dots drift forever.
-- **Description:** Dots drift, link up when close, and dodge your pointer. Best for tech sites.
-- **Watch it help line:** It moves by itself, and the dots move away from your pointer or finger. Pause it to look closely, or turn on slow motion.
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble (`loop(t)`, with no fixed gate: a frame is drawn only when a Trails wash is due, see the frame-rate fix below). Each drawn frame runs `update(k)` on every particle (the pointer's push or pull within 120px, the speed cap, the move, the bounce), then `draw(washes)`.
- - **The links in six batches:** `draw()` puts every link into one of six paths by its opacity step and strokes each path once, in place of one `stroke()` per link. For a pair closer than Link distance, `k = Math.min(5, Math.floor((1 - d2/d2max) * 6))` picks the path, and path k is stroked at opacity `(k + 0.5) / 6 * 0.4` (today's opacity, `(1 - d2/d2max) * 0.4`, in six steps). `ctx.lineWidth=.5` stays, set once before the six strokes. The dots are drawn as today.
- - **The first picture:** `draw()` runs at load, after `spawn()`. **While paused,** every setting and a resize call `redraw()`, which clears the canvas and then calls `draw()` (today's `if(paused)draw()` calls). With Trails on, `draw()` only lays a 15% wash over what is already there, so without the clearing a new Link distance, number of dots or color would show on top of the old picture.
- - **The resize handler** returns at once when the stage's size has not changed (`if(stage.clientWidth===W&&stage.clientHeight===H)return;`, as on Cloth / Soft-Body Simulation), so a phone's address bar showing or hiding does not scatter the dots again.
-- **Slow motion:** while the switch is on, `update(k)` gets a third of its usual `k`: it moves each particle by a third of its velocity (`this.x += this.vx*k`, and the same for y), and the pointer's push or pull adds a third of today's amount, from the next frame. The speed cap stays. The Trails wash is not slowed (see the frame-rate fix below).
-- **Reduced motion:** the page's reduced-motion branch (paused at load with one frame drawn) goes (see the preamble).
-- **Stage font:** no text on the stage.
-- **Stage:** only the canvas. The fps badge goes. `hb-dots`: no (its dots would mix with the particles). Default height.
-- **Phone fallback:** the number of dots depends on the size of the screen, checked at each `spawn()` (today's `innerWidth<=600` test only lowered the default to 250): up to 600px wide, or up to 500px tall (a phone held sideways), 30 · 45 · 60; otherwise up to 1024px wide (tablets) 60 · 90 · 120; wider 250 · 500 · 800. Measured with the batched links on the throttled phone (see the preamble): 40 or 60 dots draw close to a full 60 frames a second with Medium links (159 to 181 frames in 3 s), at 1.7–2.4ms of script a frame, where today's 250 took 140ms; from 80 dots on, the browser's drawing falls to about 28 frames a second, which is why Many stops at 60 on phones. Long links cost more (60 dots: 114–131 frames in 3 s). On a tablet stage, 60, 90 and 120 dots drew 180, 122 and 111 frames in 3 s, at 2–3ms of script a frame. On a phone held sideways (812×375, wider than 600px) the tablet counts drew the default 90 dots in about 87 to 128 frames in 3 s, and the phone counts draw 179 to 182 frames for all three choices, at 1.2–2ms of script a frame.
-- **Touch:** `touchstart` also sets the pointer's position (today only `touchmove` does), so a finger resting on the stage pushes the dots too. `touchend` and `touchcancel` still clear it.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pointer effect | Choice buttons | Push · Pull · None | Push | What your pointer or finger does to nearby dots. | `FORCE`: −0.5 / 0.5 / 0 |
-| Number of particles | Choice buttons | Few · Medium · Many | Medium | More dots make more links; phones and tablets draw fewer. | `COUNT`: 250 / 500 / 800 on screens wider than 1024px, 60 / 90 / 120 up to 1024px, 30 / 45 / 60 up to 600px wide or up to 500px tall (the size is checked at each `spawn()`), then `spawn()`; pressing the number already chosen does nothing (it would scatter every dot again) |
-| Link distance | Choice buttons | None · Short · Medium · Long | Medium | How close two dots must be to join with a line. | None: `CONNECTIONS` false; Short · Medium · Long: `CONNECTIONS` true and `DIST` 70 / 100 / 150 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow drifting feels calm; fast looks busy. | `SPD`: 0.5 / 0.8 / 1.3, scaling every particle's velocity by new ÷ old as today's slider does |
-| Color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The color of the dots and lines. | `COLOR`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-| Trails | Switch | on / off | off | Each dot leaves a fading streak behind it. | `TRAILS` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps badge and the Particles readout.
- - The Particle Count, Connect Distance, Speed and Mouse Force sliders. They become Number of particles, Link distance, Speed and Pointer effect.
- - "Show connections". It becomes Link distance's None.
- - The colour picker. It becomes the Color swatches.
- - "Particle trails" becomes Trails.
-- **Good for:** Hero sections · Tech sites · Loading screens · Dark backgrounds · **Avoid on:** Long reading pages · Busy layouts
-- **Prompt:**
-
- > Add a particle background to [the section you want it behind]. Draw small dots on a canvas, give each its own direction, and bounce them off the edges. When the settings include lines, join any two dots that come close with a thin line that fades as they move apart, so a network keeps forming and breaking. Dots near the pointer, or a finger on touch screens, can be pushed away or pulled in. Checking every pair of dots gets slow quickly, so draw far fewer dots on phones and tablets, and stroke the lines in a few batches rather than one at a time. If the visitor has reduced motion turned on, show the dots still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A canvas particle effect draws hundreds of small dots on one canvas and moves them every frame. Each dot drifts in its own direction and bounces off the edges, thin lines join dots that come close, and the pointer pushes nearby dots away or pulls them in. It is the connected-dots background seen on many tech sites.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pointer effect | Push | What the pointer or a finger does to dots within 120px: pushes them away, pulls them in, or nothing |
- | Number of particles | Medium | Few is 250, medium 500 and many 800 dots on computers; tablets draw 60, 90 and 120, and phones 30, 45 and 60, which keeps them smooth |
- | Link distance | Medium | How close two dots must be to join with a line: short is 70px, medium 100px and long 150px; none draws no lines |
- | Speed | Normal | How fast the dots drift: slow is 0.5, normal 0.8 and fast 1.3 (the fastest dots' pixels for every sixtieth of a second, on any screen); slow feels calm, fast looks busy |
- | Color | Blue | The color of the dots and lines |
- | Trails | off | Each dot leaves a fading streak, because the canvas is only partly cleared between frames |
-
-- **README See also:**
- - [GPGPU Particle System](../gpgpu-particle-system/) — tens of thousands of particles moved on the graphics chip
- - [Noise-Based Motion](../noise-based-motion/) — dots moved by smooth noise instead of physics
- - [Particle Constellation](../../07-ambient-background/particle-constellation/) — calmer linked dots, as a background
-- **README How it works:** the Connections snippet becomes the batched version, and one sentence follows it (the frame-rate fix, below, also changes the first snippet to `update(k)` and adds a `frame(elapsed)` snippet with a paragraph after it):
-
- ```js
- // Every link goes into one of six paths by its opacity; each path is stroked once
- const paths = Array.from({ length: 6 }, () => new Path2D());
- for (let i = 0; i < particles.length; i++) {
- for (let j = i + 1; j < particles.length; j++) {
- const dx = particles[i].x - particles[j].x;
- const dy = particles[i].y - particles[j].y;
- const d2 = dx*dx + dy*dy;
- if (d2 < DIST * DIST) {
- const k = Math.min(5, Math.floor((1 - d2 / (DIST * DIST)) * 6));
- paths[k].moveTo(particles[i].x, particles[i].y);
- paths[k].lineTo(particles[j].x, particles[j].y);
- }
- }
- }
- ctx.lineWidth = 0.5;
- paths.forEach((path, k) => {
- ctx.strokeStyle = `rgba(88, 166, 255, ${(k + 0.5) / 6 * 0.4})`;
- ctx.stroke(path);
- });
- ```
-
- "Stroking each link on its own costs one draw call per line, thousands a frame; grouping the links into six opacity steps draws them all in six calls, with no visible difference."
-- **README Production notes:**
- - The `ctx.clearRect` bullet's "(enable "trails" toggle in the demo)" becomes "(turn on Trails in the demo)".
- - Add a bullet after "O(n²) limit": "**Phones and tablets**: the demo draws 30 to 60 dots on phones (screens 600px wide or less, or 500px tall or less when held sideways) and 60 to 120 on other screens up to 1024px wide, and strokes the links in six batches instead of one call per line."
- - The same bullet gains: "The demo washes once for every 1/60 s of frame time (twice on a 30 Hz screen, once on each drawn frame from 59.94 Hz up), always at 15% and whatever Slow motion does, so the streaks last as long on a 30 Hz phone as on a 60 Hz screen. One smaller wash would fade the same amount, but an 8-bit canvas rounds it differently, and the faint leftovers of a trail would end up another color."
- - After it comes a new bullet: "**Time, not frames**: a fixed step per frame follows the screen's refresh rate, so the dots would drift twice as fast at 120 Hz and half as fast at 30 Hz. Cap the time of one frame (this demo uses 50 ms) so a tab that comes back does not lurch, and let a returning tab start from its next frame."
- - The rest is unchanged.
-- **Category line:** `06.04 · 3D &amp; Advanced`
-- **Pager:** Previous: Parallax 3D Tilt (`../parallax-3d-tilt/`) · Next: Fluid / Liquid Simulation (`../fluid-simulation/`)
-- **Frame-rate fix (wrap-up):** each drawn frame moves the dots by `k = steps * (slow ? 1/3 : 1)`, where `steps` is the time since the last drawn frame in 60 Hz frames (`FRAME = 1000/60`, at most 50 ms), so they drift at the same speed on every screen (`update(k)` scales the pointer's push or pull and the move). The Trails wash is not scaled: it is the same 15% laid over the picture once for every 1/60 s (`washes`; two on a 30 Hz frame), and Slow motion does not slow it. `owed` carries the part of a step not laid yet, a `steps` value within 5% of a whole number counts as that number, and the count is rounded with a 0.05 bias, so a 59.94 or 60.06 Hz screen (or a little timestamp noise) still washes exactly once a frame, and the half step of an exact 120 or 240 Hz screen does not sit on a tie. A frame with no wash due draws nothing and changes nothing, so its time carries to the next frame; that replaces the 16 ms gate (Trails off included) and keeps drawing near 60 pictures a second on a faster screen. `start()` and a `visibilitychange` listener set the last frame time back to `null` and `owed` to 0, and the first frame after a start only takes the time. README: the snippets and paragraph above in How it works, the Speed row of Key parameters and two Production notes.
-
----
-
-## fluid-simulation — Fluid / Liquid Simulation
-
-- **Kind:** loop. The blobs drift and merge forever.
-- **Description:** Blobs drift and melt into each other like liquid. Best for hero backgrounds.
-- **Watch it help line:** It moves by itself, and one blob follows your pointer or finger. Pause it to look closely, or turn on slow motion.
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the WebGL loop as in the preamble (`render(ts)`, 16ms gate). Each drawn frame adds the frame's time × Speed to `simT` (at most 100ms, as today) and draws.
- - **The first picture:** at load, `render(lastT+16)` runs once in place of `raf=requestAnimationFrame(render)`: it draws a frame at once and starts the loop.
- - **Pause:** on `hb:pause`, paused sets `paused=true`, cancels the frame and sets `raf=null`; not paused sets `paused=false` and `lastT=performance.now()` and requests a frame (today's Pause button code, without the label).
- - **While paused,** any `click` or `change` in Try it repaints with `render(lastT+16)` (today's `aside` `input` listener, moved to the Try it step; it does not advance `simT` while paused), and a resize repaints as today.
-- **Slow motion:** while the switch is on, the clock adds a third of the frame's time (`simT += Math.min(dt,100)/1000*SPD/3`), from the next frame.
-- **Reduced motion:** the page's reduced-motion branch (one still frame, paused) goes, and so does the rule `*{transition:none!important;animation:none!important}` (see the preamble).
-- **Stage font:** no text on the stage; the WebGL message uses the site font.
-- **Stage:** only the canvas; the fps badge goes and `.no-webgl` stays. `hb-dots`: no. Default height. `touch-action:pan-y` stays.
-- **Phone fallback:** today's stays: on phones (screens 600px wide or less, or 500px tall or less) the canvas caps the pixel ratio at 1.5 (2 on computers), because every pixel measures its distance to every blob. The height half is there so that a phone held sideways gets the same limit as on the other pages; the page used to look only at the width, and even then it measured 180 frames in 3 seconds sideways, so nothing was slow.
-- **Touch:** `pointerdown` also sets the pointer's position, so a tap moves the pointer blob there and a sideways drag moves it along.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Melting | Choice buttons | A little · Medium · A lot | Medium | How far apart two blobs start to melt together. | `SMOOTH`: 0.03 / 0.08 / 0.15 |
-| Number of blobs | Choice buttons | Few · Medium · Many | Medium | More blobs meet and merge more often. | `BALLS`: 3 / 5 / 8 |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow feels calm, like a lava lamp. | `SPD`: 0.5 / 0.8 / 1.3 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Blob size | Choice buttons | Small · Medium · Large | Medium | Bigger blobs touch and merge more. | `RAD`: 0.09 / 0.14 / 0.2 |
-| Color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The color of the liquid. | `COLOR = hexToRgb(…)` of `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-| Glow | Switch | on / off | on | A soft halo around the liquid. | `GLOW` true / false |
-| One blob follows the pointer | Switch | on / off | on | Moves one blob to your pointer or finger. | `MOUSE_BALL` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps badge.
- - The Metaballs, Smoothness, Ball Radius and Speed sliders. They become Number of blobs, Melting, Blob size and Speed.
- - The Fluid Color picker. It becomes the Color swatches.
- - The Background Color picker. The background stays `#030810`; it framed the effect but did not change it.
- - "Mouse moves a ball" and "Glow effect" become One blob follows the pointer and Glow.
-- **Good for:** Hero backgrounds · Wellness brands · Creative studios · Splash screens · **Avoid on:** Behind text · Small elements
-- **Prompt:**
-
- > Add liquid blobs to [the section you want them in]. In a WebGL fragment shader, work out for every pixel its distance to each of a few moving circles, and blend those distances with a smooth minimum so circles that come close melt into one shape with soft necks between them, like drops of mercury. Move the circles on looping paths so they keep merging and separating; one can follow the pointer or a finger. Every pixel is checked against every circle, so draw fewer pixels on phones. If the visitor has reduced motion turned on, show the blobs still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > This fluid effect looks like liquid but is not a real fluid simulation. A WebGL shader works out, for every pixel, how far it is from a few moving circles, and blends those distances so circles that come close melt into one smooth shape, like drops of mercury or a lava lamp. Circles that drift apart separate cleanly again.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Melting | Medium | How far apart two blobs start to melt together: a little is 0.03, medium 0.08 and a lot 0.15 of the stage height; a lot gives thick, soft necks |
- | Number of blobs | Medium | Few is 3, medium 5 and many 8 blobs; each one adds work for every pixel |
- | Speed | Normal | How fast the blobs move on their paths: slow is 0.5, normal 0.8 and fast 1.3 |
- | Blob size | Medium | Each blob's radius: small is 9%, medium 14% and large 20% of the stage height |
- | Color | Blue | The color of the liquid |
- | Glow | on | Adds a soft halo that fades out around the liquid |
- | One blob follows the pointer | on | One blob leaves its path and sits under the pointer or a finger |
-
-- **README See also:**
- - [WebGL Shader Animation](../webgl-shader-animation/) — the same one-surface shader setup, painting patterns
- - [Morphing Blob](../morphing-blob/) — the same melting look from blurred circles, without WebGL
- - [Noise-Based Motion](../noise-based-motion/) — smooth noise moves dots and a blob instead
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `06.05 · 3D &amp; Advanced`
-- **Pager:** Previous: Canvas Particle Effect (`../canvas-particle-effect/`) · Next: Glassmorphism Animated (`../glassmorphism-animated/`)
-
----
-
-## glassmorphism-animated — Glassmorphism Animated
-
-- **Kind:** loop. The colors behind the glass drift forever.
-- **Description:** Frosted glass cards blur the colors behind them. Best for cards and panels.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** the four blobs run `@keyframes blob-move` forever (over Speed, alternating direction); the Breathing card runs `blur-breath` (4s) and the Shifting card `tint-cycle` (8s). No page timers or frames. The only animations on the stage are these `@keyframes`.
- - **Speed keeps the picture.** Setting a new `animation-duration` on a running CSS animation moves it to another point of its cycle, so a Speed change made the blobs jump, both while playing and while paused (13 to 71px per blob; 56% of the paused stage's pixels changed). The three negative delays are therefore fractions of the duration: `.b2{animation-delay:calc(var(--blob-spd) * -.375)}`, `.b3` with `-.625` and `.b4` with `-.25` (equal to −3s, −5s and −2s at the default 8s, so the default picture is the same; `.b1` has no delay). The page keeps `let secs=8`, the length in use. The Speed handler, before it sets `--blob-spd`, multiplies the clock of each blob's animation by the new length divided by the old one, then stores the new length: `const next=parseFloat(d.spd);document.querySelectorAll('.blob').forEach(el=>el.getAnimations().forEach(a=>{if(a.currentTime!=null)a.currentTime=a.currentTime*next/secs}));secs=next;`. Only the blobs are scaled, not `stage.getAnimations`, because `blur-breath` and `tint-cycle` have fixed lengths. Scaling the clocks while keeping fixed delays does not work (a blob whose scaled time falls below zero still jumps). Measured: 0px jump and no scale change over six Speed changes while playing (also with Slow motion on), 0 changed pixels over six changes while paused, the reduced-motion still picture unchanged; the blobs drift over 13s, 8s and 5s.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule `.blob,.glass-card.g2,.glass-card.g3{animation:none!important}` goes, because it would stop Play. The loop starts paused, showing the blobs and cards still (a Speed change keeps that picture).
-- **Stage font:** site font. `.card-title` gets `font-weight:700`; `.card-tag` gets 11px, `font-weight:600` and `rgba(255,255,255,.88)` (was 9px at .5); `.card-body` gets 13px and `rgba(255,255,255,.92)` (was 10px at .6). The Ambient card colours (tag .5, body .72) were too pale over the bright blobs; see the dark layer below.
-- **Stage:**
- - The four blobs and the three cards stay. The code badges at the foot of the cards go (the pages show no code). Card text, as eyebrow / title / line:
- - "Still" / "Fixed frost" / "The blur stays the same." (was "Static" / "Fixed Frost" / "Constant blur at the configured intensity. The baseline glass effect.")
- - "Animated" / "Breathing frost" / "The blur grows and fades." (was "Blur cycles 8px → 20px → 8px — the frost intensifies and recedes.")
- - "Shifting" / "Shifting tint" / "The tint keeps changing." (was "Tint Cycle" / "Frost color rotates through the palette over 8 seconds.")
- - **Phones:** today the cards wrap into one column, and the 300px stage would show only the first. Under `@media(max-width:600px)` the stage becomes a grid of three equal columns, and the cards share one row at one height: `.stage{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-content:center;align-items:stretch;gap:8px;padding:12px}` (the blobs are absolutely positioned, so they stay out of the grid), `.glass-card{width:auto;min-width:0;min-height:0;padding:12px 8px;border-radius:12px;gap:6px}`, `.card-title` 13px, `.card-tag` 10px with 1px letter spacing, and `.card-body` 12px with `line-height:1.4`. Measured with the site font: three 100×137px cards on a 375px phone and three 82×137px cards on a 320px phone, all text inside.
- - On computers and tablets the cards stay in one row as today (180×200px on computers, 145×200px on a tablet).
- - **A dark layer under the text (owner decision: readable card text).** Over the bright blobs the text sat at 1.7:1 on phones and 2.9:1 on computers (worst text and moment, 10th percentile of each text box, measured against what is really behind the words with the text hidden, at 16 moments of the 8s cycle). Each card gets a see-through dark layer inside it, under its text: `.glass-card::before{content:"";position:absolute;inset:0;border-radius:inherit;background:rgba(6,8,14,.54);z-index:-1}`. The card's `z-index:1` makes it a stacking context, so the layer sits above the card's tint and the blurred backdrop and below its text; `tint-cycle` still animates the card's own background. The title stays `#fff`, the tag is `rgba(255,255,255,.88)` and the body `rgba(255,255,255,.92)`. Measured the same way (worst text and moment, 10th percentile), with the round-2 dots, on computers (1280) / a 375px phone / a 320px phone: at least 9.7 / 6.8 / 6.4:1 with the default settings; 10.3 / 6.2 / 6.1:1 with Frost Off; 8.2 / 5.9 / 5.6:1 with Strong tint strength and the White tint color (the brightest glass the settings can make); 8.5 / 5.5 / 5.4:1 with that and Frost Off (the dots sharp behind the words). A tablet (768) and a sideways phone (812×375) read at least 8.4:1 by default and 7.2:1 with Strong tint strength, the White tint color and Frost Off; a laptop (1366×657) reads at least 9.6:1 by default and 7.9:1 in that harshest case. Every median is 5.9:1 or more. (With the stronger round-1 dots the same four cases read 9.5 / 5.9 / 5.8, 9.0 / 5.6 / 5.6, 8.0 / 5.2 / 5.1 and 7.6 / 5.0 / 5.0:1; the first values tried, .45 for the layer with the tag at .75 and the body at .85, gave 4.0:1 on phones at the brightest.)
- - **A faint pattern behind the glass (owner decisions: make Frost visible; then make the dots fainter).** Frost Light, Medium and Heavy looked the same: the backdrop is already a 60px blur (36px on phones) of soft blobs, so the glass blur had nothing left to soften. `.stage::after` paints soft white dots between the colors and the cards: `.stage::after{content:"";position:absolute;inset:0;--dots:rgba(255,255,255,.16);--dot-r:16px;--dot-pitch:56px;--fade:68%;background:radial-gradient(circle,var(--dots) 0 var(--dot-r),transparent calc(var(--dot-r) + 2px)) 0 0/var(--dot-pitch) var(--dot-pitch);-webkit-mask-image:radial-gradient(ellipse closest-side,#000 var(--fade),transparent);mask-image:radial-gradient(ellipse closest-side,#000 var(--fade),transparent)}`, and under the phone block `.stage::after{--dots:rgba(255,255,255,.3);-webkit-mask-image:linear-gradient(transparent,#000 28%,#000 72%,transparent);mask-image:linear-gradient(transparent,#000 28%,#000 72%,transparent)}` (stronger dots of the same size, because the bright phone backdrop hides white; the mask keeps them behind the row of cards). It comes after the blobs in tree order and the cards have `z-index:1`, so it sits above the blobs and below the cards; it is static (it adds no animation to the stage) and fades out toward the edges, so most of the stage reads as soft color. Round 1 used .28 on computers and .42 with 20px dots on a 64px grid on phones; the owner found that a dot grid over most of the stage, so round 2 lowered the strength to the values above (the masks, the fade, the dark layer and the text stay). The values come from a sweep of strengths measured with the text hidden at two moments: outside the cards (the pattern against no pattern, Medium frost) the mean change fell from 5.9 to 3.4 levels on computers and from 9.5 to 5.5 on a 375px phone, the pixels changed by more than 20 levels from 11.9% to 7.1% and from 19.7% to 13.6%, and the brightest dot from 68 to 39 and from 100 to 64 levels; on phones the computer-sized dots keep about twice the Light-vs-Heavy difference of the bigger ones for the same quiet (at a mean change of about 5.4 levels outside the cards, 18% against 8% of the card pixels change by more than 8 levels), which is why the phone block no longer overrides the size. Two measured alternatives, should the owner want more Frost difference back: .18 on computers gives 12% / 46% (over 8 / over 4 levels, Light vs Heavy) at a mean change of 3.8 outside the cards; .32 on phones 22% / 62% at 5.8. Dot contrast that survives inside the two cards that follow Frost (the dots' own contribution, a pattern-off shot subtracted at each Frost, luminance levels between the middle of a dot and the gap between dots, mean of four moments; round 1 → round 2): on computers Off 25.9 → 14.9, Light 26.2 → 15.0, Medium 15.2 → 8.7, Heavy 2.5 → 1.4; on the phone Off 23.5 → 15.9, Light 23.5 → 15.9, Medium 19.6 → 10.3, Heavy 9.3 → 3.3 (Heavy now erases the smaller dots better). Changed pixels inside those two cards, over 8 / over 4 levels of a channel, before the pattern → round 1 → round 2: Light vs Heavy on computers 2.2% → 20.8% → 8.7% / 8.7% → 71.5% → 34.4%, on the phone 25.2% → 37.8% → 19.5% / 66.0% → 74.6% → 62.6%; Light vs Medium on computers 0.0% → 8.4% → 0.3% / 0.9% → 32.5% → 11.8%, on the phone 0.7% → 6.6% → 2.6% / 13.2% → 37.3% → 26.9%; Medium vs Heavy on computers 0.3% → 1.6% → 0.3% / 4.1% → 21.5% → 5.1%, on the phone 4.2% → 4.6% → 0.8% / 39.6% → 34.3% → 15.2% (the phone's earliest differences were smooth color shifts that the dark layer dims; the dots replace them); Off vs Light in round 2 7.6% / 37.3% on computers and 61.7% / 83.2% on the phone. Over the whole stage Light vs Heavy changes 1.7% / 6.8% of the pixels on computers and 5.2% / 16.8% on the phone (round 1: 4.1% / 14.1% and 10.2% / 20.0%). The middle card breathes on its own, so only Off changes it.
- - `hb-dots`: no. Default height.
-- **Phone fallback:** today's stays: the blobs blur 36px on phones instead of 60px. The glass blur only covers the three small cards. The dot pattern is one static layer: on the throttled phone (375×812 at pixel ratio 2, CPU ×4, headless Chrome drawing in software) the page draws 181 or 182 frames in 3 s (a full 60 fps is 180) with none or one dropped, as before, also with Heavy frost and with Frost Off.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Frost | Choice buttons | Off · Light · Medium · Heavy | Medium | How strongly the glass blurs what is behind it. | Off: the stage gets `no-bf` (no blur on any card); Light · Medium · Heavy: `--blur` 6px / 12px / 20px and `no-bf` removed |
-| Tint strength | Choice buttons | Faint · Medium · Strong | Medium | How much color the glass adds. | `--glass-op`: 0.06 / 0.12 / 0.25 |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the colors drift behind the glass. | the blobs' clocks rescaled (see Sequence), then `--blob-spd`: 13s / 8s / 5s |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Tint color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The color of the glass. | `--tint`: `rgba(r,g,b,var(--glass-op))` from `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657`, as today's picker handler |
-| Breathing frost | Switch | on / off | on | The middle card's blur grows and fades. | `.g2`'s `style.animation`: `''` / `'none'` |
-| Shifting tint | Switch | on / off | on | The right card slowly changes color. | `.g3`'s `style.animation`: `''` / `'none'` |
-
-- **Removed:**
- - The note.
- - The Blur Intensity, Glass Opacity and Blob Speed sliders. They become Frost, Tint strength and Speed.
- - The Frost Tint picker. It becomes the Tint color swatches.
- - "Animated blur (card 2)" and "Tint cycle (card 3)" become Breathing frost and Shifting tint.
- - "Disable backdrop-filter" and its Effect readout. They become Frost's Off.
- - The code badges on the cards.
-- **Good for:** Cards and panels · Dashboards · Modals · Navigation bars · **Avoid on:** Plain backgrounds · Large surfaces
-- **Prompt:**
-
- > Add frosted glass to [the cards or panels you want to style]. Give each card a see-through tinted background, blur whatever sits behind it, and add a thin light edge. Put colorful shapes that drift slowly behind the cards, with a faint pattern of dots over them, because glass over plain color looks gray and shows no frost. Put a see-through dark layer inside each card under its text so the words stay readable. A card can also breathe, its blur growing and fading, or slowly change its tint. Blurring costs a lot, so keep the glass to small cards and blur the shapes less on phones. If the visitor has reduced motion turned on, keep everything still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Glassmorphism styles a card as frosted glass: a see-through tint, a blur of whatever sits behind it, and a thin light edge. It only works when something colorful moves behind the glass, so the demo drifts soft color blobs behind three cards: one with a still frost, one whose blur breathes, and one whose tint slowly changes.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Frost | Medium | How strongly the glass blurs what is behind it: light is 6px, medium 12px and heavy 20px; off shows the cards with no blur, to compare |
- | Tint strength | Medium | How much color the glass adds: faint is 6%, medium 12% and strong 25% |
- | Speed | Normal | How long the colors behind take to drift through one path: slow is 13s, normal 8s and fast 5s |
- | Tint color | Blue | The color of the glass |
- | Breathing frost | on | The middle card's blur grows from 8px to 20px and back every 4 seconds |
- | Shifting tint | on | The right card's tint moves through blue, green, purple and orange every 8 seconds |
-
-- **README See also:**
- - [Mesh Gradient Animation](../../07-ambient-background/mesh-gradient/) — soft color blobs drifting as a background
- - [WebGL Shader Animation](../webgl-shader-animation/) — moving color drawn on the graphics chip
- - [Modal Expand](../../04-micro-interactions/modal-expand/) — a dialog, where frosted glass often appears
-- **README How it works:** unchanged, plus two paragraphs after the blob keyframes, each with a code block: "**A pattern behind the glass** makes the frost visible. Colors that are already a soft blur leave the glass nothing to soften, so Light, Medium and Heavy frost would look alike. The demo puts a faint pattern of white dots between the colors and the cards. Each card blurs the dots behind it: Off leaves them sharp, Light softens them and Heavy smears them almost away. The pattern fades out toward the edges of the stage, so most of the stage still reads as soft color:" (the `.stage::after` rule with the computer values, without the variables) and "**A dark layer under the text** keeps the words readable. Bright colors pass behind the glass, and white text over them can fall well under the 4.5:1 contrast that small text needs. Each card has a see-through dark layer that sits above the tint and the blurred backdrop and below the text (the card's `z-index` gives the layer's `z-index: -1` a place inside the card):" (the `.glass-card::before` rule).
-- **README Production notes:** the "Disable for performance audit" bullet becomes: "**Compare with the blur off**: the demo's Frost setting has an Off choice. If the page is noticeably faster without the blur, reconsider the design." Three bullets are added: after "The backdrop must have content", "**Frost needs detail behind it to show**: a blur of soft color changes little as the amount grows, so a Frost setting can look as if it does nothing. Put something with edges behind the glass, such as a pattern, shapes or an image, as the demo does with its dots." and "**Keep the text readable**: measure the contrast of the text against what is really behind it, at several moments of the animation, not against the tint. The demo darkens the glass under the text with a see-through layer, so every text stays at 4.5:1 or better, even over the brightest colors."; after "Dark mode", "**Changing the length of a running animation**: a new `animation-duration` puts a running CSS animation at a different point of its cycle, so it jumps. The demo makes its negative delays fractions of the duration and multiplies each blob's `currentTime` by the new length divided by the old one, so a change of Speed keeps every blob where it is." The rest is unchanged.
-- **Category line:** `06.06 · 3D &amp; Advanced`
-- **Pager:** Previous: Fluid / Liquid Simulation (`../fluid-simulation/`) · Next: WebGL Shader Animation (`../webgl-shader-animation/`)
-
----
-
-## webgl-shader-animation — WebGL Shader Animation
-
-- **Kind:** loop. The pattern keeps moving.
-- **Description:** Moving color patterns computed for every pixel. Best for bold backgrounds.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the WebGL loop as in the preamble (`render(ts)`, 16ms gate). Each drawn frame adds the frame's time × Speed to `T` (at most 100ms, as today), sets `SHOWN_UV=MOUSE_UV` (see Touch and pointer) and calls `draw()`.
- - **The first picture:** `draw()` runs once at load, after `resize()` (today `still()` draws only while paused).
- - **Pause:** on `hb:pause`, `setPaused(e.detail.paused)` (today's function, without the button label): it cancels the frame and redraws the held frame, or starts the loop.
- - **While paused,** settings call `still()`, as today, and so does a resize.
- - **A failed build:** `switchShader` stops the loop when a pattern's shader does not build, and shows the message. Picking a pattern that builds hides the message and, unless the page is paused, starts the loop again: the Pattern handler calls `still()` while paused and `start()` otherwise (`start()` does nothing while the loop runs). Before, the loop stayed stopped although the button still said Pause. After `webglcontextrestored` the page calls `init()` and `resize()` and no `clearFail()` of its own, so the message stays when the restored shader does not build; `switchShader` clears it when the shader does.
- - The "WebGL is not available" branch keeps `fail()`; the line that disabled the panel's controls goes (the settings then change nothing, which the message explains).
-- **Slow motion:** while the switch is on, `T` adds a third: `T += Math.min(dt,100)/1000*SPD/3`, from the next frame.
-- **Reduced motion:** the page's `setPaused(true)` at load goes (see the preamble).
-- **Stage font:** no text on the stage; `.gl-msg` uses the site font.
-- **Stage:** only the canvas. The fps and pattern-name badges (`.overlay`) and the shader source panel go; `.gl-msg` stays. `hb-dots`: no. Default height. `touch-action:pan-y` stays.
-- **Phone fallback:** today's stays: the pixel ratio is capped at 1.5 on phones (2 on computers).
-- **Touch and pointer:** `pointerdown` also sets the pointer's position, so with Reacts to the pointer a tap bends the pattern there. The `pointermove` and `pointerdown` handlers only record `MOUSE_UV`: today's `still()` call in the `pointermove` handler goes, so a paused pattern does not bend under a moving pointer (the preamble's rule). The picture takes the pointer only from a frame that moves on, as Fluid / Liquid Simulation does: `render()` sets `SHOWN_UV=MOUSE_UV` (it starts at the middle, `[.5,.5]`) just before `draw()`, and `draw()` sends `SHOWN_UV` to the shader. A repaint while paused (a setting change or a resize) therefore shows the new setting and nothing else: a paused Plasma to Waves to Plasma round trip changes 0 pixels, where it changed 99% of the stage when the repaint took the pointer recorded since pausing. The new position shows at the next Play. With Plasma the middle looks the same as no pointer, so if the pointer has not been over the stage, switching Reacts to the pointer on while paused shows nothing until Play; Waves, Cells and Kaleidoscope show their bump or slices at the middle.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pattern | Choice buttons | Plasma · Waves · Cells · Kaleidoscope | Plasma | Four patterns, each one short formula. | `switchShader(0 / 1 / 2 / 3)`, then `still()` while paused or `start()` otherwise |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the pattern moves. | `SPD`: 0.6 / 1 / 1.6 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Reacts to the pointer | Switch | on / off | off | The pattern bends around your pointer or finger. | `MOUSE_ON` true / false, then `still()` |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps and pattern-name badges.
- - The Shader Preset menu and the Speed slider. They become Pattern and Speed.
- - The Hue Shift slider. Every pattern already runs through the whole rainbow, so turning the hues changed little; the shaders keep `H` at 0.
- - "Mouse interaction" becomes Reacts to the pointer.
- - "View shader source" and its panel (the pages show no code).
-- **Good for:** Hero backgrounds · Music and events · Loading screens · Art pages · **Avoid on:** Behind text · Low-power devices
-- **Prompt:**
-
- > Add a moving shader pattern to [the background or section you want it in]. Cover the area with one WebGL surface and write a fragment shader that works out the color of every pixel from its position and the time, so the whole pattern moves as the time runs on: flowing plasma, rippling waves, cells or a kaleidoscope. When the settings include it, let the pointer, or a finger on touch screens, bend the pattern near it. Draw fewer pixels on phones, and show a clear message where WebGL is not available. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A shader animation draws a moving picture entirely on the graphics chip. One small program runs for every pixel, every frame, and works out that pixel's color from its position and the time, so the whole pattern is made of math, with no images. Each of the four patterns in the demo is one such program.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pattern | Plasma | Plasma adds up sine waves into flowing color; Waves bends striped color; Cells splits the plane into cells around moving points; Kaleidoscope mirrors one slice around the middle |
- | Speed | Normal | How fast time runs in the pattern: slow is 0.6, normal 1 and fast 1.6 times |
- | Reacts to the pointer | off | Each pattern bends around the pointer or a finger in its own way; in Kaleidoscope the pointer sets the number of slices |
-
-- **README See also:**
- - [Fluid / Liquid Simulation](../fluid-simulation/) — blobs drawn by the same one-surface shader setup
- - [Ray Marching / SDF Scene](../ray-marching-sdf/) — a whole 3D scene drawn by one shader
- - [Noise-Based Motion](../noise-based-motion/) — moving patterns drawn on a 2D canvas instead
-- **README How it works:** in the first snippet, `render()` adds up its own clock, as the demo does, in place of `ts / 1000 * speed`:
-
- ```js
- let t = 0, last = 0;
- function render(ts) {
- if (last) t += Math.min(ts - last, 100) / 1000 * speed; // add up time, so a new speed never jumps
- last = ts;
- gl.uniform2f(uRes, W, H);
- gl.uniform1f(uT, t);
- gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
- requestAnimationFrame(render);
- }
- ```
-
- The Plasma and Cells snippets did not match the demo and are brought in line with it. Plasma gets `uv.x *= uRes.x / uRes.y;`, `uT * 0.5` in the third sine, `sin(length(uv) * 6.0)` and the colour `float hue = fract(v * 0.25 + uT * 0.05); gl_FragColor = vec4(hsv(hue, 0.9, 0.95), 1.0);` in place of the cosine palette, and its lead-in says the sum picks a hue (`hsv()` turns a hue, a saturation and a brightness into a color). The second snippet is headed "Cells (Voronoi)" and its point is `rand2(i + n + uT * 0.01)`, which moves with time. The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `06.07 · 3D &amp; Advanced`
-- **Pager:** Previous: Glassmorphism Animated (`../glassmorphism-animated/`) · Next: Noise-Based Motion (`../noise-based-motion/`)
-
----
-
-## noise-based-motion — Noise-Based Motion
-
-- **Kind:** loop. The dots sway, or the blob ripples, forever.
-- **Description:** Smooth noise makes dots sway and a blob ripple. Best for calm backgrounds.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble (`loop(ts)`, 16ms gate). Each drawn frame adds Speed × 0.01 × `dt / FRAME` to `t` (`FRAME = 1000/60`, `dt` at most 50 ms; see the frame-rate fix below) and draws with `frame()`.
- - **The dot spacing:** `drawGrid()` uses `SPACE` pixels as its step, in place of `Math.max(4,Math.floor(W/GRID))`. Today the grid is set by columns across the stage, so a narrow phone stage gets a finer grid and more dots than a laptop (340 dots on a phone stage against 160 on the stage of a 1280×800 screen). Spacing in pixels keeps the same look on every screen: Medium, 48px, is today's 20 columns on a 960px laptop stage.
- - **The first picture:** `frame()` runs at load. **While paused,** every setting (Try it's `click` and `change`, in place of today's `aside` listener) and a resize call `frame()`.
- - **The resize handler** returns at once when the stage's size has not changed (`if(stage.clientWidth===W&&stage.clientHeight===H)return;`, as on Canvas Particle Effect and Cloth / Soft-Body Simulation): setting a 2D canvas's size blanks it, and a phone's address bar showing or hiding also fires `resize`, which on a 90 or 120 Hz phone could flash the stage empty for a frame.
- - **The blob ripples.** The edge reads the noise along a circle of radius `RING × SCALE` with `RING = 48`, and the inner ring along `RING_IN × SCALE` with `RING_IN = 32`, in place of today's 12 and 8. Today's circle was so small that the noise hardly varied along it: at the default the edge departed only 12px from round (median, on a 106px radius, with one lobe) while the whole blob breathed 39px (86 to 125px), so it read as a breathing circle, not the ripple the Description and the prompt promise. Measured on the page over 120s of noise (the drawn outline, largest minus smallest radius): before, 11.5px median, 1.1 lobes; now, at the default settings, 33px median (25 to 41px from the 10th to the 90th percentile, 44px at most), about two lobes (2.3), and the whole blob breathes 20px (96 to 115px). The choices stay meaningful: Pattern size Large 23px and 1.4 lobes, Medium 33px and 2.3, Small 37px and 4.4 (busy); Wobble Small 16px, Medium 33px, Large 55px (73px at most). The largest ripple (Large wobble, Small pattern size) stays inside the canvas on the 286×298, 341×298, 745×258 and 958×378 stages. The edge is drawn with 96 points, up from 48 (`VERTS`), because the wider ripple made 48 show corners at the busy settings: the sharpest turn between neighbouring segments was 57° with 48 points at Small pattern size and Medium wobble (95° with Large wobble) and is 36° (69°) with 96; at the default settings it is 11° with 96 (21° with 48), where a plain circle of 96 points turns 3.8°. The blob still draws in under 1ms a frame on the throttled phone (181 of 180 frames in 3s on the phone, the sideways phone and the 320px phone). The dots are untouched.
-- **Slow motion:** while the switch is on, each drawn frame adds a third: `t += SPD*.01*(Math.min(dt,50)/FRAME)/3`, from the next frame.
-- **Reduced motion:** the page's reduced-motion branch goes (see the preamble).
-- **Stage font:** no text on the stage.
-- **Stage:** only the canvas. The fps badge goes. `hb-dots`: no (it would mix with the field of dots). Default height.
-- **Phone fallback:** the spacing above: a phone stage draws 25 dots at Wide, 42 at Medium and 99 at Tight, against 340 today. Measured on the throttled phone: 120 dots take 3.7ms a frame at a full 60 fps; today's 340 take 8.9ms and draw about 33 frames a second.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shape | Choice buttons | Field of dots · Blob | Field of dots | A field of swaying dots, or one rippling blob. | `MODE`: `'grid'` / `'blob'`; also shows Space between dots only with Field of dots |
-| Pattern size | Choice buttons | Large · Medium · Small | Medium | Large patterns sway together; small ones look busy. | `SCALE`: 0.004 / 0.008 / 0.016 |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the noise moves along. | `SPD`: 0.3 / 0.5 / 0.8 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Wobble | Choice buttons | Small · Medium · Large | Medium | How far each dot, or the blob's edge, moves. | `AMP`: 6 / 12 / 20 (px) |
-| Space between dots | Choice buttons; shown only when Shape is Field of dots | Wide · Medium · Tight | Medium | Wider spacing draws fewer dots. | `SPACE`: 64 / 48 / 32 (px) |
-| Color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The color of the dots or the blob. | `COLOR`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps badge.
- - The Mode menu. It becomes Shape.
- - The Noise Scale, Speed and Amplitude sliders. They become Pattern size, Speed and Wobble.
- - The Grid Density slider. It becomes Space between dots, in pixels (see Sequence).
- - The Blob Vertices slider. The blob is drawn with 96 points, up from 48: with the wider ripple, 48 points showed straight segments and corners at the busy settings on a phone screen, and 96 smooth them (see Sequence); fewer make the blob look like a polygon.
- - The colour picker. It becomes the Color swatches.
-- **Good for:** Backgrounds · Generative art · Idle and loading states · **Avoid on:** Behind text · Fast-paced screens
-- **Prompt:**
-
- > Add noise-based motion to [the background or shape you want to bring to life]. Use smooth noise, a random value that changes gradually from place to place, instead of plain random numbers, which jump. For a field of dots, turn the noise at each dot into a direction and nudge the dot that way, then move through the noise over time so the whole field sways like grass in the wind. For a blob, push each point of its outline in or out by the noise so the edge ripples. Space the dots by distance, not by count, so phones draw fewer. If the visitor has reduced motion turned on, keep everything still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Noise-based motion uses smooth noise, a random value that changes gradually from place to place, to move things naturally. Plain random numbers jump about; noise drifts, so neighboring dots move alike and nothing jerks. The demo turns it into a field of dots swaying like grass in the wind, and into a blob whose edge ripples.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Shape | Field of dots | A field of dots that sway, or one blob whose outline ripples |
- | Pattern size | Medium | How big the noise's patterns are: large moves big areas together, small looks busy and fine |
- | Speed | Normal | How fast the noise moves along: slow is 0.3, normal 0.5 and fast 0.8. Every sixtieth of a second the noise moves on by 0.01 times this, so the speed is the same on every screen |
- | Wobble | Medium | How far each dot, or the blob's edge, moves: small is 6px, medium 12px and large 20px |
- | Space between dots | Medium | The distance between dots in the field: wide is 64px, medium 48px and tight 32px; smaller stages draw fewer dots |
- | Color | Blue | The color of the dots or the blob |
-
-- **README See also:**
- - [Canvas Particle Effect](../canvas-particle-effect/) — dots moved by simple physics instead of noise
- - [Flow Field](../../07-ambient-background/flow-field/) — particles follow a noise field and leave trails
- - [Volumetric Smoke / 3D Noise](../volumetric-smoke/) — the same kind of noise, in 3D, drawn as smoke
-- **README How it works:** unchanged, plus one sentence after the wind-field snippet: "The demo sets `step` as a spacing in pixels rather than a number of columns, so a phone's smaller stage draws fewer dots at the same spacing." The Blob snippet reads `48 * SCALE` where it read `12 * SCALE`, with one sentence after it: "The noise is read along a circle of radius `48 * SCALE`. A tiny circle would see almost one value, so the whole edge would only swell and shrink together; this one spans about two bumps of noise at the default size, so the edge ripples." The frame-rate fix (below) also changes the last line of the wind-field snippet to `time += speed * 0.01 * (dt / FRAME); // advance through noise volume` and adds a paragraph after that snippet, on `dt` and `FRAME`.
-- **README Production notes:** unchanged, except that the frame-rate fix (below) adds a bullet after the `glsl-noise` one: "**Time, not frames**: move through the noise by the time since the last frame, because a fixed step per frame follows the screen's refresh rate. Cap that time (this demo uses 50 ms), or a tab that comes back after a minute would jump ahead by a minute of motion, and let a returning tab start from its next frame."
-- **Category line:** `06.08 · 3D &amp; Advanced`
-- **Pager:** Previous: WebGL Shader Animation (`../webgl-shader-animation/`) · Next: SVG Path Animation (`../svg-path-animation/`)
-- **Frame-rate fix (wrap-up):** `t += SPD * .01 * (Math.min(dt, 50) / FRAME) / (slow ? 3 : 1)`, with `FRAME = 1000/60` and `dt` the time since the last drawn frame (measured before the last frame time is updated), so the noise moves the same distance a second on a 30, 60 or 144 Hz screen. The 16 ms gate stays, as a cap of 60 drawn frames a second. A `visibilitychange` listener sets the last frame time back to `null` (as `start()` does), so the first frame after a start, a Play or a return from a hidden tab only takes the time. README: the last line of the wind-field snippet and a paragraph after it, the Speed row of Key parameters and a "Time, not frames" Production note.
-
----
-
-## svg-path-animation — SVG Path Animation
-
-- **Kind:** once. The drawing draws itself and stays drawn; Loop repeats it.
-- **Description:** A line drawing draws itself, stroke by stroke. Best for icons and logos.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Sequence:** every play rebuilds the paths hidden (`buildPaths()`, then each path's dash set to its length, or to minus its length with Starts from the other end, with the transition off). Path i starts 20 + i × (Speed × 0.3) ms after the play starts: a forced reflow (`path.getBoundingClientRect()`, as today), then its offset slides to 0 over Speed with Feel. 50ms after the last path finishes, the shapes fill when Fills in at the end is on (`fill-done`).
- - While Loop is on, the drawing then holds 1200ms, counted from the end of the last movement: with Fills in at the end on, from the end of the fill's fade (400ms, or 1200ms in slow motion), so the hold is 1200ms of a finished, filled drawing. Loop is checked at the end of the hold: on, the next play starts (the drawing vanishes at once and draws again); off, it stays drawn.
- - Timers use the pruning `later()`, and every play clears them all (Rotate In's `play()`/`cycle()`). Today's `animating` flag, `run` counter and `loopTimer` go.
-- **Slow motion:** multiplies Speed (each path's transition), the delay between paths (Speed × 0.3) and the timer that waits for the last path by 3. The fill's fade becomes `transition:fill var(--fill-dur) ease`: 400ms, or 1200ms while Slow motion is on (`fillMs`, which the page also adds to the timer that waits before Loop starts the next play). The 20ms and 50ms steps and the 1200ms hold stay: the hold is 1200ms after the fade ends, whatever the fade's length.
-- **Reduced motion:** the demo's rule `.draw-path{stroke-dashoffset:0!important;transition:none!important}` stays, so the drawing shows complete at once, and with Fills in at the end on the fill appears at once too: its timer waits 0ms in place of the time the lines would have taken (`motionOk?20+(paths.length-1)*gap+ms+50:0`), and the rule's `transition:none` makes it instant. As on Rotate In, Replay plays once.
-- **Stage font:** no text on the stage.
-- **Stage:** only the drawing.
- - The three preset tabs on the stage move to Try it as Drawing. The label under the drawing and the Path length readout go.
- - `svg{…}` becomes `.stage svg{…}`, so it cannot size the page's icons.
- - `#svg-stage` gets `role="img"` and an `aria-label` naming the drawing, set with each play from Drawing: "House and star icon", "Signature" or "Logo mark". Screen readers then find the whole drawing as one labelled image from the start, as What it is says.
- - The stage keeps `background:#04060c`, its flex centring and 24px padding. The drawing fits: previewed at 343×300 and 288×300.
- - `hb-dots`: yes. Default height.
-- **Phone fallback:** none needed.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Drawing | Choice buttons | Icon · Signature · Logo | Icon | What is drawn: an icon, a signature or a logo. | `current`: 0 / 1 / 2 (the shared script replays) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each line takes to draw. | `dur`: 2400 / 1500 / 900 (ms) |
-| Line thickness | Choice buttons | Thin · Medium · Thick | Medium | Thin looks precise; thick looks bold. | `--stroke-w`: 1 / 2 / 4 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Gentle · Even | Smooth | Smooth slows at the end, like a hand finishing. | `ease`: `ease-out` / `ease-in-out` / `linear` |
-| Line color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The color of the lines. | `--stroke-color`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-| Starts from the other end | Switch | on / off | off | Draws each line from its end back to its start. | `rev` true / false (the hidden offset is minus the length / the length) |
-| Fills in at the end | Switch | on / off | off | Fills the shapes once the lines are drawn. | `fill` true / false |
-
-- **Removed:**
- - The note.
- - Replay and Auto-loop. The player bar replaces them.
- - The preset tabs on the stage. They become Drawing.
- - The label under the drawing and the Path length readout.
- - The Draw Duration and Stroke Width sliders. They become Speed and Line thickness.
- - The Easing menu. It becomes Feel; its "Smooth" curve, nearly the same as Ease out, goes (Ease out is now Smooth).
- - The colour picker. It becomes the Line color swatches.
- - "Draw in reverse" and "Fill at end" become Starts from the other end and Fills in at the end.
- - The unused `--draw-dur` and `--draw-ease` variables.
-- **Good for:** Icons · Logos · Signatures · Illustrations · **Avoid on:** Photos · Body text
-- **Prompt:**
-
- > Add a self-drawing line to [your icon, logo or signature, drawn as SVG lines]. Measure the length of each line, hide it behind a dash exactly as long as the line, then slide the dash away so the line appears from one end to the other, as if drawn by hand. Draw several lines one after another, each starting a little after the one before. When the settings include it, fill the shapes once the lines are done. The finished drawing should be there for screen readers from the start. If the visitor has reduced motion turned on, show the drawing complete. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > An SVG path animation makes a line drawing appear as if drawn by hand. Each line is hidden behind a dash exactly as long as the line, and sliding that dash away uncovers the line from one end to the other. The whole drawing is in the page from the start, with a label, so screen readers can always find it.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Drawing | Icon | What is drawn: a house with a star, a flowing signature, or a circle logo |
- | Speed | Normal | How long each line takes to draw: slow is 2400ms, normal 1500ms and fast 900ms; each next line starts after 30% of that |
- | Line thickness | Medium | Thin is 1px, medium 2px and thick 4px; thin looks precise, thick looks bold |
- | Feel | Smooth | Smooth slows at the end, like a hand finishing a stroke; Gentle eases in and out; Even keeps one pace |
- | Line color | Blue | The color of the lines, and of the fill |
- | Starts from the other end | off | Draws each line from its end back to its start |
- | Fills in at the end | off | Fills the shapes with a light tint of the line color once the lines are drawn |
-
-- **README See also:**
- - [Checkmark Draw](../../04-micro-interactions/checkmark-draw/) — the same technique for a success tick
- - [Text Clip-Path Reveal](../../05-text-typography/text-clip-path-reveal/) — lines of text uncovered one by one
- - [Outline to Fill](../../05-text-typography/outline-to-fill/) — hollow letters fill with color
-- **README How it works:** the two snippets that wait with a double `requestAnimationFrame` wait with a forced reflow instead, as the demo does:
- - The first snippet becomes:
-
- ```js
- const path = document.querySelector('.draw-path');
- const length = path.getTotalLength();
-
- // Set up hidden state
- path.style.strokeDasharray = length;
- path.style.strokeDashoffset = length; // fully hidden
- path.style.transition = 'none';
-
- // Make the browser apply the hidden state, then animate
- path.getBoundingClientRect();
- path.style.transition = 'stroke-dashoffset 1500ms ease-out';
- path.style.strokeDashoffset = 0; // fully revealed
- ```
-
- - The second snippet becomes:
-
- ```js
- paths.forEach((path, i) => {
- const len = path.getTotalLength();
- path.style.strokeDasharray = len;
- path.style.strokeDashoffset = len;
- path.style.transition = 'none';
-
- setTimeout(() => {
- path.getBoundingClientRect(); // apply the hidden state first
- path.style.transition = 'stroke-dashoffset 700ms ease-out';
- path.style.strokeDashoffset = 0;
- }, i * 300);
- });
- ```
-
- The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `06.09 · 3D &amp; Advanced`
-- **Pager:** Previous: Noise-Based Motion (`../noise-based-motion/`) · Next: Chromatic Aberration (`../chromatic-aberration/`)
-
----
-
-## chromatic-aberration — Chromatic Aberration
-
-- **Kind:** loop. The split pulses or glitches forever. Movement's default becomes Pulse; today the page starts still (Static), which a loop cannot be.
-- **Description:** A word splits into red, green and blue fringes. Best for bold titles.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** with Pulse, the red and blue copies run `@keyframes ca-pulse-r` and `ca-pulse-b` (2s) forever; with Glitch, `ca-glitch-r` and `ca-glitch-b` (4s, a quick jump near the end of each cycle). With None nothing moves. No page timers. The only animations on the stage are these `@keyframes`.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule `.ca-r,.ca-b{animation:none!important}` goes, because it would stop Play. The loop starts paused, showing the split still.
-- **Stage font:** site font. `.ca-text` drops Georgia and the italic and gets `font-weight:800`.
-- **Stage:**
- - Only the word. The red, green and blue copies get `aria-hidden="true"`, so screen readers read the word once, from the see-through base copy.
- - Typed text: `trim()` decides blankness, blank falls back to "PRISM", and the text is set with `textContent` (today's `setText()`).
- - `hb-dots`: yes. `hb-grow`, because typed text can wrap.
-- **Phone fallback:** none needed: three blended text layers.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Movement | Choice buttons | Pulse · Glitch · None | Pulse | Pulse breathes in and out; Glitch jumps now and then. | `#ca-wrap`'s class: `pulse` / `glitch` / neither, then `applyOffset()` |
-| Color split | Choice buttons | Small · Medium · Large | Medium | How far the red and blue copies sit from the word. | `amt`: 2 / 4 / 8 (px), then `applyOffset()` |
-| Direction | Choice buttons | Sideways · Slanted · Up and down | Slanted | Which way the red and blue copies move apart. | `angle`: 0 / 30 / 90 (degrees), then `applyOffset()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Soft color edges | Switch | on / off | off | Blurs the colored copies, like a real lens. | `--ca-blur`: 2px / 0px |
-| Your text | Text (`input.hb-text`) | any text | PRISM | Short words work best. | on input, `setText(v.trim() ? v : 'PRISM')` with `v = txtIn.value`: blank falls back to "PRISM", other text stays as typed |
-
-- **Removed:**
- - The note.
- - The Intensity, Direction Angle and Channel Blur sliders. They become Color split, Direction and Soft color edges.
- - "Blur offset channels". It folds into Soft color edges.
- - The Animation Mode menu. It becomes Movement.
- - The Text box becomes Your text.
-- **Good for:** Bold titles · Music and games · Error pages · **Avoid on:** Body text · Light backgrounds
-- **Prompt:**
-
- > Add a chromatic aberration effect to [your headline or short word]. Stack three copies of the text in pure red, green and blue, blend them so that where they overlap they add up to white, and shift the red and blue copies in opposite directions so colored fringes appear at the letters' edges, like a cheap camera lens. The split can breathe in and out, or jump now and then like a glitch. It only works on a dark background. Screen readers should read the text once, not three times. If the visitor has reduced motion turned on, keep the copies still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Chromatic aberration copies a flaw of cheap lenses, where red, green and blue light land in slightly different places and leave colored fringes at the edges. The demo stacks a red, a green and a blue copy of a word, which add up to white where they overlap, and shifts the red and blue copies apart. The split can breathe in and out or glitch.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Movement | Pulse | Pulse widens and narrows the split every 2 seconds; Glitch jumps it briefly every 4 seconds; None keeps it still |
- | Color split | Medium | How far the red and blue copies sit from the word: small is 2px, medium 4px and large 8px; above about 6px the word gets hard to read |
- | Direction | Slanted | Sideways splits the colors left and right; Slanted splits them at 30°; Up and down splits them vertically |
- | Soft color edges | off | Blurs the red and blue copies by 2px, which looks more like a lens than a digital shift |
- | Your text | PRISM | The word that splits |
-
-- **README See also:**
- - [Glitch Text](../../05-text-typography/glitch-text/) — red and cyan strips tear across a word
- - [WebGL Shader Animation](../webgl-shader-animation/) — shaders, which can split colors pixel by pixel
- - [Scramble / Glitch Text](../../05-text-typography/scramble-text/) — random symbols lock into the real text
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `06.10 · 3D &amp; Advanced`
-- **Pager:** Previous: SVG Path Animation (`../svg-path-animation/`) · Next: 2.5D / Pseudo-3D (`../2-5d-pseudo-3d/`)
-
----
-
-## 2-5d-pseudo-3d — 2.5D / Pseudo-3D
-
-- **Kind:** do it. Nothing moves until the pointer, a finger or Show me moves the camera.
-- **Description:** Flat layers slide by different amounts, faking depth. Best for hero scenes.
-- **Step 1:** Hover it — "Move your pointer across the scene, drag a finger sideways, or press Show me."
-- **Player bar:** Show me · Reset. No Slow motion: the camera follows the pointer directly.
-- **Show me:** one run of 3 seconds: the camera sweeps right, back through the middle, left and back, dipping a little, then rests in the middle. For progress p from 0 to 1 and the camera's position when the run starts (`x0 = mx`, `y0 = my`), each animation frame sets `mx = x0*(1-p) + 0.45*Math.sin(2*Math.PI*p)` and `my = y0*(1-p) + 0.2*Math.sin(Math.PI*p)` and calls `applyParallax(mx, my)`, so `mx` and `my` always hold where the camera is. A second press mid-run, or a run stopped by `hb:input`, therefore starts the next run from where the camera is. At the end `mx = my = 0`.
-- **Stopping a run:** on `hb:input`, only if a run is under way (its frame handle is set): cancel the frame, leaving the camera where it is; otherwise do nothing. The stage's `pointermove` handler also ends a run that is under way the same way, for the visitor's own (trusted) events, then moves the camera to the pointer.
-- **Reset:** stops a run, sets `mx = my = 0` and calls `applyParallax(0,0)` (today's Reset camera, without the readout).
-- **Sequence:** the Mode menu and `autoLoop()` go (Auto-pan becomes Show me). The pointer moves the camera as today (`pointermove` → `applyParallax(mx,my)`), and the camera stays where the pointer leaves it, as today.
-- **Reduced motion:** Show me does not run on arrival. The page's `motionOk` branch goes with the Mode menu. The rule `.scene-inner{transition:none!important}` can stay (it changes nothing).
-- **Stage font:** site font. The layer labels get 11px and `font-weight:600` (were 8px) and read "moves 5%" to "moves 100%" (were "depth 0.05" to "depth 1.0"). Their stagger becomes `top = 4 + i*16` px so the larger labels do not overlap, and `MAX_PAN` becomes 35 (half the largest Camera movement; the slider it read goes). The labels move to the top-left corner (`left` in place of `right`, with the same inset, `6 + pad + MAX_PAN*depth`): on the right, their column crossed the moon on phones. Checked at the laptop, tablet and both phone stages: every label stays clear of the moon. The labels sit on a dark backing (`padding:0 5px;border-radius:4px;background:rgba(2,8,18,.75)`) and their text is `rgba(255,255,255,.7)` (was .5): stars are bright dots, and a star behind a letter of the .5 text with no backing took it down to 1.0 to 1.2:1 (measured on the letters' own pixels); with the backing and .7 the worst pixel of labels 1 to 6 is at least 5.7:1 over 60 pictures (page loads, sizes and camera positions).
-- **Stage:**
- - The seven layers, the custom cursor ring and the labels stay. `cursor:none` and `touch-action:pan-y` stay. The ring is moved with `transform` (`#cursor{left:0;top:0}` and `translate(x - 10px, y - 10px)` from the stage's top left corner), not with `left` and `top`, so the page moves nothing but transforms. The scene has `role="img"` and an `aria-label` in plain words ("A night landscape of seven flat layers, from the sky to the ground, that slide by different amounts as the camera moves"), as the cube on Scroll-Driven 3D Rotation has.
- - **A smaller scene.** The scene was drawn for a 620px stage: on the shared 300–440px stage the mountains' peaks are cut off and the moon hides behind the hills. Its fixed sizes shrink to about 0.7 (the hills to 0.6), previewed at the laptop, tablet and both phone stages with the peaks, the moon and the tree line all in view:
- - `.mtns-far` (inline style): height 200px → 140px;
- - the six mountains' inline `border-width:0 W H`: 100/160 → 70/112, 80/120 → 56/84, 120/180 → 84/126, 90/140 → 63/98, 110/160 → 77/112, 70/100 → 49/70;
- - `.hills-wrap` 180px → 108px, and the second one's inline 130px → 78px;
- - `.fog` 80px → 56px; `.moon` 50px → 36px;
- - `addTrees('trees-far',14,25,…)` and `addTrees('trees-near',8,39,…)` (were 36 and 56).
- - **The moon moves up on short stages (fix round 1).** The mountains' sizes are fixed pixels, so on a short stage their peaks reach the moon at `top:15%;right:20%`, which the previews above did not catch: they used the 300px, 327px, 380px and 440px stages (the moon was in view there, a fifth of it behind a peak on the 300px and 327px ones) and never a 258px stage. Measured on pixels (the moon's own pixels against the scene as drawn, camera at rest), the hidden part of the moon was 100% at 1280×590 (a 258px stage), 84% at 896×414, 63% at 812×375, 26% at 667×375, 19% at 1366×657, 20% at 375×812 and 16% at 320×640. So the stage gets `container-type:size` and, after the `.moon` rule, `@container (max-height:360px){.moon{top:4%;right:6%}}`. A stage 361px or taller keeps the moon where it was (it is clear from there up, at every width), and a browser without container queries keeps the old position. The numbers come from a sweep of the geometry (the 36px moon against the six triangles, with the camera at rest and at its four corners with Large movement, for a phone's 298px stage 286 to 566px wide and every stage 258 to 360px tall and 551 to 958px wide): the peak nearest the moon on the phone stage is 47px from the top, so `top:4%` clears it at every width, and the peaks at 30% and 70% reach 6px and 20px from the top of a 258px stage, so `right:6%` keeps the moon clear of both at every width. The first candidates left part of the moon hidden at some width: `top:6%;right:8%` (16% of the moon on a 551px-wide 258px stage, 4% on a phone stage 364 to 500px wide) and a 280px limit (nothing done for the 300px and 325px stages, where 16 to 23% stayed hidden). Measured the same way on pixels, at rest and at the four camera corners with Large movement, none of the moon is hidden at 1280×590, 896×414, 812×375, 667×375, 1366×657, 375×812, 320×640, 360×640, 412×915, 480×320, 1024×768, 1280×800, 768×1024, 1440×900 and 25 more sizes from 320 to 1600 wide.
- - **No star over the "moves 5%" label (fix round 1).** The sky is the lowest layer, so a star (one layer up) could pass over its label; in review that happened on 20% of the page loads at 1280×800, 30% at 1280×590, 67% on a 375px phone and 43% on a sideways phone. The star loop draws a star's position again while `top<8%` and `left<30%` (that corner holds the label at every stage size and camera position), so there are still 80 stars. Over ten loads at each of five sizes (1280×800, 1280×590, 375×812, 320×640, 812×375) no star sits in the corner and none touches the label at any camera position (before: 22 to 42 stars in the corner per ten loads).
- - `hb-dots`: no. Default height.
-- **Phone fallback:** none needed: seven layers moved with transforms (a continuous pan measured 0.6ms a frame on the throttled phone).
-- **Touch:** `pointerdown` also sets the camera (today only `pointermove` does), so a tap moves it; a sideways drag keeps moving it. The camera is held between −0.5 and 0.5 on both axes (`edge()`): a finger dragged off the stage keeps sending its moves to the stage, and the label insets (`MAX_PAN`) and the layers' overscan assume no more than that.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Camera movement | Choice buttons | Small · Medium · Large | Medium | How far the nearest layer moves; far ones move less. | `strength`: 20 / 40 / 70 (px), then `applyParallax(mx,my)` unless a run is under way |
-| Layer labels | Switch | on / off | off | Shows how much each layer moves. | the `.depth-label`s' `display`: `block` / `none` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note.
- - The Mode menu. Auto-pan becomes Show me.
- - The Camera Strength slider. It becomes Camera movement.
- - "Show depth labels" becomes Layer labels.
- - The Mouse X and Layers readouts.
- - "↺ Reset camera". The player bar's Reset replaces it.
-- **Good for:** Hero scenes · Illustrations · Game sites · Landing pages · **Avoid on:** Photos · Content-heavy pages
-- **Prompt:**
-
- > Add a 2.5D parallax scene to [the illustration or hero you want to give depth]. Split the picture into flat layers, from a far sky to the near ground, and when the pointer moves, shift every layer the opposite way by an amount that grows with how near it is: the sky barely moves and the ground moves the most, so the flat picture seems deep. Make each layer a little wider than the frame so no edge shows. On touch screens, dragging a finger should move the scene the same way. If the visitor has reduced motion turned on, keep the layers still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > 2.5D fakes depth with flat layers. The picture is split into layers at different distances, and when the camera moves, near layers slide further than far ones, as the view from a train window does. The same trick gave old cartoons and video games their sense of depth.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Camera movement | Medium | How far the nearest layer travels as the pointer crosses the scene from one side to the other: small is 20px, medium 40px and large 70px (half that each way from the middle); the farthest layer moves 5% of that |
- | Layer labels | off | Labels each layer with the share of the camera movement it follows, from 5% for the sky to 100% for the ground |
-
-- **README See also:**
- - [Parallax Depth-of-Field](../../01-scroll-based/parallax-depth-of-field/) — the same layered depth, driven by scrolling
- - [Parallax 3D Tilt](../parallax-3d-tilt/) — one card leans toward the pointer
- - [Scroll-Driven 3D Rotation](../scroll-driven-3d-rotation/) — scrolling moves a 3D object
-- **README How it works:** three changes, so the prose and the snippets match the demo:
- - The first snippet listens for `pointermove`, as the demo does, and measures the pointer against the stage's box. Its first three lines become these four:
-
- ```js
- stage.addEventListener('pointermove', e => {
- const r = stage.getBoundingClientRect();
- const normX = (e.clientX - r.left) / r.width - 0.5; // -0.5 to 0.5
- const normY = (e.clientY - r.top) / r.height - 0.5;
- ```
-
- - The sentence "For an **auto-pan** camera, drive the norm values with sine:" and its snippet become "For **Show me**, the demo drives the same layers with a three-second sweep instead of the pointer, ending in the middle:" and:
-
- ```js
- function sweep(now) { // start = performance.now() when Show me is pressed
- const p = Math.min(1, (now - start) / 3000);
- const normX = 0.45 * Math.sin(2 * Math.PI * p);
- const normY = 0.2 * Math.sin(Math.PI * p);
- LAYERS.forEach(({ el, depth }) => {
- el.style.transform = `translate(${-normX * STRENGTH * depth}px, ${-normY * STRENGTH * depth * 0.4}px)`;
- });
- if (p < 1) requestAnimationFrame(sweep);
- }
- ```
-
- - The paragraph before the first snippet says how the transform is made, as the code makes it: "Each layer has a CSS `transform: translate(x, y)` that slides it the opposite way from the pointer: x = `-normX * strength * depth` and y = `-normY * strength * depth * 0.4`, where `normX` and `normY` are the pointer's position across the stage, from -0.5 to 0.5." (it said `translateX(offset)` with `offset = mouseNormalizedX * strength * depth`). After the first snippet a sentence says the demo has seven layers and listens for `pointerdown` too, and after the Show me snippet a sentence says the demo blends in the camera's starting position and that Reset puts the camera back in the middle.
-
- The rest is unchanged.
-- **README Production notes:** in the Scroll-driven variant bullet, "replace `mousemove` with `scroll`" becomes "replace `pointermove` with `scroll`", to match the snippet. The rest is unchanged.
-- **Category line:** `06.11 · 3D &amp; Advanced`
-- **Pager:** Previous: Chromatic Aberration (`../chromatic-aberration/`) · Next: Ray Marching / SDF Scene (`../ray-marching-sdf/`)
-
----
-
-## ray-marching-sdf — Ray Marching / SDF Scene
-
-- **Kind:** loop. The camera keeps circling the shapes.
-- **Description:** A 3D scene drawn only from formulas, circled by a camera. Best for art pages.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the WebGL loop as in the preamble (`render(ts)`, 16ms gate).
- - **The clock:** the page keeps its own clock, `curT`, which adds each frame's time (at most 50ms, and nothing on the first frame after a start), in place of `(ts-startT)/1000`. Each drawn frame calls `draw(curT)`.
- - **The camera:** the page also keeps the camera's angle, `camA`, which adds the same step × Camera speed. The shader takes `uniform float uCamAng` and uses `float angle=uCamAng;` in place of `uT*uCamSpd`, so a new Camera speed never makes the camera jump (today the angle is the time × the speed, so any change of speed moves the camera at once).
- - `start()` and `stop()` stay, without `startT`. **The first picture:** `draw(0)` at load. **While paused,** settings call `refresh()` and a resize redraws, as today.
-- **Slow motion:** while the switch is on, the clock and the camera's angle add a third of each frame's step, from the next frame.
-- **Reduced motion:** the page's reduced-motion branch goes (see the preamble).
-- **Stage font:** no text on the stage; `.fallback` uses the site font.
-- **Stage:** only the canvas. The fps and scene badges and the shader source panel go; `.fallback` stays. `hb-dots`: no. Default height.
-- **Phone fallback:** today's stays: on phones (screens 600px wide or less, or 500px tall or less) the canvas draws at 0.7 of the stage's CSS size (up to 1.5 times on computers), and Detail takes two thirds of the steps there (16 · 32 · 64 in place of 24 · 48 · 96; today phones start at 32).
-- **Pixel cap:** on every screen the canvas also holds about 300,000 pixels at most, and the browser scales it up: the scale is the smaller of the ratio above and `Math.sqrt(300000/(w×h))` for a stage of w×h CSS pixels. The cost is one ray march per backing pixel, so without the cap the 60 fps rule failed on integrated graphics. Measured on an Intel UHD chip, frames drawn in 3 seconds (180 is 60 fps), each run checked against a stage-sized control page that read 181–182: 1280×720 at 1.5× 96 frames before the cap and 180 after; 1440×900 at 2× 86 → 180; 1920×1080 at 1× 181 → 181 (the final review's 167 did not reproduce); a 768×1024 tablet at 2× with the CPU slowed four times 120 → 181; the 1366×657 laptop 180 → 179, which is no change (its canvas was 958×325, about 4% over the cap, and is now 940×319).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Scene | Choice buttons | Blend · Cut-out · Endless | Blend | Shapes that melt, shapes cut from shapes, or endless copies. | `SCENE`: 0 / 1 / 2, then `refresh()` |
-| Camera speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the camera circles the shapes. | `CAM_SPD`: 0.35 / 0.6 / 1 |
-| Soft shadows | Switch | on / off | off | Real soft shadows; costly, so best left off on phones. | `SHADOW` true / false, then `refresh()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Corner shading | Switch | on / off | on | Darkens creases where surfaces meet. | `AO` true / false, then `refresh()` |
-| Detail | Choice buttons | Low · Medium · High | Medium | More steps find thin edges; phones use fewer. | `MAX_STEPS`: 24 / 48 / 96 (16 / 32 / 64 on phones), then `refresh()` |
-| Step count view | Switch | on / off | off | Colors each pixel by how many steps it took. | `DEBUG` true / false, then `refresh()` |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps and scene badges.
- - The Scene menu. It becomes Scene.
- - The Camera Speed slider, which could reach zero. It becomes Camera speed; Pause now stops the camera.
- - The Max March Steps slider. It becomes Detail.
- - "Ambient occlusion", "Soft shadows (GPU-heavy)" and "Debug: march steps as color" become Corner shading, Soft shadows and Step count view.
- - "View shader source" and its panel (the pages show no code).
-- **Good for:** Art pages · Hero visuals · Tech demos · **Avoid on:** Behind text · Low-power devices
-- **Prompt:**
-
- > Add a ray-marched 3D scene to [the section you want it in]. Draw the whole scene in a fragment shader, with no 3D models: describe each shape as a formula that gives the distance to its surface, then for every pixel step a ray forward by that distance until it touches a surface, and light that point. Formulas let shapes melt together, be carved out of each other or repeat without end, while a camera circles them. Every pixel does a lot of work, so draw fewer pixels and take fewer steps on phones. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Ray marching draws a 3D scene without any 3D models. Each shape is a formula that gives the distance to its surface, and for every pixel the shader steps a ray forward by that distance until it touches something, then lights that point. Because the shapes are formulas, they can melt together, be carved out of each other or repeat forever.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Scene | Blend | Blend melts a sphere, a box and a ring together; Cut-out carves a box out of a sphere, with a small ball inside; Endless repeats a carved box across the floor without end |
- | Camera speed | Normal | How fast the camera circles the shapes: once in about 18 seconds at slow, 10 at normal and 6 at fast |
- | Soft shadows | off | Casts a second ray toward the light from every surface point, for soft shadows; the most costly option |
- | Corner shading | on | Darkens creases and corners where surfaces meet, by testing a few points just above each surface |
- | Detail | Medium | The most steps a ray may take: low is 24, medium 48 and high 96; phones take two thirds as many |
- | Step count view | off | Colors each pixel by how many steps its ray took: edges and near misses take the most |
-
-- **README See also:**
- - [Volumetric Smoke / 3D Noise](../volumetric-smoke/) — rays that add up smoke instead of stopping at a surface
- - [WebGL Shader Animation](../webgl-shader-animation/) — simpler shaders on the same setup
- - [Fluid / Liquid Simulation](../fluid-simulation/) — the same melting of shapes, in 2D
-- **README How it works:** the snippet steps `t += d * 0.9` (a little short, since blended and carved shapes are not exact distances) and stops at `t > 22.0`, as the page does (final fix wave).
-- **README Production notes:** the Performance bullet says the cost scales with pixels and with the work per step, and that the demo caps its canvas at about 300,000 pixels (final fix wave).
-- **Category line:** `06.12 · 3D &amp; Advanced`
-- **Pager:** Previous: 2.5D / Pseudo-3D (`../2-5d-pseudo-3d/`) · Next: GPGPU Particle System (`../gpgpu-particle-system/`)
-
----
-
-## gpgpu-particle-system — GPGPU Particle System
-
-- **Kind:** loop. The particles flow forever.
-- **Description:** Tens of thousands of particles flow on the graphics chip. Best for hero effects.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the WebGL 2 loop as in the preamble (`render(ts)`, with no fixed gate: a frame is drawn only when a physics pass is due, see the frame-rate fix below).
- - `drawFrame(t)` splits into `physics(t)` (the physics pass and the texture swap) and `paint(t)` (the drawing pass). Each drawn frame runs `physics(t, unit)` once for every pass due (at most 3), then `paint(t, false, passes)` once.
- - The page keeps its own clock, `simT`, in place of `(ts-startT)/1000`: it adds `unit/60` for each pass (`unit` is 1, or 1/3 in Slow motion), so a pause never makes the particles jump, and nothing is added on the first frame after a start.
- - **The first picture:** `settle()` and then `paint()` run once at load (today's `resize()` draws only while paused). `settle()` is 120 silent physics steps at the full step, whatever Slow motion says (`physics(t,step)` takes the step as a second argument and sets `uStep` to it; called without one it uses 1, or 1/3 in slow motion, as before). That is two seconds of flow, so a picture shown still (paused on arrival, or under reduced motion) already shows the flow, not the starting square cloud. It costs about 23 ms on a laptop and 11 ms on a phone with the CPU slowed four times.
- - **While paused,** a setting or a resize calls `paint()` only. Today's `refresh()` also ran a physics step, which moved the particles a little while paused. A change of Number of particles builds the new cloud and settles it first, so the picture shows the flow and not the starting cloud. Pressing the Number of particles or the Color that is already chosen does nothing (Color would otherwise draw the picture again and erase the streaks Trails leaves).
-- **Slow motion:** the physics shader gets `uniform float uStep` (1, or 1/3 while Slow motion is on), from the next frame. Every change of velocity is multiplied by `uStep` (the four behaviours' pushes, and the vortex's and orbit's inward pulls), the damping becomes `pow(.985,uStep)`, and the move becomes `x+=vx*uStep; y+=vy*uStep`. So every particle moves a third as far in each pass while its speed and the shapes the particles form stay the same. Passes still come 60 a second, so the Trails fade is not slowed. The clock adds a third of a 1/60 s for each pass.
-- **Reduced motion:** the page's reduced-motion branch goes (see the preamble).
-- **Stage font:** no text on the stage. The WebGL 2 message uses the site font and reads "This demo needs WebGL 2, which this browser does not offer. Try a recent Chrome, Firefox or Safari.", set with `textContent` (was "WebGL2 required for GPGPU texture ping-pong." with a `<br>`). A shader that fails to build reads "Shader failed to build: " and the browser's log; when the browser gives no log the page says "the shader did not compile" (or "the shaders did not link"), so the message is never left blank, as on Ray Marching / SDF Scene and Volumetric Smoke.
-- **Stage:** only the canvas. The fps, count and behaviour badges go; `.no-wgl2` stays. `hb-dots`: no. Default height.
-- **Phone fallback:** today's stays: on phones (screens 600px wide or less, or 500px tall or less) the page starts with 16,000 particles (today's `SMALL` default). At load it gives 16,000 the `on` class and `aria-pressed="true"` (and takes them from 65,000) itself, before the shared script reads the settings. The visitor can still pick more.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Movement | Choice buttons | Flow · Swirl · Attract · Orbit | Flow | The rule every particle follows. | `BEHAVIOR`: 0 / 1 / 2 / 3 |
-| Number of particles | Choice buttons | 16,000 · 65,000 · 100,000 | 65,000 (16,000 on phones) | Phones start with 16,000; more can be slow there. | `TEX_N`: 128 / 256 / 320, then `initTex(TEX_N)` (and, while paused, `settle()` before the picture is drawn again) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How hard the rule pushes the particles. | `SPD`: 0.35 / 0.6 / 1 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Color | Choice buttons | One color · By speed · Shifting | One color | One color, by speed, or slowly shifting colors. | `COLOR_MODE`: 0 / 1 / 2, then the picture is drawn again while paused; pressing the color already chosen does nothing, because drawing it again would erase the streaks Trails leaves |
-| Trails | Switch | on / off | off | Each particle leaves a fading streak. | `TRAILS` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps, count and behaviour badges, and the Texture size and Physics pass readouts.
- - The Particle Count, Behavior and Color Mode menus. They become Number of particles, Movement and Color.
- - The Speed slider. It becomes Speed.
- - "Motion trails" becomes Trails.
-- **Good for:** Hero effects · Data art · Launch pages · **Avoid on:** Behind text · Low-power devices
-- **Prompt:**
-
- > Add a GPU particle system to [the section you want it in]. Keep every particle's position and speed in a floating-point texture, one pixel per particle, and move them all at once in a shader that reads one texture and writes the other, swapping them after each pass, one pass per 60th of a second so it runs at the same speed on every screen. Then draw each particle as a tiny point, following a flowing field, a swirl, a pull to the middle or an orbit. That keeps tens of thousands of particles smooth. Start with far fewer on phones, and show a clear message where WebGL 2 is missing. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A GPU particle system moves tens of thousands of particles on the graphics chip instead of in JavaScript. Every particle's position and speed is stored as one pixel of a texture, and a shader reads last frame's texture and writes the next one, all at once. A second step draws each particle as a tiny point.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Movement | Flow | Flow follows a shifting field of currents; Swirl circles the middle; Attract pulls everything toward the middle; Orbit sweeps the particles round in rings |
- | Number of particles | 65,000 | 16,000, 65,000 or 100,000 particles, one pixel each of a texture 128, 256 or 320 pixels square; phones start with 16,000 |
- | Speed | Normal | How hard the rule pushes for every sixtieth of a second: slow is 0.35, normal 0.6 and fast 1 |
- | Color | One color | One blue, a color from each particle's speed, or colors that slowly shift |
- | Trails | off | Fades the last picture instead of clearing it, so each particle leaves a streak |
-
-- **README See also:**
- - [Canvas Particle Effect](../canvas-particle-effect/) — hundreds of particles moved in JavaScript
- - [Fluid / Liquid Simulation](../fluid-simulation/) — a shader that melts blobs together
- - [WebGL Shader Animation](../webgl-shader-animation/) — shaders that paint every pixel
-- **README How it works:** the physics snippet matches the new shader: after `uniform int uBehavior;` add `uniform float uStep; // one 60 Hz step per pass: 1, or 1/3 in slow motion`; the vortex's four velocity lines each end in `* uStep`; the damping line becomes `vx *= pow(0.985, uStep); vy *= pow(0.985, uStep); // damping`; and the move becomes `x += vx * uStep; y += vy * uStep;`. The frame-rate fix (below) also puts a "**Time step**" paragraph in front of the ping-pong snippet, and its lead-in reads "alternate which texture is the read source each pass:". The rest is unchanged.
-- **README Production notes:** the phone rule reads "on phones (screens 600px wide or less, or 500px tall or less)" (final fix wave). The frame-rate fix (below) adds a bullet after the WebGL2 one: "**Time, not frames**: a fixed step per frame would move the particles twice as fast on a 120 Hz screen and half as fast on a 30 Hz phone, and fade the trails at the same wrong rate. Step by a fixed 1/60 s from an accumulator, as above, and cap the time of one frame (this demo uses 50 ms) and the passes per frame, so a strong pull near a point settles the same on every screen. Fade once per physics pass, always by the same amount."
-- **Category line:** `06.13 · 3D &amp; Advanced`
-- **Pager:** Previous: Ray Marching / SDF Scene (`../ray-marching-sdf/`) · Next: Image Distortion on Hover (`../image-distortion-hover/`)
-- **Frame-rate fix (wrap-up):** every physics pass is exactly one 60 Hz step (`uStep` 1, or 1/3 in Slow motion), never a longer or shorter one, because the Attract rule pulls hard near the middle and settles differently for another step size. The loop looks at every frame the screen offers: `steps` is the time since the last drawn frame in steps of 1/60 s (at most 50 ms), a value within 5% of a whole number counts as that number, and `owed` carries the part of a step not run yet. A frame runs one pass for every whole step owed (1 ms of slack, at most 3), so one on a 60 Hz screen and two on a 30 Hz one; a frame with no pass due changes nothing and draws nothing, which replaces the 12 ms gate and keeps drawing near 60 pictures a second on a faster screen. A drawn frame lays the Trails fade over the picture once for every pass, always at the same 12%, so Slow motion, which still runs 60 passes a second, slows the particles but not the fade. `settle()` still runs its 120 steps of 1. `start()` and a `visibilitychange` listener set the last frame time back to `null` and `owed` to 0. README: the `uStep` comment, a "Time step" paragraph, the Speed row of Key parameters and a "Time, not frames" Production note.
-
----
-
-## image-distortion-hover — Image Distortion on Hover
-
-- **Kind:** do it. The picture bends only where the pointer, a finger or Show me touches it.
-- **Description:** The picture ripples and bends around your pointer. Best for portfolio images.
-- **Step 1:** Hover it — "Move your pointer over the picture, drag a finger across it, or press Show me."
-- **Player bar:** Show me. No Reset: the distortion fades by itself. No Slow motion.
-- **Show me:** one run of 3 seconds: a pretend pointer crosses the picture from left to right along a gentle S, then lets go, and the distortion fades over Fade-out speed. The run's own state is its start time, `demoStart`: `performance.now()` when Show me is pressed, 0 when no run is under way. The render loop drives it: while `demoStart` is set, each frame sets `mouseX = W*(0.2 + 0.6*p)` and `mouseY = H*(0.5 + 0.18*Math.sin(2*Math.PI*p))` (backing-store pixels, p from 0 to 1), `active = true` and `amp = 1`; when p reaches 1, `active = false`, `demoStart = 0` and the run ends. A second press starts again from the left. Show me wakes the render loop when it has stopped (see Sequence).
-- **Stopping a run:** on `hb:input`, only if a run is under way (`demoStart` is set; not `raf`, which the render loop also keeps set while the pointer rests on the picture): set `demoStart = 0` and `active = false`; otherwise do nothing, so a tap does not start fading the distortion under a resting finger. The stage's `track()` handler also ends a run that is under way (`demoStart` set), for the visitor's own (trusted) events, then follows the visitor's pointer as today.
-- **Sequence:** `paused`, `poke()` and the Pause button go (a do-it page has no Pause).
- - **The render loop runs only while something moves.** After drawing a frame, `render()` requests the next one only while the pointer is on the picture (`active`), the distortion is still fading (`amp > 0`) or a Show me run is under way (`demoStart` set); otherwise it sets `raf = null` and stops, so a picture at rest is not redrawn 60 times a second. A frame skipped by today's 15ms gate still requests the next one. `wake()` starts the loop again when it has stopped (it sets `lastT` and `startT` to `performance.now()`, so `phase` does not jump, then requests a frame); `track()` and Show me call it.
- - **The first picture:** `draw()` at load. While the loop is stopped, a resize and every setting call `draw()` once (a resize clears the canvas).
- - **The picture stands still:** the shader's `uT` stays 0. Today the pattern drifts slowly by itself; a real image would not, and a do-it page moves only when the visitor or Show me moves it.
- - `phase` and the fade (`amp`) run as today while the loop runs, with one change: the fade ends, and the loop stops, when `amp` falls below `.01` (today `.005`), about half a second sooner. The last frame then differs from the picture at rest by at most 7 (of 255) in any pixel at the default settings, and by at most 19 at any strength and size with Ripple, Push or Liquid; Pixels changes by about 30 in a few pixels, as it did with `.005`, because its cell size settles to its rest value at any strength.
- - **The fade is quicker than today's.** Today's default (Decay Speed 5, `DECAY` 0.5) took about 10.5 seconds to stop after the pointer let go, so a Show me run (3 seconds) was not back at rest until about 13.5 seconds after the press, against the "2.5 to 3 seconds ... returns the demo to rest" above, and the browser check (which looks for a still stage about 4.5 seconds after the arrival run) failed. Fade-out speed is now Slow · Normal · Fast = `DECAY` 0.9 / 1.5 / 2.4, and the default is 1.5. The fade law (`amp *= 1 - DECAY*dt/1000`) is unchanged. The loop now stops about 5, 3 and 2 seconds after the pointer lets go, so at Normal the picture is at rest about 6 seconds after Show me is pressed, and at Medium strength the last half second of the fade is under a pixel of movement.
-- **Reduced motion:** the page's reduced-motion branch goes. With the picture still, nothing on the stage moves until the visitor or Show me does.
-- **Stage font:** no text on the stage; `.fallback` uses the site font.
-- **Stage:** only the canvas. The fps badge and the shader source panel go. `touch-action:none` on the canvas stays. `hb-dots`: no. Default height.
-- **Phone fallback:** today's stays: the pixel ratio is capped at 1.5 on phones (2 on computers).
-- **Touch:** as today: dragging a finger bends the picture under it, and lifting it lets the distortion fade.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Effect | Choice buttons | Ripple · Push · Liquid · Pixels | Ripple | Rings, a bulge, a liquid swirl, or big square pixels. | `TYPE`: 0 / 1 / 2 / 3; also shows Moving ripples only with Ripple |
-| Strength | Choice buttons | Gentle · Medium · Strong | Medium | How far the picture bends. | `STR`: 4 / 8 / 14 |
-| Size | Choice buttons | Small · Medium · Large | Medium | How wide an area around the pointer bends. | `RAD`: 0.15 / 0.25 / 0.4 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Fade-out speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the picture settles after the pointer leaves. | `DECAY`: 0.9 / 1.5 / 2.4 |
-| Moving ripples | Switch; shown only when Effect is Ripple | on / off | on | The rings keep moving outward. | `ANIMATE` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. A do-it page has none; the loop simply keeps drawing.
- - The fps badge.
- - The Distortion Type menu. It becomes Effect.
- - The Strength, Radius and Decay Speed sliders. They become Strength, Size and Fade-out speed.
- - "Animate ripple over time" becomes Moving ripples.
- - "View shader source" and its panel (the pages show no code).
- - The pattern's slow drift.
-- **Good for:** Portfolio images · Gallery tiles · Hero images · Product photos · **Avoid on:** Small thumbnails · Images with text
-- **Prompt:**
-
- > Add a hover distortion to [the image you want to react]. Draw the image with a WebGL shader and, in a circle around the pointer, read each pixel from a slightly shifted spot, so the picture seems to ripple, bulge, swirl like liquid or break into squares there while the image itself never changes. The bending fades out smoothly after the pointer leaves. On touch screens, dragging a finger across the image should do the same. If the visitor has reduced motion turned on, keep the image still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Image distortion on hover bends a picture around the pointer. A WebGL shader draws the image, and near the pointer each pixel is read from a slightly shifted spot, so the picture seems to ripple, bulge, swirl or break into squares there, while the image itself never changes. The bending fades away after the pointer leaves.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Effect | Ripple | Ripple sends rings out from the pointer; Push bulges the picture outward; Liquid swirls it; Pixels breaks it into squares |
- | Strength | Medium | How far the picture bends: gentle is 4, medium 8 and strong 14; stronger looks more dramatic but harder to read |
- | Size | Medium | How wide an area bends: small is 15%, medium 25% and large 40% of the picture's height |
- | Fade-out speed | Normal | How fast the bending fades after the pointer leaves: each second it loses about three fifths of its strength at slow, about four fifths at normal and nine tenths at fast |
- | Moving ripples | on | With Ripple, the rings keep moving outward while the pointer rests; off, they stand still |
-
-- **README See also:**
- - [WebGL Shader Animation](../webgl-shader-animation/) — the same shader setup, painting patterns
- - [Parallax 3D Tilt](../parallax-3d-tilt/) — a card leans toward the pointer instead of bending
- - [Fluid / Liquid Simulation](../fluid-simulation/) — a liquid look that follows the pointer
-- **README How it works:** unchanged, plus two sentences after the procedural-texture snippet: "In the demo the pattern stands still, as a real image would: its time value stays at 0, and only the distortion moves. Once the pointer has gone and the fade has finished, the demo stops drawing, and the pointer or Show me starts it again."
-- **README Production notes:** in the "Backing store and DPR" bullet, "so a paused or reduced-motion demo has to repaint after a resize or it goes black" becomes "so a demo that is not drawing every frame (this one stops at rest) has to repaint after a resize or it goes black". The Wrap bullet names `CLAMP_TO_EDGE` (final fix wave); the rest is unchanged.
-- **Category line:** `06.14 · 3D &amp; Advanced`
-- **Pager:** Previous: GPGPU Particle System (`../gpgpu-particle-system/`) · Next: Cloth / Soft-Body Simulation (`../cloth-simulation/`)
-
----
-
-## cloth-simulation — Cloth / Soft-Body Simulation
-
-- **Kind:** loop. The cloth sways in the wind forever; you can drag it.
-- **Description:** A cloth sways in the wind, and you can drag it around. Best for playful pages.
-- **Watch it help line:** It moves by itself. Drag the cloth to pull it, or pause it to look closely.
-- **Player bar:** Pause (page) · Reset. No Slow motion: every physics step is a fixed 1/60 s, and slowing the steps would change how stiff the cloth is.
-- **Reset:** hangs a fresh cloth (`initCloth(paused)`, today's Reset cloth). While paused it settles the fresh cloth first (see the first picture below), so it shows the cloth already hanging, still; while playing it hangs the cloth flat and the loop lets it fall.
-- **Sequence:** the canvas loop as in the preamble (`loop(ts)`, 16ms gate). Each drawn frame runs `update()` once for every 1/60 s that has passed since the last one, at most three (see the frame-rate fix below), then `draw()`.
- - **Two functions in place of today's `start()`,** which both rebuilt the cloth and started the loop: `rebuild(settle)` is `resize(); initCloth(settle);`, for Detail and for a resize (both pass `paused` on as `settle`); `resume()` is `if(raf!==null)return; lastT=null; behind=0; raf=requestAnimationFrame(loop);`, for Play (`hb:pause` with `paused` false). At load the page runs `rebuild(true)`, then `resume()`.
- - **The first picture:** `initCloth(settle)` draws the cloth (today it draws only while paused). With `settle` it first runs 120 silent physics steps (`windT+=16; update();` each, two seconds of a 60 fps loop), so a cloth shown still (at load, on a paused arrival or under reduced motion) already hangs and sways, not the flat coloured rectangle it starts as; `rebuild(true)` at load does that. It costs 25 · 47 · 71 ms at Low · Medium · High on a laptop; on the throttled phone 84 ms at Low (the phone default, paid once at load), 195 ms at Medium and about half a second to a second at High (paid when the visitor presses Detail while paused).
- - **While paused,** Hangs from, Detail, Reset and a resize show a fresh cloth that has been settled first (`initCloth(paused)`, `rebuild(paused)`); while playing they hang it flat and the loop lets it fall. Shows the points redraws, and Wind, Gravity and Stiffness show at the next Play (they change how it moves).
- - **Dragging does nothing while paused:** the `if(paused){update();draw();}` line in the `pointermove` handler goes, so a paused cloth stays still.
- - The resize handler keeps its guard (it returns when the stage's size has not changed) and calls `rebuild(paused)`.
-- **Reduced motion:** the page's `paused=matchMedia(…).matches` start goes, and so does the rule `*,*::before,*::after{animation:none!important;transition:none!important}` (see the preamble).
-- **Stage font:** no text on the stage.
-- **Stage:** only the canvas. The fps badge goes. `touch-action:none` on the stage and the canvas stays (dragging needs it). `hb-dots`: no. Default height.
-- **Phone fallback:** today's stays: on phones (screens 600px wide or less, or 500px tall or less) the page starts at Low detail (16 × 12 points). At load it gives Low the `on` class and `aria-pressed="true"` (and takes them from Medium) itself, before the shared script reads the settings. Measured on the throttled phone: Low takes 5.2ms a frame, Medium 8.1ms and High 29ms; frames drawn in 3 seconds (180 is a full 60 fps): Low 180, Medium 141, High 52 (about 17 a second).
-- **Touch:** as today: Pointer Events with pointer capture; a finger drags the nearest point within 30px.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Hangs from | Choice buttons | Two corners · Top edge · One corner · Nothing | Two corners | Where the cloth is pinned; Nothing lets it fall. | `PIN_MODE`: `'top-corners'` / `'top-edge'` / `'single'` / `'none'`, then `initCloth(paused)` |
-| Wind | Choice buttons | Light · Medium · Strong | Medium | How hard the wind blows; it rises and falls. | `WIND`: 0.2 / 0.5 / 1.2 |
-| Stiffness | Choice buttons | Stretchy · Medium · Stiff | Medium | Stretchy sags and bounces; stiff keeps its shape. | `ITERS`: 2 / 4 / 8 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Gravity | Choice buttons | Light · Normal · Heavy | Normal | Heavy cloth hangs straighter and falls faster. | `GRAVITY`: 0.06 / 0.12 / 0.2 |
-| Detail | Choice buttons | Low · Medium · High | Medium (Low on phones) | More points make finer folds; phones start at Low. | `COLS`: 16 / 24 / 40, with `ROWS=Math.round(COLS*.75)`, then `rebuild(paused)` |
-| Shows the points | Switch | on / off | off | Marks each point; pinned ones are red. | `SHOW_VERTS` true / false, then `draw()` while paused |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - "↺ Reset cloth". The player bar's Reset replaces it.
- - The fps badge.
- - The Resolution and Pin Mode menus. They become Detail and Hangs from.
- - The Gravity, Wind Strength and Stiffness sliders. They become Gravity, Wind and Stiffness.
- - "Show vertices" becomes Shows the points.
- - "Show constraints". It drew exactly the same lines as the mesh, so it changed nothing.
-- **Good for:** Flags and banners · Playful pages · Fashion and textiles · **Avoid on:** Behind text · Serious content
-- **Prompt:**
-
- > Add a cloth simulation to [the flag, banner or fabric you want to show]. Model the cloth as a grid of points joined to their neighbors by links of fixed length. In fixed 1/60 s steps, as many as the time since the last frame needs, move every point by its own momentum plus gravity and wind, then pull linked points back toward their proper distance a few times over, so the cloth moves at the same speed on every screen. Pin some points so the cloth hangs, and let the visitor grab and drag the nearest point with the pointer or a finger. Use a coarser grid on phones. If the visitor has reduced motion turned on, show the cloth hanging still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A cloth simulation treats fabric as a grid of points joined by links of fixed length. Sixty times a second, every point keeps moving the way it was moving, plus gravity and wind, and then the links pull neighboring points back into shape. Pin a few points and the grid hangs, sways and folds like fabric, and you can grab it.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Hangs from | Two corners | Pins the top two corners, the whole top edge, one corner, or nothing, in which case the cloth falls to the floor |
- | Wind | Medium | How hard the wind blows; it rises and falls on its own: light is 0.2, medium 0.5 and strong 1.2 |
- | Stiffness | Medium | How many times each step, sixty a second, the links are pulled back to length: stretchy is 2, medium 4 and stiff 8 |
- | Gravity | Normal | How heavy the cloth is: light is 0.06, normal 0.12 and heavy 0.2 |
- | Detail | Medium | How many points the cloth has: low is 16 × 12, medium 24 × 18 and high 40 × 30; phones start at low |
- | Shows the points | off | Marks every point of the grid, with the pinned ones in red |
-
-- **README See also:**
- - [GPGPU Particle System](../gpgpu-particle-system/) — physics moved to the graphics chip
- - [Noise-Based Motion](../noise-based-motion/) — natural movement from noise instead of physics
- - [Canvas Particle Effect](../canvas-particle-effect/) — simpler physics for loose particles
-- **README How it works:** unchanged, except for the frame-rate fix (below): the Verlet lead-in ends "(`dt` is the fixed step, 1/60 s)", and a "**Fixed steps**" paragraph with a `frame(elapsed)` snippet and a paragraph after it follow the constraints snippet.
-- **README Production notes:** the Performance bullet becomes "**Performance**: at 40×30 (1,271 points, 2,470 links, 4 passes = 9,880 link corrections a step) a phone-class CPU manages about 17 frames a second (one step and one drawing each), and 24×18 about 47. The demo starts at 16×12 on phones (screens 600px wide or less, or 500px tall or less), where it holds 60; its Detail setting still lets you pick more." The "Verlet vs explicit Euler" bullet says "on every step" in place of "each frame", and a bullet follows it: "**Fixed time step**: one step per drawn frame makes the cloth fall twice as fast on a 120 Hz screen and half as fast on a 30 Hz phone, and stretching a step to the length of the frame changes what Verlet computes. Step by a fixed 1/60 s from an accumulator, as above, and draw once per frame." The rest is unchanged.
-- **Category line:** `06.15 · 3D &amp; Advanced`
-- **Pager:** Previous: Image Distortion on Hover (`../image-distortion-hover/`) · Next: Volumetric Smoke / 3D Noise (`../volumetric-smoke/`)
-- **Frame-rate fix (wrap-up):** Verlet keeps a point's velocity as the distance it moved in the last step, so every step must be the same length: the loop always steps by `FRAME = 1000/60` and runs as many steps as the time since the last drawn frame calls for. `behind` is the time not yet stepped: `behind += Math.min(dt, 50)`, then `while (behind >= FRAME - 1 && steps < 3) { windT += FRAME; update(); behind -= FRAME; steps++; }` (1 ms of slack, at most 3 steps, so a slow device makes the cloth slower instead of piling up work), and the frame is drawn only if a step ran. The wind clock `windT` adds `FRAME` per step. The 16 ms gate stays, as a cap of 60 drawn frames a second, so a 60 Hz screen runs one step a frame, a 30 Hz screen two, and a 144 Hz screen draws about 48 pictures a second with one or two steps; the cloth falls and swings at the same speed on all of them. `lastT` starts as `null` (the first frame only takes the time), and `resume()` and a `visibilitychange` listener set it to `null` and `behind` to 0. The 120 settle steps in `initCloth(true)` are unchanged. The prompt now says "In fixed 1/60 s steps, as many as the time since the last frame needs" (128 words; the limit is 130).
-
----
-
-## volumetric-smoke — Volumetric Smoke / 3D Noise
-
-- **Kind:** loop. The smoke keeps rising.
-- **Description:** Soft smoke curls upward, drawn as a real 3D cloud. Best for moody backgrounds.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the WebGL loop as in the preamble (`render(ts)`, 16ms gate).
- - **The clock:** the page keeps its own clock, `curT` (each frame's time, at most 50ms, and nothing on the first frame after a start), in place of `(ts-startT)/1000`. `startT` and `pausedAt` go. `curT` starts at 2 (today's value) and `rise` (below) at 1.2, 2 × the default Speed, so the first picture is today's still frame.
- - **The rise:** the page also keeps `rise`, which adds the same step × Speed. The shader takes `uniform float uRise` and `density()` uses `fbm(q*1.4+vec3(0.,uRise*.4,0.))` in place of `t*uSpd*.4`, so a new Speed never makes the smoke jump (today the rise is the time × the speed). The wind drift still follows the clock.
- - **The first picture:** `draw(curT)` at load. **While paused,** settings call `refresh()` and a resize redraws, as today.
-- **Slow motion:** while the switch is on, the clock and the rise add a third of each frame's step, from the next frame.
-- **Reduced motion:** the page's reduced-motion branch goes (see the preamble), with the CSS comment about it.
-- **Stage font:** no text on the stage; `.msg` uses the site font.
-- **Stage:** only the canvas. The fps and steps badges and the shader source panel go; `.msg` stays. `hb-dots`: no. Default height.
-- **Phone fallback:** more than today's, because today's left the effect at 6 to 7 frames a second on a laptop with integrated graphics and at 20 to 38 on the phone stages, against the 60 CLAUDE.md asks for (Intel UHD chip, GPU rendering in headless Chrome, the CPU slowed four times on the tablet and phones). Two changes carry it, with the phone limits below:
- - **The plume's edge:** `density()` returns 0 at once where the plume's shape is faint, `if(src<1e-3)return 0.;` after the `src` line and before the `fbm` line, so the five noise samples are only taken where there can be smoke. The first picture changes by 4/255 at most in a pixel (12/255 at most with Thick smoke; 15/255 later in the loop).
- - **The canvas:** it is capped at about 65,000 pixels. It draws at `Math.min(devicePixelRatio, 0.75 on phones and 1 elsewhere, Math.sqrt(65000/(w×h)))` of the stage's CSS size, where w×h is the stage's size in CSS pixels, and the browser scales it up (the resize guard compares the resulting canvas size, as before). With both changes the stage differs from today's by 0.05 to 0.15/255 on average; the grain is a little coarser. The cap was 90,000 at first, which drew only 148 to 156 frames in 3 seconds on a portrait tablet (768×1024 at 2×, CPU slowed four times); 65,000 draws 181 there, and its first picture differs from the 90,000 one in 0.02% of its pixels by more than 8/255. Laptops and landscape tablets draw 181 at every cap.
- - **Phones** are screens 600px wide or less, or 500px tall or less (held sideways). There the canvas is also at most 0.75 of the stage and a ray takes at most 48 steps, so High is 48 (today's).
- - **Measured:** frames drawn in 3 seconds at Medium (180 is a full 60 fps), before → after: 1366×657 laptop 23 → 180, 1280×800 computer 21 → 181, tablet 25 → 181 (156 at the first 90,000 cap), phone held upright 114 → 180, phone held sideways 61 → 181; at High (measured at the first 90,000 cap): 12 → 122, 11 → 113, 14 → 85, 80 → 159 (48 steps), 44 → 160 (48 steps). Low draws about 180 on every screen.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Thickness | Choice buttons | Thin · Medium · Thick | Medium | Thin smoke is wispy; thick smoke hides what is behind. | `DENS`: 0.4 / 0.7 / 1.2 |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the smoke rises. | `SPD`: 0.35 / 0.6 / 1 |
-| Detail | Choice buttons | Low · Medium · High | Medium | More steps look smoother but cost more. | `STEPS`: 16 / 32 / 64 (High is 48 on phones), through `setSteps()` without its slider and badge lines |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Smoke color | Swatches | Gray blue · White · Purple · Orange | Gray blue | The color of the lit smoke. | `SMOKE` from `#9ab4d8` / `#f4f4f2` / `#d2a8ff` / `#ffa657` (today's default is the first) |
-| Wind | Switch | on / off | on | The smoke drifts slowly to one side. | `WIND` true / false |
-| Fine grain | Switch | on / off | on | Grain hides the stripes that few steps leave. | `DITHER` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps and steps badges.
- - The Smoke Density, Animation Speed and March Steps sliders. They become Thickness, Speed and Detail.
- - The Smoke Color picker. It becomes the Smoke color swatches.
- - The Background Color picker. The background stays `#030810`; it framed the smoke but did not change it.
- - "Wind drift" and "Noise dither (reduce banding)" become Wind and Fine grain.
- - "View shader source" and its panel (the pages show no code).
-- **Good for:** Moody backgrounds · Title cards · Games · Sci-fi themes · **Avoid on:** Behind text · Low-power devices
-- **Prompt:**
-
- > Add volumetric smoke to [the section you want it in]. In a fragment shader, send a ray through a 3D cloud of smooth noise for every pixel and add up how much smoke it passes through, shading each step by how much smoke lies between it and the light, so the plume looks soft, deep and lit from one side. Move the noise upward over time so the smoke rises and curls, and let it drift sideways when the settings include wind. It is costly, so draw fewer pixels and take fewer steps on phones. If the visitor has reduced motion turned on, show the smoke still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Volumetric smoke is drawn as a real 3D cloud rather than a flat picture. For every pixel, a ray passes through a cloud of smooth noise and adds up how much smoke it meets, shading each part by how much smoke lies between it and the light. That gives soft edges and depth, which is how films draw smoke, fog and clouds.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Thickness | Medium | How dense the smoke is: thin is 0.4, medium 0.7 and thick 1.2; thin looks wispy, thick hides what is behind |
- | Speed | Normal | How fast the smoke rises: slow is 0.35, normal 0.6 and fast 1 |
- | Detail | Medium | How many steps each ray takes: low is 16, medium 32 and high 64 (48 on phones); fewer steps leave visible stripes |
- | Smoke color | Gray blue | The color of the lit smoke; the shadowed parts are darker shades of it |
- | Wind | on | The whole plume drifts slowly to one side |
- | Fine grain | on | Starts each ray at a slightly random point, which turns the stripes that few steps leave into fine grain |
-
-- **README See also:**
- - [Ray Marching / SDF Scene](../ray-marching-sdf/) — rays that stop at surfaces instead of adding up smoke
- - [Noise-Based Motion](../noise-based-motion/) — the same kind of noise, on a flat canvas
- - [Fluid / Liquid Simulation](../fluid-simulation/) — a soft, liquid look drawn by a shader
-- **README How it works:** in the `smokeDensity` snippet, `t * speed` becomes `rise`, and the line `if (src < 0.001) return 0.0; // nothing to add here, so skip the noise` goes after the `src` line, before the `fbm` line. These sentences follow the snippet, as two paragraphs: "`rise` grows every frame by the frame's time × the speed, on the page, so changing the speed never makes the smoke jump." and "Wherever `src` has faded to almost nothing the function returns before the noise, so the five noise samples are only taken where there can be smoke. That, together with the smaller canvas described under Mobile cost, keeps the demo smooth on laptops and phones." The snippet's last line reads `* src * density * 2.0`, as the page does (final fix wave). The rest is unchanged.
-- **README Production notes:** the Mobile cost bullet is rewritten, the rest is unchanged:
-
- > - **Mobile cost**: this is fill-rate bound — every fragment runs up to `steps x (fbm + 3 shadow taps)`, so the demo trims it three ways. `smokeDensity` returns before the noise wherever the plume has faded out. The backing store is capped at about 65,000 pixels and the browser scales it up to the stage, which suits soft smoke; it never exceeds 1 CSS pixel per fragment either. On phones (screens 600px wide or less, or 500px tall or less when held sideways) the backing store is also at most 0.75 of the stage and the march at most 48 steps. Honouring a 3x phone DPR would multiply the cost ninefold.
-- **Category line:** `06.16 · 3D &amp; Advanced`
-- **Pager:** Previous: Cloth / Soft-Body Simulation (`../cloth-simulation/`) · Next: Morphing Blob (`../morphing-blob/`)
-
----
-
-## morphing-blob — Morphing Blob
-
-- **Kind:** loop. The blob keeps drifting and changing shape.
-- **Description:** Blobs melt together, and one drop chases your pointer. Best for hero sections.
-- **Watch it help line:** It moves by itself, and one drop follows your pointer or finger. Pause it to look closely, or turn on slow motion.
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** an animation-frame loop moving SVG circles.
- - `frame(t)` splits into `step(dt)` and `place()`, and each frame runs both. `step(dt)` only advances `phase` and moves the drop toward the pointer. `place()` works out every drifting circle's position from `phase`, as today's `frame()` does (`b.x = b.bx + Math.sin(phase*b.sx + b.px)*b.ax`, `b.y = b.by + Math.cos(phase*b.sy + b.py)*b.ay`), and writes every circle's `cx`, `cy` and `r` (the drop at its own `x`, `y`).
- - `start()` returns when `raf` is set; otherwise it forgets the last frame's time, so the first frame after a start adds nothing (today `Math.min(time-last,0.1)` could add a tenth of a second at once), and requests a frame.
- - **The first picture:** `place()` at load, after `build()`: the circles appear where the first moving frame continues from, so Play never snaps. (`build()` only creates the circles and sets no position or size on them; today's still picture came from `paintStatic()`, which goes.) **While paused,** Number of blobs rebuilds and calls `place()` the same way; Gooeyness shows at once (it is an attribute of the filter); Speed shows at the next Play. The drop's target still follows the pointer, and the drop catches up after Play.
-- **Slow motion:** while the switch is on, `phase` adds a third (`dt/1000*speed/3`) and the drop closes 0.03 of the gap in every 1/60 s in place of 0.09, from the next frame.
-- **Reduced motion:** `reduce` goes, with `speed=0` and `paintStatic()`; the `.tip` rule goes with the tip (see the preamble).
-- **Stage font:** no text on the stage.
-- **Stage:** the SVG only; the "Move your pointer" tip goes. The stage keeps its radial gradient, `touch-action:none` and `cursor:crosshair`. `:root` gets `--ui-accent:#3fd6c4`; `--accent` and `--accent2` go with the panel, and `--stage` stays (the gradient uses it). `hb-dots`: no (it would replace the gradient). Default height. **The whole blob shows on every stage:** the SVG keeps its drawing coordinates (every formula, and the drop starting at (200, 200)) but becomes `viewBox="20 20 360 360"` with `preserveAspectRatio="xMidYMid meet"`, in place of the full 400 square sliced to fill the stage. Sliced, a stage as wide as the laptop ones showed only a horizontal band of the blob: measured on the page, 57% of each circle's box at 1280×590 (a 958×258 stage), 70% at 1366×657, 77% at 1280×800 and 72% on a sideways phone, and 57% to 71% in the paused first pictures. Now the box is as tall as the stage on a wide stage, and the stage beside it is drawn too. The circles reach at most about 194 units from the middle (about 160 at the extremes of a typical build, and 176 or less in nine builds of ten), so the size of the box is a choice between blob size and cuts. Measured on the page over random builds, phases and 4, 6 and 9 circles: a 300-unit box (`50 50 300 300`) cut some circle in 21% of moments, a 320 box in 7%, a 340 box in 2%, this 360 box in 0.2% to 0.4% (never more than 9% of one circle, a graze) and a 380 box in none, while the blob's size on screen falls only about 5% with each 20 units. The 360 box keeps 99.99% or more of every circle in view on average, on the shared stages and the paused first pictures. The drop is 49 to 83px wide on the shared stages (44px with the full 400 square), and on the phone stage the picture is almost as before (drawing scale 0.828, was 0.8575).
-- **Phone fallback:** none needed. Measured on the throttled phone: 0.5 to 0.8ms a frame and a full 60 frames a second with the filter, at 4, 6 and 9 blobs.
-- **Touch:** as today: `pointerdown` and `pointermove` set the drop's target, and the stage's `touch-action:none` lets a finger drag it. The position is turned into drawing units through the SVG itself, `new DOMPoint(e.clientX, e.clientY).matrixTransform(svg.getScreenCTM().inverse())`, so the drop stays under the pointer or finger anywhere on the stage, also beside the box on a wide stage.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Gooeyness | Choice buttons | Low · Medium · High | Medium | How far apart the circles start to melt together. | the blur's `stdDeviation`: 6 / 10 / 16 |
-| Number of blobs | Choice buttons | Few · Medium · Many | Medium | More circles make a lumpier blob. | `build(4 / 6 / 9)` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the circles drift. | `speed`: 0.6 / 1 / 1.6 |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note.
- - The Technique, Filter and Droplet readouts.
- - The "Move your pointer" tip. The help line says it.
- - The Gooeyness, Blob count and Drift speed sliders. They become Gooeyness, Number of blobs and Speed; Drift speed could reach zero, and Pause does that now.
-- **Good for:** Hero sections · Playful brands · Loading states · Cursor effects · **Avoid on:** Serious content · Busy layouts
-- **Prompt:**
-
- > Add a gooey blob to [the section you want it in]. Draw several plain circles that drift on looping paths, and run them through a filter that blurs them and then sharpens the blurred edge again, so circles that come close melt into one liquid shape and pull apart again. One drop follows the pointer, or a finger on touch screens, and merges with the rest when it comes near. Keep the blurred area small on phones. If the visitor has reduced motion turned on, show the blob still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A morphing blob is a soft, liquid shape made from plain circles. The circles are blurred and then their edges are sharpened again, so wherever two come close they melt into one shape, like drops of mercury. As they drift, the blob stretches, splits and joins, and one drop follows the pointer.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Gooeyness | Medium | How much the circles are blurred before the edge is sharpened again: low is 6, medium 10 and high 16; higher melts circles from farther apart |
- | Number of blobs | Medium | Few is 4, medium 6 and many 9 circles, counting the drop that follows the pointer |
- | Speed | Normal | How fast the circles drift: slow is 0.6, normal 1 and fast 1.6 times |
-
-- **README See also:** the last link's text changes to the page's real title.
- - [Fluid / Liquid Simulation](../fluid-simulation/) — the same melting, drawn by a WebGL shader
- - [Noise-Based Motion](../noise-based-motion/) — smooth noise ripples a blob's outline
- - [SVG Path Animation](../svg-path-animation/) — lines that draw themselves
- - [Ray Marching / SDF Scene](../ray-marching-sdf/) — shapes that melt together in 3D
-- **README How it works:** unchanged, except for the frame-rate fix (below): the `step(dt)` snippet gains `FRAME` and `pull = 1 - Math.pow(1 - 0.09, dt / FRAME)`, the sentence on the integrated phase reads `phase += dt / 1000 * speed`, and a paragraph on the drop's share of the gap follows it.
-- **README Production notes:** the Reduced motion bullet becomes: "**Reduced motion.** Under `prefers-reduced-motion: reduce` the demo starts paused, showing the blob still, until the visitor presses Play. In production, never leave an autonomous churning shape running for users who opted out: show one settled arrangement." The frame-rate fix (below) adds a bullet after the two on the filter and Safari: "**Time, not frames**: easing that closes a fixed share of the gap on every frame follows the screen's refresh rate. Scale the share by the time since the last frame, as above, and cap that time (this demo uses 50 ms) so a tab that comes back does not lurch." The rest is unchanged.
-- **Category line:** `06.17 · 3D &amp; Advanced`
-- **Pager:** Previous: Volumetric Smoke / 3D Noise (`../volumetric-smoke/`) · Next: 3D Flip Card (`../flip-card-3d/`)
-- **Frame-rate fix (wrap-up):** `step(dt)` gets `dt` in milliseconds, at most 50 (it was seconds, at most 0.1): `phase += dt/1000 * speed / (slow ? 3 : 1)`, and the drop closes `pull = 1 - (1 - (slow ? 0.03 : 0.09)) ** (dt / FRAME)` of its gap to the pointer, with `FRAME = 1000/60`. So it closes 0.09 of the gap in every 1/60 s (about 0.17 at 30 Hz and 0.04 at 144 Hz) and arrives in the same time on every screen. The drift phase was already time-based. A `visibilitychange` listener sets the last frame time back to `null`, so the first frame back from a hidden tab adds nothing (as after a start). README: the `step(dt)` snippet, a paragraph on the drop's share and a "Time, not frames" Production note.
-
----
-
-## flip-card-3d — 3D Flip Card
-
-- **Kind:** do it. The card turns only when it is clicked, tapped, hovered (with Flips on hover) or shown by Show me.
-- **Description:** A card turns over in 3D to show its back. Best for profile and product cards.
-- **Step 1:** Click it — "Click or tap the card to turn it over, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (css)
-- **Show me:** one click's worth, about 2.5 seconds at Normal: `setFlipped(true)` at once; after Speed + 1200ms (Speed × 3 + 1200ms while Slow motion is on), `setFlipped(false)`. It ends on the front. A second press clears the pending timer and starts again. A run starts from the front: a card that shows its back is put on the front without turning or fading (`toFront()` holds the transitions of the card and of its faces for that one change, so under reduced motion the swap to the back that follows is seen). With Flips on hover, Show me sets `hovering` false, so a pointer that is resting on the card (a keyboard press) turns the card again at its next move.
-- **Stopping a run:** on `hb:input`, only if a run is under way (its timer is pending): clear the timer, leaving the card as it is; otherwise do nothing. The visitor's click, tap or key then turns it as usual.
-- **Reset:** stops a run, sets `hovering` false (as Show me does), calls `setFlipped(false)` and sets the tilt flat (`tilt.style.transform='rotateX(0deg) rotateY(0deg)'`).
-- **Sequence:** as today. A click, a tap, Enter or Space turns the card over; with Flips on hover, pointing turns it and leaving turns it back, and a tap still turns it on touch screens. While idle under a hovering pointer, the card leans toward it (Tilt toward the pointer). The "Flip card" button goes: Show me demonstrates the flip, and the card itself is the control.
-- **Slow motion:** css: the flip and the tilt's return run at a third of their speed, and Show me's wait uses Speed × 3 while the switch is on.
-- **Reduced motion:** Show me does not run on arrival. The demo's reduced-motion rules stay: the faces swap with a 120ms fade instead of turning, and the tilt is off. Show me, clicks and taps still swap the faces. Show me pressed while the card shows its back puts it on the front at once, then fades to the back, so the swap is seen before the card fades back to the front.
-- **Stage font:** site font. `.avatar` and `.front .name` drop `var(--disp)` (their weights 800 and 700 stay). `.front .hint` and `.back .hint` get 11px and `rgba(255,255,255,.6)` (were 9px at .4); `.back .over` gets 11px and `font-weight:600` (was 9px).
-- **Stage:**
- - The card only, directly in the stage; the `.stage-wrap` wrapper goes.
- - **The card is sized from the stage's height.** Today's width formula assumes the old 360–560px stage, and the card overflows the 300px phone stage. `.tilt` gets `height:100%;align-items:center`, which centres the card on the stage and on the perspective's vanishing point, and `.card` gets `height:min(95%,340px);width:auto;aspect-ratio:5/7` in place of its width formula. Measured: 175×245px on both phones (both faces' text inside), 243×340px on a tablet, 155×218px on the 1366×657 laptop and 191×268px on a 1280×800 screen. Probed from 70° to 89.5° on both axes at Strong depth, nothing is clipped at any of those sizes; a card filling the stage's height (`min(100%,420px)`) was clipped by 4px on phones and 24px on a tablet.
- - Card text: the front hint becomes "Tap or click to flip →" (was "Click / tap / Enter to flip →"). The name, role, rows and the back's hint stay.
- - `.front .role` and `.back .over` use `#b98cff` directly, the card's own purple, since `--ui-accent` becomes the category's teal. `.card:focus-visible` keeps `var(--ui-accent)`.
- - The stage keeps its radial gradient, its `clamp(20px,4vw,48px)` padding and `perspective:var(--perspective)`; its own height goes. The shared `overflow:hidden` applies; the card fits at every depth and angle (above).
- - `hb-dots`: no (the stage keeps its gradient). Default height.
-- **Phone fallback:** none needed.
-- **Touch:** as today: a tap turns the card. The idle tilt stays off on touch screens (`@media(hover:none)` and the `canHover` check), because it follows a hovering pointer; turning the card is the tap equivalent.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Flip direction | Choice buttons | Sideways · Up and over | Sideways | Sideways turns like a page; up and over like a flap. | `axis`: `'y'` / `'x'` (the card's `axis-x` class off / on) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long one turn takes. | `--flip-dur`: 1000ms / 650ms / 400ms (Show me reads the same value) |
-| 3D depth | Choice buttons | Subtle · Medium · Strong | Medium | Strong looks closer and more dramatic. | `--perspective`: 2000px / 1200px / 600px |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Flips on hover | Switch | on / off | off | Pointing flips it; a tap still flips it on phones. | `trigger`: `'hover'` / `'click'`; switching it on turns the card to its front, as today |
-| Tilt toward the pointer | Choice buttons | Off · Gentle · Strong | Gentle | The card leans toward a hovering pointer. | `maxTilt`: 0 / 10 / 18 (degrees; the card leans half that at the stage's edges; Off also sets the tilt flat, as today) |
-
-- **Removed:**
- - The note.
- - The Flip card button.
- - The Flip axis and Trigger buttons. They become Flip direction and Flips on hover. The page's own `.seg`, `.seg button` and `.seg button.on` rules go with them, so they cannot restyle the shared Try it buttons.
- - The Flip duration, Perspective depth and Idle tilt strength sliders. They become Speed, 3D depth and Tilt toward the pointer.
-- **Good for:** Profile cards · Product cards · Flashcards · Quiz answers · **Avoid on:** Long text · Key information
-- **Prompt:**
-
- > Add a 3D flip to [the card you want to turn over]. Place the front and back faces in the same spot, turn the back face around so it faces away, and hide whichever face points away from the viewer. Clicking, tapping or pressing Enter turns the card over in 3D to show its back, and again to show its front. Give the card's container a 3D perspective so the turn has depth. When the settings include it, pointing at the card can flip it too, and the card can lean toward a hovering pointer. If the visitor has reduced motion turned on, swap the faces with a quick fade instead of turning. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A 3D flip card has a front and a back and turns over in 3D to show the other side. Both faces sit in the same place, the back one turned away, and whichever face points away from the viewer is hidden. Perspective on the card's container gives the turn real depth, so it feels like turning over a physical card.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Flip direction | Sideways | Sideways turns the card like a page; up and over turns it like a flap |
- | Speed | Normal | How long one turn takes: slow is 1000ms, normal 650ms and fast 400ms; 600 to 900ms feels physical |
- | 3D depth | Medium | How close the viewer seems: subtle is 2000px, medium 1200px and strong 600px; closer exaggerates the turn |
- | Flips on hover | off | Pointing at the card turns it over and leaving turns it back; a tap still turns it on touch screens |
- | Tilt toward the pointer | Gentle | While idle, the card leans toward a hovering pointer, up to 5° (gentle) or 9° (strong) at the stage's edges; off keeps it flat |
-
-- **README See also:** each line gets a phrase, as the page checks require.
- - [Parallax 3D Tilt](../parallax-3d-tilt/) — a card leans toward the pointer without turning over
- - [Flip In](../../02-entrance-and-exit/flip-in/) — a card swings into view on a 3D hinge
- - [Scroll-Driven 3D Rotation](../scroll-driven-3d-rotation/) — scrolling turns a 3D cube
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `06.18 · 3D &amp; Advanced`
-- **Pager:** Previous: Morphing Blob (`../morphing-blob/`) · Next: none
diff --git a/docs/superpowers/plans/2026-09-29-ambient-content.md b/docs/superpowers/plans/2026-09-29-ambient-content.md
deleted file mode 100644
index 6aa89ba1..00000000
--- a/docs/superpowers/plans/2026-09-29-ambient-content.md
+++ /dev/null
@@ -1,1525 +0,0 @@
-# Ambient & Background — Content Sheet
-
-This sheet decides, page by page, how the seventeen Ambient & Background pages present their kind, settings, words and prompt on the guided-steps page. The conversion tasks of `2026-09-29-demo-page-rollout-parallel.md` follow each section exactly, together with "How to convert a page" in `2026-09-28-demo-page-rollout-text-typography.md` and the lessons in the rollout's Global Constraints. Rotate In (`animations/02-entrance-and-exit/rotate-in/`) is the reference for everything a section does not mention. The Text & Typography loops are the reference for loops: Glitch Text, Marquee / Ticker, Text Gradient Animation and Wavy Text for "css" loops, Text on a Path for a loop driven by animation frames, and Variable Font Morph for a loop driven by a timer (the `wait()`/`freeze()`/`thaw()` helper).
-
-Every page in this category is a loop: each one runs forever with no natural end. None is a plays-once, do-it or scroll page, and every page keeps settings, so every page has a Try it step. None of the rollout spec's special cases concerns this category.
-
-How to read a section:
-
-- **Sets in the demo** lists one value per choice, in the same order as the choices. A Speed row sets the script's variable and the CSS variable it names.
-- **Shown only when …** in the Control column means the setting's whole `div.hb-setting` gets the `hidden` attribute while it has no effect, so it also drops out of "Your settings".
-- Switches in Try it keep their default in the markup (`checked` when the default is on), as on Rotate In. Only the player bar's Slow motion starts unchecked.
-- **Watch it help line: default** means the loop line from the Text & Typography plan: "It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement." (with Slow motion), or "It moves by itself. Pause it to look closely." (without). The Try it help line is always the loop line, "Change a setting and see the difference as it moves." A page's own Watch it help line must stay on one line on laptops, or the player bar drops below the first screen: at most about 880px in the site font at 16px (the default line is 736px).
-- **Pause (css)** means `data-hb-pause="css"` and **Pause (page)** means `data-hb-pause` without a value. The same goes for Slow motion and `data-hb-slowmo`.
-- **Speed** always reads Slow · Normal · Fast, and today's default stays Normal. For a duration (a cycle, a fade, a ring's life), Slow is about 1.6 times and Fast about 0.6 times the default; for a rate (pixels or steps per frame, steps a second), it is the other way round.
-- **Number of …** turns a count into named steps. Where the demo draws fewer on phones, the hint and the README say so.
-- **Colors** (plural) is a named set of colours, as choice buttons. A single colour picker becomes swatches, each with its colour's name as its `aria-label`. Swatches use the Text & Typography palette, in this order, where the demo's default colour is one of them: Pink `#ff6f8b` · White `#f4f4f2` · Blue `#58a6ff` · Purple `#d2a8ff` · Green `#56d364` · Orange `#ffa657`. Breathing / Pulsing Glow leaves out White (see its section). Light Leak, Particle Constellation and Synthwave Grid keep their own colours (listed in their sections), because those colours are part of the look.
-- **Category line:** the pages have none today. NN is the page's position on the home page, which its card already shows: `07.01 · Ambient &amp; Background` (Animated Gradient Background) to `07.17 · Ambient &amp; Background` (Plasma Field).
-- **Accent:** every page uses `--ui-accent:#ffce5a`, the colour twelve of the seventeen pages already have. Flow Field (`#7affc8`), Matrix Rain (`#5fd88a`), Particle Constellation (`#5ad1ff`), Plasma Field (`#ff6f8b`) and Synthwave Grid (`#ff5ca8`) change to it. None of those five uses `--ui-accent` inside its stage (their canvas colours are written in their scripts), so only the page around the demo changes colour.
-- **Stage:** `hb-dots` is left off on every page, because every stage paints its own full background (a gradient, a canvas, a scene). Every page uses the default height: the old `--stage-h` values (620px, 420px or 380px on phones; `min(64vh,600px)` and `52vh` on Plasma Field) go, and so do the phone rules that made Grain / Film Noise Overlay and Scanline Effect `height:auto`. A demo's own `.stage` rule keeps only what its content needs (`position:relative`, `overflow:hidden`, its background, its flex centring where it has it, and Grid / Dot Pattern Parallax's `cursor:none`, which that page's custom cursor ring replaces); `flex:1`, `min-width`, `height`, `border` and `border-radius` go, because the page owns them. Nothing here takes typed text, so no stage uses `hb-grow`.
-
----
-
-## Owner decisions and lessons that apply here
-
-- **Stage text uses the site font.** No page here is a typing effect, so none keeps a monospace font: Scanline Effect's terminal and Matrix Rain's falling characters use the site font too (see their sections). Georgia and the italics go from every card and caption.
-- **Pause stops at once, on every loop.**
- - On the "css" loops (Animated Gradient Background, Mesh Gradient Animation, Aurora / Northern Lights, Scanline Effect, Breathing / Pulsing Glow), the shared class `hb-paused` holds every `@keyframes` animation on the stage at once. These five have no page timers.
- - On the canvas and animation-frame loops, the page cancels its frame (the pattern below).
- - Light Leak is a timer chain drawn by a CSS transition: it uses the Text sheet's `wait()`/`freeze()`/`thaw()` helper, with `freeze()` limited to CSS transitions, while `data-hb-pause="css"` holds its floating light spots (see its section).
-- **Reduced motion** greys out Slow motion, starts every loop paused and runs nothing by itself; Pause/Play still works. See "Reduced motion" below for what that removes from these pages.
-- **Long names in the top bar** ("Grid / Dot Pattern Parallax", "Starfield / Space Particles") are cut with "…" by the shared stylesheet; the pages do nothing.
-- **Lessons from the Text & Typography reviews:** the `hb:pause` listener is registered at the top level of the page's inline script; the page reaches the player controls by their ids (`btn-pause`, `slow-tog`), never by `data-hb-*`; a page never calls `pause()` or `play()` on a CSS keyframe animation.
-
-## Canvas and animation-frame loops (Pause "page")
-
-Eleven pages move their picture with `requestAnimationFrame`: Grain / Film Noise Overlay, Starfield / Space Particles, Ambient Ripple Effect, Floating Elements, Grid / Dot Pattern Parallax, Abstract Geometric Motion, Particle Constellation, Flow Field, Synthwave Grid, Matrix Rain and Plasma Field. Each follows Text on a Path, and its section only adds what differs:
-
-- The loop keeps exactly one pending frame in `raf`. `start()` returns at once when `raf` is set; otherwise it forgets the time of the last frame and requests a frame.
-- The page listens for `hb:pause`, registered at the top level of its inline script. Paused: `cancelAnimationFrame(raf); raf=null;` and the picture on screen stays as it is. Not paused: `start()`, which carries on from the current state. The page keeps its own `paused` flag from this event; the old panel's flag and button go.
-- Every other path that used to restart the loop (`visibilitychange` on Matrix Rain and Plasma Field, the mouse leaving Grid / Dot Pattern Parallax, a resize) restarts it only while not paused.
-- Where the movement follows the clock (Ambient Ripple Effect, Grid / Dot Pattern Parallax, Plasma Field), the page keeps its own clock, which adds up each frame's time (at most 50 ms, and nothing on the first frame after a start), so Play never jumps. Matrix Rain keeps today's step timer and Grain / Film Noise Overlay today's redraw interval; after a pause, each takes at most one step. Where the movement is a step per frame, the step scales with the time since the last frame, in 60ths of a second (`dt / (1000/60)`, `dt` at most 50 ms, and no step on the first frame after a start); the frame-rate wrap-up did this on Floating Elements, Flow Field, Particle Constellation, Starfield / Space Particles, Synthwave Grid and Ambient Ripple Effect's source drift (see their sections), as Abstract Geometric Motion already did. The existing 16 ms frame gate (`if(dt<16)return`) stays where a page has one, except on Flow Field and Starfield / Space Particles, which draw only when a whole 60th of a second is due.
-- **The first picture:** the page draws a frame at load, before the loop starts (or the settled picture its section names), so a loop that is paused on arrival never shows an empty stage.
-- **While paused,** a setting change draws the picture again so the change shows: without moving anything, or, on Flow Field and Matrix Rain, as a fresh settled picture (their trails need steps to show a change). This is the loop rule "changing a setting while paused shows the new setting without starting the loop again". The sections name the function that draws.
-- **Resizes:** a page acts on a resize only when its stage's size has really changed. It compares the stage's `clientWidth` and `clientHeight` with the size it last drew for, and otherwise does nothing. Phones fire `resize` whenever the address bar slides in or out, and Matrix Rain's `ResizeObserver` reports once as soon as it starts watching; without the check, each of those would clear the canvas or start the picture again from scratch. After a real change, the page draws its picture again at once, playing or paused (the sections name the function).
-- **Slow motion (page):** while the switch is on, each frame moves things a third of the usual step, or adds a third of the frame's time to the page's clock, or (Matrix Rain, Grain / Film Noise Overlay) waits three times as long between steps. It takes effect from the next frame.
-- **The same choice again:** a press on the choice already made does nothing where it would deal or draw again (a new arrangement of stars, shapes, dots, particles, columns, rings or grain, or a re-planned wait). The handler returns before it changes anything, so a paused picture changes only when a setting really changes. A choice that only sets a value or a CSS variable is harmless to press twice, so it has no guard.
-- The fps badges and FPS readouts go.
-
-## Reduced motion for full-stage effects
-
-Today every page handles reduced motion itself, in one of two ways:
-
-- CSS rules that stretch the loop to 60 or 300 seconds a cycle, or remove it (`animation-duration:300s!important`, `animation:none!important`, a leak held at a steady glow);
-- script checks that draw one still frame and never start the loop. On Particle Constellation they also hide the Pause button, and on Matrix Rain they make Pause do nothing.
-
-All of them go, on every page:
-
-- the shared script now starts every loop paused under reduced motion, and a visitor who presses Play has asked to see the effect;
-- the slow-down rules override Speed with `!important`, so Speed would do nothing, and at 300 seconds a cycle Play would look broken;
-- the still-frame checks would stop Play from starting anything, and the browser check fails a loop that does not move after Play.
-
-What stays is the still picture: while the loop is paused on arrival, every stage shows a full, still frame (the first frame, or the settled picture its section names). The prompts keep their reduced-motion sentence, which is about the visitor's own site.
-
-## Heavy effects and their phone fallbacks
-
-CLAUDE.md asks for 60 fps on a mid-range phone, and a reduced-quality fallback on phones for heavy effects (heavy blur, many particles). Each section has a **Phone fallback** line: what the demo already does, or the smallest change that keeps it smooth. "On phones" means phones and short screens, by the viewport rule `(max-width:600px),(max-height:500px)`, so a phone turned sideways counts too (its stage is about 745px wide, which a test of the stage's width missed). The script fallbacks read it with `matchMedia`. Grain / Film Noise Overlay reads it every frame, so it needs no listener; the others read it where they build the picture, and a change listener builds it again when a window crosses the rule while the stage keeps its size. Starfield / Space Particles, Matrix Rain and Plasma Field guard that listener (it does nothing when the count or size the rule gives is unchanged, and `addListener` covers old browsers); Particle Constellation and Flow Field deal their dots or particles again at every crossing. The CSS blur fallbacks (Mesh Gradient Animation and Aurora / Northern Lights) keep `@media(max-width:600px)` on purpose: halving the blur looks as soft only where the stage is less than half as wide as a laptop's, and a sideways phone's is not (half the blur would show the edges of the blobs and bands there: a blur-to-size ratio of 0.09, against 0.14 on a laptop). The cards have their own rule, under "Cards and captions on the stage".
-
-The canvas numbers come from a scratch measurement: headless Chrome at 375×812 with pixel ratio 2, the CPU slowed four times (roughly a mid-range phone), the stage set to 351×300 (a phone stage), recording how long each animation-frame callback runs. They show the demo's own work per frame, against a budget of about 16 ms, not the graphics chip's. So for the blur pages (Mesh Gradient Animation, Aurora / Northern Lights) the fallback follows their READMEs' own advice, less blur on phones, rather than a number.
-
-| Page | What was measured | Median / slowest 5% of frames |
-|---|---|---|
-| Grain / Film Noise Overlay | Medium grain, a new frame every frame | 7.9 / 10.8 ms |
-| | Fine grain, every frame | 12.7 / 21 ms |
-| | Colored grain, every frame (today's colour for every pixel) | 25 / 40 ms (35 fps) |
-| | Medium grain, 24 times a second | 0.7 / 10.8 ms (the heavy frames are the redraws) |
-| Starfield / Space Particles | 300 stars | 8.7 / 13 ms |
-| | 600 stars | 12.2 / 18 ms (51 fps) |
-| Particle Constellation | 60 dots (today's phone cap) | 9.5 / 14.9 ms |
-| Flow Field | 500, 900 and 1,400 particles | 3.3, 4.9 and 6.8 ms (medians) |
-| Plasma Field | Medium detail (140px picture) | 6.9 / 10.7 ms |
-| | High detail (200px picture) | 13.2 / 18.7 ms |
-| Ambient Ripple Effect, Floating Elements, Grid / Dot Pattern Parallax, Abstract Geometric Motion, Synthwave Grid, Matrix Rain | defaults, on today's taller phone stage | 0.4 to 2.9 ms (medians) |
-
-## Cards and captions on the stage
-
-Eight stages hold a small card that shows the effect behind real content: Animated Gradient Background, Mesh Gradient Animation, Aurora / Northern Lights, Starfield / Space Particles, Ambient Ripple Effect, Floating Elements and Grid / Dot Pattern Parallax keep theirs; Light Leak's card goes (see its section). On every card that stays:
-
-- `.fg-title` drops Georgia and the italic and gets `font-weight:700`;
-- `.fg-eyebrow` gets `font-weight:600` and 11px (was 9px), the size and weight of the site's small spaced capitals;
-- `.fg-body` gets 13px (was 10–11px) and `color:rgba(255,255,255,.72)` (was .4–.6, under 4.5:1 on the cards).
-
-**On phones and short screens** (`@media (max-width:600px), (max-height:760px)`) every card also gets `padding:12px 14px`, `.fg-eyebrow{margin-bottom:4px}`, `.fg-title{margin-bottom:0}` and `.fg-body{display:none}`. The eyebrow and the title still put content in front of the effect, and the card covers about a quarter of the stage instead of half to two thirds, so the effect stays in view.
-
-- **Phones:** the shared stage is 300px tall.
-- **Short screens:** a laptop at 1366×657 or a phone turned sideways gets the same card. On any screen wider than 600px and at most 760px tall, the shared stage is 100svh − 330px tall, at least 260px: 327px on a 1366×657 laptop and 260px on a phone turned sideways. There the laptop-size cards covered 42–63% of it.
-- **Ambient Ripple Effect:** its card also moves to the bottom and, on phones, gets a smaller title (see its section).
-
-Measured with the site font, each section's card text and the page's 1px stage border. Each cell gives the share of the stage's height the card covers, and where. The "before" figures on phones are from round 1 (no stage border).
-
-| Page | Phone 343×300, before | Phone 343×300, after | Sideways phone 747×260, before → after | Laptop 1366×657 (960×327), before → after |
-|---|---|---|---|---|
-| Animated Gradient Background | 57%, 30–87% down | 26.7%, 59.7–86.3% down | 58.7% → 31.9% | 49.4% → 28.1% |
-| Mesh Gradient Animation | 64%, 23–87% down | 26.7%, 59.7–86.3% down | 59.2% → 24.4% | 55.8% → 28.1% |
-| Aurora / Northern Lights | 54%, 34–88% down | 26.8%, 60.9–87.7% down | 55.2% → 31.5% | 46.6% → 27.8% |
-| Starfield / Space Particles | 51%, 39–91% down (over the centre, where stars are born) | 25.3%, 65.0–90.3% down | 46.0% → 23.8% | 43.9% → 26.3% |
-| Ambient Ripple Effect | 64%, 18–82% down (over all three ripple sources) | 20.3%, 75.4–95.7% down (below the sources, which sit 25–75% down) | 51.8% → 25.0% | 41.9% → 20.6% |
-| Floating Elements | 69%, 16–84% down | 27.5%, 36.3–63.7% down | 56.5% → 25.2% | 54.5% → 29.6% |
-| Grid / Dot Pattern Parallax | 69%, 16–84% down | 27.5%, 36.3–63.7% down | 63.3% → 24.4% | 54.5% → 29.6% |
-
-The phone figures hold from 320px to 414px wide.
-
-The sections give the card text; wording that used developer terms is rewritten in plain words.
-
-## Pointer and touch
-
-Floating Elements (Shapes avoid the pointer) and Particle Constellation (Dots follow the pointer) take the pointer's position from `pointermove` only, so a tap does nothing. Each also takes it from `pointerdown`, so on a touch screen a finger resting on the stage works too.
-
-Grid / Dot Pattern Parallax moves from mouse and touch events to Pointer Events, as CLAUDE.md asks of drag interactions. Its stage gets `touch-action:pan-y`, as on 2.5D / Pseudo-3D, so a sideways drag steers the grid while a vertical swipe still scrolls the page. Its hover state (the cursor ring and the light) starts only for `pointerType === 'mouse'`, so a tap never starts it (see its section).
-
-None of these is a CSS `:hover` rule, so no `@media (hover: hover)` gate is needed. While a loop is paused, the pointer moves nothing on the stage. The one exception is Grid / Dot Pattern Parallax's cursor ring, which still follows the pointer, because that stage hides the system cursor.
-
----
-
-## animated-gradient-background — Animated Gradient Background
-
-- **Kind:** loop. The gradient shifts forever; there is no end.
-- **Description:** Colors slowly drift across a soft gradient background. Best for hero sections.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** `.grad-bg` runs its keyframes forever. Sliding and Bright bands use `@keyframes grad-pos` (over Speed, and over 1.5 × Speed for Bright bands), and Color wheel uses `@keyframes grad-hue` (over Speed). There are no page timers.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule `.grad-bg{animation-duration:300s!important}` goes (see the preamble).
-- **Stage font:** site font, on the card as in the preamble.
-- **Stage:** the gradient layer and the card stay.
- - Card text: eyebrow "Animated gradient"; title "Color that moves without demanding it"; body "A slow cycle keeps it calm: the color shifts, and the eye barely notices." (was "A long cycle duration makes the loop imperceptible. …").
- - `hb-dots`: no. Default height.
-- **Phone fallback:** none needed. One gradient layer moves (or turns its colors), and the small card's 10px backdrop blur is the only filter.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Gradient | Choice buttons | Sliding · Color wheel · Bright bands | Sliding | Sliding is the calmest; the color wheel turns every color. | the gradient layer's class: `var-pos` / `var-hue` / `var-multi` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Longer cycles feel calmer. | `--dur`: 32s / 20s / 12s |
-| Colors | Choice buttons | Cool · Sunset · Ocean · Gray | Cool | The set of colors the gradient moves through. | the stage's palette class: none / `pal-sunset` / `pal-ocean` / `pal-mono` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Muted colors | Switch | on / off | off | Takes most of the color out for a quieter look. | the gradient layer's `subtle` class on / off |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The Variant and Palette menus. They become Gradient and Colors.
- - The Cycle Duration slider. It becomes Speed.
- - "Subtle (reduced saturation)" becomes Muted colors.
-- **Good for:** Hero sections · Landing pages · Dashboards · Splash screens · **Avoid on:** Long reading pages · Small elements
-- **Prompt:**
-
- > Add an animated gradient background to [the section you want behind your content]. Paint a soft gradient much larger than the section and slowly slide it back and forth, or turn all its colors around the color wheel, so the colors keep shifting behind the content. End the gradient on the color it starts with, so the loop never shows a seam. A long, slow cycle feels calm; a fast one pulls attention away from the content. If the visitor has reduced motion turned on, show the gradient still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > An animated gradient background slowly shifts its colors behind the content, over a long cycle (typically 15 to 30 seconds), so the page feels alive without anything catching the eye. The gradient is painted much larger than the area it fills and slides slowly back and forth, or its colors turn around the color wheel. It is the lightest ambient effect: the browser animates it with no script at all.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Gradient | Sliding | Sliding moves a large, soft gradient back and forth; Color wheel turns every color around the color wheel; Bright bands slides brighter colors between dark ends, one and a half times as slowly |
- | Speed | Normal | How long one cycle takes: slow is 32s, normal 20s and fast 12s; under 8s it becomes distracting |
- | Colors | Cool | The colors the gradient moves through: cool blues and purples, sunset oranges, ocean blues and greens, or grays |
- | Muted colors | off | Takes most of the color out (30% saturation) for a quieter background |
-
-- **README See also:** the link texts change to the pages' real titles.
- - [Mesh Gradient Animation](../mesh-gradient/) — soft blobs of color drift and blend
- - [Breathing / Pulsing Glow](../breathing-glow/) — one soft glow grows and shrinks
- - [Aurora / Northern Lights](../aurora/) — bands of color sway like the northern lights
-- **README How it works:** the names match the settings and Bright bands is described. "**Position shift**" becomes "**Sliding** (a position shift)"; "**Hue rotation**" becomes "**Color wheel** (a hue rotation)", and its lead-in ends "— apply a rotating filter to a static gradient:". After the filter note, add: "**Bright bands** runs the same sliding animation on a gradient with brighter colors between dark ends (`background-size: 300% 300%`), over one and a half times the cycle." The snippets are unchanged.
-- **README Production notes:** the first bullet ends "…is a CSS animation, with no `requestAnimationFrame` and no canvas." The "Compositor-thread animation" bullet was wrong (`background-position` repaints every frame) and becomes "**It repaints every frame**: `background-position` is not a property the compositor can animate by itself, so the browser repaints the gradient on every frame (no layout, though). Over a full hero this is usually fine; for the cheapest version, paint the gradient on an oversized layer and slide it with `transform: translate()`, which the compositor runs without repainting." The "Performance" bullet becomes "**Performance**: on low-end devices a large repainting gradient can cost frames; `will-change: background-position` does not stop the repaint, the `transform` version does." The rest is unchanged.
-- **Category line:** `07.01 · Ambient &amp; Background`
-- **Pager:** Previous: none · Next: Mesh Gradient Animation (`../mesh-gradient/`)
-
----
-
-## mesh-gradient — Mesh Gradient Animation
-
-- **Kind:** loop. The blobs drift forever.
-- **Description:** Blurred blobs of color drift and melt together. Best for landing pages.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** each blob runs its own keyframes forever (`@keyframes b1` to `b5`, `alternate`), over Speed × 1, 1.1, 0.9, 1.2 and 0.8, so no two blobs line up. There are no page timers.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule `.blob{animation-duration:300s!important}` goes (see the preamble).
-- **Stage font:** site font, on the card as in the preamble.
-- **Stage:** the blobs and the card stay.
- - Card text: eyebrow "Mesh gradient"; title "Organic color without sharp edges"; body "Heavy blur melts round blobs into soft washes of color, the look Stripe made popular." (was "Heavy blur dissolves gradient boundaries into painterly washes. …").
- - `hb-dots`: no. Default height.
-- **Phone fallback:** none today. Smallest change: on phones the blobs are blurred half as much, `@media(max-width:600px){.blob{filter:blur(calc(var(--blob-blur) * .5))}}`. The phone stage is less than half as wide, and the blobs are sized in percent of it, so they look just as soft, while each frame blurs a much smaller area. Heavy blur is the cost here: up to five blurred layers are redrawn every frame. The rule stays width-only on purpose (see "Heavy effects and their phone fallbacks"); the card has its own rule.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Blur | Choice buttons | Light · Medium · Heavy | Medium | Heavy blur hides the circles; light blur shows them. | `--blob-blur`: 50px / 80px / 130px |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Longer cycles feel calmer. | `--dur`: 64s / 40s / 24s |
-| Colors | Choice buttons | Cool · Warm · Sunset · Synthwave · Earth | Cool | The colors of the blobs. | `setPalette()`: `'cool'` / `'warm'` / `'sunset'` / `'synthwave'` / `'earth'` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of blobs | Choice buttons | 3 · 4 · 5 | 4 | More blobs make a richer mix of color. | the first 3 / 4 / 5 blobs shown (`display` block, the rest none, as today) |
-| Blend | Choice buttons | Plain · Lighter · Deeper | Plain | Lighter brightens where blobs overlap; deeper darkens it. | `--blend`: `normal` / `screen` / `overlay` |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The Blob Count, Blur Amount and Speed (cycle) sliders. They become Number of blobs, Blur and Speed.
- - The Palette and Blend Mode menus. They become Colors and Blend, and the blend modes get plain names for what they look like (normal, screen and overlay become Plain, Lighter and Deeper).
- - The script's last line, which hid the fifth blob again (`.b5` is already hidden by its CSS).
-- **Good for:** Hero sections · Landing pages · App splash screens · Dark dashboards · **Avoid on:** Small elements · Long reading pages
-- **Prompt:**
-
- > Add a mesh gradient background to [the section you want behind your content]. Place a few large circles of color behind the content and blur them, so their edges soften and the colors run into one another. Let each circle drift and grow or shrink slowly on its own path, so the colors keep blending in new ways, and clip them to the section so they never spill out. Blur is costly on phones, so blur less on small screens. If the visitor has reduced motion turned on, keep the circles still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A mesh gradient is a background of a few large circles of color, blurred so their edges soften and the colors run into one another; with heavy blur they melt into soft washes. Each circle drifts and grows or shrinks slowly on its own path, so the colors keep blending in new ways, like paint that never quite dries. It is the look of Stripe, Linear and many modern software sites.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Blur | Medium | How much the blobs are blurred: light is 50px, medium 80px and heavy 130px; below about 80px the circles show, above it they become a wash. Phones use half |
- | Speed | Normal | How long each blob takes to drift one way: slow is 64s, normal 40s and fast 24s |
- | Colors | Cool | The blob colors: cool, warm, sunset, synthwave or earth tones |
- | Number of blobs | 4 | Three, four or five blobs; more make a richer mix |
- | Blend | Plain | How overlapping blobs mix: plain stacks them (normal blending), lighter brightens the overlap (screen), deeper darkens it and deepens the colors (overlay) |
-
-- **README See also:** the link texts change to the pages' real titles.
- - [Animated Gradient Background](../animated-gradient-background/) — one gradient that slowly shifts
- - [Aurora / Northern Lights](../aurora/) — tall bands of color instead of round blobs
- - [Breathing / Pulsing Glow](../breathing-glow/) — a single glow that grows and shrinks
-- **README How it works:** keep the snippets, but the first paragraph says what the demo does: each blob is "an absolutely-positioned round `<div>` filled with one color and softened with `filter: blur()`" (not "with a radial gradient background"), and heavy blur "dissolves the circle's hard edge into a wash of color" (not "the gradient's hard edges into pure color wash"). After the blend-mode list, add: "Heavy blur is the costly part on phones, so the demo halves it on small screens:" and this snippet:
-
- ```css
- @media (max-width: 600px) {
- .blob { filter: blur(calc(var(--blob-blur) * .5)); }
- }
- ```
-
-- **README Production notes:** unchanged
-- **Category line:** `07.02 · Ambient &amp; Background`
-- **Pager:** Previous: Animated Gradient Background (`../animated-gradient-background/`) · Next: Aurora / Northern Lights (`../aurora/`)
-
----
-
-## aurora — Aurora / Northern Lights
-
-- **Kind:** loop. The bands sway forever.
-- **Description:** Blurred bands of light sway like the northern lights. Best for dark backgrounds.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** each band sways forever with its own keyframes (`@keyframes drift1` to `drift5`), over Speed × 1, 1.15, 0.85, 1.25 and 1.1. With Stars in the sky on, each star twinkles with `@keyframes twinkle` (2–6s each, at random). There are no page timers. Today's Pause only held the bands; the "css" Pause holds the stars too.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule `.band{animation-duration:300s!important}.star{animation:none!important}` goes (see the preamble).
-- **Stage font:** site font, on the card as in the preamble.
-- **Stage:** the sky, the stars layer, the bands, the horizon strip and the card stay.
- - Card text: eyebrow "Aurora" (its green `rgba(0,220,100,.7)` stays: 5.5:1); title "Charged particles. Magnetic fields. Light."; body "Green is oxygen high in the sky; red is rarer, and higher still." (was a longer line in kilometres, which ran to five lines on phones).
- - `hb-dots`: no. Default height.
-- **Phone fallback:** none today. Smallest change: on phones the bands are blurred half as much, `@media(max-width:600px){.band{filter:blur(18px)}}` (35px today). The phone stage is less than half as wide, so the bands look as soft, and each frame blurs far fewer pixels. The README already advises less blur on mobile. The rule stays width-only on purpose (see "Heavy effects and their phone fallbacks"); the card has its own rule.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of bands | Choice buttons | 2 · 3 · 4 · 5 | 2 | More bands make a fuller sky. | `count`: 2 / 3 / 4 / 5, then `applyPalette()` (it shows the first `count` bands of the chosen colors' order, as today) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Longer cycles feel calmer. | `--dur`: 48s / 30s / 18s |
-| Colors | Choice buttons | Green · Purple · Red | Green | Green is the most common aurora; red is rare. | `applyPalette()`: `'classic'` / `'vivid'` / `'rare'` (green and blue first / purple and pink first / red and pink first) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Brightness | Choice buttons | Dim · Medium · Bright | Medium | How strongly the bands glow. | each band's `style.opacity`: .5 / .75 / 1 |
-| Stars in the sky | Switch | on / off | off | Adds twinkling stars behind the bands. | on: `buildStars()` (once) and the stars layer shown / off: the stars layer hidden |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The Band Count, Speed (cycle) and Brightness sliders. They become Number of bands, Speed and Brightness.
- - The Palette menu. It becomes Colors.
- - "Stars in background" becomes Stars in the sky.
-- **Good for:** Hero sections · Night and space themes · Music and meditation apps · Travel sites · **Avoid on:** Light pages · Busy layouts
-- **Prompt:**
-
- > Add an aurora background to [the dark section you want it behind]. Stack a few tall, wide bands of color that fade to transparent at the top and bottom, blur them softly, and let each one sway sideways and lean a little on its own slow cycle, so they drift apart and together like curtains of light. Make the bands wider than the section and clip them, so their ends never show. Blur less on phones to keep it smooth. If the visitor has reduced motion turned on, keep the bands still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > An aurora background imitates the northern lights with a few tall bands of color that sway slowly across a night sky. Each band fades away at the top and bottom and is softly blurred, and each one drifts sideways and leans a little on its own cycle, so the curtains of light never move together. The browser draws it all with no script.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Number of bands | 2 | How many bands of light: two look clear, five make a richer, layered sky |
- | Speed | Normal | How long each band takes to sway through its cycle: slow is 48s, normal 30s and fast 18s |
- | Colors | Green | Which colors come first: green and blue (the most common aurora), purple and pink, or red and pink (rare); more bands add the other colors |
- | Brightness | Medium | How strongly the bands glow: dim is 50%, medium 75% and bright 100% |
- | Stars in the sky | off | Adds 120 twinkling stars behind the bands |
-
-- **README See also:** the link texts change to the pages' real titles.
- - [Mesh Gradient Animation](../mesh-gradient/) — round blobs of color instead of tall bands
- - [Starfield / Space Particles](../starfield/) — stars stream toward you out of the dark
- - [Animated Gradient Background](../animated-gradient-background/) — one gradient that slowly shifts
-- **README How it works:** keep the snippet. After it, add: "On phones the demo halves the blur, `@media (max-width: 600px) { .band { filter: blur(18px); } }`, which keeps the bands as soft on the smaller stage." The color list stays.
-- **README Production notes:** in the "Star layer pairing" bullet, "See the demo's star toggle." becomes "See the demo's Stars in the sky switch." In the "Performance" bullet, "a star canvas" becomes "a star layer" (the stars are elements, not a canvas). The rest is unchanged.
-- **Category line:** `07.03 · Ambient &amp; Background`
-- **Pager:** Previous: Mesh Gradient Animation (`../mesh-gradient/`) · Next: Grain / Film Noise Overlay (`../grain-overlay/`)
-
----
-
-## grain-overlay — Grain / Film Noise Overlay
-
-- **Kind:** loop. New grain is drawn again and again, forever.
-- **Description:** Fine grain flickers over the page, like old film. Best for editorial sites.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the page's `loop()` runs on animation frames, as in the preamble.
- - When the time since the last grain frame reaches the interval, 1000 ÷ How often it changes, it draws new grain: `drawCanvasGrain()` for Random dots, or `seed++` on the `feTurbulence` for Noise filter.
- - The fps measurement and both readouts go from `loop()`.
- - At load the page draws one grain frame at once (today's `loop(performance.now())` did the same), then calls `start()`. So a loop paused on arrival shows still grain over the scene.
- - Pause and Play as in the preamble. While paused, a setting change that alters the grain's look (Grain size, Colored grain, Grain source) draws one new grain frame (a press on the choice already made does nothing); Strength and Blend are CSS and show at once. After a real resize (see the preamble), `resize()` draws a grain frame at once, playing or paused; today it did so only while paused, so a playing page showed no grain until the next change came round.
-- **Slow motion:** while the switch is on, the interval between grain frames is multiplied by 3 (Like film, 24 a second, becomes 8), from the next frame.
-- **Reduced motion:** the page's own checks go (`reduceMQ` in `loop()`, `resize()` and the setting handlers, `renderStatic()`, and the `reduceMQ` change listener), as in the preamble.
-- **Stage font:** site font.
- - `.hero-h` drops Georgia and the italic and gets `font-weight:700`.
- - `.hero-label` becomes 11px (was 10px), with `color:rgba(88,166,255,.85)` (was .5: 2.6:1).
- - `.hero-p` becomes 13px (was 12px), with `color:rgba(255,255,255,.72)` (was .5).
-- **Stage:** the scene (the "Atlas Studio" hero mock-up) and both grain layers (canvas and SVG filter) stay; the fps badge goes. The mobile rule `height:auto;min-height:400px` goes: the hero mock-up fits the 300px phone stage (about 225px with its padding). `hb-dots`: no. Default height.
-- **The Noise filter is as strong as the dots.** The filter's own noise is faint, half-see-through gray: at full layer opacity it changed the picture by a spread of 2.8 (per-pixel standard deviation of the change, luma 0–255) against 17.6 for Random dots, and at the real Faint, Light and Strong by 0.38, 0.46 and 0.56 against 0.72, 1.38 and 2.74. It is built as follows:
- - the SVG that holds it is a zero-size one (`.grain-svg{position:absolute;width:0;height:0}`), not `display:none`, from which some browsers draw no filter;
- - the `<filter>` carries `color-interpolation-filters="sRGB"`; without it, the zero-size SVG's filter runs in linear light and brightens the stage (by about 11 levels at full layer opacity, measured);
- - after `<feColorMatrix type="saturate" values="0"/>` comes an `<feComponentTransfer>` that makes the noise opaque and stretches its contrast: `feFuncR`, `feFuncG` and `feFuncB` with `type="linear" slope="3" intercept="-1"`, and `feFuncA` with `type="linear" slope="0" intercept="1"`.
-
- Measured on the page in Chrome (1280×800): the spread at full opacity is 15.5 against 17.6 for the dots, and at Faint, Light and Strong 0.68, 1.23 and 2.50 against 0.73, 1.39 and 2.74, with the same small shift as the dots (about +0.5 levels): no brightening.
-- **Phone fallback:** today the grain canvas is drawn at CSS pixels, not device pixels (a quarter to a ninth of the pixels on a phone). Two small changes:
- 1. **Colored grain per dot.** Colored grain picks its three colors once per grain dot, like gray grain, instead of for every pixel. Today it ignores Grain size and picks three random numbers for every pixel, twelve times as many as gray grain at Medium size: 25 ms a frame, 35 fps, measured.
- 2. **At most 24 changes a second on phones.** On phones and short screens (the viewport rule above; `interval()` reads it every frame, so it needs no listener) the grain changes at most 24 times a second (`frameInterval` at least 1000/24 ms), so Every frame looks like Like film there, on a phone turned sideways too. Fine grain at every frame measured 12.7 ms with 21 ms peaks, too close to the budget.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Strength | Choice buttons | Faint · Light · Strong | Light | Grain works best when it is felt more than seen. | `--grain-op`: 0.04 / 0.08 / 0.16 |
-| Grain size | Choice buttons; shown only when Grain source is Random dots | Fine · Medium · Coarse | Medium | Coarse grain looks like old film stock. | `SIZE`: 1 / 2 / 3 (px) |
-| How often it changes | Choice buttons | Every frame · Like film · Choppy · Slow | Like film | Film grain changes 24 times a second; phones cap it there. | `frameInterval`: 1000/60 / 1000/24 / 1000/12 / 1000/4 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Blend | Choice buttons | Film · Lighter · Softer | Film | Film adds contrast, Lighter lifts the darks, Softer is mild. | `--grain-blend`: `overlay` / `screen` / `soft-light` |
-| Colored grain | Switch; shown only when Grain source is Random dots | on / off | off | Colored dots instead of gray ones. | `COLOR_NOISE` true / false |
-| Grain source | Choice buttons | Random dots · Noise filter | Random dots | Dots drawn by a script, or the browser's noise filter. | `IMPL`: `'canvas'` / `'svgfilter'`, showing the matching grain layer (as today) and hiding Grain size and Colored grain for Noise filter |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps badge on the stage and the Render readout.
- - The Intensity slider. It becomes Strength.
- - The Implementation, Grain Size, Update Rate and Blend Mode menus. They become Grain source, Grain size, How often it changes and Blend, and the blend modes get plain names for what they look like (overlay, screen and soft light become Film, Lighter and Softer).
- - "Color noise (RGB)" becomes Colored grain.
-- **Changed default:** How often it changes starts at Like film (24 a second), not at 60. The README's Key parameters and the demo's own note already give 24 as the rate to use, and it is the film look this page is named for.
-- **Good for:** Editorial sites · Portfolios · Photo and film pages · Hero sections · **Avoid on:** Small text · Forms
-- **Prompt:**
-
- > Add a film grain overlay to [the section or page you want to texture]. Cover it with a see-through layer of random light and dark dots, and draw a new set of dots again and again so the grain flickers like old film; grain works best when it is felt more than seen. Blend the layer into the picture beneath it instead of laying gray on top, and let clicks pass through it. Redraw less often on phones, where drawing every dot is the costly part. If the visitor has reduced motion turned on, show the grain still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Film grain lays a see-through layer of random dots over a design and draws it again and again, so the texture flickers like the grain of photographic film. At a low strength, around 5 to 10 percent, it is barely visible, yet flat digital colors feel warmer and deeper; much stronger, and it looks like a damaged screen. The trick is subtlety: people should not notice the grain, only miss it when it is gone.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Strength | Light | How visible the grain is: faint is 4%, light 8% and strong 16%; 5–10% is felt more than seen, above 20% it looks like a damaged screen |
- | Grain size | Medium | The size of each dot: fine is 1px, medium 2px and coarse 3px; coarse looks like old film stock |
- | How often it changes | Like film | New grain every frame (60 times a second), like film (24), choppy (12) or slow (4); phones change it at most 24 times a second |
- | Blend | Film | How the grain mixes with the picture: film darkens dark areas and lightens light ones, like real grain (overlay blending); lighter only lightens (screen); softer is a gentler film (soft light) |
- | Colored grain | off | Randomly colored dots instead of gray ones |
- | Grain source | Random dots | Dots drawn by a script, or the browser's own noise filter; grain size and colored grain apply to the dots only |
-
-- **README See also:** the first link's text changes to the page's real title.
- - [Scanline Effect](../scanline/) — dark lines over the page, like an old monitor
- - [Chromatic Aberration](../../06-3d-advanced/chromatic-aberration/) — colors split at the edges, like a cheap lens
- - [Light Leak](../light-leak/) — warm light washes in, like a film camera flaw
-- **README How it works:** in the canvas snippet, pick each dot's color once per dot, so it matches the demo. The loop body becomes:
-
- ```js
- for (let y = 0; y < H; y += pixelSize) {
- for (let x = 0; x < W; x += pixelSize) {
- // one color per grain dot: gray, or three random channels
- const v = Math.random() * 255 | 0;
- const r = colorNoise ? Math.random() * 255 | 0 : v;
- const g = colorNoise ? Math.random() * 255 | 0 : v;
- const b = colorNoise ? Math.random() * 255 | 0 : v;
- for (let dy = 0; dy < pixelSize && y + dy < H; dy++) {
- for (let dx = 0; dx < pixelSize && x + dx < W; dx++) {
- const idx = ((y + dy) * W + (x + dx)) * 4;
- data[idx] = r; data[idx + 1] = g; data[idx + 2] = b; data[idx + 3] = 255;
- }
- }
- }
- }
- ```
-
- In the SVG snippet, `<svg style="display:none">` becomes `<svg width="0" height="0" style="position:absolute">`, the `<filter>` gets `color-interpolation-filters="sRGB"`, and after the `feColorMatrix` line comes the `feComponentTransfer` block with the three `feFunc` lines (`type="linear" slope="3" intercept="-1"`) and `feFuncA` (`slope="0" intercept="1"`). After the HTML snippet, add: "The raw noise is faint, half-transparent gray; the component transfer makes it opaque and stretches its contrast, so it shows as strongly as drawn dots at the same opacity." The rest is unchanged.
-- **README Production notes:** add a bullet after "Reduced update rate is intentional": "**Phones**: the demo changes the grain at most 24 times a second on phone-sized screens (up to 600px wide, or up to 500px tall for a phone held sideways), and draws the canvas at CSS pixels rather than device pixels; drawing every dot is the costly part." The rest is unchanged.
-- **Category line:** `07.04 · Ambient &amp; Background`
-- **Pager:** Previous: Aurora / Northern Lights (`../aurora/`) · Next: Scanline Effect (`../scanline/`)
-
----
-
-## scanline — Scanline Effect
-
-- **Kind:** loop. The beam sweeps and the cursor blinks forever.
-- **Description:** Dark lines and a sweeping beam imitate an old TV screen. Best for retro sites.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** while Moving beam is on, the beam sweeps down forever (`@keyframes beam-sweep`, over Beam speed), and the cursor always blinks (`@keyframes blink`, 1s, `step-end`). The scanlines themselves are a still pattern. There are no page timers.
-- **Changed default:** Moving beam starts on (today it starts off). With it off, the stage is almost a still picture: only the cursor blinks, so Pause and Slow motion show next to nothing. Variable Font Morph did the same: its Auto-morph became the loop and runs from load. The `.beam` rule loses `display:none`, so the beam shows at load and the switch hides it.
-- **Beam speed keeps the beam where it is.** A new `--beam-dur` alone keeps the time the beam has already swept, so the band would jump to another point of its sweep, and a paused stage would change its picture. The Beam speed choice first scales each beam animation's `currentTime` by new/old sweep length, then writes `--beam-dur`, so the beam stays where it is whether it moves or is paused, with Slow motion on or off. The Speed choices of Animated Gradient Background, Mesh Gradient Animation and Aurora / Northern Lights follow the same rule.
-- **The beam starts 40% into its first sweep** (`animation-delay:calc(var(--beam-dur) * -.4)` on `.beam`). Without the offset the band starts just above the stage, so the first frame, the still frame under reduced motion and a beam switched back on while paused would show no beam, and Beam brightness could not be seen while paused. The offset is a share of the sweep, so the rule above keeps working. After the first sweep the loop is unchanged.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule `.beam{animation-duration:60s!important}.term-cursor{animation:none!important}` goes (see the preamble).
-- **Stage font:** site font. The terminal drops `font-family:monospace` (the owner's ruling keeps a typewriter font for typing effects only, and the effect here is the lines, not the text).
- - `.term-line` becomes `font-size:clamp(12px,1.4vw,14px)` (was `clamp(10px,1.3vw,12px)`, 10px on phones).
- - `.term-line.dim` gets `opacity:.75` (was .4, which is 1.9:1 on the terminal).
-- **Stage:** the terminal mock-up, the scanlines, the beam and the dark-corners layer stay.
- - The terminal's lines read like an old screen instead of shell code (the page shows no code): "SYSTEM READY" / "Tuning the signal…" (dim) / "All channels clear" / "Picture steady" (dim) / a last line holding only the blinking cursor. They replace "$ initialize_system --mode ambient", "// scanning for motion patterns", "→ all systems nominal", "→ rendering 60fps continuous" and "_ ".
- - The mobile rule `height:auto;min-height:420px` goes: the terminal fits the 300px phone stage (about 170px).
- - `hb-dots`: no. Default height.
-- **Phone fallback:** none needed. The lines are one still repeating gradient, and the beam and the cursor are single animations of `transform` and `opacity`.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Line spacing | Choice buttons | Tight · Medium · Wide | Medium | Tight lines look most like a real old screen. | `--line-gap`: 2px / 4px / 8px |
-| Line darkness | Choice buttons | Light · Medium · Dark | Medium | Darker lines look more retro but are harder to read. | `--line-dark`: 0.08 / 0.15 / 0.3 |
-| Moving beam | Switch | on / off | on | A band of light sweeps down the screen. | the beam's `display`: block / none |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Beam speed | Choice buttons; shown only when Moving beam is on | Slow · Normal · Fast | Normal | How long the beam takes to cross the screen. | `--beam-dur`: 6.4s / 4s / 2.4s |
-| Beam brightness | Choice buttons; shown only when Moving beam is on | Faint · Medium · Bright | Medium | Keep the beam faint: it should be felt, not seen. | `--beam-bright`: 0.06 / 0.12 / 0.24 |
-| Dark corners | Switch | on / off | off | Darkens the corners like an old screen's curved glass. | the dark-corners layer's `display`: block / none |
-| Glowing text | Switch | on / off | off | A soft glow around the letters. | the terminal's `phosphor` class on / off |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The Line Density menu. It becomes Line spacing.
- - The Line Darkness, Beam Speed and Beam Brightness sliders. They become Line darkness, Beam speed and Beam brightness.
- - "Moving beam sweep" becomes Moving beam; "CRT curvature vignette" becomes Dark corners; "Phosphor text glow" becomes Glowing text.
-- **Good for:** Retro and gaming sites · Terminal screens · Music players · Sci-fi interfaces · **Avoid on:** Long reading · Forms
-- **Prompt:**
-
- > Add a scanline effect to [the screen, panel or section you want to look like an old monitor]. Lay thin, dark horizontal lines over the content with a repeating stripe pattern, in a layer that clicks pass through, so it looks like the rows of an old tube screen. When the settings include them, sweep a soft band of light slowly down the screen again and again, darken the corners like curved glass, and give the text a soft glow. Make sure the text stays readable through the lines. If the visitor has reduced motion turned on, keep the beam still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Scanlines are the thin dark lines between the rows of light on an old tube television or computer monitor. Laying them over a design as a repeating stripe pattern gives it the look of a retro screen from the 80s or 90s. A soft band of light sweeping slowly down the screen adds movement, and darkened corners suggest the curved glass.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Line spacing | Medium | The distance between lines: tight is 2px, medium 4px and wide 8px; 4px looks like a standard old screen |
- | Line darkness | Medium | How dark the lines are: light is 8%, medium 15% and dark 30%; darker looks more retro but lowers contrast |
- | Moving beam | on | A soft band of light sweeps down the screen, again and again |
- | Beam speed | Normal | How long the beam takes to cross the screen: slow is 6.4s, normal 4s and fast 2.4s |
- | Beam brightness | Medium | How bright the beam is: faint is 6%, medium 12% and bright 24%; it should be felt more than seen |
- | Dark corners | off | A soft vignette darkens the corners, like the curved glass of an old screen |
- | Glowing text | off | A soft glow around the letters, like light spreading on an old screen |
-
-- **README See also:** the first two link texts change to the pages' real titles.
- - [Grain / Film Noise Overlay](../grain-overlay/) — a flickering texture of fine grain
- - [Light Leak](../light-leak/) — warm light washes in, like a film camera flaw
- - [Chromatic Aberration](../../06-3d-advanced/chromatic-aberration/) — colors split at the edges, like a broken signal
-- **README How it works:** "The `line-gap` CSS custom property in the demo allows the density to be adjusted: `4px` is standard CRT density; `8px` is coarser and more stylized." becomes "The demo's Line spacing setting changes this gap (`--line-gap`): `2px` is dense, `4px` is standard CRT density and `8px` is coarser and more stylized." The rest is unchanged.
-- **README Production notes:** in the first bullet, "Only the panel controls use JS." becomes "Only the demo's settings use JavaScript." The rest is unchanged.
-- **Category line:** `07.05 · Ambient &amp; Background`
-- **Pager:** Previous: Grain / Film Noise Overlay (`../grain-overlay/`) · Next: Light Leak (`../light-leak/`)
-
----
-
-## light-leak — Light Leak
-
-- **Kind:** loop. A leak comes every few seconds, at random, forever.
-- **Description:** Warm light washes in from a corner at random times. Best for photo sites.
-- **Watch it help line:** Leaks come at random, a few seconds apart. Pause it to look closely, or turn on slow motion to see each leak fade.
-- **Player bar:** Pause (css) · Slow motion (page)
-- **Sequence:** the leak is one chain of timers, and every timer goes through the helper's `wait()`, so there is only ever one pending timer:
- - `flash()` sets this leak's fade time `d` (Speed, or 3 × Speed while Slow motion is on) as `--leak-dur`, and sets `--leak-peak` to Brightness × (0.75 to 1, at random).
- - It then adds `active`, so the glow fades in over `d`, spawns three floating light spots when that switch is on, and calls `wait(() => fadeOut(d), d + 200)`.
- - `fadeOut(d)` removes `active`, so the glow fades out over `d`, and calls `wait(flash, d + gap)`, where the gap is random within Time between leaks.
- - At load the page shows a leak at its peak and starts the chain with `wait(() => fadeOut(d), gap)`.
- - This is the settled first picture (owner decision), for every visitor. It sets `--leak-dur` and `--leak-peak` as `flash()` does, adds `active` and finishes the glow's fade in at once (`leak.getAnimations().forEach(a => a.finish())`), so there is no fade on arrival. The leak then holds for one gap before it fades out and the chain carries on. A stage that arrives paused (reduced motion) shows the glow, and Comes from and Color show while it is paused.
- - The first picture has no light spots, and its `d` is the Speed at load, kept for its fade out.
-
- So one leak is: fade in, hold 200ms at its peak, fade out, then a dark gap (the first picture is the one leak with no fade in, and it holds for one gap instead of 200ms). Today the gap was counted from the start of each leak, so a short gap could start the next leak while the last was still fading; now it starts when the glow is gone. The "Next leak in" countdown (a second `setInterval`) and its readout go.
-
- **The light spots** float once (`animation:bokeh-float linear both`, no longer `infinite`) and remove themselves on `animationend`, so the 8-second removal timers go. `both` also stops a spot from showing at full size and full strength during its start delay, before its float begins (a glitch today).
-
- **Pause (css)** holds the spots' `@keyframes`. The page's `hb:pause` listener (top level) freezes the chain with the Text sheet's helper. Here `freeze()` holds only the stage's running CSS transitions, which is the glow's fade, never the spots' keyframes:
-
- ```js
- // Pause freezes the leak under way: its fade stops where it is and the timer keeps the time it had left.
- // The floating light spots are CSS keyframes, which data-hb-pause="css" holds; only the fade is held here.
- let timer=0, next=null, due=0, left=0, held=[], paused=false;
- function wait(fn,ms){ clearTimeout(timer); next=fn; if(paused){ left=ms; return; } due=performance.now()+ms; timer=setTimeout(()=>{ next=null; fn(); },ms); }
- function freeze(){ paused=true; clearTimeout(timer); if(next) left=Math.max(0,due-performance.now()); held=stage.getAnimations({subtree:true}).filter(a=>a instanceof CSSTransition&&a.playState==='running'); held.forEach(a=>a.pause()); }
- function thaw(){ paused=false; held.forEach(a=>{ if(a.playState!=='paused') return; if(a.currentTime>=a.effect.getComputedTiming().endTime) a.finish(); else a.play(); }); held=[]; if(next) wait(next,left); }
- document.addEventListener('hb:pause',e=>e.detail.paused?freeze():thaw());
- ```
-
- `stage` is the page's `.stage`.
-
- **Time between leaks re-plans the wait under way.** The gap is drawn when a fade out starts, so without this a change made in the dark gap would wait for the old gap (Long to Short could take up to about 9 seconds to show). `fadeOut(d)` records the wait it starts, `fadeD = d` and `gapTotal = d + gap` (the fade out and the dark gap, which is what its `wait(flash, …)` waits for), and a new choice plans that wait again:
-
- ```js
- let fadeD=0, gapTotal=0;
- function fadeOut(d){ leak.classList.remove('active'); fadeD=d; gapTotal=d+randomGap(); wait(flash,gapTotal); }
- // in the Time between leaks handler, after minGap and maxGap are set (a choice that is already chosen does nothing):
- if(next!==flash) return; // a leak under way keeps its timing
- const waited=gapTotal-(paused?left:Math.max(0,due-performance.now()));
- gapTotal=fadeD+randomGap();
- wait(flash,Math.max(0,gapTotal-waited)); // never before the fade out ends
- ```
-
- So a fade out or dark gap under way counts the time it has already waited: Long to Short shows within one new gap, Short to Long stretches the wait, the next leak never starts before the fade out has ended, and it comes at once when the new plan has already passed. A leak under way (its fade in or hold, including the first picture) keeps its timing and uses the new range for the gap after it. While paused, `wait()` only records the new plan, so nothing starts, and Play carries on from it.
-
- **Settings while paused:** Comes from and Color repaint the glow's gradient at once (`applyColor()`, no transition). Speed, Brightness and Floating light spots take effect from the next leak. Time between leaks plans the wait under way again, as above. Brightness no longer writes `--leak-peak` directly (today it does), because that would restart a fade held by Pause.
-- **Slow motion (page):** while the switch is on, `flash()` makes the fade `d` 3 × Speed (the CSS fade and the two waits that wait for it), and new light spots float three times as long. The 200ms hold and the gap keep their length. The change takes effect from the next leak. This is "page" rather than "css" so the page stretches its own fade and waits together, and because between leaks nothing on the stage is animating for a shared slow-down to act on.
-- **Reduced motion:** the demo's rule (the glow held at a steady dim level, and 60-second light spots) goes (see the preamble). The still picture is the first picture: the glow at its peak.
-- **Stage font:** site font. `.photo-cap` becomes `color:rgba(255,255,255,.72)` (was .5). It also sits above the glow (`position:relative;z-index:6`), so a bright leak, most of all Down the middle, does not wash the caption out as far.
-- **Stage:** the scene (the photo mock-up with its caption, "ambient · atmospheric · analog warmth") and the glow stay; the spots are added while it runs.
- - The card goes. On the new stage (440px, 300px on phones) it covers most of the photo mock-up, and the leak needs the photo to show against. Its words repeat the page's title and lede.
- - `hb-dots`: no. Default height.
-- **Phone fallback:** none needed. One full-stage gradient fades in and out, plus at most a few small blurred spots when that switch is on.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Comes from | Choice buttons | Top left · Top right · Bottom left · Bottom right · Down the middle | Top left | Where the light spills in. | the glow's class: `dir-tl` / `dir-tr` / `dir-bl` / `dir-br` / `dir-h`, then `applyColor()` |
-| Time between leaks | Choice buttons | Short · Medium · Long | Medium | Gaps are random within the range, so it never feels timed. | `minGap`–`maxGap`: 0.5–1.5s / 1–3s / 3–8s (the dark gap after each leak); a new choice plans the wait under way again (see Sequence) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How quickly each leak fades in and out. | `dur`: 2000ms / 1200ms / 700ms (`flash()` writes it to `--leak-dur`) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Brightness | Choice buttons | Dim · Medium · Bright | Medium | Each leak peaks a little below this, at random. | `intensity` (and `--leak-op`): 0.3 / 0.55 / 0.8 |
-| Color | Swatches | Amber · Gold · Rose · Magenta · Cyan | Amber | Warm colors look like film; cyan looks cooler. | `curColor` from `#ffa532` / `#ffce5a` / `#ff6f8b` / `#ff5ca8` / `#5ad1ff` (as `rgba(r,g,b,`, as today), then `applyColor()` |
-| Floating light spots | Switch | on / off | off | Soft spots of light drift up after each leak. | `bokehOn` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The "Next leak in" readout and its countdown timer.
- - The card on the stage (see Stage).
- - The Direction menu. It becomes Comes from.
- - The Sweep Duration slider. It becomes Speed.
- - The Min / Max Delay sliders. They become Time between leaks.
- - The Intensity slider. It becomes Brightness.
- - The colour picker. It becomes the Color swatches: the README's classic leak colors (amber, gold, rose, magenta, cyan). There is no white, which the README says reads as a lens flare.
- - "Bokeh light blobs" becomes Floating light spots.
-- **Good for:** Photo and film sites · Portfolios · Music pages · Lifestyle brands · **Avoid on:** Dashboards · Long reading pages
-- **Prompt:**
-
- > Add a light leak effect to [the photo, video or section you want it over]. Place a soft glow of light, classically warm amber, spilling in from one corner or down the middle, in a see-through layer that clicks pass through, and fade it in and out every so often, like stray light reaching the film in an old camera. Make the gaps between leaks random and vary each leak's strength a little, because evenly timed leaks look fake. Keep each leak soft, so it never looks like a flash. If the visitor has reduced motion turned on, keep the glow still and faint. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A light leak is a warm glow that washes in from the edge of the frame and fades away again, like the stray light that reached the film when an old camera was not sealed properly. Real leaks happen at random and vary in strength, so the effect waits a random gap between leaks and peaks at a slightly different brightness each time; evenly timed leaks look like a machine, not a film camera.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Comes from | Top left | The corner the glow spills in from, or a band of light down the middle |
- | Time between leaks | Medium | The random dark gap between one leak and the next: short is 0.5–1.5s, medium 1–3s and long 3–8s |
- | Speed | Normal | How long each leak takes to fade in, and again to fade out: slow is 2s, normal 1.2s and fast 0.7s |
- | Brightness | Medium | How strong the glow gets: dim is 30%, medium 55% and bright 80%; each leak peaks a little below this, at random |
- | Color | Amber | Amber is the classic leak; gold, rose and magenta are warm too, and cyan looks like a cooler film stock |
- | Floating light spots | off | Soft spots of light drift up and fade after each leak |
-
-- **README See also:** the first two link texts change to the pages' real titles.
- - [Grain / Film Noise Overlay](../grain-overlay/) — the film grain that pairs with a leak
- - [Scanline Effect](../scanline/) — dark lines over the page, like an old monitor
- - [Glassmorphism Animated](../../06-3d-advanced/glassmorphism-animated/) — frosted glass over moving color
-- **README How it works:** the JS snippet is replaced with the new chain. The CSS snippet gets the fade rule. JS:
-
- ```js
- const leak = document.querySelector('.leak');
-
- function flash() {
- leak.style.setProperty('--leak-dur', fadeMs + 'ms'); // the fade time, read by the CSS transition
- // each leak peaks a little below the chosen brightness, at random
- leak.style.setProperty('--leak-peak', (brightness * (0.75 + Math.random() * 0.25)).toFixed(3));
- leak.classList.add('active'); // fades in over --leak-dur
- setTimeout(fadeOut, fadeMs + 200); // hold the peak for 200ms
- }
-
- function fadeOut() {
- leak.classList.remove('active'); // fades out over --leak-dur
- setTimeout(flash, fadeMs + randomGap()); // a random dark gap before the next leak
- }
-
- function randomGap() {
- return (minGap + Math.random() * (maxGap - minGap)) * 1000; // 1–3s in the demo
- }
-
- setTimeout(flash, randomGap());
- ```
-
- In the CSS snippet, add `transition: opacity var(--leak-dur) ease-in-out;` to `.leak`, and after it the rule `.leak.active { opacity: var(--leak-peak); }`. The sentence before the JS snippet stays. After the JS snippet, add: "The demo opens on a leak at its peak rather than a dark stage: it lights the glow, finishes the fade at once (`leak.getAnimations().forEach(a => a.finish())`) and starts the chain with `setTimeout(fadeOut, randomGap())`, so the first leak holds for one gap before it fades out."
-- **README Production notes:** unchanged
-- **Category line:** `07.06 · Ambient &amp; Background`
-- **Pager:** Previous: Scanline Effect (`../scanline/`) · Next: Starfield / Space Particles (`../starfield/`)
-
----
-
-## starfield — Starfield / Space Particles
-
-- **Kind:** loop. The stars keep coming.
-- **Description:** Stars stream toward you out of the dark. Best for space themes.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble. Each drawn frame is `paint(true, n, nf)` (see the frame-rate fix below for `n` and `nf`):
- - it covers the canvas `nf` times with `rgba(0,0,0,.85)`, which leaves short trails;
- - it draws the haze after each cover when Nebula haze is on;
- - it moves every star (`update(k)`) and draws it.
-
- `paint(false)` draws the same frame without moving the stars, and covers the canvas with opaque black (`#000`) first. The see-through `rgba(0,0,0,.85)` cover belongs only to `paint(true)`, where it makes the trails while playing; a still picture repainted after a setting change while paused must leave no ghost of the old stars. `paint(false)` runs at load, after `initStars()`, so a loop paused on arrival shows the stars. It also runs after a setting change while paused, which replaces today's `redraw()` (it only worked under reduced motion), and after a real resize (see the preamble), playing or paused, following `initStars()`. The fps measurement and both readouts go.
-- **Slow motion:** while the switch is on, `update()` moves each star, and advances its twinkle, by a third of the usual step (outward: `dist`; sideways: `x`; and `twinklePhase`), from the next frame. The covers, which make the trails, are not slowed.
-- **Reduced motion:** the page's `REDUCED` checks go (see the preamble).
-- **Stage font:** site font, on the card as in the preamble. `.fg-eyebrow` becomes `color:rgba(255,255,255,.6)` (was .4, which is 3.4:1).
-- **Stage:** the canvas and the card stay; the fps badge goes.
- - Card text: eyebrow "Starfield"; title "Infinite depth from a single point"; body "Small, slow stars in the middle grow and speed up toward the edge." (was "… — perspective through motion.").
- - `hb-dots`: no. Default height.
-- **Phone fallback:** none today (the canvas caps the pixel ratio at 2). Smallest change: `initStars()` builds at most 300 stars on phones and short screens (the viewport rule above), so Many shows 300 there, on a phone turned sideways too. A guarded change listener builds the stars again (`initStars()`, then `paint(false)`) when a window crosses the rule while the stage keeps its size and the count changes. Measured on a phone stage: 300 stars take about 9 ms a frame, and 600 take 12 ms with 18 ms peaks (51 fps).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Direction | Choice buttons | Outward · Sideways | Outward | Outward flies through space; sideways looks out a window. | `MODE`: `'radial'` / `'drift'`, then `initStars()` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Keep it slow for a calm background. | `SPD`: 0.25 / 0.4 / 0.65 |
-| Number of stars | Choice buttons | Few · Medium · Many | Medium | More stars feel deeper; phones show at most 300. | `COUNT`: 150 / 300 / 600, then `initStars()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Star color | Choice buttons | White · Warm white · Many colors | White | The color of the stars. | `COL`: `'white'` / `'warm'` / `'color'` |
-| Twinkling | Switch | on / off | on | Each star gently brightens and dims. | `TWINKLE` true / false |
-| Nebula haze | Switch | on / off | off | A faint purple and blue haze behind the stars. | `NEBULA` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps badge and the FPS readout.
- - The Mode and Star Color menus. They become Direction and Star color.
- - The Star Count and Speed sliders. They become Number of stars and Speed.
-- **Good for:** Space and science themes · Hero sections · Screensavers and kiosks · Launch pages · **Avoid on:** Light pages · Long reading pages
-- **Prompt:**
-
- > Add a starfield background to [the dark section you want it behind]. Draw many small stars on a canvas and move them out from the center, or sideways past the viewer, so it feels like flying through space. Tie each star's size, brightness and speed to its distance from the center: small, dim and slow near the middle, bigger, brighter and faster toward the edge, which is what creates the depth. A slow speed keeps it calm. Draw fewer stars on phones. If the visitor has reduced motion turned on, show the stars still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A starfield fills a dark background with small stars that stream out from the center, like the view from a spaceship flying through space. Each star's size, brightness and speed depend on how far it is from the middle: near the center stars are small, dim and slow, and they grow, brighten and speed up toward the edge, which is what makes it feel deep. A sideways version drifts stars past, the nearer ones faster, like the view from a window.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Direction | Outward | Outward streams the stars from the center; sideways drifts them past, the nearer ones faster |
- | Speed | Normal | How fast the stars move: slow is 0.25, normal 0.4 and fast 0.65, about the pixels a star covers in a 60th of a second out at the edge (16, 25 and 41 pixels a second), and about a third of that near the center; keep it slow for a calm background |
- | Number of stars | Medium | Few is 150, medium 300 and many 600; phones show at most 300 |
- | Star color | White | White, a warm white, or a different pale color for each star |
- | Twinkling | on | Each star gently brightens and dims on its own rhythm |
- | Nebula haze | off | A faint purple and blue haze behind the stars adds depth |
-
-- **README See also:** the first link's text changes to the page's real title.
- - [Aurora / Northern Lights](../aurora/) — bands of light that pair with a night sky
- - [Canvas Particle Effect](../../06-3d-advanced/canvas-particle-effect/) — particles that link up and react to the pointer
- - [Floating Elements](../floating-elements/) — shapes that drift slowly on their own paths
-- **README How it works:** the Star snippet matches the demo's speed rule and size. In `update(k)`, `this.dist += this.speed * k;` comes first, then `const ratio = …`, then `this.speed = (ratio * 0.5 + 0.2) * BASE_SPEED * 1.5; // faster toward the edge`, and the reset branch also sets `this.speed = (Math.random() * 0.6 + 0.2) * BASE_SPEED;`. In `draw()`, `1 + ratio * 2` becomes `1 + ratio * 1.5`. The frame-rate fix (below) adds to it: the sentence before the snippet says the distance grows by the speed times `k`; the DriftStar snippet reads `update(k) { this.x -= this.depth * SPEED * 2 * k; … }`; and after that snippet come a paragraph and snippet on `n` and `k`, then a paragraph and snippet on the counted covers (`w`, `f`, `nf`, `fa`, and the haze after each cover), with a closing paragraph on why the same cover is repeated instead of one stronger cover (`1 - 0.15 ** n`). The rest is unchanged.
-- **README Production notes:** add a bullet after "Canvas vs DOM": "**Phones**: the demo draws at most 300 stars on phone-sized screens (up to 600px wide, or up to 500px tall for a phone held sideways); each star is a separate fill, so the count is the main cost." The rest is unchanged, except that the frame-rate fix replaces the "`requestAnimationFrame` throttling" bullet, which said the loop runs twice as fast on 120Hz displays, with "**Same speed on every screen**: a fixed step per `requestAnimationFrame` frame runs twice as fast on a 120Hz display and half as fast on a 30Hz phone. The demo scales each step by the time since the last drawn frame (in 60ths of a second, capped at 50 ms), so the stars move at the same speed everywhere, and it draws only when a whole 60th of a second is due, at most about 60 times a second on any display, so a fast display does no extra work.".
-- **Category line:** `07.07 · Ambient &amp; Background`
-- **Pager:** Previous: Light Leak (`../light-leak/`) · Next: Breathing / Pulsing Glow (`../breathing-glow/`)
-- **Frame-rate fix (wrap-up):** each drawn frame stands for `n`, the time since the last drawn frame in 60ths of a second (`FRAME = 1000/60`, at most 50 ms): 1 at 60 Hz, 2 at 30 Hz. The stars move by `k = n`, or a third of it in slow motion, so their speed is the same on every screen. The trail cover is not scaled: the same `rgba(0,0,0,.85)` cover goes on once for every 60th of a second, `nf` covers per drawn frame with the haze redrawn after each. `nf` comes from `n` plus a carried remainder, and a step within 5% of a whole number counts as that number, so a 59.94 or 60.06 Hz screen still gets exactly one cover a frame. A frame with no whole cover due draws nothing and its time carries to the next one, which replaces the 16 ms gate and keeps drawing at about 60 frames a second at most. The first frame after a start, a Play or a return from a hidden tab (`visibilitychange`) only takes the time.
-
----
-
-## breathing-glow — Breathing / Pulsing Glow
-
-- **Kind:** loop. The glow breathes forever.
-- **Description:** A soft glow slowly grows and shrinks, like calm breathing. Best for idle states.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** the glow breathes forever (`@keyframes breathe`, over Speed). The second glow, when it is on, breathes the other way (`reverse`, over 1.3 × Speed). The centre group (`.center-el`: the ✦ icon and the "Rest state" title under it) breathes with the glow when Icon and title breathe too is on (`@keyframes el-breathe`, over Speed). There are no page timers. Icon and title breathe too sets the group's `animation` to `''` or `'none'` as today; its line that set `animationPlayState` goes, because the "css" Pause holds it.
-- **Speed keeps the point of the breath.** A new `--glow-dur` alone keeps the time already played, so every layer would jump to another point of its breath, and a paused stage would change its picture. The Speed choice first scales each animation's `currentTime` on the stage by new/old breath length, then writes `--glow-dur`. The glow stays where it is, moving or paused. This is the rule of Scanline Effect's Beam speed and the Speed choices of the other css pages.
-- **The centre group rejoins the glow's breath.** When Icon and title breathe too is switched back on, the group's restarted animation takes the glow's `currentTime`, so it swells in step with the glow instead of starting a breath of its own.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule `.glow,.glow2,.center-el{animation-duration:60s!important}` goes (see the preamble).
-- **Stage font:** site font.
- - `.center-title` drops Georgia and the italic and gets `font-weight:700`.
-- **Stage:** the glow layers, the ✦ icon and the "Rest state" title stay. The "Breathing glow" label between them goes, with its `.center-label` rule: it sits in the middle of the glow, about 2:1 against the default blue at the breath's peak and nearly gone on a white glow, and it repeats the page's title. `hb-dots`: no. Default height.
-- **The second glow sits behind the first** (a fix). Today both glows are flex items of `.glow-wrap`, so with Second glow on they sit side by side: at 960×440, 195px left and 130px right of the stage's centre.
- - `.glow2` gets `position:absolute`, which takes it out of the row, and `.glow-wrap`'s flex centring then puts it on the stage's centre.
- - `.glow` gets `position:relative;z-index:1`, so the first glow stays in front of the fainter second one.
- - Measured with the fix: both centres on the stage's centre.
-- **Title contrast:** the white title sits over both glows, and at the breath's peak they can be too bright behind it.
- - **How it was measured:** both glows held at their peak, for every remaining Glow color, glow size and swing, with and without the second glow, on 343×300, 960×380 and 960×440 stages. The figure is the contrast against the glow within 3px of the letters.
- - **Without help** it falls to 2.7:1 (Green, Large, A lot, second glow on). Text shadows alone do not fix it: the strongest stack tried, four dark shadows, reached 4.0:1.
- - **The fix:** the title gets a soft dark shadow behind it, a see-through dark patch whose edge fades out: `.center-title{padding:0 6px;border-radius:10px;background:rgba(2,4,8,.4);box-shadow:0 0 14px 8px rgba(2,4,8,.4)}`. It breathes with the title, because it is part of `.center-el`.
- - **With it,** the lowest measured contrast is 6.3:1, at every setting.
- - Glow color still leaves out White: a white glow behind white text.
-- **Phone fallback:** none needed. One or two blurred circles (at most 510px across before they grow) change only their size and opacity.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Four to six seconds feels like a calm breath. | `--glow-dur`: 8s / 5s / 3s |
-| How much it grows | Choice buttons | A little · Medium · A lot | Medium | Big swings look alarming rather than calm. | `--glow-min` and `--glow-max`: 0.8 and 1.2 / 0.6 and 1.5 / 0.45 and 1.8 |
-| Glow color | Swatches (the site palette without White) | Pink · Blue · Purple · Green · Orange | Blue | The color of the glow. | `--glow-color`: `#ff6f8b` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Glow size | Choice buttons | Small · Medium · Large | Medium | How big the glow is before it grows. | `--glow-size`: 180px / 260px / 340px |
-| Second glow | Switch | on / off | off | A larger, fainter glow breathes out of step. | the second glow's `display`: block / none |
-| Icon and title breathe too | Switch | on / off | on | The icon and its title swell very slightly each breath. | the centre group's (`.center-el`) `animation`: `''` / `'none'` |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The Cycle Duration slider. It becomes Speed.
- - The Min Scale and Max Scale sliders. They become How much it grows, which sets both.
- - The Glow Size slider. It becomes Glow size.
- - The colour picker. It becomes the Glow color swatches (without White; see Title contrast).
- - The "Breathing glow" label in the middle of the stage (see Stage).
- - "Double glow (two layers)" becomes Second glow; "Element breathes too" becomes Icon and title breathe too, which names what it moves.
-- **Good for:** Idle states · Voice assistants · Meditation apps · Media players · **Avoid on:** Alerts · Busy screens
-- **Prompt:**
-
- > Add a breathing glow behind [the icon or element that should look alive but at rest]. Place a soft, round, blurred glow of color behind it, and make it slowly grow and brighten, then shrink and dim, over and over, easing gently at both ends like a calm breath. Four to six seconds a breath feels relaxed; much faster feels anxious. When the settings include it, let the element itself swell very slightly with the glow. If the visitor has reduced motion turned on, keep the glow still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A breathing glow is a soft, round glow of color that slowly grows and brightens, then shrinks and dims, over and over, like someone breathing calmly. A cycle of four to six seconds matches a relaxed breath. It sits behind things that are alive but at rest, such as a paused music player, an idle voice assistant or a meditation timer.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long one breath takes: slow is 8s, normal 5s and fast 3s; 4 to 6 seconds feels relaxed, 2 seconds anxious |
- | How much it grows | Medium | How far the glow shrinks and grows: a little is 80% to 120% of its size, medium 60% to 150% and a lot 45% to 180% |
- | Glow color | Blue | The color of the glow: pink, blue, purple, green or orange (white would hide the white title at the breath's peak) |
- | Glow size | Medium | The glow's size before it grows: small is 180px, medium 260px and large 340px |
- | Second glow | off | A larger, fainter glow behind the first breathes the other way over a longer cycle, so the two never line up |
- | Icon and title breathe too | on | The icon and the title under it swell by 2% with each breath, too little to notice consciously |
-
-- **README See also:** the first two link texts change to the pages' real titles.
- - [Ambient Ripple Effect](../ambient-ripple/) — rings spread out instead of a glow swelling
- - [Mesh Gradient Animation](../mesh-gradient/) — soft color drifting across a whole background
- - [Floating Elements](../floating-elements/) — shapes that drift and slowly fade in and out
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `07.08 · Ambient &amp; Background`
-- **Pager:** Previous: Starfield / Space Particles (`../starfield/`) · Next: Ambient Ripple Effect (`../ambient-ripple/`)
-
----
-
-## ambient-ripple — Ambient Ripple Effect
-
-- **Kind:** loop. Rings keep spreading, forever.
-- **Description:** Rings spread from a few spots, like drops on a still pond. Best for hero areas.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble, with the page's own clock `clock` (ms). Each drawn frame (at most one per 16ms, as today) adds the time since the last frame to `clock`, at most 50ms and nothing on the first frame after a start. Then:
- - `advance(k * dt / FRAME)` drifts the sources when Sources drift is on (a step for every 60th of a second, `FRAME = 1000/60`: one at 60 Hz, two at 30 Hz; `k` is 1, or a third in slow motion).
- - A source whose `nextEmit` has come adds a ring born at `clock`, and its next ring is due one Time between ripples later (up to 40% earlier or later at random when Uneven timing is on).
- - Rings older than their life (Speed) go.
- - `draw()` clears the canvas and draws the source dots and every ring from `clock` (its radius and fade come from its age).
-
- Rings' birth times and `nextEmit` use `clock` instead of `performance.now()` and the frame time. So Pause holds every ring exactly where it is, and Play carries on without rings jumping ahead or vanishing. Today a paused ring kept ageing by the wall clock.
-
- **The first picture:** `initSources()` first empties `rings`, then gives each source three rings born 0.3, 0.6 and 0.9 ring lives ago (today's `paintStatic()` picture, which only reduced motion saw), and the page draws one frame at load. So the stage opens with ripples already spreading, and a loop paused on arrival shows them. Emptying `rings` first means a resize or a new Number of sources never piles new rings on the old ones.
-
- **Speed keeps each ring's progress.** A ring's radius and fade come from its age over its life, so a new Speed alone would send every ring on screen to another point of its spread. The Speed choice first gives each ring on screen the new life at the same progress (`r.dur = newLife; r.born = clock - progress * newLife`), then sets `LIFE`, so the picture stays as it is and only the pace changes, moving or paused.
-
- **Time between ripples plans the waits under way again.** A source's next ring is due at its `nextEmit`, drawn under the old gap, so without this a change from Long to Short could take up to about seven seconds to show (5s, up to 40% longer with Uneven timing). A source whose next ring is due later than a new random gap away is brought forward to within one: `s.nextEmit = Math.min(s.nextEmit, clock + Math.random() * gap())`. A press on the choice already made does nothing, and neither does a press on the Number of sources already chosen (`initSources()` would deal the picture again).
-
- **While paused,** every setting change calls `draw()`, so a new color, size or thickness shows at once; a new Number of sources calls `initSources()` first. This replaces today's `document`-wide `input` and `change` listeners, which repainted `paintStatic()`. **After a real resize** (see the preamble), `resize()` calls `initSources()` and `draw()`, playing or paused.
-- **Slow motion:** while the switch is on, `clock` advances by a third of each frame's time, and the sources drift a third of a step. Rings grow, fade and are sent out three times slower. From the next frame.
-- **Reduced motion:** the page's `REDUCED` checks and `paintStatic()` go (see the preamble).
-- **Stage font:** site font, on the card as in the preamble.
-- **Stage:** the canvas and the centred card stay.
- - Card text: eyebrow "Ambient ripple"; title "Something is alive here"; body "Like drops on a still pond, or a sonar ping: it hints that something is there." (was "… ECG monitors, sonar pings — suggests presence without interaction.").
- - The card moves from the middle to the bottom, at every size: `.fg-card{top:auto;bottom:28px;transform:translateX(-50%)}`, and `bottom:12px` under the preamble's phone and short-screen card rules. Today it sits over all three ripple sources, which are 35%, 50% and 65% across and 25–75% down.
- - On phones (at most 600px wide) its `.fg-title` is 13px and its padding `12px`. So "Something is alive here" (146.7px wide) stays on one line down to a 320px screen, where the card leaves it 154px. At 14px it wrapped on every phone narrower than 390px, and the card grew to 26.8% of the stage.
- - Measured with the page's 1px stage border:
- - phones from 320px to 414px wide: 20.3% of the stage's height, 75.4–95.7% down, below every source;
- - a phone turned sideways (747×260 stage): 25.0%, 70.0–95.0% down, so a source near the bottom of its range can sit behind the card's top edge;
- - a 1366×657 laptop (960×327): 20.6%, 75.4–96.0% down;
- - taller screens, full card: 36.0% of a 1280×800 laptop's 380px stage (56.3–92.4% down) and 63–94% of a 440px stage. There the middle source is sometimes just behind the card's top edge, and its rings still spread well past the card.
- - `hb-dots`: no. Default height.
-- **Phone fallback:** none needed. A few thin circles a frame, on a canvas that caps the pixel ratio at 2 (0.8 ms a frame, measured on today's phone stage).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each ring takes to spread and fade. | `LIFE`: 4s / 2.5s / 1.5s (each ring on screen keeps how far along it is) |
-| Time between ripples | Choice buttons | Short · Medium · Long | Medium | How often each spot sends out a new ring. | `INTERVAL`: 1.8s / 3s / 5s (the waits under way are planned again; a choice already chosen does nothing) |
-| Ripple size | Choice buttons | Small · Medium · Large | Medium | How far each ring spreads before it fades. | `MAX_R`: 100px / 160px / 250px |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of sources | Choice buttons | 1 · 3 · 5 | 3 | One spot feels focused; five feel like rain. | `SRCS`: 1 / 3 / 5, then `initSources()` (a choice already chosen does nothing) |
-| Ring thickness | Choice buttons | Thin · Medium · Thick | Medium | The width of each ring's line. | `THICK`: 1 / 1.5 / 3 (px) |
-| Ring color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The color of the rings. | `COLOR`: [255,111,139] / [244,244,242] / [88,166,255] / [210,168,255] / [86,211,100] / [255,166,87] |
-| Uneven timing | Switch | on / off | on | Slightly random gaps feel natural, not mechanical. | `IRR` true / false |
-| Sources drift | Switch | on / off | off | The spots slowly wander around the stage. | `DRIFT` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The Source Count, Emit Interval, Max Radius, Ring Life and Ring Thickness sliders. They become Number of sources, Time between ripples, Ripple size, Speed and Ring thickness.
- - The colour picker. It becomes the Ring color swatches.
- - "Irregular timing" becomes Uneven timing; "Sources drift slowly" becomes Sources drift.
-- **Good for:** Hero sections · Live and connected states · Maps and places · Meditation apps · **Avoid on:** Buttons · Alerts
-- **Prompt:**
-
- > Add an ambient ripple background to [the section or status you want to feel alive]. Pick a few spots and let each one send out a ring every so often that grows from nothing and gets fainter as it spreads until it disappears, so several rings overlap like drops on a still pond. It runs by itself, never on clicks. When the settings ask for uneven timing, vary the gaps slightly, because perfectly regular rings feel like a clock. If the visitor has reduced motion turned on, show a few still rings. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > An ambient ripple sends rings out from a few spots, over and over, like drops falling on a still pond or the ping of a sonar screen. Each ring grows from nothing and fades as it spreads, and the next one starts before it is gone, so the rings overlap into a gentle, steady pulse. It runs on its own rather than answering a click, and hints that something is alive there.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long each ring takes to spread and fade: slow is 4s, normal 2.5s and fast 1.5s |
- | Time between ripples | Medium | How often each spot sends out a ring: short is every 1.8s, medium 3s and long 5s |
- | Ripple size | Medium | How far each ring spreads: small is 100px, medium 160px and large 250px; big rings look calmer with a slow speed |
- | Number of sources | 3 | One spot feels focused; three spread across the stage; five feel like rain on water |
- | Ring thickness | Medium | The width of each ring: thin is 1px, medium 1.5px and thick 3px |
- | Ring color | Blue | The color of the rings |
- | Uneven timing | on | Each gap is up to 40% longer or shorter, at random, so the rings never tick like a clock |
- | Sources drift | off | The spots slowly wander around the stage |
-
-- **README See also:** the second link's text changes to the page's real title.
- - [Click / Tap Ripple](../../04-micro-interactions/click-ripple/) — a ripple that answers a click instead
- - [Breathing / Pulsing Glow](../breathing-glow/) — one glow that grows and shrinks instead of rings
- - [Abstract Geometric Motion](../abstract-geometric-motion/) — its Rings pattern spreads rings from the center
-- **README How it works:** the snippets use the demo's clock:
- - In the `Ring` constructor, the comment on `this.born = now;` becomes `// the page's own clock, which stops while paused`, and the comment on the next line goes.
- - In `update`, the fade `(1 - progress) * 0.6` becomes `(1 - progress) * 0.5`, the value the demo draws.
- - In `scheduleEmit`, `performance.now()` becomes `clock`.
- - In the drift snippet, `source.x += source.vx;` and `source.y += source.vy;` become `source.x += source.vx * k; // k is the time since the last frame in 60ths of a second: 1 at 60 Hz, 2 at 30 Hz, a third of it in slow motion` and `source.y += source.vy * k;`.
- - After the first snippet, add: "`now` is the page's own clock: each frame adds the time since the last one (a third of it in slow motion), and it stops while the animation is paused, so rings freeze in place and carry on without jumping."
-- **README Production notes:** the "Ring density calibration" bullet, which said there are always about three rings from each source on screen, becomes "**Ring density calibration**: with the defaults (three sources, a ring every 3s, each living 2.5s) each source has at most one ring out most of the time, so two or three rings are on screen at once, with short quiet spells. Shorter gaps or longer lives overlap more rings; single, evenly spaced rings look like a clock, too many look frantic." The rest is unchanged.
-- **Category line:** `07.09 · Ambient &amp; Background`
-- **Pager:** Previous: Breathing / Pulsing Glow (`../breathing-glow/`) · Next: Floating Elements (`../floating-elements/`)
-- **Frame-rate fix (wrap-up):** only the drift needed it, because the rings already run on `clock`, which adds the frame's time. `advance(k * dt / FRAME)` moves the sources by the frame's time in 60ths of a second, so they wander at the same speed on every screen. A `visibilitychange` listener sets the last frame time back to `null`, so the first frame back from a hidden tab adds no time (the page already did this on a start). The 16 ms gate stays.
-
----
-
-## floating-elements — Floating Elements
-
-- **Kind:** loop. The shapes drift forever.
-- **Description:** Small shapes drift slowly, each on its own path. Best for hero backgrounds.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the loop as in the preamble, moving elements rather than drawing on a canvas. Each frame, with `k` the frame's time in 60 Hz frames, or a third of that in slow motion (see the frame-rate fix below):
- - it adds Speed × 0.005 × `k` to `t`;
- - when Shapes turn is on, it turns each shape by its own step (`e.rot += e.rotSpd * k`);
- - then `place()` writes every shape's `transform` and `opacity` for the current `t`, as today's loop body does, including the push away from the pointer.
-
- `place()` also runs at the end of `rebuild()`. So the shapes are in place at load, playing or paused; today they sit in the stage's top-left corner until the first frame. It also runs after any setting change while paused. The four settings that rebuild the shapes (Number of shapes, How far they drift, Shapes and Colors) ignore a press on the choice already made, so it does not scatter a new arrangement.
-- **Slow motion:** while the switch is on, each frame adds a third of the usual step to `t` and to each shape's turn, from the next frame.
-- **Reduced motion:** the page's `REDUCE` checks and the rule `.el{animation:none!important;transition:none!important}` go (see the preamble).
-- **Stage font:** site font, on the card as in the preamble.
-- **Stage:** the shapes layer and the centred card stay.
- - Card text: eyebrow "Floating elements"; title "No two shapes move together" (was "5–12 shapes is the sweet spot", which a setting can now contradict); body "Each shape follows its own slow path, so the motion never looks mechanical." (was about amplitude, frequency and phase).
- - `hb-dots`: no. Default height.
-- **Phone fallback:** none needed. At most 14 small shapes, moved with `transform` and `opacity` (2.9 ms a frame, measured on today's phone stage).
-- **Touch:** the stage's `pointerdown` also sets the pointer's position (today only `pointermove` does, so a tap did nothing). With Shapes avoid the pointer on, a finger resting on the stage pushes the shapes aside. `pointerleave` and `pointercancel` still clear it.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of shapes | Choice buttons | Few · Medium · Many | Medium | 5 to 12 shapes feels calm; more gets busy. | `COUNT`: 5 / 8 / 14, then `rebuild()` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the shapes drift. | `SPD`: 0.3 / 0.5 / 0.8 |
-| How far they drift | Choice buttons | Short · Medium · Long | Medium | How far each shape wanders from its place. | `RANGE`: 30 / 50 / 90 (px), then `rebuild()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shapes | Choice buttons | Circles · Squares · Rings · Mixed | Mixed | The kind of shapes that float. | `SHAPE`: `'circles'` / `'squares'` / `'rings'` / `'mixed'`, then `rebuild()` |
-| Colors | Choice buttons | Cool · Warm · Gray · Neon | Cool | The set of colors the shapes use. | `PAL`: `'cool'` / `'warm'` / `'mono'` / `'neon'`, then `rebuild()` |
-| Shapes turn | Switch | on / off | on | Each shape slowly spins as it drifts. | `ROT` true / false |
-| Fades in and out | Switch | on / off | on | Each shape slowly brightens and dims. | `PULSE` true / false |
-| Shapes avoid the pointer | Switch | on / off | off | Shapes near your pointer or finger slide aside. | `REACT` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The Rebuild button. The settings that change the shapes rebuild them, and a fresh arrangement is not a setting.
- - The Count, Drift Speed and Drift Range sliders. They become Number of shapes, Speed and How far they drift.
- - The Shape Mix and Palette menus. They become Shapes and Colors.
- - "Subtle rotation" becomes Shapes turn; "Opacity pulse" becomes Fades in and out; "Mouse repulsion" becomes Shapes avoid the pointer.
-- **Good for:** Hero backgrounds · Landing pages · Onboarding screens · Empty states · **Avoid on:** Busy layouts · Long reading pages
-- **Prompt:**
-
- > Add floating shapes to [the section you want a gentle moving background behind]. Scatter a handful of small, see-through circles, squares or rings, and move each one slowly around its own starting point on a smooth, looping path, giving every shape its own speed, distance and starting point so no two ever move in step. Keep them behind the content and let clicks pass through. When the settings include it, shapes slide away from the pointer, or from a finger on touch screens. If the visitor has reduced motion turned on, keep the shapes still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Floating elements are small, see-through shapes, such as circles, squares or rings, that drift slowly around a background. Each shape follows its own smooth, looping path, with its own speed, distance and starting point, so no two ever move in step. That independence is what makes it look like a living background rather than a screensaver.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Number of shapes | Medium | Few is 5, medium 8 and many 14; 5 to 12 feels calm, more gets busy |
- | Speed | Normal | How fast the shapes drift: slow is 0.3, normal 0.5 and fast 0.8 |
- | How far they drift | Medium | How far each shape wanders from its place: short is up to 30px, medium 50px and long 90px |
- | Shapes | Mixed | Circles, squares, rings or a mix |
- | Colors | Cool | Cool blues and purples, warm oranges and reds, grays, or bright neon |
- | Shapes turn | on | Each shape slowly spins at its own rate as it drifts |
- | Fades in and out | on | Each shape slowly brightens and dims, adding depth |
- | Shapes avoid the pointer | off | Shapes within 120px of the pointer, or of a finger, slide aside |
-
-- **README See also:** the second link's text changes to the page's real title.
- - [Canvas Particle Effect](../../06-3d-advanced/canvas-particle-effect/) — many particles that link up and react to the pointer
- - [Ambient Ripple Effect](../ambient-ripple/) — rings spreading out instead of shapes drifting
- - [Noise-Based Motion](../../06-3d-advanced/noise-based-motion/) — smooth, natural-looking random motion
-- **README How it works:** the snippets match the demo's code:
- - In the first snippet, the turn line becomes `const rot = el.rotation ? el.rot : 0; // its own small turn, added up in the loop below`: each shape turns by its own step, not by a multiple of `t`, and the loop adds that step up (`el.rot += el.rotSpeed * k`). The frame-rate fix (below) also rewords the sentence before the snippet (the position comes from the base position plus sinusoidal offsets of a running time `t`) and adds, after the snippet, a paragraph and a `loop(now)` snippet: `FRAME`, `last`, `dt`, `k`, `t += speed * 0.005 * k`, the shapes' turn and `animate(t)`.
- - In "Key construction", `amp` becomes `const amp = RANGE * 0.5 + Math.random() * RANGE * 0.5; // half to all of How far they drift (30, 50 or 90px)`, and the comment on `freq` becomes `// its own pace, 0.3 to 0.8 times as fast as t` (`t` is not seconds).
- - The "CSS shape generation" block, whose `.shape-*` classes no shape has, becomes "**Shape generation** — shapes without image assets, styled in code:" followed by the demo's own `if (shape === 'ring') … else if (shape === 'square') … else …`, which sets `borderRadius`, `border` and `background` on each shape.
- - In the mouse repulsion snippet, `if (d < 120) {` becomes `if (d > 0 && d < 120) {`, the demo's guard for a pointer exactly on a shape's centre.
- - After the mouse repulsion snippet, add: "The pointer's position is taken from `pointerdown` as well as `pointermove`, so on a touch screen a finger resting on the stage pushes the shapes too."
-- **README Production notes:** unchanged
-- **Category line:** `07.10 · Ambient &amp; Background`
-- **Pager:** Previous: Ambient Ripple Effect (`../ambient-ripple/`) · Next: Grid / Dot Pattern Parallax (`../grid-dot-pattern-parallax/`)
-- **Frame-rate fix (wrap-up):** a frame adds `k = dt / FRAME * (slow ? 1/3 : 1)` steps instead of one, where `FRAME = 1000/60` and `dt` is the time since the last frame: at most 50 ms, and 0 on the first frame after a start, a Play or a return to a hidden tab (`start()` and a `visibilitychange` listener set the last frame time back to `null`). `t` and each shape's turn move by `k`, so the shapes drift and turn at the same speed on a 30, 60 or 144 Hz screen. The page still has no frame gate: it moves the shapes on every display frame.
-
----
-
-## grid-dot-pattern-parallax — Grid / Dot Pattern Parallax
-
-- **Kind:** loop. The grid drifts slowly by itself, forever. The pointer steers it while it is over the stage, but nothing waits for the visitor, so it is a loop rather than a do-it page (and the do-it kind is not in this lane's shared files yet).
-- **Description:** A dot grid shifts gently against your pointer for depth. Best for tech sites.
-- **Watch it help line:** It drifts by itself. Move your pointer over it, or drag a finger sideways across it, and the grid shifts the other way.
-- **Player bar:** Pause (page), no Slow motion. The drift moves only a few pixels a second, so a third of that shows nothing new, and the rest of the effect follows the pointer, which slow motion cannot slow.
-- **Sequence:** the drift is the loop, on animation frames as in the preamble, with its own clock `clock`. Each frame adds the time since the last frame, at most 50ms and nothing on the first frame after a start. The first layer is placed with today's formula, with the frame time replaced by `clock`:
- - `dx = -sin(clock × 0.0002) × Strength × W × 0.4`
- - `dy = -cos(clock × 0.00014) × Strength × H × 0.3`
-
- The second layer is placed at half of that, `dx / 2` and `dy / 2`, as the mouse already places it. Today only a mouse moved it, so it stood still during the drift and on touch screens, and its hint ("A sparser layer moves half as far") was true for a mouse only.
-
- Today the frame time was used directly, so a pause would jump the grid on Play.
-
- **The pointer takes over,** through Pointer Events in place of today's mouse and touch events (CLAUDE.md asks drags to use Pointer Events):
- - **Mouse:** `pointerenter` with `pointerType === 'mouse'` stops the drift and shows the cursor ring (`hasMouse = true`). `pointermove` from the mouse shifts the grid, the second layer, the ring and the light, as today's `mousemove` does. `pointerleave` from the mouse hides the ring and the light and starts the drift again, from its clock; both layers follow it.
- - **Finger or pen:** `pointerdown` stops the drift and shifts the grid against it, by the same rule as the mouse; `pointermove` while it is down shifts it the same way; the second layer goes half as far each time (today's `touchmove` moved the first layer only); `pointerup` and `pointercancel` start the drift again, and both layers follow it. These replace today's four touch listeners.
- - **Scrolling:** the stage gets `touch-action:pan-y`, as on 2.5D / Pseudo-3D. A sideways drag stays with the page and steers the grid, while a vertical swipe still scrolls the page (the browser then sends `pointercancel`, and the drift starts again).
- - Only a mouse starts the hover state, so a tap on a phone never shows the cursor ring or the light.
-
- Each restart happens only while not paused, and Play restarts the drift only when no mouse is over the stage (`hasMouse`). While paused, pointer moves no longer move the grid, the second layer or the light; the cursor ring still follows the mouse, because the stage hides the system cursor.
-
- **The first picture:** at load the page places both layers where the drift starts (`clock` 0) before the first frame, so Play after a pause on arrival does not jump. A Strength change or a resize while paused places both again for the current `clock`.
-
- The unused `.auto-drift` class and its `@keyframes auto-pan` go (nothing ever adds the class).
-- **Slow motion:** none (see Player bar).
-- **Reduced motion:** the `reduceMotion` check in `startAuto()` and the demo's rule (`.pattern-layer{transition:none!important}` and the 300s `.auto-drift`) go (see the preamble).
-- **Stage font:** site font, on the card as in the preamble.
-- **Stage:** both pattern layers, the light, the cursor ring and the centred card stay.
- - Card text: eyebrow "Dot grid parallax"; title "Move your pointer or finger across it" (was "Move your mouse across the stage"); body "The grid shifts slightly against your pointer: depth you feel more than see." (was "… opposite to your cursor — a depth illusion so subtle you almost don't notice it.").
- - The stage's own rule keeps `cursor:none` (the ring replaces the system cursor over the stage) and gets `touch-action:pan-y` (see Sequence).
- - The ring is drawn above the card (`z-index` 11, the card's is 10), because the stage hides the system pointer over the card too.
- - `hb-dots`: no (the stage is itself a dot grid). Default height.
-- **Phone fallback:** none needed. Two tiled background layers are moved with `transform` only (0.4 ms a frame, measured on today's phone stage).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pattern | Choice buttons | Dots · Lines · Dots and lines | Dots | The shape of the grid. | shows `pat-dots` / `pat-lines` / `pat-cross` and hides the others (as today) |
-| Strength | Choice buttons | Subtle · Medium · Strong | Medium | Under 10% of the pointer's move is felt, not seen. | `str`: 3 / 5 / 10 (% of the stage) |
-| Spacing | Choice buttons | Tight · Medium · Wide | Medium | The distance between the dots or lines. | `--dot-gap`: 20px / 28px / 44px |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pattern color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The color of the dots and lines. | `--dot-color`: `rgba(r,g,b,.25)` and the light's gradient `rgba(r,g,b,.06)` (as today) from `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-| Second layer | Switch | on / off | off | A sparser layer moves half as far, adding depth. | the second layer's `display`: block / none |
-| Light under the pointer | Switch | on / off | on | A faint glow follows your pointer. | `spotOn` true / false (off also hides the light at once, as today) |
-
-- **Removed:**
- - The note, and the line "No mouse? Auto-drifts on touch."
- - The Background colour picker. It does not change the effect, and the stage keeps its near-black `#04060c`.
- - The Pattern menu. It becomes choice buttons.
- - The Dot Spacing and Parallax Strength sliders. They become Spacing and Strength. Strength no longer reaches 0%, which switched the effect off.
- - The pattern colour picker. It becomes the Pattern color swatches.
- - "Two layers (depth)" becomes Second layer; "Spotlight under cursor" becomes Light under the pointer.
- - The unused auto-drift class and its keyframes.
- - The `mouseenter`, `mousemove` and `mouseleave` listeners and the four touch listeners. Pointer Events replace them (see Sequence).
-- **Good for:** Tech and developer sites · Hero sections · Dashboards · Portfolios · **Avoid on:** Photo backgrounds · Long reading pages
-- **Prompt:**
-
- > Add a dot grid parallax background to [the section you want a subtle sense of depth behind]. Tile a faint grid of dots or lines behind the content, a little larger than the section, and shift it slightly in the opposite direction to the pointer, so it seems to sit deeper than the content. Keep the shift to a few percent of the pointer's movement, so it is felt more than seen. On touch screens, let it follow a dragging finger the same way, and when nothing is over it, let it drift slowly by itself. If the visitor has reduced motion turned on, keep the grid still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A grid or dot pattern parallax places a faint repeating pattern of dots or lines behind the content and shifts it slightly in the opposite direction to the pointer. The shift is tiny, a few percent of the pointer's movement, so the pattern seems to sit a little deeper than the content: depth you feel more than see. When no pointer is over it, the grid drifts slowly by itself. Linear, Vercel and many developer tools use it.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pattern | Dots | A grid of dots, of lines, or both |
- | Strength | Medium | How far the grid shifts: subtle is 3% of the pointer's movement, medium 5% and strong 10%; under 10% it is felt more than seen |
- | Spacing | Medium | The distance between dots or lines: tight is 20px, medium 28px and wide 44px |
- | Pattern color | Blue | The color of the dots and lines, shown at 25% so they stay faint |
- | Second layer | off | A sparser layer of larger dots shifts half as far, adding real depth between the two |
- | Light under the pointer | on | A faint round glow follows the pointer |
-
-- **README See also:**
- - [Floating Elements](../floating-elements/) — shapes that drift on their own instead
- - [2.5D / Pseudo-3D](../../06-3d-advanced/2-5d-pseudo-3d/) — many layers moving at different depths
- - [Parallax 3D Tilt](../../06-3d-advanced/parallax-3d-tilt/) — a card that tilts toward the pointer
-- **README How it works:** the auto-drift snippet follows the demo's clock. It becomes:
-
- ```js
- let clock = 0, last = null;
- function autoLoop(now) {
- clock += last === null ? 0 : Math.min(now - last, 50); // the drift's own clock stops while paused
- last = now;
- const dx = -Math.sin(clock * 0.0002) * STRENGTH * W * 0.4;
- const dy = -Math.cos(clock * 0.00014) * STRENGTH * H * 0.3;
- patternLayer.style.transform = `translate(${dx}px, ${dy}px)`;
- requestAnimationFrame(autoLoop);
- }
- ```
-
- The heading "**Auto-drift fallback** for touch devices (no mouse hover):" becomes "**Auto-drift** when no pointer is over the stage (and on touch screens between drags):". In the first snippet, `stage.addEventListener('mousemove', e => {` becomes `stage.addEventListener('pointermove', e => {`, and after it add: "Pointer events cover a mouse, a pen and a finger. The demo's stage has `touch-action: pan-y`, so a sideways drag steers the grid while a vertical swipe still scrolls the page, and only a mouse turns on the cursor ring and the light." The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `07.11 · Ambient &amp; Background`
-- **Pager:** Previous: Floating Elements (`../floating-elements/`) · Next: Abstract Geometric Motion (`../abstract-geometric-motion/`)
-
----
-
-## abstract-geometric-motion — Abstract Geometric Motion
-
-- **Kind:** loop. The pattern moves forever.
-- **Description:** Shapes turn, spread and flow in a calm, endless pattern. Best for music players.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble. Each drawn frame (at most one per 16ms, as today) runs `advance(k)`, then `draw()`. `k` is the frame's time in 60 Hz frames: the time since the last frame (at most 50ms, and nothing on the first frame after a start) divided by 1000/60, and a third of that in slow motion. So one 60 Hz frame is one step, and a faster or slower screen keeps the same speed:
- - `advance(k)` adds Speed × 0.01 × `k` to `t`, and moves the bars' and dashes' own counters with it (`barX` by 40 × Speed and `dashPhase` by 30 × Speed each time `t` grows by 1, so a Speed change never makes them jump). For Rings, it also grows every ring by Speed × 2 × `k`, adds a ring every 0.5 of `t`, and drops rings past the edge; this is today's `updateRings()`, moved out of the drawing.
- - `draw()` paints the background and the chosen pattern for the current `t`; this is today's `render()` without `updateRings()`.
-
- **The first picture:** the page calls `draw()` at load (the polygons at `t` 0). Choosing Rings seeds six rings spread across the stage (today's `still()` picture, which only reduced motion saw), so the pattern shows at once, playing or paused; choosing another pattern clears the rings, as today. The rings on screen are coloured by their place in the list, spread across Number of shapes: ring `i` of `n` gets colour `floor(i × CX / n)`, so the same choice always gives the same picture and a bigger count shows more of the colour range even where only the inner rings fit the stage (a wide, short stage). With the default Medium the six seeded rings are colours 0 to 5, as in today's picture.
-
- **While paused,** every setting change calls `draw()`; `repaint()` becomes `draw()`. After a real resize (see the preamble), `resize()` calls `draw()` at once, playing or paused.
-
- **Thicker lines** is hidden while Pattern is Bars: Bars are filled shapes with no lines, so the switch would change nothing there. Its choice is kept while it is hidden, it comes back with the other patterns, and it is out of "Your settings" while hidden.
-- **Slow motion:** while the switch is on, `k` is a third of what it would be, so `t`, each ring's growth, the bars and the dashes all move a third of the usual step, from the next frame.
-- **Reduced motion:** the `RM` checks and `still()` go (see the preamble).
-- **Stage font:** no text on the stage.
-- **Stage:** only the canvas. The four pattern tabs that sat on top of the stage (`.preset-tabs`, `.ptab`) move to Try it as Pattern. `hb-dots`: no. Default height.
-- **Phone fallback:** none needed. At most 20 lines or 10 shapes a frame, on a canvas that caps the pixel ratio at 2 (1.3 ms a frame, measured on today's phone stage).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pattern | Choice buttons | Polygons · Rings · Bars · Lines | Polygons | Four patterns, each an endless loop. | `PRESET`: 0 / 1 / 2 / 3 (Rings also seeds six rings) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow feels calm; keep it slow behind content. | `SPD`: 0.35 / 0.6 / 1.0 |
-| Number of shapes | Choice buttons | Few · Medium · Many | Medium | More shapes make a busier pattern. | `CX`: 3 / 6 / 10 (on Rings the rings on screen are coloured again at once by the rule under "The first picture") |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Colors | Choice buttons | Cool · Warm · Neon · Gray | Cool | The set of colors the shapes use. | `PAL`: `'cool'` / `'warm'` / `'neon'` / `'mono'` |
-| Thicker lines | Switch; shown only when Pattern is not Bars | on / off | off | Bolder lines that stand out more. | `CONTRAST` true / false (line width 1.5 / 0.8) |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The pattern tabs on the stage. They become Pattern.
- - The Speed and Complexity sliders. They become Speed and Number of shapes.
- - The Palette menu. It becomes Colors.
- - The Background menu. It does not change the effect, and the stage keeps its near-black `#020408`.
- - "High contrast" becomes Thicker lines, which is what it does.
-- **Good for:** Music and media players · Screensavers and kiosks · Loading screens · Art pages · **Avoid on:** Forms · Long reading pages
-- **Prompt:**
-
- > Add an abstract geometric animation to [the section or screen you want a calm moving background in]. Draw simple shapes on a canvas and keep them moving in an endless loop: polygons slowly turning around the center, rings spreading out and fading, slanted bars sliding across, or wavy lines with color flowing along them. Drive everything from one steadily growing time value, so the loop never restarts or jumps. Colors from one family keep it calm. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Abstract geometric motion is an endless loop of simple shapes that exists just to be watched: polygons slowly turning, rings spreading out from the center, slanted bars sliding by, or wavy lines with color flowing along them. There is no story and nothing to click. Like a screensaver or a music visualizer, it is meant to stay calm and pleasant to look at for a long time.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pattern | Polygons | Turning polygons, rings spreading from the center, sliding bars, or wavy lines with flowing color |
- | Speed | Normal | How fast everything moves: slow is 0.35, normal 0.6 and fast 1; keep it below 1 behind content |
- | Number of shapes | Medium | How many polygons, bars or lines: few is 3, medium 6 and many 10 (the Lines pattern draws twice as many); on Rings it sets how many colors the rings use |
- | Colors | Cool | Cool blues, warm ambers, bright neon or grays |
- | Thicker lines | off | Draws the lines 1.5px wide instead of 0.8px, so the shapes stand out more |
-
-- **README See also:** the first link's text changes to the page's real title.
- - [Ambient Ripple Effect](../ambient-ripple/) — rings spreading from a few spots, on their own
- - [WebGL Shader Animation](../../06-3d-advanced/webgl-shader-animation/) — patterns drawn by the graphics card
- - [Noise-Based Motion](../../06-3d-advanced/noise-based-motion/) — smooth, natural-looking random motion
-- **README How it works:** unchanged
-- **README Production notes:** the "Infinite seamless looping" bullet, which said no preset uses `%`, becomes "**Infinite seamless looping**: nothing restarts. Every preset draws from values that only grow (`t`, and the bars' and dashes' own counters), and the bars wrap around the stage with `%`, so there is no reset moment." The rest is unchanged.
-- **Category line:** `07.12 · Ambient &amp; Background`
-- **Pager:** Previous: Grid / Dot Pattern Parallax (`../grid-dot-pattern-parallax/`) · Next: Particle Constellation (`../particle-constellation/`)
-
----
-
-## particle-constellation — Particle Constellation
-
-- **Kind:** loop. The dots drift and link forever.
-- **Description:** Drifting dots link up with lines whenever they come close. Best for tech sites.
-- **Watch it help line:** It moves by itself, and the dots gather toward your pointer or finger. Pause it to look closely, or turn on slow motion.
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble. Each drawn frame (at most one per 16ms, as today) runs `step(k)`, then `draw()`, where `k` is the frame's time in 60 Hz frames, or a third of that in slow motion (see the frame-rate fix below):
- - `step(k)` moves every dot by its velocity × Speed × `k`.
- - With Dots follow the pointer on, a dot within about 160px of the pointer is pulled toward it (today's `d2<26000`, with a pull `f = .04 / d`, times `k`).
- - The dot's velocity then eases back toward its own cruising velocity, and it bounces off the edges.
- - `draw()` draws the links and the dots, as today.
-
- **The drift fix (needed for a loop):** today `step()` multiplies each velocity by 0.99 every frame, so the dots stop within about fifteen seconds and the loop stands still. Measured at the default settings: the average step is 0.07px a frame after 2 seconds and 0.0000px after 16 seconds.
- - `init()` stores each dot's starting velocity as its cruising velocity (`p.cvx`, `p.cvy`).
- - `step(k)` eases toward it: `p.vx += (p.cvx - p.vx) * .01 * k`, and the same for `vy`, in place of `p.vx *= .99`.
- - A bounce points both the velocity and the cruising velocity away from the wall the dot crossed. Past the left or top edge both become positive (`p.vx = Math.abs(p.vx); p.cvx = Math.abs(p.cvx)`), past the right or bottom edge both become negative, and the dot is kept inside, as today's clamp does. Today's `p.vx *= -1` only flips the sign, so a dot the pointer has pulled against a wall, already moving back inward, would be sent straight into the wall again; flipping the cruising velocity the same way would do the same.
- - A pull from the pointer still fades within a second or two, as before, and the drift never dies.
-
- **The first picture:** the page calls `draw()` after `init()` at load and after a real resize (see the preamble; today every `resize` event, including a phone's address bar sliding, scattered the dots again), so a loop paused on arrival shows the dots and links. **While paused,** every setting change calls `draw()`; Number of dots calls `init()` first.
-- **Slow motion:** while the switch is on, `k` is a third of the frame's time in 60 Hz frames, so the whole movement runs at a third of its speed: the position step (`p.x += p.vx * SPD * k`, and the same for `y`), the pull toward the pointer (`f * k`) and the easing (`.01 * k`) all shrink with it. So a slowed dot follows the same path, three times slower, pointer included. From the next frame.
-- **Reduced motion:** the demo's rule `.fps-badge,#pause-btn{display:none}` and the `reduce` checks go (see the preamble).
-- **Stage font:** no text on the stage.
-- **Stage:** only the canvas; the fps badge goes. `hb-dots`: no. Default height.
-- **Phone fallback:** today: at most 60 dots on phones and short screens (the viewport rule above, read in `init()`; a change listener deals the dots again when a window crosses the rule), because every pair of dots is tested for a link, so the cost grows with the square of the count; and the canvas draws at CSS pixels, not device pixels. Keep both. Measured on a phone stage: 9.5 ms a frame with 15 ms peaks.
-- **Touch:** the stage's `pointerdown` also sets the pointer's position (today only `pointermove` does, so a tap did nothing), so a finger resting on the stage draws the dots toward it. `pointerleave` still clears it.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of dots | Choice buttons | Few · Medium · Many | Medium | More dots, more links; phones show at most 60. | `COUNT`: 50 / 90 / 140, then `init()` |
-| Link distance | Choice buttons | Short · Medium · Long | Medium | How close two dots must be to link up. | `LINK`: 90 / 130 / 180 (px) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow drifting stays calm. | `SPD`: 0.35 / 0.6 / 1.0 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Color | Swatches | Cyan · Violet · Mint · Gray | Cyan | The color of the dots and lines. | `COL`: `'cyan'` / `'violet'` / `'mint'` / `'mono'` (the swatches show `#5ad1ff` / `#a882ff` / `#7affc8` / `#dcdce1`, today's `PAL` colors) |
-| Dots follow the pointer | Switch | on / off | on | Dots gather where you point or touch. | `MOUSE` true / false |
-
-- **Removed:**
- - The note, and the line "Nodes cap at 60 on small screens for 60fps."
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps badge.
- - The Node Count, Link Distance and Drift Speed sliders. They become Number of dots, Link distance and Speed.
- - The Color menu. It becomes the Color swatches.
- - "Mouse attraction" becomes Dots follow the pointer.
-- **Good for:** Tech and data sites · Hero sections · Network and security products · Loading screens · **Avoid on:** Busy layouts · Long reading pages
-- **Prompt:**
-
- > Add a particle constellation background to [the section you want it behind]. Scatter dots on a canvas, let each drift slowly in its own direction and bounce off the edges, and on every frame join any two dots that are close with a thin line that fades as they move apart, so a network keeps forming and breaking. When the settings include it, let the dots drift toward the pointer, or toward a finger on touch screens. Checking every pair of dots gets slow fast, so use fewer dots on phones. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A particle constellation is a field of small dots drifting slowly across a background, where any two dots that come close enough are joined by a thin line that fades as they move apart. The lines keep forming and breaking, so the network seems to shift and grow: the "connected dots" background behind many tech and product sites.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Number of dots | Medium | Few is 50, medium 90 and many 140; phones show at most 60, because every pair of dots is checked each frame |
- | Link distance | Medium | How close two dots must be to be linked: short is 90px, medium 130px and long 180px; too long and everything links to everything |
- | Speed | Normal | How fast the dots drift: slow is 0.35, normal 0.6 and fast 1; faster looks agitated |
- | Color | Cyan | The color of the dots and lines: cyan, violet, mint or gray |
- | Dots follow the pointer | on | Dots near the pointer, or a finger, drift toward it and gather there |
-
-- **README See also:** the first link's text changes to the page's real title.
- - [Starfield / Space Particles](../starfield/) — particles that show depth instead of links
- - [Floating Elements](../floating-elements/) — shapes that drift on their own paths
- - [Grid / Dot Pattern Parallax](../grid-dot-pattern-parallax/) — a still grid that shifts against the pointer
-- **README How it works:** after the sentence "Optional mouse attraction nudges each node's velocity toward the pointer, so the mesh gathers where the cursor rests.", add: "Each node remembers the velocity it started with and eases back to it by 1% for every 60th of a second, so a pull from the pointer fades away while the slow drift goes on. On touch screens the pointer's position also comes from `pointerdown`, so a resting finger works too." The frame-rate fix (below) adds a paragraph and a snippet after that paragraph (`dt`, `k`, and the drift, pull and easing lines). The rest is unchanged.
-- **README Production notes:**
- - The "Velocity damping" bullet becomes: "**Velocity easing**: for every 60th of a second, a node's velocity eases 1% of the way back to the velocity it started with. That keeps pulls from the pointer from building into runaway speeds, and unlike multiplying the velocity by 0.99 every 60th of a second, which slows every node to a stop within seconds, it never lets the drift die out. Scaling the 1% by `k` is a linear shortcut that differs from the exact `1 - 0.99^k` by about 1% at most, on a 50 ms frame."
- - The "Reduced motion" bullet becomes: "**Reduced motion**: the demo starts paused, showing one still frame, until the visitor presses Play. In production, show these visitors the still frame."
- - The rest is unchanged.
-- **Category line:** `07.13 · Ambient &amp; Background`
-- **Pager:** Previous: Abstract Geometric Motion (`../abstract-geometric-motion/`) · Next: Flow Field (`../flow-field/`)
-- **Frame-rate fix (wrap-up):** `step(k)` gets `k = dt / FRAME * (slow ? 1/3 : 1)`, with `FRAME = 1000/60` and `dt` the time since the last drawn frame: at most 50 ms, and 0 on the first frame after a start, a Play or a return to a hidden tab (`start()` and a `visibilitychange` listener set the last frame time back to `null`). The drift, the pull toward the pointer and the easing back all take `k`, so the dots drift, gather and settle at the same speed on a 30, 60 or 144 Hz screen. The easing is the linear `.01 * k`, within about 1% of the exact `1 - .99^k` on a 50 ms frame. The 16 ms gate stays, as a cap of 60 drawn frames a second.
-
----
-
-## flow-field — Flow Field
-
-- **Kind:** loop. The particles flow forever.
-- **Description:** Particles ride invisible currents, leaving fading trails. Best for art pages.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble. Each drawn frame runs `frame(s, nf)`, where `s` is the frame's time in 60 Hz frames and `nf` the number of dims due (see the frame-rate fix below):
- - it dims the canvas `nf` times with a see-through fill (Trail length), instead of clearing it;
- - it moves every particle a step of Speed × `k` along the angle of the field under it, and draws that step (`k` is `s`, or a third of it in slow motion);
- - it respawns particles that leave the canvas, and adds 0.01 × `k` to the field's time `t`.
-
- **The first picture:** `prerender()` (40 frames at once) runs at load and after every real resize, for every visitor; today only reduced motion saw it. So the stage opens with trails already drawn, and a loop paused on arrival shows them. "Real" matters here: phones fire `resize` each time the address bar slides (about every 130ms while it moves), and restarting the field and redrawing 40 frames each time would visibly jump; `resize()` returns at once unless the stage's size changed (see the preamble).
-
- **While paused,** a setting change runs `prerender()`, so the change shows; Number of particles calls `init()` first. The picture moves on by those 40 steps, but the loop stays paused. Speed changes no picture: it keeps the one on screen and takes effect once the loop plays.
-- **Slow motion:** while the switch is on, each frame moves the particles a third of a step (`SPD × k`, with `k` a third of `s`) and adds a third of 0.01 × `s` to `t`, from the next frame. The trail fade stays once per 60th of a second, so the trails look shorter while it is on. Stretching the fade too would leave marks that never fade (the README's warning about very low trail values).
-- **Reduced motion:** the `reduce` checks and the rule `.fps-badge{display:none}` go (see the preamble).
-- **Stage font:** no text on the stage.
-- **Stage:** only the canvas; the fps badge goes. `hb-dots`: no. Default height.
-- **Phone fallback:** today: at most 500 particles on phones and short screens (the viewport rule above, read in `init()`; a change listener deals the particles again when a window crosses the rule), and the canvas draws at CSS pixels. Keep both. Measured on a phone stage: 500 particles take 3.3 ms a frame, and even 1,400 took 6.8 ms. The README names fill rate on the graphics chip, which this measurement cannot see, as the real limit on phones.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Swirl size | Choice buttons | Small · Medium · Large | Medium | Large swirls look calm; small ones look stormy. | `SCALE`: 20 / 34 / 60 |
-| Trail length | Choice buttons | Short · Medium · Long | Medium | How long each particle's trail lingers. | `TRAIL`: 0.12 / 0.06 / 0.04 (not lower: the README warns that very low values leave marks that never fade) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast each particle moves. | `SPD`: 0.6 / 1.0 / 1.6 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of particles | Choice buttons | Few · Medium · Many | Medium | More particles fill the currents; phones show at most 500. | `COUNT`: 400 / 900 / 1500, then `init()` |
-| Color | Choice buttons | Mint · Ember · Ice · Rainbow | Mint | Rainbow changes color across the stage and over time. | `COL`: `'mint'` / `'ember'` / `'ice'` / `'spectrum'` |
-
-- **Removed:**
- - The note, and the line "Count caps at 500 on small screens."
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps badge.
- - The Particle Count, Noise Scale, Speed and Trail Persistence sliders. They become Number of particles, Swirl size, Speed and Trail length.
- - The Color menu. It becomes choice buttons; Rainbow is not one color, so these are not swatches.
-- **Good for:** Art and creative sites · Hero sections · Loading screens · Data art · **Avoid on:** Busy layouts · Long reading pages
-- **Prompt:**
-
- > Add a flow field background to [the section you want it behind]. Fill a canvas with many particles and give every point a direction that changes smoothly from spot to spot (smooth random noise does this). Each frame, move each particle a small step along the direction under it, scaled by the time since the last frame so it runs at the same speed on every screen. Instead of clearing the canvas, cover it with a see-through dark layer once for every 60th of a second that passes, so each particle leaves a fading trail. Let the directions change slowly over time, and use fewer particles on phones. If the visitor has reduced motion turned on, show one still frame of trails. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A flow field moves thousands of particles across a canvas, each one steering by the direction of an invisible current under it. The directions change smoothly from one spot to the next, so particles near each other curve together, and the whole surface shows gentle, river-like currents. The canvas is dimmed a little each frame instead of cleared, so every particle leaves a fading trail that traces the flow.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Swirl size | Medium | How large the currents are: the direction turns over about 20px (small), 34px (medium) or 60px (large); larger looks calm, smaller turbulent |
- | Trail length | Medium | How long trails linger: short fades 12% every 60th of a second, medium 6% and long 4%; below about 4% trails can leave faint marks that never fade |
- | Speed | Normal | How far each particle moves in a 60th of a second: slow is 0.6px, normal 1px and fast 1.6px (36, 60 and 96px a second) |
- | Number of particles | Medium | Few is 400, medium 900 and many 1,500; phones show at most 500 |
- | Color | Mint | Mint, ember or ice, or rainbow, where the color changes across the stage and over time |
-
-- **README See also:** the second and third link texts change to the pages' real titles.
- - [Particle Constellation](../particle-constellation/) — particles that link up instead of flowing
- - [Aurora / Northern Lights](../aurora/) — flowing bands of color made with blur
- - [Mesh Gradient Animation](../mesh-gradient/) — smooth drifting color with no particles
-- **README How it works:** unchanged, except that the frame-rate fix (below) changes the per-frame lines of the last snippet (`s`, `w`, `f`, `nf`, `fa`, the dim loop, `k` and `p.x += Math.cos(a) * SPD * k`) and adds a paragraph after it on the whole-dim rule.
-- **README Production notes:** the "Reduced motion" bullet becomes: "**Reduced motion**: the demo starts paused, showing about 40 frames drawn at once as a still, settled picture, until the visitor presses Play. The same 40 frames are drawn whenever the page opens, so the stage never starts empty." The rest is unchanged.
-- **Category line:** `07.14 · Ambient &amp; Background`
-- **Pager:** Previous: Particle Constellation (`../particle-constellation/`) · Next: Synthwave Grid (`../synthwave-grid/`)
-- **Frame-rate fix (wrap-up):** particles move by `s`, the time since the last drawn frame in 60ths of a second (`FRAME = 1000/60`, at most 50 ms; 1 at 60 Hz, 2 at 30 Hz), and the field's time moves with them, so the speed is the same on every screen. The trail dim is not scaled: the canvas is dimmed with the same `rgba(5,6,10,TRAIL)` once for every 60th of a second, `nf` dims per drawn frame (two at 30 Hz). `nf` comes from `s` plus a carried remainder `fa`, and a step within 5% of a whole number counts as that number, so a 59.94 or 60.06 Hz screen still gets exactly one dim a frame. A frame with no whole dim due draws nothing and its time carries to the next one, which replaces the 16 ms gate and keeps drawing at about 60 frames a second at most. `prerender()` runs 40 frames of `s = 1` with one dim each, so the settled picture is the same on every screen. The first frame after a start, a Play or a return from a hidden tab (`visibilitychange`) only takes the time.
-
----
-
-## synthwave-grid — Synthwave Grid
-
-- **Kind:** loop. The floor rolls toward you forever.
-- **Description:** A glowing grid rolls toward you under a striped sun. Best for music and games.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble. Each drawn frame (at most one per 16ms, as today) adds Speed × 0.02 × `dt / FRAME` to `offset` (`FRAME = 1000/60`; see the frame-rate fix below) and redraws the sky, the sun and the grid (`frame()`). **The first picture:** `frame()` runs at load. **While paused,** Number of lines and Grid color call `frame()` at once, playing or paused; Speed draws nothing, and the floor carries on from where it is. After a real resize (see the preamble), `frame()` runs at once, playing or paused.
-
- **The sun** is a half disc filled with a vertical gradient and striped with seven gaps in the sky's dark color across its lower half, wider toward the horizon: `for(let i=0;i<7;i++)ctx.fillRect(cx-rad,cy-rad*.55+i*rad*.08,rad*2,rad*(.015+i*.009))`. The earlier loop began 15% of the radius above the horizon and stepped 16% of it, so six of its seven gaps fell below the sun's base, outside the clipped half disc, and only one showed, though the Description, lede, prompt and README all say "striped". Counted on the sun's centre line at 1280×800, 1366×657, 375×812 and 812×375: seven stripes, against one.
-- **Slow motion:** while the switch is on, each frame adds a third of the usual step to `offset`, from the next frame.
-- **Reduced motion:** the `reduce` checks and the rule `.fps-badge{display:none}` go (see the preamble).
-- **Stage font:** no text on the stage.
-- **Stage:** only the canvas; the fps badge goes. `hb-dots`: no. Default height.
-- **Phone fallback:** none needed. The scene is redrawn at CSS pixels, with the canvas glow (`shadowBlur` 8) on every line: 39 lines at the default (23 toward the horizon and 16 across) and 59 at Many (35 and 24). The default took 1.2 ms a frame, measured on today's phone stage. The README keeps its note on dropping the glow for much denser grids.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the floor rolls toward you. | `SPD`: 0.6 / 1.0 / 1.6 |
-| Number of lines | Choice buttons | Few · Medium · Many | Medium | More lines make a finer grid. | `DENS`: 10 / 16 / 24 (the lines across; the lines toward the horizon follow as `2 × round(DENS × 0.7) + 1`: 15 / 23 / 35) |
-| Grid color | Swatches | Pink · Cyan · Purple · Orange | Pink | The color of the glowing lines. | `GLOW`: `#ff2fb0` / `#2de2e6` / `#b967ff` / `#ff8a3d` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the line "Sun and sky bands are static gradients; only the grid animates."
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps badge.
- - The Scroll Speed and Line Density sliders. They become Speed and Number of lines.
- - The colour picker and its hex readout. They become the Grid color swatches: today's pink, and three other neon colors of the look (the orange is the sun's own).
-- **Good for:** Music and gaming sites · Retro themes · Event pages · Hero sections · **Avoid on:** Calm brands · Long reading pages
-- **Prompt:**
-
- > Add a synthwave grid to [the section you want a retro scene in]. Draw a purple sky with a striped, glowing sun on the horizon and, below it, a glowing grid floor in perspective: lines that meet at one point on the horizon, crossed by lines that bunch up near the horizon and spread out toward the viewer. Move the cross lines steadily toward the viewer and wrap them around, fading each one in at the horizon, so the floor rolls forward forever with no visible jump. If the visitor has reduced motion turned on, show the scene still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A synthwave grid is a glowing neon floor that stretches to the horizon and rolls steadily toward the viewer, under a purple sky with a striped, glowing sun. It is the retro look of 1980s album covers and arcade games, the 1980s idea of the future, drawn as a loop that never visibly restarts.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How fast the floor rolls toward the viewer: slow is 0.6, normal 1 and fast 1.6 |
- | Number of lines | Medium | How many lines the floor has: few is 10 across and 15 toward the horizon, medium 16 and 23, many 24 and 35; more lines make a finer grid |
- | Grid color | Pink | The color of the glowing lines: pink, cyan, purple or orange |
-
-- **README See also:** the first two link texts change to the pages' real titles.
- - [Starfield / Space Particles](../starfield/) — another way of flying forward through space
- - [Scanline Effect](../scanline/) — dark lines that finish the old-screen look
- - [Grid / Dot Pattern Parallax](../grid-dot-pattern-parallax/) — a flat grid that shifts against the pointer
- - [Animated Gradient Background](../animated-gradient-background/) — a gradient like the sky's, moving on its own
-- **README How it works:** unchanged, except that the frame-rate fix (below) adds a paragraph and a `dt` snippet (`offset += speed * 0.02 * dt / (1000 / 60) * (slow ? 1 / 3 : 1)`) after the grid-lines snippet.
-- **README Production notes:** the "Reduced motion" bullet becomes: "**Reduced motion**: the demo starts paused, showing the grid, sky and sun still, until the visitor presses Play. In production, show these visitors the still scene." The rest is unchanged, except the "CSS alternative" bullet, whose claim that an animated `background-position` offloads to the compositor was wrong; it becomes "**CSS alternative**: this can also be built with a `transform: perspective()` plane and a repeating linear-gradient scrolled toward the viewer. Scrolling it with `background-position` repaints every frame; sliding an oversized plane one grid square with `transform: translateY()` and jumping back lets the compositor run it. The canvas version wins on control over per-line fade and glow."
-- **Category line:** `07.15 · Ambient &amp; Background`
-- **Pager:** Previous: Flow Field (`../flow-field/`) · Next: Matrix Rain (`../matrix-rain/`)
-- **Frame-rate fix (wrap-up):** the step scales with the time since the last drawn frame: `offset += SPD * 0.02 * dt / FRAME`, times a third in slow motion, with `FRAME = 1000/60` and `dt` at most 50 ms, and 0 on the first frame after a start, a Play or a return to a hidden tab (`start()` and a `visibilitychange` listener set the last frame time back to `null`). At normal speed the floor rolls 1.2 lines a second on every screen. The 16 ms gate stays, as a cap of 60 drawn frames a second.
-
----
-
-## matrix-rain — Matrix Rain
-
-- **Kind:** loop. The rain falls forever.
-- **Description:** Columns of glowing characters rain down a dark screen. Best for tech themes.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble. The rain takes one `step()` each time 1000 ÷ (Speed × 3.5) ms of real time has passed (today's accumulator; after a pause it takes at most one step). Each step:
- - it covers the canvas with see-through black (Trail length);
- - it draws a bright leading character, and a dimmer one above it, in every column;
- - it moves each column down a row, and sends it back to the top at random once it is past the bottom.
-
- The `visibilitychange` stop and restart stay, and restart only while not paused.
-
- **The first picture:** `paintStatic()` runs at load for every visitor, after `resize()`; today only reduced motion saw it. So the stage opens showing rain, and a loop paused on arrival shows it. It looks like rain in full flow, not a wall of characters: the columns are dealt afresh over a whole cycle, each drop starting at a random row from two screens above the top to one screen below the bottom (`Math.floor(Math.random() * 3 * rows - 2 * rows)`, with `rows = H / fontSize`), on a black canvas, and then one screen of steps runs (`Math.ceil(rows)`). The result has bright heads with fading tails and about a third of the columns still dark (33–37% with nothing lit, against none for the earlier picture), like steady rain, so nothing thins when Play is pressed. Measured as the share of the canvas whose green channel is above 40 (eight loads each on a desktop, a phone and a sideways phone): 7.4%, 7.0% and 7.8% on arrival and 7.7%, 7.0% and 6.5% one to three seconds after Play, against 16.1%, 17.6% and 19.2% on arrival and about 7% after Play for the earlier picture (columns dealt above the top, one and a half screens of steps). A reduced-motion visitor keeps this picture until Play.
-
- **While paused,** a change to Characters, Trail length or Glowing leaders repaints with `paintStatic()`. Speed shows once it plays.
-
- **Character size and real resizes** start the rain over, playing or paused: `resize()` (new columns, every drop above the top, a black canvas), then `paintStatic()` at once. Today only a paused or reduced-motion page repainted, so a playing page went black and the rain fell from the top again.
-
- **The first-report wipe:** the page watches its stage with a `ResizeObserver`, which reports once as soon as it starts watching. Today that report runs `refit()`, and about 150ms after load `resize()` clears the rain the visitor has just seen: full rain, then black, then rain falling from the top. `refit()` now returns at once when the stage's `clientWidth` and `clientHeight` equal the size `resize()` last used (`W`, `H`), as the preamble's resize rule says. After a real change it runs `resize()` and then `paintStatic()`, playing or paused.
-- **Slow motion:** while the switch is on, the time between steps is multiplied by 3, from the next step.
-- **Reduced motion:** the `reduced` checks go, including the one that made Pause do nothing (see the preamble).
-- **Stage font:** site font. `step()` sets `ctx.font` to `fontSize + 'px ' + FONT`, where `FONT` is the page's font family, read once (`getComputedStyle(document.body).fontFamily`), in place of the old `--mono` variable. The characters fall; they are not typed, so the typewriter font does not apply. The Japanese characters come from the system's fallback font, as the site font has none.
-- **Stage:** only the canvas; the fps badge goes, and so does the `.stage-wrap` around the stage. `hb-dots`: no. Default height.
-- **Phone fallback:** today, and kept:
- - columns are at least 14px apart on phones and short screens (the viewport rule above; 11px elsewhere), so there are fewer of them, and a guarded change listener starts the rain over when a window crosses the rule and the column count changes;
- - the canvas caps the pixel ratio at 2;
- - the glow blur is only on each column's leading character.
-
- Measured on today's phone stage: 1 ms a frame (7 ms on the frames that step).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow is a drizzle; fast is a downpour. | `SPD`: 5 / 8 / 13 (the rain steps Speed × 3.5 times a second) |
-| Characters | Choice buttons | Japanese · Binary · Hexadecimal | Japanese | Japanese characters give the film's look. | `SET`: `'kana'` / `'bin'` / `'hex'` |
-| Trail length | Choice buttons | Short · Medium · Long | Medium | How long characters linger behind each leader. | `FADE`: 0.12 / 0.07 / 0.04 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Character size | Choice buttons | Small · Medium · Large | Medium | Larger characters make fewer, wider columns. | `fontSize`: 12 / 16 / 22 (px), then `resize()` |
-| Glowing leaders | Switch | on / off | on | The leading character in each column glows. | `GLOW` true / false |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The fps badge and the FPS readout.
- - The Speed, Font size and Trail fade sliders. They become Speed, Character size and Trail length.
- - The Characters menu. It becomes choice buttons.
- - "Leader glow" becomes Glowing leaders.
-- **Good for:** Tech and hacker themes · Loading screens · Game and event pages · 404 pages · **Avoid on:** Calm brands · Long reading pages
-- **Prompt:**
-
- > Add a matrix rain background to [the section you want it behind]. Split a dark canvas into columns and, at a steady pace, draw a bright character at the head of each column and move it down one row, sending each column back to the top at random once it passes the bottom. Instead of clearing the canvas, cover it with a see-through black layer before each step, so older characters fade into a trail behind each bright leader. Space the columns wider on phones. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.
-
-- **README What it is:** rewritten (today's text names the canvas element in code):
-
- > Matrix rain, also called digital rain, is a background of columns of characters falling down a dark screen. The leading character in each column is bright and the ones behind it fade toward black, so each column looks like a glowing head with a fading tail. It became shorthand for "computers at work" after the film The Matrix (1999).
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How often the rain moves down a row: slow is about 18 times a second, normal 28 and fast about 46 |
- | Characters | Japanese | Japanese katakana (the film's look), binary 0 and 1, or hexadecimal 0 to F |
- | Trail length | Medium | How long characters linger: short fades 12% a step, medium 7% and long 4% |
- | Character size | Medium | Small is 12px, medium 16px and large 22px; larger characters make fewer columns |
- | Glowing leaders | on | A soft glow around each column's leading character |
-
-- **README See also:** the first two link texts change to the pages' real titles.
- - [Starfield / Space Particles](../starfield/) — another canvas background of moving points
- - [Scanline Effect](../scanline/) — dark lines for the same old-terminal mood
- - [Synthwave Grid](../synthwave-grid/) — a neon grid for a retro-future backdrop
-- **README How it works:** two corrections to match the demo. In the sentence on the translucent rectangle, "each frame" becomes "each step"; in the snippet, `drops[i] = 0; // recycle randomly` becomes `drops[i] = Math.floor(Math.random() * -20); // back above the top, at random`. The rest is unchanged.
-- **README Production notes:** the "Reduced motion" bullet becomes: "**Reduced motion**: the demo starts paused, showing a screen of rain drawn at once, until the visitor presses Play. In production, show these visitors a still frame." The rest is unchanged.
-- **Category line:** `07.16 · Ambient &amp; Background`
-- **Pager:** Previous: Synthwave Grid (`../synthwave-grid/`) · Next: Plasma Field (`../plasma/`)
-
----
-
-## plasma — Plasma Field
-
-- **Kind:** loop. The colors flow forever.
-- **Description:** Smooth waves of color flow endlessly, made from math. Best for creative sites.
-- **Watch it help line:** default
-- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the canvas loop as in the preamble. Each frame adds the time since the last frame (at most 50ms) × Speed to `clock`, and draws the field at that clock (`draw(clock)`).
- - Today's Pause only stopped the clock, while the loop kept drawing the same picture sixty times a second. Now Pause cancels the frame, and Play (`start()`) carries on from the same clock.
- - The `visibilitychange` stop and start stay, and start only while not paused.
- - **The first picture:** `resize()` always ends with `draw(clock)` (today only under reduced motion), so the field shows at load and after every real resize (see the preamble) or Detail change, playing or paused. A Detail change calls `resize()` directly; the window's `resize` event goes through the size check first.
- - **While paused,** Pattern size and Colors call `draw(clock)`, and Detail calls `resize()`, which draws: all of them at once, playing or paused. Speed draws nothing: the field stays where it is and only its pace changes, from the next frame.
-- **Slow motion:** while the switch is on, the clock advances by a third of each frame's time, from the next frame.
-- **Reduced motion:** the `reduce` checks go (see the preamble).
-- **Stage font:** no text on the stage.
-- **Stage:** only the canvas; the `.stage-wrap` around the stage goes. The stage's own height, `--stage-h:min(64vh,600px)` (52vh on phones), goes. `hb-dots`: no. Default height.
-- **Phone fallback:** today the field is computed as a small picture (Detail sets its width) and scaled up, and the canvas caps the pixel ratio at 1.5. Smallest change: on phones and short screens (the viewport rule above), `resize()` uses a picture at most 140px wide, so High looks like Medium there. `pictureWidth()` returns `phone.matches ? Math.min(quality, 140) : quality`, `resize()` takes `bw` from it, and `bh` then comes from `bw` instead of `quality`: `bh = Math.max(1, Math.round(bw * H / Math.max(W, 1)))`. A guarded change listener calls `resize()` when a window crosses the rule and the width changes. A 140px picture on a 343px stage is already sharper than on a laptop. Measured on a phone stage: Medium takes 6.9 ms a frame, and High 13.2 ms with 19 ms peaks.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow drifts calmly; fast churns. | `speed`: 0.6 / 1 / 1.6 |
-| Pattern size | Choice buttons | Small · Medium · Large | Medium | Large shapes feel soft; small ones feel busy. | `scale`: 1.6 / 1 / 0.6 |
-| Colors | Choice buttons | Neon · Sunset · Ocean · Rose | Neon | The set of colors the field flows through. | `lut = buildLUT(PALETTES.neon / .sunset / .ocean / .mono)` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Detail | Choice buttons | Low · Medium · High | Medium | Sharper detail costs more; phones use at most Medium. | `quality`: 96 / 140 / 200, then `resize()` |
-
-- **Removed:**
- - The note.
- - The panel's Pause button. The player bar's Pause replaces it.
- - The Speed slider, which could reach zero. It becomes Speed, and Pause now stops the field.
- - The Scale / Zoom slider. It becomes Pattern size.
- - The Palette and Quality menus. They become Colors and Detail. "Mono" is named Rose, which is the color it shows.
-- **Good for:** Music and creative sites · Hero sections · Loading screens · Retro themes · **Avoid on:** Serious content · Long reading pages
-- **Prompt:**
-
- > Add a plasma background to [the section you want it behind]. For every point, add up a few waves based on its position and on time (across, down, diagonally and outward from the center) and use the sum to pick a color from a smooth palette, so the whole field flows like liquid color. To keep it fast, draw the field into a small image and scale it up smoothly to fill the section, using a smaller image on phones. If the visitor has reduced motion turned on, show one still frame. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Plasma is a classic effect from the demoscene, the 1990s community that made art with home computers: a field of color with no hard edges that flows and shifts like liquid. It is made from math alone. Each point's color comes from adding up a few waves, based on its position and on time, so the field keeps moving without any image or video.
-
-- **README Key parameters:** replaces today's table, which has other columns and code names:
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How fast the field flows: slow is 0.6 times the base speed, normal 1 and fast 1.6 |
- | Pattern size | Medium | How big the color shapes are: small packs more waves into the field, large makes broad, soft blobs |
- | Colors | Neon | The palette: neon, sunset, ocean or rose |
- | Detail | Medium | How wide the small picture is before it is scaled up: low is 96 pixels, medium 140 and high 200; phones use at most 140 |
-
-- **README See also:** each line gets a phrase (today they have none, which the page checks reject), and the second and third link texts change to the pages' real titles.
- - [Animated Gradient Background](../animated-gradient-background/) — one gradient that slowly shifts, with no script
- - [Mesh Gradient Animation](../mesh-gradient/) — soft blobs of color drift and blend
- - [Aurora / Northern Lights](../aurora/) — bands of color sway like the northern lights
-- **README How it works:** unchanged
-- **README Production notes:** add a bullet after the first: "On phone-sized screens (up to 600px wide, or up to 500px tall for a phone held sideways) the demo caps the buffer at 140 pixels wide; a phone's stage is small enough that it looks the same." The "Precompute what you can" bullet becomes "Precompute what you can: the radial distance of each pixel only changes with the size, so it is computed once; the row, column and diagonal sines change with time, so they are computed once per frame for each row and column rather than for every pixel, leaving one sine per pixel in the inner loop." The rest is unchanged.
-- **Category line:** `07.17 · Ambient &amp; Background`
-- **Pager:** Previous: Matrix Rain (`../matrix-rain/`) · Next: none
diff --git a/docs/superpowers/plans/2026-09-29-demo-page-kinds-do-and-scroll.md b/docs/superpowers/plans/2026-09-29-demo-page-kinds-do-and-scroll.md
deleted file mode 100644
index 378e4e2d..00000000
--- a/docs/superpowers/plans/2026-09-29-demo-page-kinds-do-and-scroll.md
+++ /dev/null
@@ -1,330 +0,0 @@
-# Guided-Steps Template: Do-It and Scroll Pages — Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Teach the shared guided-steps files, the page checks and the browser tool the last two kinds of page — "do it" pages (Show me, Reset) and "scroll" pages (Play, Back to top) — and pages without settings, so the remaining five categories can be converted in parallel.
-
-**Architecture:** Task 1 makes Try it optional (pages without settings). Task 2 adds the do-it kind. Task 3 adds the scroll kind. Each task changes `assets/js/demo-page.js`, `assets/css/demo-page.css`, `tests/pages.test.js` and `tools/check-pages.mjs` together and proves the change on a scratch page; the last task bumps the shared-file version on every converted page.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build step); Node's built-in test runner; `tools/check-pages.mjs` (Node and the local Chrome).
-
-**Specs:** `docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md` (four kinds, markers table, reduced motion) and `docs/superpowers/specs/2026-09-27-demo-page-guided-steps-design.md`. **Reference pages:** the 27 converted pages in `animations/02-entrance-and-exit/` and `animations/05-text-typography/` (plays-once and loop kinds).
-
-## Global Constraints
-
-- Plain HTML + CSS + vanilla JS only. No build step, no frameworks, no npm packages, no CDN scripts or fonts.
-- The behaviour of the 27 converted pages must not change. Their only edit in this plan is the shared-file version (`?v=3` → `?v=4`, Task 4).
-- User rulings that bind every kind: scroll and do-it pages show themselves once on arrival (the box scrolls through once; a Show me run plays once) and then wait for the visitor; with reduced motion nothing runs by itself, and Play, Back to top, Show me and Reset still work when pressed; Loop and Slow motion are greyed out under reduced motion where a page has them.
-- Page kinds are declared on the body: `<body class="hb" data-hb-kind="do" data-hb-autoplay>` and `<body class="hb" data-hb-kind="scroll" data-hb-autoplay>` (the autoplay attribute asks for the one run on arrival).
-- The page's script reaches the player controls by their ids (`btn-demo`, `btn-reset`, `btn-scroll`, `btn-top`, and the existing ones), never by their `data-hb-*` attributes.
-- Every page, every kind: the Watch it step title and help line are written into the page (step 1 may be "Hover it", "Click it", "Drag it", "Press Tab" or "Scroll it"); controls are at least 44×44px on phones; hover effects only inside `@media (hover: hover)` and every hover has a tap equivalent.
-- Tests: `node --test "tests/*.test.js"` from the repo root. Browser check: `node tools/check-pages.mjs <page or category folder>` with the static server at `http://127.0.0.1:8731`.
-- Scratch files go in `.superpowers/scratch/` (ignored by git). Never delete with a wildcard or a command substitution in the path. Never write a raw non-breaking space; if a backslash-u escape must appear in a file, check afterwards that the file holds the literal characters.
-- Commit messages: a lower-case prefix (`feat:`, `test:`, `docs:`, `fix:`) and a plain sentence.
-
----
-
-### Task 1: Pages without settings
-
-**Files:**
-- Modify: `tests/pages.test.js`
-- Scratch only: `.superpowers/scratch/no-settings/` (a copy of `animations/02-entrance-and-exit/fade-in-out/` with its Try it step removed)
-
-**Interfaces:**
-- Produces, for the category plans: a page whose demo has no settings leaves out the Try it section entirely; its steps are numbered 1 (Watch it or its do/scroll title) and 2 (Copy the prompt); it keeps the `<ul class="hb-chips">` markup (the shared script hides the box when there are no settings); its prompt does not end with "Match the settings listed below."; its README keeps a Key parameters table describing the technique's own values (not settings).
-
-The shared script already copes with a missing Try it (`settings()` returns `[]`, the chips box is hidden, the copied text has no settings line); only the page checks assume every page has settings.
-
-- [ ] **Step 1: Make the page checks accept pages without Try it**
-
-In `tests/pages.test.js`, in the guided-steps page test:
-1. Remove `'<section class="hb-step hb-try"'` from the list of parts that must appear exactly once, and add after that loop: `assert.ok(count(html, '<section class="hb-step hb-try"') <= 1, 'at most one Try it step');` and `const hasTry = html.includes('<section class="hb-step hb-try"');`.
-2. Replace the prompt-ending assertion with: `if (hasTry) assert.ok(prompt.trim().endsWith('Match the settings listed below.'), 'prompt ending'); else assert.ok(!prompt.includes('Match the settings listed below.'), 'a page without settings does not point to them');`.
-3. Wrap the main-settings count and the hint count (from `const tryIt = tryItOf(html);` to the hint assertion) in `if (hasTry) { … }`.
-4. In the "every setting has a label" test and the "Try it and the README Key parameters name the same settings" test, return early when the page has no Try it step (`if (!pageOf(d).includes('<section class="hb-step hb-try"')) return;`).
-5. In the autocomplete test, change `assert.ok(fields.length > 0, 'the page has fields');` to apply only when the page has a Try it step.
-6. `tryItOf` returns `''` when Try it is missing because `between()` finds no start — check that and leave it.
-
-- [ ] **Step 2: Prove it on a scratch page**
-
-Copy `animations/02-entrance-and-exit/fade-in-out/index.html` and `README.md` to `.superpowers/scratch/no-settings/`; delete its whole Try it `<section>`, renumber Copy the prompt to 2, and shorten the prompt so it no longer ends with "Match the settings listed below.". Temporarily copy the folder into `animations/02-entrance-and-exit/zz-no-settings/`, run `node --test "tests/*.test.js"` (the scratch page passes; nothing else changes), then delete that temporary folder by its exact path (`rm -r animations/02-entrance-and-exit/zz-no-settings`) and confirm `git status` shows no trace of it. Run `node tools/check-pages.mjs .superpowers/scratch/no-settings` (six `ok` lines: no chips, no warnings).
-
-- [ ] **Step 3: Commit**
-
-```bash
-git add tests/pages.test.js
-git commit -m "test: accept guided-steps pages whose demo has no settings"
-```
-
----
-
-### Task 2: Do-it pages — Show me and Reset
-
-**Files:**
-- Modify: `assets/js/demo-page.js`, `assets/css/demo-page.css`, `tests/pages.test.js`, `tools/check-pages.mjs`
-- Scratch only: `.superpowers/scratch/do-page/`
-
-**Interfaces:**
-- Produces, for the category plans:
- - The Show me button, exactly: `<button class="hb-play" type="button" id="btn-demo" data-hb-demo><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>Show me</button>`. The page's own click handler plays one example of the interaction (about two to four seconds) and returns the demo to rest.
- - The Reset button, where the demo has a state to reset, exactly: `<button class="hb-play" type="button" id="btn-reset" data-hb-reset><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Reset</button>`. The page's click handler returns the demo to its starting state.
- - On arrival (body `data-hb-autoplay`, not reduced motion) the shared script presses Show me once, 400ms after load.
- - The document event `hb:input`, sent by the shared script when the visitor presses, types, scrolls, touches or clicks inside the stage (trusted `pointerdown`, `keydown`, `wheel`, `touchstart` or `click`; the click is there for an activation that comes with no pointer or key event, from assistive technology). A page stops a Show me run that is under way when it receives it, leaving the visitor in control.
- - Slow motion may appear on a do-it page where it works (the existing `data-hb-slowmo`, "css" or page mode).
- - On phones, two buttons in the player bar share one row.
-
-- [ ] **Step 1: Write the failing page checks**
-
-In `tests/pages.test.js`, after the `if (kind === 'loop') { … }` block, add:
-
-```js
- if (kind === 'do') {
- assert.equal(count(html, 'data-hb-demo'), 1, 'one Show me control');
- assert.ok(player.includes('<button class="hb-play" type="button" id="btn-demo" data-hb-demo>'), 'Show me is in the player bar');
- assert.ok(count(html, 'data-hb-reset') <= 1 && count(player, 'data-hb-reset') === count(html, 'data-hb-reset'),
- 'at most one Reset, in the player bar');
- for (const other of ['data-hb-replay', 'data-hb-loop', 'data-hb-pause', 'data-hb-autoscroll', 'data-hb-top']) {
- assert.equal(count(html, other), 0, `a do-it page has no ${other}`);
- }
- }
-```
-
-and add `'data-hb-demo', 'data-hb-reset'` to the marker list that checks "at most one, inside the player bar".
-
-Run: `node --test "tests/*.test.js"` — all pass (no do-it page exists yet); the check is exercised in Step 5.
-
-- [ ] **Step 2: Show me, Reset and visitor input in `assets/js/demo-page.js`**
-
-1. In `boot`, after `var player = page.querySelector('.hb-player');`, add:
-
-```js
- var demoCtl = page.querySelector('[data-hb-demo]');
-```
-
-2. Directly before the reduced-motion comment block (`// While the device asks for reduced motion, …`), add:
-
-```js
- // Do-it pages: the visitor's own press, key, wheel or touch inside the stage is sent as "hb:input", so the page
- // can stop a Show me run that is under way and leave the visitor in control.
- function setUpVisitorInput() {
- ['pointerdown', 'keydown', 'wheel', 'touchstart'].forEach(function (type) {
- stage.addEventListener(type, function (e) {
- if (e.isTrusted) doc.dispatchEvent(new win.CustomEvent('hb:input', { detail: { type: type } }));
- }, { capture: true, passive: true });
- });
- }
-```
-
-3. After the line `if (pauseCtl) pauseCtl.addEventListener('click', function () { setPaused(!paused); });`, add:
-
-```js
- if (demoCtl && stage) setUpVisitorInput();
-```
-
-4. In the arrival block (`if (doc.body.hasAttribute('data-hb-autoplay')) { win.setTimeout(function () { … }, 400); }`), make this the first line inside the timeout function, leaving the rest unchanged:
-
-```js
- if (demoCtl) { if (!(reduce && reduce.matches)) demoCtl.click(); return; }
-```
-
-(Plays-once pages keep today's behaviour exactly: under reduced motion they press Replay once; otherwise they switch Loop on, or press Replay when Loop is already on or missing. A do-it page runs Show me once, and nothing under reduced motion.)
-
-- [ ] **Step 3: Styles in `assets/css/demo-page.css`**
-
-In the `@media(max-width:600px)` block, after the loop-page rule (`.hb-player:has(> [data-hb-pause] + .hb-toggle) > .hb-play{grid-column:auto}`), add:
-
-```css
- /* Two buttons in the player bar (Show me and Reset, Play and Back to top) share one row */
- .hb-player:has(> .hb-play + .hb-play) > .hb-play{grid-column:auto}
-```
-
-- [ ] **Step 4: The browser tool**
-
-In `tools/check-pages.mjs`, after `loopProblems`, add:
-
-```js
-// Do-it pages: Show me must visibly move the stage within 1.6 s, and under reduced motion the page must not move by
-// itself. Show me runs on arrival, so the desktop check first waits for that run to end.
-async function demoProblems(reduced) {
- if (!(await evaluate(`!!document.querySelector('[data-hb-demo]')`))) return ['no Show me button to check'];
- const problems = [];
- if (reduced && await stageChanges(1500)) problems.push('the stage moves by itself under reduced motion');
- if (!reduced) await sleep(5000);
- const rest = await stageShot();
- await evaluate(`document.querySelector('[data-hb-demo]').click()`);
- let moved = false;
- for (let i = 0; i < 8 && !moved; i++) { await sleep(200); moved = (await stageShot()) !== rest; }
- if (!moved) problems.push('Show me does not visibly move the stage');
- return problems;
-}
-```
-
-and after the loop call site add:
-
-```js
- if (result.kind === 'do' && (setup.moves || setup.reduce)) problems.push(...await demoProblems(!!setup.reduce));
-```
-
-Update the header comment to mention do-it pages.
-
-- [ ] **Step 5: Prove it on a scratch do-it page**
-
-Create `.superpowers/scratch/do-page/index.html` and `README.md` from `animations/02-entrance-and-exit/fade-in-out/`: body `data-hb-kind="do" data-hb-autoplay`; step 1 titled "Click it" with the help line "Click the box, or press Show me."; the stage holds one `<button class="box">` that toggles a class `.on` (scale 1 → 1.2 with a 300ms transition) when clicked; the player bar holds Show me and Reset (markup above); the page script: Show me adds `.on`, removes it after 1200ms (one example, then rest), and cancels that timer on `document`'s `hb:input` and on Reset (which also removes `.on`). Temporarily copy it to `animations/02-entrance-and-exit/zz-do-page/`, run the tests with the temporary page's home-card test skipped (`node --test --test-skip-pattern="zz-.*: the home page card" "tests/*.test.js"`; they pass), delete the temporary folder by its exact path, and confirm `git status` is clean of it. Run `node tools/check-pages.mjs .superpowers/scratch/do-page` — six `ok` lines. In headless Chrome confirm: on arrival Show me runs once; under reduced motion nothing runs until Show me is pressed; a real click inside the stage during a run sends `hb:input` and the run stops; on a 375px phone Show me and Reset share one row.
-
-- [ ] **Step 6: Run everything and commit**
-
-Run `node --test "tests/*.test.js"` (all pass) and `node tools/check-pages.mjs animations/02-entrance-and-exit animations/05-text-typography` (162 `ok` lines — nothing changes for the converted pages). Commit:
-
-```bash
-git add assets/js/demo-page.js assets/css/demo-page.css tests/pages.test.js tools/check-pages.mjs
-git commit -m "feat: support do-it demos with Show me and Reset"
-```
-
----
-
-### Task 3: Scroll pages — Play and Back to top
-
-**Files:**
-- Modify: `assets/js/demo-page.js`, `tests/pages.test.js`, `tools/check-pages.mjs`
-- Scratch only: `.superpowers/scratch/scroll-page/`
-
-**Interfaces:**
-- Produces, for the category plans:
- - The Play button, exactly: `<button class="hb-play" type="button" id="btn-scroll" data-hb-autoscroll><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M19 12l-7 7-7-7"/></svg>Play</button>`. The shared script scrolls the box from where it is to its end at a steady speed (the whole box in about six seconds), starting again from the top when it is already at the end.
- - The Back to top button, exactly: `<button class="hb-play" type="button" id="btn-top" data-hb-top><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 19V5M5 12l7-7 7 7"/></svg>Back to top</button>`. The shared script stops any automatic scroll and jumps the box to the top.
- - The box that scrolls is the `.stage`, or the element marked `data-hb-scroller` when the stage holds its own scroller.
- - The visitor's own wheel, touch, press, key or click input anywhere in the stage (trusted events only) stops an automatic scroll.
- - On arrival (body `data-hb-autoplay`, not reduced motion) the shared script presses Play once, 400ms after load. Under reduced motion nothing scrolls by itself; Play still works.
-
-- [ ] **Step 1: Write the failing page checks**
-
-In `tests/pages.test.js`, after the `if (kind === 'do') { … }` block, add:
-
-```js
- if (kind === 'scroll') {
- assert.equal(count(html, 'data-hb-autoscroll'), 1, 'one Play control');
- assert.equal(count(html, 'data-hb-top'), 1, 'one Back to top control');
- assert.ok(player.includes('id="btn-scroll" data-hb-autoscroll') && player.includes('id="btn-top" data-hb-top'),
- 'Play and Back to top are in the player bar');
- assert.ok(count(html, 'data-hb-scroller') <= 1, 'at most one scroller');
- for (const other of ['data-hb-replay', 'data-hb-loop', 'data-hb-pause', 'data-hb-demo']) {
- assert.equal(count(html, other), 0, `a scroll page has no ${other}`);
- }
- }
-```
-
-and add `'data-hb-autoscroll', 'data-hb-top'` to the "at most one, inside the player bar" marker list.
-
-- [ ] **Step 2: Automatic scroll in `assets/js/demo-page.js`**
-
-1. In `boot`, after `var demoCtl = …`, add:
-
-```js
- var scrollCtl = page.querySelector('[data-hb-autoscroll]');
- var topCtl = page.querySelector('[data-hb-top]');
- var scroller = page.querySelector('[data-hb-scroller]') || stage;
-```
-
-2. After `setUpVisitorInput`, add:
-
-```js
- // Scroll pages: Play scrolls the box from where it is to its end at a steady speed (the whole box in about six
- // seconds), from the top when it is already at the end. The visitor's own wheel, touch, press or key input on the
- // box stops it, and so does Back to top, which jumps the box to the top.
- var FULL_SCROLL_MS = 6000;
- var scrollFrame = 0;
- function stopScroll() {
- if (scrollFrame) win.cancelAnimationFrame(scrollFrame);
- scrollFrame = 0;
- }
- function scrollBox(top) { scroller.scrollTo({ top: top, behavior: 'instant' }); }
- function autoscroll() {
- stopScroll();
- var end = scroller.scrollHeight - scroller.clientHeight;
- if (end <= 0) return;
- if (scroller.scrollTop >= end - 2) scrollBox(0);
- var pos = scroller.scrollTop, last = 0, speed = end / FULL_SCROLL_MS;
- function step(now) {
- if (last) pos = Math.min(end, pos + (now - last) * speed);
- last = now;
- scrollBox(pos);
- scrollFrame = pos < end ? win.requestAnimationFrame(step) : 0;
- }
- scrollFrame = win.requestAnimationFrame(step);
- }
- function setUpScroll() {
- scrollCtl.addEventListener('click', autoscroll);
- if (topCtl) topCtl.addEventListener('click', function () { stopScroll(); scrollBox(0); });
- ['wheel', 'touchstart', 'pointerdown', 'keydown'].forEach(function (type) {
- scroller.addEventListener(type, function (e) { if (e.isTrusted) stopScroll(); }, { passive: true });
- });
- }
-```
-
-3. After `if (demoCtl && stage) setUpVisitorInput();`, add `if (scrollCtl && scroller) setUpScroll();`.
-
-4. In the arrival block, directly after the `if (demoCtl) { … }` line, add:
-
-```js
- if (scrollCtl) { if (!(reduce && reduce.matches)) scrollCtl.click(); return; }
-```
-
-- [ ] **Step 3: The browser tool**
-
-In `tools/check-pages.mjs`, after `demoProblems`, add:
-
-```js
-// Scroll pages: the box scrolls by itself on arrival (not under reduced motion); Back to top returns it to the top and
-// stops it; Play scrolls it; a real wheel turn over the box stops Play.
-async function scrollProblems(reduced) {
- const box = `(document.querySelector('[data-hb-scroller]') || document.querySelector('.hb-page .stage'))`;
- const pos = () => evaluate(`${box}.scrollTop`);
- const problems = [];
- const arrived = await pos();
- if (reduced && arrived > 0) problems.push('the box scrolls by itself under reduced motion');
- if (!reduced && arrived <= 0) problems.push('the box does not scroll by itself on arrival');
- await evaluate(`document.querySelector('[data-hb-top]').click()`);
- await sleep(500);
- if (await pos() !== 0) problems.push('Back to top does not return the box to the top and stop it');
- await evaluate(`document.querySelector('[data-hb-autoscroll]').click()`);
- await sleep(800);
- if (await pos() <= 0) problems.push('Play does not scroll the box');
- const c = await evaluate(`(() => { const b = ${box}.getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + Math.min(b.height, innerHeight - b.top) / 2 }; })()`);
- await send('Input.dispatchMouseEvent', { type: 'mouseWheel', x: c.x, y: c.y, deltaX: 0, deltaY: 40 });
- await sleep(300);
- const held = await pos();
- await sleep(600);
- if (await pos() !== held) problems.push('turning the wheel does not stop Play');
- return problems;
-}
-```
-
-and after the do-it call site add:
-
-```js
- if (result.kind === 'scroll' && (setup.moves || setup.reduce)) problems.push(...await scrollProblems(!!setup.reduce));
-```
-
-Update the header comment to mention scroll pages.
-
-- [ ] **Step 4: Prove it on a scratch scroll page**
-
-Create `.superpowers/scratch/scroll-page/` from `animations/02-entrance-and-exit/fade-in-out/`: body `data-hb-kind="scroll" data-hb-autoplay`; step 1 titled "Scroll it" with the help line "Scroll inside the box, or press Play and it scrolls for you."; the stage gets `overflow-y:auto` in the page's own `.stage` rule and holds twelve tall cards that fade in as they enter the box (an IntersectionObserver with the stage as root); the player bar holds Play and Back to top (markup above); no Try it step (Task 1). Temporarily copy it into `animations/02-entrance-and-exit/zz-scroll-page/`, run the tests with the temporary page's home-card test skipped (`node --test --test-skip-pattern="zz-.*: the home page card" "tests/*.test.js"`), delete the temporary folder by its exact path, confirm `git status` is clean of it. Run `node tools/check-pages.mjs .superpowers/scratch/scroll-page` — six `ok` lines. In headless Chrome confirm: arrival scrolls the box once to its end in about six seconds; a real wheel turn, touch or press stops it; Back to top jumps to the top and stops; Play at the end starts again from the top; under reduced motion nothing scrolls until Play is pressed; on a 375px phone Play and Back to top share one row.
-
-- [ ] **Step 5: Run everything and commit**
-
-Run `node --test "tests/*.test.js"` and `node tools/check-pages.mjs animations/02-entrance-and-exit animations/05-text-typography` (162 `ok` lines). Commit:
-
-```bash
-git add assets/js/demo-page.js tests/pages.test.js tools/check-pages.mjs
-git commit -m "feat: support scroll demos with Play and Back to top"
-```
-
----
-
-### Task 4: Shared-file version
-
-**Files:** every converted page (`animations/02-entrance-and-exit/*/index.html`, `animations/05-text-typography/*/index.html`)
-
-- [ ] **Step 1:** Change `demo-page.css?v=3` → `?v=4` and `demo-page.js?v=3` → `?v=4` on all 27 pages (the version test requires one version everywhere). Run the tests and `node tools/check-pages.mjs animations/02-entrance-and-exit animations/05-text-typography` (162 `ok`).
-- [ ] **Step 2:** Commit — `chore: load version 4 of the shared page files`.
diff --git a/docs/superpowers/plans/2026-09-29-demo-page-rollout-parallel.md b/docs/superpowers/plans/2026-09-29-demo-page-rollout-parallel.md
deleted file mode 100644
index e95b8f8d..00000000
--- a/docs/superpowers/plans/2026-09-29-demo-page-rollout-parallel.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# Guided-Steps Rollout: The Last Five Categories, in Parallel — Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Move the last 102 demo pages — Ambient & Background (17), 3D & Advanced (18), Micro-Interactions (29), Page Transitions (12) and Scroll-Based (26) — to the guided-steps page, running the five categories side by side while keeping every quality step, and publish each category as soon as it is finished and checked.
-
-**Architecture:** One lane per category, each in its own git worktree and branch with its own static server, so lanes never touch each other's files. Each lane runs the same pipeline as Text & Typography: a content sheet, then pairs of pages (a builder, a separate reviewer, fixes, a re-review), then a browser check of the whole category, a final category review and one fix wave, then merge to `main` and publish. The shared files (`assets/`, `tests/`, `tools/`) are frozen in the lanes: only the coordinator changes them, on `main`, and merges `main` into the lanes. Ambient & Background needs only the loop kind and starts first; the other four lanes start when the do-it and scroll kinds (`2026-09-29-demo-page-kinds-do-and-scroll.md`) are merged.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build step); Node's built-in test runner; `tools/check-pages.mjs` (Node and the local Chrome); git worktrees.
-
-**Specs and references:** `docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md` (four kinds, markers, special cases, category order), `docs/superpowers/specs/2026-09-27-demo-page-guided-steps-design.md`, the Text & Typography plan and content sheet (`2026-09-28-demo-page-rollout-text-typography.md`, `2026-09-28-text-typography-content.md` — the model for sheets and conversions, with its preamble's owner decisions), the do-it/scroll plan above, and the page survey (session scratchpad `rollout/inventory-A.md`: Scroll-Based and Page Transitions; `inventory-B.md`: Micro-Interactions; `inventory-C.md`: 3D & Advanced and Ambient & Background).
-
-## Global Constraints
-
-- Everything in the Text & Typography plan's Global Constraints still applies (plain HTML/CSS/JS; one version of the shared files everywhere; settings and prompt rules; touch targets; hover only inside `@media (hover: hover)` with a tap equivalent; plain words; no code on the page; each category keeps its own `--ui-accent` and category line `0N.NN · Category`).
-- Owner decisions that bind every page: stage text uses the site font (only typing effects may use a typewriter font); reduced motion greys out Loop and Slow motion, starts loops paused and runs nothing by itself, while Replay, Pause/Play, Show me, Reset, Play and Back to top still work; scroll and do-it pages show themselves once on arrival; Pause stops at once on every loop (the Text sheet preamble's `wait()`/`freeze()`/`thaw()` helper for page loops, whose `thaw()` finishes rather than plays a transition caught at its end; the "css" Pause for `@keyframes` loops); long names in the top bar are cut with "…".
-- Every do-it page's step-1 help line (under Hover it / Click it / Drag it / Press Tab) ends with ", or press Show me." (e.g. "Point at the card, or press Show me.").
-- The Try it help line comes from the page kind, the same on every page: plays once "Change a setting and the animation plays again."; loop "Change a setting and see the difference as it moves."; do it "Change a setting, then try it again or press Show me."; scroll "Change a setting, then scroll again or press Play."
-- Lessons from the Text & Typography reviews, now rules for every conversion:
- - Replay restarts the animated pieces themselves (rebuild or reset them hidden, force a reflow, then show them); never a double requestAnimationFrame.
- - A plays-once page checks Loop at the moment the last step would leave the screen (after its hold), not earlier.
- - Use the pruning `later()` (a fired timer's id leaves `timers`); every play clears all timers.
- - Typed text: `trim()` decides blankness, blank falls back to the default, non-blank text stays as typed; added with `textContent`/`createTextNode` only.
- - Text measured for fitting is measured again after `document.fonts.ready`.
- - Text split into letters or changed every frame or keystroke gets `role="img"` and an `aria-label` with the real text; no live region on it.
- - Page loops never call `pause()`/`play()` on CSS keyframe animations (that detaches them from `animation-play-state`, which the css Pause relies on); they freeze transitions and timers with the helper.
- - The `hb:pause` / `hb:input` listeners are registered at the top level of the page's inline script; the page reaches player controls by their ids, never by `data-hb-*`.
- - `hb:input` can arrive several times for one gesture (a tap or click sends one for the press and one for the click; a trackpad sends a stream of wheel events; a held key repeats): the page's handler only stops a Show me run and must be safe to call repeatedly — never a toggle or a counter.
- - No stage element uses the class names `seg` or `swatches`: the shared stylesheet styles `.hb-page .seg` and `.swatches` for the Try it controls and would restyle a demo's own element.
- - A stage control with its own focus look (a field's underline, a switch's track) must beat the site focus ring `body.hb :focus-visible` (specificity 0,2,1), e.g. `.stage .field input:focus-visible{outline:none}`; one that sets its own `outline-offset` must also beat the stage's inset rule `.hb-page .stage :focus-visible` (0,3,0). A control without its own focus look keeps the site ring, drawn inset inside the stage. No page keeps a class the page checks ban anywhere in the file (`lbl`, `note`, `kv`, `btn-row`).
- - A page's own step-1 help line stays on one line on laptops — at most about 880px in the site font at 16px (the default loop line is 736px) — or the player bar drops below the first screen.
- - The first picture (at load, under reduced motion, on a paused arrival) shows the effect, never an empty stage; a setting changed while paused shows the new setting and nothing else (no ghost of the old picture: a canvas that fades instead of clearing is cleared before a paused redraw; a pointer moved while paused shows only at the next Play); a setting whose effect waits on a pending timer re-plans that timer so the change shows soon; Speed changes keep the picture where it is.
- - Pointer input comes from pointer events (a tap's follow-up `mousemove` would leave a phantom pointer); phone fallbacks apply when the viewport is at most 600px wide or at most 500px tall, so a phone held sideways gets them; README How it works matches the new code even where the sheet says "the rest is unchanged".
- - Slow motion multiplies movements and the timers that wait for them, never holds (pauses), on every kind of page, Show me runs included.
- - A "Press Tab" page (Focus Ring) also stops its Show me run when the visitor tabs into the stage (a trusted `focusin` the run did not cause); the run's own `focus()` calls fire trusted `focusin` too, so the page ignores focus moves it made itself (for example with a flag set around its own `focus()` call).
-- What the shared do-it and scroll code needs of a page (from the do-it/scroll plan and its fix rounds):
- - While Play runs, the shared script marks the scroller `data-hb-autoscrolling` and a shared rule turns CSS scroll snapping off for it (`scroll-snap-type:none !important`), or every step would snap. A page sets its snap type freely, inline or in its own style, but never with `!important`. Keep the first snap point at scroll position 0 (`scroll-padding` when the content is padded), or the re-snap after Back to top rests on the first snap point instead of at 0.
- - The page's own `.stage` rule (or the element marked `data-hb-scroller`) sets `overflow-y:auto`: the shared default is `overflow:hidden`, which the script can still scroll but the visitor cannot. The browser check fails a scroll page whose box cannot be scrolled by hand.
- - The scroller sits inside the stage (the visitor's input anywhere in the stage stops Play, a menu or button beside an inner scroller included) and gets `tabindex="0"`, `role="region"` and an `aria-label`, so keyboard users can focus and scroll it; a key stops Play only once focus is inside the stage.
- - The scroll range is read once, when Play starts, so the scroller needs bottom padding at least as large as any offset a reveal starts from (a card that begins 40px low adds 40px of range that disappears when the card arrives, and the box jerks at the end of the run), or the reveal uses opacity only.
- - Reset (`data-hb-reset`, the exact template markup, at most one, in the player bar) is allowed on do-it and loop pages. On a do-it page it comes right after Show me and on a loop page right after Pause, so the two buttons share one row on phones.
- - Every page links the shared-file version `main` uses, `?v=4` now, on both links; not the `?v=3` in the Text & Typography plan's head template ("How to convert a page"). The page checks require one version everywhere; a lane that rebases onto a `main` with a newer version changes its pages to it (the Publish step).
-- Lanes never edit `assets/`, `tests/`, `tools/`, another category's folder, or another category's cards in the root `index.html`. A lane that needs a shared change stops and reports it; the coordinator makes it on `main` and merges `main` into every lane.
-- Tests: `node --test "tests/*.test.js"` from the lane's worktree root. Browser check: `node tools/check-pages.mjs --base http://127.0.0.1:<lane port> <folder>`.
-- Scratch files go in the lane worktree's `.superpowers/scratch/`. Never delete with a wildcard or a command substitution in the path; never write a raw non-breaking space.
-- Commit messages: a lower-case prefix and a plain sentence, one page per conversion commit.
-
-## Lanes
-
-| Lane | Category | Pages | Worktree | Branch | Port | Starts after |
-|---|---|---|---|---|---|---|
-| ambient | 07-ambient-background | 17 | `.superpowers/worktrees/ambient` | `feat/rollout-ambient` | 8741 | Text & Typography merged |
-| 3d | 06-3d-advanced | 18 | `.superpowers/worktrees/3d` | `feat/rollout-3d` | 8742 | do-it/scroll kinds merged |
-| micro | 04-micro-interactions | 29 | `.superpowers/worktrees/micro` | `feat/rollout-micro` | 8743 | do-it/scroll kinds merged |
-| transitions | 03-page-transitions | 12 | `.superpowers/worktrees/transitions` | `feat/rollout-transitions` | 8744 | do-it/scroll kinds merged |
-| scroll | 01-scroll-based | 26 | `.superpowers/worktrees/scroll` | `feat/rollout-scroll` | 8745 | do-it/scroll kinds merged |
-
-The coordinator creates each worktree from `main` (`git worktree add .superpowers/worktrees/<lane> -b feat/rollout-<lane> main`), adds a launch configuration `lane-<lane>` serving that folder on its port (`python -m http.server <port> --bind 127.0.0.1 --directory <worktree>`), and starts it with the preview tool. Every helper in a lane works only inside that lane's worktree. Each lane keeps its own ledger at `<worktree>/.superpowers/sdd/rollout-<lane>/progress.md`.
-
----
-
-### Task 1 (every lane): Content sheet
-
-**Files:** Create `docs/superpowers/plans/2026-09-29-<lane>-content.md` in the lane's worktree.
-
-Follow Task 3 of the Text & Typography plan (the format, the rules and the checks), with these additions:
-- **Kinds:** plays once, loop, do it or scroll, as the rollout spec defines them. Do-it pages name their step 1 title (Hover it · Click it · Drag it · Press Tab) and write its help line, and describe the Show me run (what it does, 2–4 s, how it returns to rest, what stops it on `hb:input`) and whether there is a Reset. Scroll pages name the scroller (the stage, or the element marked `data-hb-scroller`) and what scrolling shows; they have no Slow motion.
-- **Pages without settings** leave out Try it (the do-it/scroll plan's Task 1).
-- **Special cases** from the rollout spec apply (Scroll Image Sequence rebuilt to scroll inside its stage; View Transitions API and Shared Element Transition not clipped; Focus Ring as a Press Tab page; click demos play one click and return to rest; pages showing several small examples keep them together in one stage).
-- For categories over 20 pages the sheet is written in two halves by two writers at the same time (pages split in home-page order), each half reviewed on its own.
-- The sheet is reviewed (Opus) and fixed before any conversion starts; decisions the owner should make are collected and asked in one question per lane.
-
-### Tasks 2…N (every lane): Convert two pages per task
-
-Follow "How to convert a page" in the Text & Typography plan with the lessons in Global Constraints, the do-it/scroll plan's markup for the new kinds, and the lane's content sheet. One builder per task (Sonnet), then a separate reviewer (Opus) that checks the pair against the sheet and in a real browser, fix rounds with a scoped re-review (Sonnet) until clean. One page per commit. The lane runs one builder at a time; its reviewer of the previous pair may run alongside the next builder, but fixes wait for the running builder to finish.
-
-### Last tasks (every lane): Check, review, publish
-
-- [ ] **Browser check:** `node tools/check-pages.mjs --base http://127.0.0.1:<port> animations/<category>` — every line `ok`; the coordinator reads laptop and phone contact sheets and sends them to the owner; spot checks of each kind in the in-app browser (settings → chips, copied prompt, the kind's controls).
-- [ ] **Final category review** (Opus) with the lane's deferred minor findings; one fix wave; one scoped re-review.
-- [ ] **Publish:** in the lane worktree, `git rebase main` (only the lane's own category folder, its README and its home-page cards change, so conflicts can only be in the root `index.html` card list — keep both sides); if `main` now links a newer shared-file version (`?v=N`), change the lane's pages to it (the page checks require one version everywhere); run the tests and the category's browser check again, then in the main working copy `git merge --ff-only feat/rollout-<lane>` and `git push origin main` (standing permission: push each category when it is finished and checked). Remove the worktree (`git worktree remove .superpowers/worktrees/<lane>`) and delete the branch.
diff --git a/docs/superpowers/plans/2026-09-29-micro-content-part1.md b/docs/superpowers/plans/2026-09-29-micro-content-part1.md
deleted file mode 100644
index d21b27ab..00000000
--- a/docs/superpowers/plans/2026-09-29-micro-content-part1.md
+++ /dev/null
@@ -1,1147 +0,0 @@
-# Micro-Interactions — Content Sheet, Part 1
-
-This sheet decides, page by page, how the first fifteen Micro-Interactions pages (home-page order, Hover State Animation to Notification Badge Pulse) present their kind, settings, words and prompt on the guided-steps page. Part 2 (Tooltip Reveal to Pull to Refresh) is written separately. The conversion tasks of `2026-09-29-demo-page-rollout-parallel.md` follow each section exactly, together with "How to convert a page" in `2026-09-28-demo-page-rollout-text-typography.md`, the do-it markup in `2026-09-29-demo-page-kinds-do-and-scroll.md` and the lessons in the rollout's Global Constraints. Rotate In (`animations/02-entrance-and-exit/rotate-in/`) is the reference for everything a section does not mention; Wavy Text and Text Gradient Animation are the reference for "css" loops.
-
-Kinds in this half: ten do-it pages (Hover State Animation, Click / Tap Ripple, Focus Ring Animation, Button Press Scale, Magnetic Button, Toggle / Switch Slide, Heart / Like Burst, Success Confetti, Checkmark Draw, Form Field Morph), three loops (Shimmer Effect, Loading Spinner, Notification Badge Pulse) and two plays-once pages (Skeleton Loader, Progress Animation). Every page keeps settings, so every page has a Try it step.
-
-How to read a section:
-
-- **Sets in the demo** lists one value per choice, in the same order as the choices. A Speed row sets the script's variable (used by timers) and the CSS variable it names.
-- Switches in Try it keep their default in the markup (`checked` when the default is on), as on Rotate In. The player bar's Loop and Slow motion switches start unchecked.
-- Do-it sections replace "Watch it help line" and "Sequence" with **Step 1** (title and help line), **What the visitor does**, **Show me** and **Reset**.
-- **Try it help line** comes from the kind: plays once "Change a setting and the animation plays again."; loop "Change a setting and see the difference as it moves."; do it "Change a setting, then try it again or press Show me." (on do-it pages a setting change does not replay anything; the shared script only updates the chips).
-- **Watch it help line: default** means the kind's line: plays once "It plays by itself. Turn on slow motion to see each part of the movement."; loop with Slow motion "It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement."
-- **Pause (css)** means `data-hb-pause="css"`; **Slow motion (css)** means `data-hb-slowmo="css"` and **Slow motion (page)** `data-hb-slowmo` without a value.
-- **Speed** always reads Slow · Normal · Fast; today's default is Normal, Slow is about 1.6 times and Fast about 0.6 times the default duration.
-- **Feel** uses the names shared with Part 2: Smooth (slows to a stop) is `ease-out`, Gentle (eases in and out) is `ease-in-out`, Even (one steady speed) is `linear`, and Springy goes a little past, then settles. A page's own old default curve keeps its exact value under the nearest name (`ease` under Smooth, `cubic-bezier(.4,0,.2,1)` under Gentle), so the default look does not change, and each Springy row keeps its page's own overshoot curve. The exact curve is in each row.
-- **Swatches** use the Text & Typography palette, in this order, with the colour's name as each button's `aria-label`: Pink `#ff6f8b` · White `#f4f4f2` · Blue `#58a6ff` · Purple `#d2a8ff` · Green `#56d364` · Orange `#ffa657`. A section says when it leaves a colour out or keeps the demo's own colours.
-- **Category line:** the pages have none today. NN is the page's position on the home page, which its card already shows: `04.01 · Micro-Interactions` (Hover State Animation) to `04.15 · Micro-Interactions` (Notification Badge Pulse).
-- **Accent:** every page keeps `--ui-accent:#ff9d5c`, the colour all the Micro-Interactions pages already use.
-
----
-
-## Owner decisions and lessons that apply here
-
-- **Stage text uses the site font.** No page here is a typing effect, so none keeps a monospace font. `var(--mono)`, `monospace` and `var(--disp)` (Bricolage) go from every stage rule.
-- **Reduced motion** greys out Loop and Slow motion and runs nothing by itself; Replay, Pause/Play, Show me and Reset still work (see "Reduced motion" below for each kind).
-- **Do-it pages show themselves once on arrival:** the shared script presses Show me 400ms after load (not under reduced motion).
-- **Pause stops at once** on the three loops: all three are "css" loops whose only looping movement is `@keyframes` animations on the stage, and none has page timers.
-- **Lessons from the Text & Typography reviews:** the `hb:input` and `hb:pause` listeners are registered at the top level of the page's inline script; the page reaches the player controls by their ids (`btn-demo`, `btn-reset`, `btn-play`, `loop-tog`, `slow-tog`, `btn-pause`), never by `data-hb-*`; timers go through the pruning `later()` and every play or run clears them all; a page never calls `pause()` or `play()` on a CSS keyframe animation; Replay restarts the animated pieces themselves.
-
-## Do-it pages
-
-**Body and player bar.** `<body class="hb" data-hb-kind="do" data-hb-autoplay>`. Step 1 is titled as the section says (Hover it · Click it · Press Tab) with the section's help line. The player bar holds the Show me button, then the Reset button where the section has one, then the Slow motion switch where the section has one, all exactly as in the do-it/scroll plan (Show me `id="btn-demo"`, Reset `id="btn-reset"`, Slow motion as on Rotate In with `id="slow-tog"`).
-
-**Show me** plays one example of the interaction (the section gives each step, 2 to 4 seconds at the default settings) and returns the demo to rest. Pressing it again restarts the run from rest. The run keeps all its timers in one list, so it can always be stopped completely. Every timer of a run goes through `later(fn, move, hold)`, which waits `move*(slow?3:1) + (hold||0)` ms. `move` is the stage's movement up to that step: the transitions and animations it waits for, which follow the settings (for example Speed). `hold` is the time the stage rests up to that step. Both are counted from the moment Show me is pressed. Slow motion triples the movement and never the holds, so a slowed run takes about three times its movement plus the same holds:
-
-```js
-// Show me: one run at a time. Every timer of the run goes through later(); stopRun() cancels the whole run.
-// later(fn, move, hold) waits move*(slow?3:1) + (hold||0) ms: Slow motion triples the movement, never the hold.
-const slowTog=document.getElementById('slow-tog'); // only on pages with Slow motion
-let runTimers=[];
-function later(fn,move,hold){
- const slow=!!(slowTog&&slowTog.checked);
- const id=setTimeout(()=>{ runTimers=runTimers.filter(t=>t!==id); fn(); }, move*(slow?3:1)+(hold||0));
- runTimers.push(id);
-}
-function running(){ return runTimers.length>0; }
-function stopRun(){ runTimers.forEach(clearTimeout); runTimers=[]; /* plus what the section's "stops" line undoes */ }
-document.getElementById('btn-demo').addEventListener('click',()=>{ stopRun(); /* put the demo at rest, then play the steps with later() */ });
-document.addEventListener('hb:input',()=>{ if(running()) stopRun(); });
-```
-
-Each section writes its timeline as these `later()` calls, with the time each step happens at the default settings with Slow motion off, and the length of a slowed run. The demo's own timers (Checkmark Draw's loading wait) are holds too; they do not go through `later()` and keep their length. The two plays-once pages use the pruning `later(fn, wait)` of the Text & Typography pages (Text Clip-Path Reveal's, where a fired timer leaves `timers`) and stretch their movement durations themselves, as their sections say. `later(fn, move, hold)` is only the do-it pages' Show me helper.
-
-**A run starts from rest.** When the visitor left the demo changed, `toRest()` puts it back as it is on arrival without animating: the pieces' transitions are turned off inline, the resting state is set, `void el.offsetWidth` forces a reflow, and the inline transitions are cleared. This is Part 2's rule.
-
-**Stopping a run.** The shared script sends `hb:input` when the visitor presses, types, scrolls or touches inside the stage; a run under way stops at once and leaves the visitor in control. Two kinds of visitor input send no `hb:input`, so the page listens for them itself, only while a run is under way:
-- pointing: the two hover pages stop on a trusted `pointermove` over the stage;
-- a Tab press that moves the focus into the stage from outside: Focus Ring and Form Field Morph stop on a trusted `focusin` inside the stage. Their runs move no focus, so every `focusin` there is the visitor's.
-
-Each section says what "stops" also undoes.
-
-**Pretend hover and focus.** A script cannot make `:hover`, `:active`, `:focus-visible` or `:focus-within` match, so the run puts the class `is-demo` on the item it points at or focuses. Every style the run plays is written for both: the real state (hover only inside `@media (hover: hover)`, as today) and `.is-demo`, which sits outside the hover media query so the run also plays on touch screens. The run never moves the real focus.
-
-**Hover and tap.** Hover rules stay inside `@media (hover: hover)`, and every hover has the tap equivalent the section names.
-
-**Reset** is on a page only where the visitor can leave the demo changed in a way its own controls cannot undo in one step (Part 2's rule). In this half that is Checkmark Draw, whose finished button stays disabled, and Notification Badge Pulse, whose cleared badges have no control to bring them back. Reset calls `stopRun()`, then puts the demo back as it is on arrival. Everywhere else a second press of the same control undoes the change, and Show me starts from rest anyway.
-
-**Slow motion on do-it pages** is "css": while it is on, the shared script slows every CSS animation and transition on the stage to a third of its speed, including the visitor's own hovers and presses. `later()` triples the movement part of the run's timers and never the holds (read when each timer is set). Canvas steps are slowed only where the section says.
-
-## Reduced motion
-
-- **Do-it pages:** nothing runs on arrival (the shared script); Show me and Reset still work. The browser check presses Show me under reduced motion and needs a visible change on the stage within about 1.5 seconds, and it also needs the stage to stay still before that. So every section names what its reduced-motion version shows, and no do-it stage moves by itself under reduced motion.
-- **Loops:** the shared script starts the loop paused and Play starts it. The pages' own reduced-motion rules that pause or remove the loop go, because Play must be able to move it.
-- **Plays once:** as on the Entrance & Exit pages. Loop and Slow motion are greyed out, and Replay plays the reduced version once.
-
-## Stage
-
-- The stage keeps only the demo: counters, readouts, captions, notes, teaching overlays and on-stage buttons that only drive the demo go (each section lists them).
-- The page owns the stage's size, border and corners. The old `--stage-h`, the stage's `height`, `flex`, `min-width`, `border` and `border-radius`, and the phone rules that made the stage `height:auto` go. The demo's own `.stage` rule keeps its background, its flex centring, `position:relative` and `overflow:hidden` where it has them, and the padding and gap its section gives.
-- Heights were measured with the site font on the phone stage (343×300, and 288×300 at 320px wide) and the laptop stage (960×327, which is what a 1366×657 screen gets). Every stage in this half fits the default height, so no page sets `--hb-stage-h`, and none takes typed text that grows, so none uses `hb-grow`. The measured height of each stage's content is in its section.
- - **The short stage.** In a window at least 601px wide the stage is 260px when the window is 590px tall or less (1280×590, 1366×560, 667×375, 812×375) and grows with the window to 290px at 620px tall. Five stages in this half need 270 to 288px, so each has a `@media(min-width:601px) and (max-height:620px)` rule that gives up spacing only: the controls keep their 44px and the buttons their size. Hover State `.stage{padding:10px}` (the six cards need 236px); Focus Ring `.stage{padding:5px 8px 11px}.form{gap:8px}` (the form needs 242px, and the bottom keeps 11px for the widest ring); Button Press Scale `.stage{gap:20px}`; Toggle / Switch Slide `.stage{gap:20px;padding:20px}`; Form Field Morph `.stage{padding:8px}.form{gap:12px}`. Phones and stages of 300px and more are not affected.
-- **Site font on controls:** stage buttons, inputs, selects and textareas get `font-family:inherit`, because form controls do not take the page font by themselves.
-- **Focus looks on the stage:** the shared stylesheet draws the site's focus ring on every focused element (`body.hb :focus-visible`, specificity 0,2,1). A stage control with its own focus look beats the site ring with a stronger selector: Focus Ring's rings, Form Field Morph's fields and Toggle / Switch Slide's track. A control without one keeps the site ring.
-- **Grey stage text:** `:root`'s `--ui-muted` becomes `#8a8a92`, as in Part 2 (the site's own muted grey), so every stage rule that uses it changes at once. It is 5.7:1 on the stage's `#0b0b0d` and 5.5:1 on the cards' `#111114`; the old `#77777e` is 4.4:1 and 4.2:1. Stage text below 11px goes up to 11px.
-- **Movement uses transform and opacity** (CLAUDE.md):
- - Hover State's underline grows with `scaleX`, and its lift's shadow fades in by `opacity`.
- - Button Press Scale's glow crossfades between two shadows by `opacity`.
- - Progress Animation's bar slides in with `translateX` instead of growing its `width`.
- - Transitions on properties that never change are dropped (Toggle's knob shadow, Checkmark's button width).
-- **`hb-dots`:** yes on every stage in this half (each has a plain dark background).
-
----
-
-## hover-state — Hover State Animation
-
-- **Kind:** do — a hover effect: the visitor points at the cards, and Show me points at them in turn.
-- **Description:** Six ways a card can react when you point at it. Best for buttons and cards.
-- **Step 1:** Hover it — help line: "Point at a card (press and hold it on a phone), or press Show me."
-- **Player bar:** Show me · Slow motion (css). No Reset: nothing stays changed once the pointer leaves.
-- **What the visitor does:** pointing at a card plays its change (inside `@media (hover: hover)`, as today); pressing a card shows the same change while it is held (`:active`, as today), which is the tap equivalent on touch screens.
-- **Show me:** points at the six cards in reading order.
- - Card i (0 to 5) gets `is-demo` with `later(on, i*dur, i*320)` and loses it with `later(off, (i+1)*dur, i*320+270)`, where `dur` is Speed. Each change plays in, holds 270ms and plays back out, and the next card starts 50ms after.
- - At the defaults the cards go on at 0, 500, 1000, 1500, 2000 and 2500ms, each for 450ms. The run is at rest by about 3.1 s, or about 5.7 s with Slow motion.
- - Stops on `hb:input` and on the visitor's own `pointermove` over the stage; stopping removes `is-demo` from every card.
- - The CSS gives each card's change to `.is-demo` as well as to `:hover` and `:active`, outside the hover media query (for example `.h-scale:active,.h-scale.is-demo{transform:scale(1.03)}`).
-- **Reset:** none.
-- **Slow motion:** css. `later()` triples each card's movement (Speed), not its 270ms and 50ms holds.
-- **Reduced motion:** the demo's rule stays: the cards change look at once, without the transition. Show me still switches each card's look on and off in turn.
-- **Stage font:** site font. `.hcard-name` and `.card-link` get `font-size:15px` and `font-weight:700`.
-- **Stage:** the six cards stay, two to a row on every screen (the phone rule that made one column goes). The small "Technique 1" to "Technique 6" labels go, and the names become plain: "Color change", "Grow", "Lift", "Underline" (the link text of the underline card), "Arrow nudge" (with its →) and "Sweep". `.hgrid` gets `gap:10px`; `.hcard` gets `min-height:72px` and `padding:14px 12px`; the stage gets `padding:16px`. The wrapper `div` around the grid keeps `width:100%`. `hb-dots`: yes. Measured: 270px on a phone, at 320px wide and on a laptop (six cards of 72px make a 236px grid, with 32px of padding and 2px of border). On the short stage (see the preamble), `@media(min-width:601px) and (max-height:620px){.stage{padding:10px}}` lets the padding give way, so the cards keep their size and nothing overflows.
- - Two changes move to transform and opacity (see the preamble). Today the underline grows by `width` and the lift adds a `box-shadow`.
- - The underline: `.h-underline .card-link::after` gets `width:100%`, `transform:scaleX(0)` and `transform-origin:left`, and a `transform` transition. It grows with `transform:scaleX(1)` on hover, `:active` and `.is-demo`. Owner choice (final fix wave): the link gets `align-self:flex-start`, so the line is as wide as the word, not the whole card.
- - The lift: `.h-lift` gets `overflow:visible` and keeps only its `translateY(-4px)`, with a `transform` transition. Its shadow moves to `.h-lift::after` (`content:'';position:absolute;inset:0;border-radius:inherit;box-shadow:0 8px 24px rgba(0,0,0,.6);opacity:0;pointer-events:none;transition:opacity var(--dur) var(--ease)`), which fades in (`opacity:1`) on hover, `:active` and `.is-demo`.
- - The reduced-motion rule also lists `.h-lift::after`.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Quick feels responsive; slow can feel sticky. | `--dur`: 300ms / 180ms / 110ms |
-| Feel | Choice buttons | Smooth · Springy · Gentle · Even | Smooth | Springy goes a little too far, then settles. | `--ease`: `ease` / `cubic-bezier(.34,1.56,.64,1)` / `ease-in-out` / `linear` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The two notes.
- - The hover counters under the cards and the Total hovers readout.
- - The Duration slider and the Easing menu. They become Speed and Feel. Ease out goes: it looks nearly the same as Smooth, which keeps today's default curve (`ease`).
- - The "Technique 1" to "Technique 6" labels.
-- **Good for:** Buttons · Links · Cards · Menus · **Avoid on:** Plain text · Non-clickable items
-- **Prompt:**
-
- > Add hover feedback to [the buttons, links or cards you want to react]. When the pointer moves over an item, change it in one clear way: shift its background color, grow it slightly, lift it with a deeper shadow, draw an underline out from the left, nudge its arrow forward, or sweep a tint across it. Use one style per kind of item and keep it the same across the page. Apply hover styles only on devices that can hover, and show the same change while an item is pressed on touch screens. If the visitor has reduced motion turned on, switch the look without animating it. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A hover state is a small change that plays when the pointer moves over something you can click, such as a button, a link or a card. It tells people the item will respond before they click it. The demo shows six common ways to do it: a color change, a slight grow, a lift with a shadow, an underline that draws out, an arrow that nudges forward and a tint that sweeps across.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long each change takes: slow is 300ms, normal 180ms and fast 110ms; keep hover changes at 200ms or less so moving across several items never feels sticky |
- | Feel | Smooth | Smooth slows into place; Springy goes a little too far, then settles; Gentle eases in and out; Even keeps one steady pace |
-
-- **README See also:**
- - [Button Press Scale](../button-press-scale/) — the button shrinks while it is pressed
- - [Tooltip Reveal](../tooltip-reveal/) — pointing at an item shows a short note
- - [Click / Tap Ripple](../click-ripple/) — a ripple spreads from the spot you press
-- **README How it works:** the snippets must match the demo. In the first CSS snippet, `.h-color:hover { background: #1a2a3a; border-color: var(--ui-accent); }` becomes `@media (hover: hover) { .h-color:hover { background: #2a201a; border-color: var(--ui-accent); } }` followed by `.h-color:active { background: #2a201a; border-color: var(--ui-accent); }`, and the sweep's `rgba(88,166,255,.13)` becomes `rgba(255,157,92,.13)`. The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `04.01 · Micro-Interactions`
-- **Pager:** Previous: none · Next: Click / Tap Ripple (`../click-ripple/`)
-
----
-
-## click-ripple — Click / Tap Ripple
-
-- **Kind:** do — a click effect: the visitor presses a button, and Show me presses the three buttons in turn.
-- **Description:** A ripple spreads out from the spot you press. Best for buttons and list items.
-- **Step 1:** Click it — help line: "Click or tap anywhere on a button, or press Show me."
-- **Player bar:** Show me · Slow motion (css). No Reset: every ripple fades away by itself.
-- **What the visitor does:** pressing a button (`pointerdown`, so mouse, touch and pen alike, as today) spawns a ripple at the press point, or at the button's middle when Starts from is The middle.
-- **Show me:** presses each button once, top to bottom, each at a different point so the start point shows: a quarter of the way across the first button, three quarters across the second, and the middle of the third, all at half height.
- - Button i (0 to 2) is pressed with `later(press, i*dur, i*100)`, where `dur` is Speed: each ripple plays, then 100ms pass before the next press.
- - Each press calls `spawnRipple(btn, {clientX, clientY})` with that point, taken from the button's `getBoundingClientRect()` at the moment of the press, so Starts from and every other setting apply.
- - At the defaults the presses come at 0, 700 and 1400ms, and the last ripple has faded by 2000ms, or about 5.6 s with Slow motion.
- - A single press lasts only 0.6 seconds, so the run presses all three buttons, one press each.
- - Stops on `hb:input`; ripples already spreading finish by themselves.
-- **Reset:** none.
-- **Slow motion:** css (the ripple is a `@keyframes` animation on the stage). `later()` triples each ripple's time (Speed), not the 100ms between presses.
-- **Reduced motion:** the demo's rule changes. Today it shortens the ripple to 1ms, which shows nothing at all, and Show me must still visibly work. Under reduced motion the ripple no longer grows: it appears at full size and only fades out, over Speed, so the press shows as a soft flash across the button. The rule becomes `.ripple{animation-name:ripple-fade}` with `@keyframes ripple-fade{from{transform:scale(var(--ripple-scale))}to{transform:scale(var(--ripple-scale));opacity:0}}` (the ripple keeps its start opacity, and `animationend` still removes it). `.rbtn{transition:none!important}` stays.
-- **Stage font:** site font. `.rbtn` gets `font-family:inherit` in place of `monospace`.
-- **Stage:** the three buttons stay. Their labels become "Primary button", "Secondary button" and "Outline button" (was "Primary Action", "Secondary Action", "Ghost / Outline"). The counters (`.cnt-row`) go. The stage gets `padding:24px` and `gap:20px`. `hb-dots`: yes. Measured: 246px on phones and laptops.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Starts from | Choice buttons | Where you press · The middle | Where you press | Where you press shows exactly where it landed. | `fromCenter`: `false` / `true` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the ripple takes to spread and fade. | `dur`: 1000 / 600 / 350 (ms, each new ripple's `animation-duration`) |
-| Ripple size | Choice buttons | Small · Medium · Large | Medium | How far the circle grows before it fades. | `scale` (each new ripple's `--ripple-scale`): 1.5 / 2.5 / 4 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Ripple strength | Choice buttons | Faint · Medium · Strong | Medium | How visible the ripple is when it starts. | `opacity`: 0.2 / 0.4 / 0.6 |
-| Ripple color | Swatches (the demo's own three colours) | White · Orange · Black | White | Pick a color that shows up on your buttons. | `color`: `255,255,255` / `255,157,92` / `0,0,0` (swatch colours `#ffffff` / `#ff9d5c` / `#000000`) |
-
-- **Removed:**
- - The note, the click counters and the Total clicks readout.
- - The Duration, Max Scale and Start Opacity sliders. They become Speed, Ripple size and Ripple strength.
- - The Ripple Color menu. It becomes swatches: Accent becomes Orange, and Dark becomes Black.
- - The "From center (not click point)" checkbox. It becomes Starts from.
-- **Good for:** Buttons · List items · Menu items · Icon buttons · **Avoid on:** Links in text · Large panels
-- **Prompt:**
-
- > Add a ripple to [the buttons or list items you want to respond to presses]. When the visitor presses one, a soft circle appears where they pressed, or in the middle when the settings say so, then grows outward and fades away. Clip it to the button's shape so it never spills outside, start it as soon as the press begins so the feedback feels instant, and remove each ripple once it has faded so quick taps do not pile up. It should work the same for mouse, touch and pen. If the visitor has reduced motion turned on, fade a flat highlight over the button instead of a growing circle. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A ripple is a soft circle that grows out from the spot you press and fades away. It confirms that the press registered and shows exactly where it landed, which helps most on touch screens, where nothing reacts to hovering. Material Design, Google's design system, made it popular.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Starts from | Where you press | Where you press shows exactly where the press landed; the middle is simpler but less exact |
- | Speed | Normal | How long the ripple takes to spread and fade: slow is 1000ms, normal 600ms and fast 350ms; a little longer than a hover change, because the click is already made |
- | Ripple size | Medium | How far the circle grows before it fades: small, medium or large; even small reaches every corner of the button |
- | Ripple strength | Medium | How visible the ripple is at the start: faint is 20%, medium 40% and strong 60% |
- | Ripple color | White | White suits colored buttons, orange matches the accent, black suits light buttons |
-
-- **README See also:**
- - [Button Press Scale](../button-press-scale/) — the button shrinks while it is pressed
- - [Hover State Animation](../hover-state/) — items react before they are clicked
- - [Checkmark Draw](../checkmark-draw/) — a tick draws itself once the task is done
-- **README How it works:** unchanged
-- **README Production notes:** add a bullet after "Cleanup": "**Reduced motion**: skip the growing circle and fade a flat highlight over the button instead, so the press still shows. The demo does this." The rest is unchanged.
-- **Category line:** `04.02 · Micro-Interactions`
-- **Pager:** Previous: Hover State Animation (`../hover-state/`) · Next: Focus Ring Animation (`../focus-ring/`)
-
----
-
-## focus-ring — Focus Ring Animation
-
-- **Kind:** do — the rollout's "Press Tab" page: the visitor moves through the form with the Tab key, and Show me moves the ring through its four items.
-- **Description:** A ring closes in around the item the Tab key reaches. Best for forms and menus.
-- **Step 1:** Press Tab — help line: "Click the first field and press Tab to move through the form, or press Show me."
-- **Player bar:** Show me · Slow motion (css). No Reset (see Removed).
-- **What the visitor does:** the Tab key moves the real focus through the text field, the menu, the button and the link, and each one draws its ring on `:focus-visible`, as today. A mouse click on the button or the link shows no ring; the text field shows one on click too, because browsers treat a field you type in as keyboard focus, and Chrome does the same for the menu.
-- **Show me:** draws the ring on the four items in turn with `is-demo`: the text field, the menu, the button and the link.
- - Item i (0 to 3) gets `is-demo` with `later(ring, i*ringDur, i*460)`, and the item before it loses it at the same moment. The last one loses it with `later(end, 4*ringDur, 4*460)`, back to rest. `ringDur` is Speed: each ring closes in, then holds 460ms.
- - At the defaults the ring moves at 0, 600, 1200 and 1800ms and goes at 2400ms, or about 3.5 s with Slow motion.
- - At the start the run also blurs a stage item that has the real focus. The arrival press is the exception: it is the shared script's, not the visitor's, so when the visitor is already in the form the page ignores an untrusted Show me press (`e=>{if(!e.isTrusted&&stage.contains(document.activeElement))return; ...}`) and never takes a visitor's place in a field. The visitor's own Show me press still blurs and runs.
- - The run never moves the real focus (owner decision). Moving it would take a keyboard or screen-reader user's place on the page when Show me runs on arrival, scroll the page, and open the on-screen keyboard on phones. So the ring is drawn the way the other do-it pages draw a pretend hover.
- - The four ring-style rules and the reduced-motion rule each list `.focusable.is-demo` beside `.focusable:focus-visible`, so the same `ring-in` animation plays.
- - Stops on `hb:input` and on a trusted `focusin` inside the stage (a Tab press into the form sends no `hb:input`); stopping removes `is-demo` from all four items.
-- **Reset:** none.
-- **Slow motion:** css (the `ring-in` keyframes and the border transition). `later()` triples each ring's closing-in (Speed), not the 460ms holds.
-- **Reduced motion:** the demo's rule stays, extended to the `is-demo` rings: the ring shows at once, without closing in. Show me still moves the ring from item to item.
-- **Stage font:** site font. `.focusable`, `.form-btn` and `.form-link` get `font-family:inherit` in place of `monospace`.
-- **Stage:** the form stays: Full name, Country, Submit Form and Forgot password?. The step strip above it (`.tab-indicator`, "1 · Text" to "4 · Link") goes, because it is a readout of where the focus is. The field labels become 11px; their grey is `--ui-muted`. `.form` gets `gap:12px` and the stage `padding:16px`. `hb-dots`: yes. Measured: 288px on phones and laptops (a 254px form, 32px of padding and 2px of border).
- - **The ring-style rules need the `.stage` prefix.** Written `.stage .ring-solid .focusable:focus-visible` (and the same for `.is-demo` and the other three styles), they are 0,4,0. Without the prefix they are 0,3,0 and tie with the site's inward stage rule (`.hb-page .stage :focus-visible`), which comes later in the shared stylesheet and wins, so a real Tab press would draw the ring at `outline-offset:-3px` whatever Ring gap says.
- - **The short stage** (see the preamble). The form needs 288px with the normal padding, and a short stage is 260 to 290px. `@media(min-width:601px) and (max-height:620px){.stage{padding:5px 8px 11px}.form{gap:8px}}` gives up spacing only, so the items keep their 44px; on a 260px stage the form (242px) then fills the space inside the padding exactly. The bottom keeps 11px because the widest ring (Thick ring, Large gap, Wide style: a 4px outline 6px out, and a shadow reaching 11px) would otherwise be cut by the stage's edge under the last item; the top has 14px to spare.
- - **iOS zoom.** The fields are 12px, and iOS zooms the whole page when a text field or menu under 16px gets focus. `@media(pointer:coarse){input.focusable,select.focusable{font-size:16px}}` makes them 16px on touch screens; their 44px height stays.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Ring style | Choice buttons | Solid · Dashed · Glow · Wide | Solid | Glow adds a soft halo; Wide fills the gap with color. | the form's class: `ring-solid` / `ring-dashed` / `ring-glow` / `ring-dual` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How quickly the ring closes in around the item. | `--ring-dur`: 220ms / 140ms / 80ms |
-| Ring thickness | Choice buttons | Thin · Medium · Thick | Medium | Thicker rings are easier to spot. | `--ring-w`: 1px / 2px / 4px |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Ring gap | Choice buttons | None · Small · Large | Small | The space between the ring and the item. | `--ring-offset`: 0px / 3px / 6px |
-
-- **Removed:**
- - The note, the "Click in stage, then press Tab." line and the step strip on the stage.
- - The Reset focus button. Clicking it already takes the focus off the form, so it did nothing more, and the Show me run never moves the real focus.
- - The Ring Style menu. It becomes Ring style. "Dual ring" becomes Wide, because it draws one thick band: its shadow fills the gap up to the outline, leaving only a thin dark line next to the item.
- - The Ring Width, Ring Offset and Duration sliders. They become Ring thickness, Ring gap and Speed.
-- **Good for:** Forms · Buttons · Links · Menus · **Avoid on:** Non-interactive items
-- **Prompt:**
-
- > Add an animated focus ring to [the links, buttons and form fields on your page]. When keyboard focus moves to an item, draw an outline around it that starts a little further out and faint, then closes in to its place, so each Tab press is easy to follow. Show the ring only for keyboard focus, not after mouse clicks, and never remove the browser's focus outline without drawing this one instead. Make sure the ring stands out against every background it sits on. If the visitor has reduced motion turned on, show the ring at once without closing in. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A focus ring is the outline that shows which item the keyboard is on. Animating it, so the ring closes in around each item as you press Tab, makes every move easier to follow. It shows when the keyboard is used (and when you click into a text field, since you type there next), so people who click buttons and links with a mouse do not see rings appear.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Ring style | Solid | Solid is a plain outline; Dashed draws it in dashes; Glow adds a soft halo; Wide fills the gap between the item and the ring, making one thick band |
- | Speed | Normal | How long the ring takes to close in: slow is 220ms, normal 140ms and fast 80ms; fast enough not to feel delayed, slow enough to see |
- | Ring thickness | Medium | Thin is 1px, medium 2px and thick 4px; 2px or more is easy to see |
- | Ring gap | Small | The space between the ring and the item: none, 3px or 6px; 2 to 4px looks natural |
-
-- **README See also:**
- - [Form Field Morph](../form-field-morph/) — the label moves up when a field is focused
- - [Hover State Animation](../hover-state/) — items react when the pointer is over them
- - [Button Press Scale](../button-press-scale/) — the button shrinks while it is pressed
-- **README How it works:** the snippets must match the demo's colour. In the first snippet `--ring-color: #58a6ff;` becomes `--ring-color: #ff9d5c;`, and in the glow snippet `rgba(88,166,255,.18)` becomes `rgba(255,157,92,.18)`. The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `04.03 · Micro-Interactions`
-- **Pager:** Previous: Click / Tap Ripple (`../click-ripple/`) · Next: Button Press Scale (`../button-press-scale/`)
-
----
-
-## button-press-scale — Button Press Scale
-
-- **Kind:** do — a press effect: the visitor presses a button, and Show me presses the three buttons in turn.
-- **Description:** Shrinks as you press it and springs back as you let go. Best for main buttons.
-- **Step 1:** Click it — help line: "Press and hold a button, then let go, or press Show me."
-- **Player bar:** Show me · Slow motion (css). No Reset: a button always returns to full size when it is let go.
-- **What the visitor does:** pressing a button adds `pressed` (`pointerdown`, or Space and Enter), and letting go removes it (`pointerup`, or the key coming up), as today; `pointercancel` lets go too, and so does `blur`: a Space or Enter held down when Tab moves the focus away sends its key-up to the next button, and without `blur` the first button stayed pressed (a change of the final wave). Touch works the same way.
-- **Show me:** presses each button once, top to bottom (Confirm, Save Draft, Cancel).
- - Button i (0 to 2) goes down (`pressed` on) with `later(down, i*(pd+rd), i*540)` and comes up with `later(up, i*(pd+rd)+pd, i*540+320)`. `pd` is Press speed and `rd` Release speed: each press shrinks, holds 320ms and springs back, and 220ms pass before the next press.
- - At the defaults the buttons go down at 0, 800 and 1600ms and come up 400ms later each. The run is at rest by about 2.2 s, or about 3.7 s with Slow motion.
- - Stops on `hb:input`; stopping removes `pressed` from every button. The shared script sends `hb:input` before the button's own `pointerdown` handler runs, so the visitor's own press still takes effect.
-- **Reset:** none.
-- **Slow motion:** css. `later()` triples each press and spring-back (Press speed and Release speed), not the 320ms and 220ms holds.
-- **Reduced motion:** the demo's rule stays: the button changes to its pressed size and back at once, without the transition. Show me still presses each button in turn.
-- **Stage font:** site font. `.pbtn` gets `font-family:inherit` in place of `monospace`.
-- **Stage:** the three buttons stay (Confirm, Save Draft, Cancel). Their `aria-label`s go, so each button's name is its visible text ("Save" did not match "Save Draft"). The press counters (`.cnt-row`) go. The stage gets `padding:24px`. `hb-dots`: yes. Measured: 274px on phones and laptops.
- - The glow crossfades instead of animating `box-shadow` (see the preamble). `.pbtn` gets `position:relative`, and its `box-shadow` rules and the `box-shadow` parts of its two transitions go.
- - Each button's resting shadow moves to `::before` and its pressed shadow to `::after`, both with `content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none`. The outlined Cancel button uses `inset:-1px`, so its shadow starts at its border edge, as today.
- - The shadows keep today's values (resting / pressed):
- - Confirm: `0 4px 20px rgba(255,157,92,.35)` / `0 1px 6px rgba(255,157,92,.2)`
- - Save Draft: `0 4px 20px rgba(86,211,100,.3)` / `0 1px 6px rgba(86,211,100,.15)`
- - Cancel: `0 4px 14px rgba(0,0,0,.4)` / `0 1px 4px rgba(0,0,0,.3)`
- - At rest `::before` has `opacity:1` and `::after` `opacity:0`; `.pressed` swaps them. Their `opacity` transitions use the same timing as the size: `var(--press-dur) ease` going down (under `.pbtn.pressed`) and `var(--release-dur) var(--release-ease)` coming up. So the glow still eases, and Slow motion slows it with the size.
- - The reduced-motion rule also lists `.pbtn::before,.pbtn::after`.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Press depth | Choice buttons | Light · Medium · Deep | Medium | How much the button shrinks while held down. | `--press-scale`: 0.97 / 0.95 / 0.9 |
-| Release speed | Choice buttons | Slow · Normal · Fast | Normal | How long it takes to spring back. | `--release-dur`: 300ms / 180ms / 110ms |
-| Release feel | Choice buttons | Springy · Smooth · Even | Springy | Springy goes a little past full size, then settles. | `--release-ease`: `cubic-bezier(.34,1.56,.64,1)` / `ease-out` / `linear` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Press speed | Choice buttons | Slow · Normal · Fast | Normal | A press should feel instant, so keep it short. | `--press-dur`: 130ms / 80ms / 50ms |
-
-- **Removed:**
- - The note, the press counters and the Total presses readout.
- - The Press Scale, Press Duration and Release Duration sliders. They become Press depth, Press speed and Release speed.
- - The Release Easing menu. It becomes Release feel. Ease out becomes Smooth, and the menu's own "Smooth" curve (`cubic-bezier(.2,.7,.3,1)`) goes, because it looks nearly the same as Ease out.
-- **Good for:** Main buttons · Icon buttons · Mobile apps · **Avoid on:** Links in text · Large cards
-- **Prompt:**
-
- > Add press feedback to [the buttons you want to feel tactile]. While a button is held down it shrinks, as if pushed in, and when it is let go it returns to full size. A press that is quicker than the release feels most like a real button. Respond to mouse, touch and pen presses and to Space and Enter on the keyboard, and let go cleanly if a press turns into a scroll, so no button stays stuck down. Change only the button's size so nothing around it moves. If the visitor has reduced motion turned on, change the size at once, without animating it. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Button press scale makes a button shrink slightly while it is pressed and spring back when it is let go. A screen has no real button travel, so this small shrink stands in for the feel of pushing a physical button, and it confirms that the press registered.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Press depth | Medium | How small the button gets while held down: light is 97%, medium 95% and deep 90% of its size; smaller than 90% looks broken |
- | Release speed | Normal | How long it takes to spring back: slow is 300ms, normal 180ms and fast 110ms; about twice the press time feels natural |
- | Release feel | Springy | Springy goes a little past full size, then settles; Smooth slows into place; Even keeps one steady pace |
- | Press speed | Normal | How long the shrink takes: slow is 130ms, normal 80ms and fast 50ms; a press should feel instant |
-
-- **README See also:**
- - [Click / Tap Ripple](../click-ripple/) — a ripple spreads from the spot you press
- - [Hover State Animation](../hover-state/) — items react before they are clicked
- - [Checkmark Draw](../checkmark-draw/) — a tick draws itself once the task is done
-- **README How it works:** the JS snippet's `pointerdown` handler also captures the pointer, `e => { press(); btn.setPointerCapture(e.pointerId); }`, and the snippet gains `btn.addEventListener('blur', release);` beside the key handlers (the page registers it just before them). One sentence after the paragraph on the asymmetric timing says the glow crossfades a resting shadow on `::before` and a pressed shadow on `::after` by opacity, with the same timing as the size, rather than animating `box-shadow`. The rest is unchanged.
-- **README Production notes:** the `prefers-reduced-motion` bullet becomes: "**`prefers-reduced-motion`**: switch the transitions off for users who request reduced motion, so the button changes size at once instead of animating; the demo does this." The `pointercancel` bullet gains: "Two more ways to get stuck are covered in the snippet: without `setPointerCapture` the release is missed when the pointer has moved off the button, and without the `blur` listener a key held down while Tab moves the focus away sends its `keyup` to the next element." The rest is unchanged.
-- **Category line:** `04.04 · Micro-Interactions`
-- **Pager:** Previous: Focus Ring Animation (`../focus-ring/`) · Next: Magnetic Button (`../magnetic-button/`)
-
----
-
-## magnetic-button — Magnetic Button
-
-- **Kind:** do — a hover effect: the visitor moves the pointer near the button, and Show me moves a pretend pointer around it.
-- **Description:** Leans toward the pointer, then springs home. Best for one main button.
-- **Step 1:** Hover it — help line: "Move the pointer close to the button (touch near it on a phone), or press Show me."
-- **Player bar:** Show me · Slow motion (css). No Reset: the button always springs home.
-- **What the visitor does:**
- - With a mouse: moving over the stage pulls the button toward the pointer while it is within Reach, and leaving the stage or the reach sends it home (inside the `(hover: hover)` branch, as today).
- - The tap equivalent, new (today a touch screen only changes a hint): on a touch, `pointerdown` on the stage pulls the button toward the finger, `pointermove` while the finger is down follows it, and `pointerup`, `pointercancel` or `pointerleave` sends it home (a pen or finger that leaves the stage ends the pull too: a pen lifted outside sends its `pointerup` elsewhere, and the button would stay pulled). These handlers act only when `e.pointerType` is not `"mouse"`. The stage keeps `touch-action:manipulation`, so a swipe still scrolls the page, which cancels the touch and sends the button home.
- - Pressing the button still shrinks it slightly (`pressed`), as today.
- - The pull is one function that takes a point on the stage (today's `pointermove` body): the mouse, the touch and Show me all call it.
-- **Show me:** moves a pretend pointer around the button, calling the pull function with three points.
- - The points are fixed offsets from the button's resting centre, taken once when the run starts from its layout box: `offsetLeft + offsetWidth/2` and `offsetTop + offsetHeight/2`, with the stage as offset parent. The pull's transform never moves the layout box.
- - The offsets are up and to the left (−0.55 × Reach, −0.35 × Reach), to the right (+0.6 × Reach, +0.1 × Reach) and below (−0.1 × Reach, +0.5 × Reach).
- - The pull function itself still measures from the button's current, moved position, as it does for the real pointer.
- - Point k (0 to 2) is pulled toward with `later(pull, k*550, k*150)`, and the button is sent home with `later(reset, 1650, 450)`. 550ms is the button's glide (its transition), and each point holds 150ms.
- - At the defaults the pulls come at 0, 700 and 1400ms, and the button is sent home at 2100ms and settles by about 2650ms, or about 7 s with Slow motion.
- - Stops on `hb:input` and on the visitor's own mouse `pointermove` over the stage. In the stage's `pointermove` handler, a run under way is stopped first (`stopRun()`, which sends the button home), and the pull runs after it, so the visitor's pointer takes over at once.
-- **Reset:** none.
-- **Slow motion:** css (the button's and label's `.55s` transform transitions). `later()` triples each 550ms glide, not the 150ms holds.
-- **Reduced motion:** the demo's rule stays: the button still follows, with a short, even move (`.12s linear`) instead of the slow glide. Show me still moves it to each point.
-- **Stage font:** site font. `.mag` drops `var(--disp)` and keeps `font-weight:700`.
-- **Stage:** only the button stays ("Get Started"). The dashed radius ring (`.ring`) and the hint under the button (`.hint`) go. `hb-dots`: yes. Measured: 63px of content on laptops and 59px on phones, centred.
- - The label's class `lbl` becomes `mag-label` in the CSS (`.mag .mag-label` and the reduced-motion rule), the markup and the script's lookup, because the page checks reject `class="lbl"` (an old panel class).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pull strength | Choice buttons | Gentle · Medium · Strong | Medium | Stronger pulls feel playful; gentle ones feel calm. | `strength`: 0.2 / 0.35 / 0.5 |
-| Reach | Choice buttons | Short · Medium · Long | Medium | How close the pointer must come before it pulls. | `radius`: 100 / 160 / 240 (px) |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, the Pull and Input readouts, and the hint on the stage.
- - Show radius ring and the dashed ring. The ring is a teaching overlay, not part of the effect.
- - The Magnet Strength and Activation Radius sliders. They become Pull strength and Reach; Magnet Strength could reach 0, which switched the effect off.
-- **Good for:** Hero buttons · Portfolio sites · One key action · **Avoid on:** Forms · Rows of buttons
-- **Prompt:**
-
- > Add a magnetic effect to [the one button you want to stand out]. When the pointer comes within reach, pull the button part of the way toward it, more strongly the closer it gets, and move its label a little further so the label seems to float above the button. When the pointer leaves, let the button spring back to its place. Move it only with transforms so the layout never shifts, and use it on one or two buttons at most. On touch screens, pull the button toward the finger while it touches and send it home when it lifts. If the visitor has reduced motion turned on, move it quickly and evenly instead of letting it glide. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A magnetic button seems to be drawn to the pointer. When the pointer comes close, the button moves part of the way toward it and its label moves a little further, so the label seems to float above the button. When the pointer leaves, the button springs back; it never leaves its place in the layout.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pull strength | Medium | How far the button moves toward the pointer: gentle is 20%, medium 35% and strong 50% of the distance; past about half it feels loose |
- | Reach | Medium | How close the pointer must come before the pull starts: short is 100px, medium 160px and long 240px; too far and the button reacts to unrelated movement |
-
-- **README See also:**
- - [Button Press Scale](../button-press-scale/) — the small shrink it also does when pressed
- - [Hover State Animation](../hover-state/) — simpler ways to react to the pointer
- - [Cursor Follower](../cursor-follower/) — a shape that follows the pointer around
-- **README How it works:** the last sentence, "On touch devices (no hover), the magnet is skipped entirely and the button only does a press-scale on tap.", becomes "On touch screens, which cannot hover, the same pull follows a finger while it touches the stage, and the button springs home when the finger lifts." Two more edits: the sentence "The inner label uses a smaller multiplier, so it lags behind the button body." becomes "The label, inside the button, is moved another 35% of the same offset, so it travels a little further than the button and seems to float above it." (the label is a child of the button, so it travels 1.35 times as far, and leads), and the snippet's finger and pen handler listens for `['pointerup', 'pointercancel', 'pointerleave']`, its comment reading "spring home when it lifts or leaves the stage". The rest is unchanged; the return easing, which leaves the Key parameters table, is already described there.
-- **README Production notes:** the "Gate on hover capability" bullet becomes: "**Gate on hover capability**: bind the hover magnet only where `window.matchMedia('(hover: hover)').matches`. On touch screens `pointermove` fires only while a finger is down, so pull toward the touch point while it is down and send the button home when it lifts, or fall back to a plain press-scale." The "Reduced motion" bullet becomes: "**Reduced motion**: shorten the transition to a quick, even move, so the button still follows the pointer without the slow glide." The rest is unchanged.
-- **Category line:** `04.05 · Micro-Interactions`
-- **Pager:** Previous: Button Press Scale (`../button-press-scale/`) · Next: Toggle / Switch Slide (`../toggle-switch/`)
-
----
-
-## toggle-switch — Toggle / Switch Slide
-
-- **Kind:** do — a click effect: the visitor flips a switch, and Show me flips each switch and back.
-- **Description:** The knob slides across as the switch turns on or off. Best for settings.
-- **Step 1:** Click it — help line: "Click or tap a switch to turn it on or off, or press Show me."
-- **Player bar:** Show me · Slow motion (css). No Reset (owner decision): a second click flips a switch back, and Show me starts from the arrival state.
-- **What the visitor does:** clicking or tapping a switch or its name (or pressing Space on the switch) flips its checkbox, and the CSS `:checked` rules slide the knob and colour the track, as today. The names flipping their switch is new (see Stage).
-- **Show me:** starts from rest. `toRest()` puts the switches back as they are on arrival (Notifications on, Appearance off, Auto-save on) without animating. Then the run flips each switch and flips it back.
- - Switch i (0 to 2) flips with `later(flip, i*dur, i*200)` and flips back with `later(back, (3+i)*dur, 1000+i*200)`, where `dur` is Speed. Each slide takes Speed, 200ms pass between switches, and all three rest 600ms before they flip back.
- - At the defaults they flip at 0, 400 and 800ms and back at 1600, 2000 and 2400ms. The run is at rest by about 2.6 s, or about 5 s with Slow motion.
- - The run sets each checkbox's `checked` directly (no `change` event is needed now that the status readout is gone).
- - Stops on `hb:input`; the switches stay as they are.
-- **Reset:** none.
-- **Slow motion:** css. `later()` triples each slide (Speed), not the 200ms and 600ms holds.
-- **Reduced motion:** the demo's rule stays: the knob jumps and the track colour changes over 0.1s. Show me still flips each switch.
-- **Stage font:** site font. `.tog-label` gets `font-size:15px` and `font-weight:600`.
-- **Stage:** the three switches and their names stay (Notifications, Appearance, Auto-save). The grey lines under the names (`.tog-sub`) go; the third one ("Elastic release overshoot") would be wrong with Springy knob off. The On/Off status readout (`.status-row`) goes. `hb-dots`: yes. Measured: 270px on phones and laptops (268px: three 44px rows, two 36px gaps and 32px of padding on each side).
- - Short windows: a window wider than 600px and at most 620px tall (a short laptop window, a phone held sideways) gives the stage 260px, which is less than the 268px above. `@media(min-width:601px) and (max-height:620px){.stage{gap:20px;padding:20px}}` takes the rows and padding down to 212px, so 48px are spare in a 260px stage; the switches keep their size (measured at 1366×580 and 667×375).
- - The names are the switches' labels: each `.tog-label` is `<label class="tog-label" for="sw0">` (`sw1`, `sw2`), so a tap on a name flips its switch, as the prompt asks ("Make the whole switch and its label easy to tap"). `.tog-label` gets `display:flex;align-items:center;min-height:44px;cursor:pointer;user-select:none` (with the `-webkit-` prefix) and `touch-action:manipulation`: a 44px tap target that fills the row up to the switch (19px tall before).
- - The checkboxes are named by their labels: "Notifications", "Appearance" and "Auto-save". The `aria-label`s on the `label.sw` wrappers ("Toggle notifications" and so on) go, and each `.sw-thumb` is `aria-hidden="true"`, or the moon and sun that Appearance's thumb draws with generated content would join its name ("Appearance 🌙").
- - Keyboard focus: the checkbox is invisible (`opacity:0` and no size), so a Tab press showed nothing. The track now shows it, as the switch's own focus look (see the preamble): `.sw input:focus-visible ~ .sw-track{outline:2px solid var(--ui-accent);outline-offset:2px}`.
- - The knob's transitions keep only `transform`: `box-shadow` and `background` leave them, because neither changes.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Fast feels mechanical; slow can feel sluggish. | `--tog-dur`: 320ms / 200ms / 120ms |
-| Feel | Choice buttons | Smooth · Gentle · Even | Gentle | Gentle gives the knob weight; Even feels robotic. | `--tog-ease`: `ease-out` / `cubic-bezier(.4,0,.2,1)` / `linear` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Springy knob | Switch | on / off | on | The third switch's knob goes past the end, then settles. | Auto-save's switch (the `label.sw` around `#sw2`) has the `elastic` class, so its knob uses the springy `.sw.elastic .sw-thumb` transition / has no `elastic` class, so its knob uses the shared `.sw-thumb` transition (Speed and Feel). This replaces today's inline style, so `toRest()` can clear inline transitions safely. |
-| On color | Swatches (White is left out: the knob is white) | Pink · Blue · Purple · Green · Orange | Blue | The track color when a switch is on. | `--on-color`: `#ff6f8b` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` (the Appearance switch keeps its own orange, as today) |
-
-- **Removed:**
- - The note and the "Tap any toggle to flip state." line.
- - The On/Off status readout and the grey lines under the switch names.
- - The Duration slider and the Easing menu. They become Speed and Feel. Today's default curve, "Material smooth", keeps its value under Gentle, and Ease out becomes Smooth. The menu's Ease in-out goes, because Gentle already covers an in-and-out curve.
- - The colour picker. It becomes the On color swatches.
- - "Elastic on toggle 3". It becomes Springy knob.
-- **Good for:** Settings · Preferences · Dark mode switches · **Avoid on:** Forms sent later · More than two options
-- **Prompt:**
-
- > Add an animated toggle switch to [the on/off setting you want to control]. Build it on a real checkbox so it works with the keyboard and screen readers. When it is turned on, the round knob slides across the track and the track fills with color; when it is turned off, both go back. When the settings ask for it, let the knob go slightly past the end and settle, so it feels springy. Make the whole switch and its label easy to tap. If the visitor has reduced motion turned on, move the knob without sliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A toggle switch is an on/off control whose round knob slides across a track, and the track fills with color when it is on. The slide shows the change instead of just flipping it, and its speed and curve decide whether the switch feels mechanical, weighty or springy.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the knob takes to slide: slow is 320ms, normal 200ms and fast 120ms; under 120ms feels mechanical, over 350ms sluggish |
- | Feel | Gentle | Gentle eases in and out, which gives the knob weight; Smooth starts fast and slows to a stop; Even slides at one steady speed |
- | Springy knob | on | The third switch's knob goes a little past the end, then settles |
- | On color | Blue | The track color when a switch is on; it must stand out from the white knob. The Appearance switch keeps its own orange |
-
-- **README See also:**
- - [Button Press Scale](../button-press-scale/) — the button shrinks while it is pressed
- - [Form Field Morph](../form-field-morph/) — the label moves up when a field is focused
- - [Accordion Open/Close](../accordion/) — a panel opens and closes smoothly
-- **README How it works:** the CSS snippet gains `.sw input:focus-visible ~ .track { outline: 2px solid #ff9d5c; outline-offset: 2px; }`, and a sentence after it says the checkbox is invisible, so keyboard focus is drawn on the track beside it (a copy of the snippet without that rule would have no visible focus). The rest is unchanged.
-- **README Production notes:** the Label wrapping bullet gains: "The demo's switch names are labels too: each name is a `<label for>` pointing at its checkbox, so tapping the name flips the switch, and it is the name a screen reader announces." The rest is unchanged.
-- **Category line:** `04.06 · Micro-Interactions`
-- **Pager:** Previous: Magnetic Button (`../magnetic-button/`) · Next: Heart / Like Burst (`../heart-burst/`)
-
----
-
-## heart-burst — Heart / Like Burst
-
-- **Kind:** do — a click effect: the visitor likes the heart, and Show me likes it once and unlikes it.
-- **Description:** The heart pops and fills as small hearts burst out. Best for like buttons.
-- **Step 1:** Click it — help line: "Click or tap the heart to like it and again to unlike it, or press Show me."
-- **Player bar:** Show me · Slow motion (css). No Reset: a second click unlikes the heart and puts the count back.
-- **What the visitor does:** clicking or tapping the heart (or Space or Enter on it) toggles the like, as today. A like fills the heart, plays the pop and bursts the particles; an unlike only removes the colour. The toggle is one function, called by the click and by Show me.
-- **Show me:** starts from rest: if the heart is liked, `toRest()` unlikes it without animating, and the count goes back to 128. Then:
- - `later(like, 0, 300)` likes it (fill, pop and burst);
- - `later(unlike, 750, 1250)` unlikes it, back to rest. 750ms is the burst, which fades in about 45 frames' worth of time (three quarters of a second on every screen since the frame-rate fix), with the 500ms pop inside it; the holds are the first 300ms and 950ms of rest before the unlike.
- - At the defaults the like comes at 300ms and the unlike at 2000ms, or about 3.5 s with Slow motion.
- - Stops on `hb:input`; the heart stays as it is.
-- **Reset:** none.
-- **Slow motion:** css for the pop and the fill. While the switch is on, the page also slows the burst: each frame moves every particle a third of its usual step. Position, the gravity added to `vy` and the life drain are multiplied by `k`, and the `0.98` drag becomes `0.98 ** k` (`k` is a third of the frame's time in 60 Hz frames while the switch is on: 1/3 at 60 Hz; see the frame-rate fix below). It takes effect from the next frame. `later()` triples the burst (750ms), not the 300ms and 950ms holds.
-- **Reduced motion:** as today, a like only fills the heart, with no pop and no burst (the demo's rule and its `reduce` check stay). Show me still fills and empties the heart.
-- **Stage font:** site font. `.count b` drops `var(--disp)`. The "Likes" count and the empty heart's outline both use `--ui-muted`, so both take the new grey.
-- **Stage:** the canvas, the heart and the "Likes 128" count stay. The count is part of a real like button, not a readout. `hb-dots`: yes. Measured: 131px of content, centred.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of hearts | Choice buttons | Few · Some · Many | Some | More pieces make a bigger celebration. | `pCount`: 10 / 18 / 32 |
-| How far they fly | Choice buttons | Short · Medium · Far | Medium | How far the pieces travel before they fade. | `spread`: 60 / 90 / 140 |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the State and Live particles readouts.
- - The Particle Count and Burst Spread sliders. They become Number of hearts and How far they fly.
-- **Good for:** Like buttons · Favorites · Bookmarks · Reactions · **Avoid on:** Delete buttons · Neutral toggles
-- **Prompt:**
-
- > Add a like button with a burst to [the heart or favorite button you want to reward]. When the visitor likes something, the heart quickly squashes, overshoots a little and settles as it fills with color, while a spray of tiny hearts and dots flies out from its center, arcs down and fades. Unliking simply removes the color, with no burst. Draw the burst on one layer over the button and stop drawing once the last piece has faded. Tell screen readers whether it is liked. If the visitor has reduced motion turned on, only fill the heart, with no pop or burst. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A like button that celebrates the moment you like something. The heart quickly squashes, overshoots and settles as it fills with color, while tiny hearts and dots burst out from its center and fade. Unliking just removes the color, with no celebration.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Number of hearts | Some | How many pieces burst out: few is 10, some 18 and many 32; above about 40 it gets busy and costs frames |
- | How far they fly | Medium | How far the pieces travel before they fade: short, medium or far |
-
-- **README See also:** the second link's text changes from "Badge Pulse" to the page's real title.
- - [Button Press Scale](../button-press-scale/) — the squash and spring behind the heart's pop
- - [Notification Badge Pulse](../badge-pulse/) — a badge pulses to catch the eye
- - [Checkmark Draw](../checkmark-draw/) — success shown without a burst
- - [Click / Tap Ripple](../click-ripple/) — a calmer response from the spot you press
-- **README How it works:** unchanged, except that the `tick()` snippet gained the drag line (final fix wave, below) and the frame-rate fix (below) made it time-based
-- **README Production notes:** unchanged, except for the new first bullet added by the frame-rate fix (below)
-- **Final fix wave (after the category review):**
- - README How it works: the `tick()` snippet lacked the drag the page applies to each piece's sideways speed every frame. Its line then read `p.x += p.vx; p.y += p.vy; p.vy += 0.12; p.vx *= 0.98; p.life -= 0.022; // move, gravity, drag, fade`, and the sentence before the snippet named the drag next to gravity; the frame-rate fix (below) has since scaled it by the time since the last frame, so it now reads `p.x += p.vx * k; p.y += p.vy * k; p.vy += 0.12 * k; // move, gravity` and `p.vx *= 0.98 ** k; p.life -= 0.022 * k; // drag, fade`.
- - Stage: the measured content height is 131px on phones and laptops (the 96px button, the 20px gap and the 15px count), not 133px. The line above is corrected.
-- **Category line:** `04.07 · Micro-Interactions`
-- **Pager:** Previous: Toggle / Switch Slide (`../toggle-switch/`) · Next: Success Confetti (`../success-confetti/`)
-- **Frame-rate fix (wrap-up):** `tick(ts)` scales every step by `k`, the time since the last frame in 60 Hz frames: `dt = last === null ? FRAME : Math.min(ts - last, 50)` with `FRAME = 1000/60`, then `k = dt / FRAME`, times a third in Slow motion. `spawn()` sets `last` to `null` when it starts the loop, so a burst's first frame counts as one 60 Hz frame. Position, gravity and life take `k` and the drag is `0.98 ** k`; a step over 1.5 frames (a 30 Hz screen, or a dropped frame) is taken in two halves, so the arc stays close to the 60 Hz one. The burst lasts about three quarters of a second on every screen (it lasted half that at 120 Hz and twice that at 30 Hz), so Show me's unlike step (2000ms, or about 3.5s in Slow motion) comes after it at every rate measured, 30 to 144 Hz. README: the `tick(ts)` snippet with `FRAME` and `last`, a sentence before it explaining `k`, a paragraph after it on the first frame, the 50ms cap, the two halves and Slow motion, and a new first Production note, "**Time, not frames**".
-
----
-
-## success-confetti — Success Confetti
-
-- **Kind:** do — a click effect: the visitor places the order, and Show me places it once and returns the button to its start.
-- **Description:** Confetti bursts from the button when a task is done. Best for big moments.
-- **Step 1:** Click it — help line: "Click or tap Place order (again for another burst), or press Show me."
-- **Player bar:** Show me only.
- - No Reset, by the preamble's Reset rule: the button stays done, a further click fires another burst, and Show me starts from rest.
- - No Slow motion: the burst already lasts about two seconds and has no quick part to study, and the only CSS on the stage is the button's colour change.
-- **What the visitor does:** clicking or tapping the button turns it green with a check and the label "Order placed", and fires the confetti (not under reduced motion), as today. The button stays done, and each further click fires another burst. The click is one function, called by the button and by Show me.
-- **Show me:** starts from rest: if the button is done, `toRest()` puts it back to "Place order" without animating (removes `done`, restores the label). Then:
- - `later(place, 0, 300)` clicks it: green, check, "Order placed" and confetti.
- - `later(back, 2100, 700)` puts the button back to "Place order". 2100ms is the burst, whose pieces fade over about 2.1 s; the holds are the first 300ms and 400ms of rest after the burst. The tick goes at once, with no fade (`.order-btn:not(.done) .check{transition:none}`): it has no width left by then, so a fade would show it over the "P" of the label for 0.3 s.
- - At 300ms and 2800ms. The page has no Slow motion, so `later()` never triples.
- - Stops on `hb:input`; the button stays as it is.
-- **Reset:** none.
-- **Slow motion:** none.
-- **Reduced motion:** as today, the button turns green and shows its check, with no confetti (the `reduce` check stays; the press shrink `.order-btn:active` stays off). Show me still turns the button green and back.
-- **Stage font:** site font. `.order-btn` drops `var(--disp)`, gets `font-family:inherit` and keeps `font-weight:700`.
-- **Stage:** the canvas and the button stay. The caption under the button (`.sub`, "Click to complete — click again to replay") goes; the help line says what to do. `hb-dots`: yes. Measured: 56px of content on phones and 58px on laptops, centred.
- - The label is centred in the button at rest. The tick (`.check`) has `margin-right:0` while it is hidden and `8px` only while the button is done (`.order-btn.done .check`), so the hidden tick no longer pushes the label 4px to the right. The button is 8px narrower at rest, and the 8px gap shows only with the tick.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Amount of confetti | Choice buttons | Some · Medium · Lots | Medium | More pieces look fuller but cost more on phones. | `pCount`: 60 / 120 / 200 |
-| Spread | Choice buttons | Narrow · Medium · Wide | Medium | Narrow shoots up like a fountain; wide fills a dome. | `spreadDeg`: 60 / 110 / 170 |
-| Fall speed | Choice buttons | Floaty · Normal · Heavy | Normal | How quickly the pieces fall back down. | `gravity`: 0.15 / 0.28 / 0.45 |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, the Live particles readout, and the caption under the button.
- - The Particle Count, Spread and Gravity sliders. They become Amount of confetti, Spread and Fall speed.
-- **Good for:** Orders placed · Sign-ups finished · Milestones · **Avoid on:** Everyday clicks · Serious tasks
-- **Prompt:**
-
- > Add a confetti burst to [the action that completes something important, such as placing an order]. When it succeeds, turn the button into a clear success state with a check mark and a short confirmation, and fire small colored rectangles from the button: they shoot upward in a fan, spin, slow down, fall and fade. Save it for real milestones, not everyday clicks. Draw the pieces on one layer and stop drawing once the last one has faded or fallen out of view. If the visitor has reduced motion turned on, show the success state without the confetti. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A burst of confetti that marks a finished task, such as placing an order. The button turns into a success state, and many small rectangles shoot up from it in a fan, spin, fall and fade. It is a reward: it celebrates the moment but adds no new information.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Amount of confetti | Medium | How many pieces fly: some is 60, medium 120 and lots 200; above about 200 costs frames on slower phones for little gain |
- | Spread | Medium | How wide the fan is: narrow is 60°, medium 110° and wide 170°; narrow looks like a fountain, wide like a dome |
- | Fall speed | Normal | How strongly the pieces are pulled down: floaty, normal or heavy; heavy falls fast, floaty drifts |
-
-- **README See also:**
- - [Checkmark Draw](../checkmark-draw/) — a quieter way to show success
- - [Button Press Scale](../button-press-scale/) — the button shrinks while it is pressed
- - [Heart / Like Burst](../heart-burst/) — a smaller burst for each like
- - [Modal Expand](../modal-expand/) — a dialog grows from the button that opened it
-- **README How it works:** in the sentence after the snippet, "adjusting a slider changes the very next burst" becomes "changing a setting changes the very next burst". The rest is unchanged, except for the time-based sentence, snippet and paragraph of the frame-rate fix (below).
-- **README Production notes:** in the Reduced motion bullet, the last sentence ("This demo swaps the sub-caption to say so.") goes. The rest is unchanged, except for the new first bullet of the frame-rate fix (below).
-- **Category line:** `04.08 · Micro-Interactions`
-- **Pager:** Previous: Heart / Like Burst (`../heart-burst/`) · Next: Skeleton Loader (`../skeleton-loader/`)
-- **Frame-rate fix (wrap-up):** `tick(ts)` scales every step by `k = dt / FRAME`, the time since the last frame in 60 Hz frames (`FRAME = 1000/60`, `dt` at most 50 ms). `fire()` sets `last` to `null` when it starts the loop, so a burst's first frame counts as one 60 Hz frame. Gravity, spin, position and life take `k` and the drag is `0.99 ** k`; a step over 1.5 frames (a 30 Hz screen, or a dropped frame) is taken in two halves, so the arc stays close to the 60 Hz one. The confetti lasts the same on every screen (it lasted half as long at 120 Hz and twice as long at 30 Hz), so it is gone before Show me's back step (2800ms) at 30 to 144 Hz. README: the same additions as Heart Burst's (a sentence explaining `k`, the `FRAME` and `last` snippet, a paragraph on the first frame, the 50ms cap and the two halves) and a new first Production note, "**Time, not frames**".
-
----
-
-## skeleton-loader — Skeleton Loader
-
-- **Kind:** once. One play shows the pulsing placeholders, then the real content fades in and stays; Loop repeats it.
-- **Description:** Gray shapes hold the place of content while it loads. Best for feeds and cards.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Sequence:** every play is today's `startLoad()` without its progress bar.
- - It clears all timers, shows the placeholders again (`visibility` back) and hides the content at once: the content's transition is switched off, `visible` removed, `void realEl.offsetWidth` forces a reflow, then the transition is switched back on.
- - After Loading time, one `later()` timer calls `reveal()`: the placeholders hide and the content fades in over 400ms (`--fade-dur`, new, in place of the fixed `400ms`). The animation-frame tick that only moved the bar goes.
- - While Loop is on, the content holds 1600ms after its fade ends. Loop is checked at that moment, and the next play starts, with the placeholders back at once. Switching Loop off lets the content stay shown.
-- **Slow motion:** page. While the switch is on, `--pulse-spd` and `--fade-dur` are multiplied by 3, from the next play (each play sets both from its settings). Loading time is a hold and keeps its length, and so does the 1600ms hold. So the content arrives at the same moment, after fewer, slower pulses, and fades in three times as slowly.
-- **Reduced motion:** the demo's rule stays (`.skel{animation:none!important;opacity:.6}`): the placeholders hold still and the content still fades in. Replay plays once.
-- **Stage font:** site font. `.real-meta` becomes 11px; it and `.real-text` take their grey from `--ui-muted`.
-- **Stage:** the card stays, with its placeholders and its real content in the same place.
- - The progress bar and its "Loading…" / "Loaded" label (`.load-bar-wrap`) go: they show progress, and a skeleton is used when progress is unknown.
- - `.card-wrap` loses `min-height:260px` and gets `padding:16px`; `.sk-img` and `.real-img` become 72px tall; the stage gets `padding:16px`.
- - The post text becomes "New coastal landscapes, shot where the light meets the water." (it was three to four lines on a phone).
- - `hb-dots`: yes. Measured: 266px on phones and laptops.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pulse speed | Choice buttons | Slow · Normal · Fast | Normal | One to two seconds a pulse feels calm. | `--pulse-spd`: 2.4s / 1.5s / 0.9s |
-| Pulse strength | Choice buttons | Soft · Medium · Strong | Medium | How far the blocks fade between pulses. | `--pulse-min`: 0.7 / 0.5 / 0.3 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Loading time | Choice buttons | Short · Medium · Long | Medium | How long the placeholders show before the content. | `loadDur`: 1000 / 2000 / 3500 (ms) |
-
-- **Removed:**
- - The note and the "↺ Reload sequence" button. The player bar's Replay replaces it, and the shared script turns Loop on at arrival.
- - The progress bar and its label.
- - The Load Duration, Pulse Speed and Pulse Intensity sliders. They become Loading time, Pulse speed and Pulse strength.
-- **Good for:** Feeds · Cards · Lists · Dashboards · **Avoid on:** Very short waits · Unknown layouts
-- **Prompt:**
-
- > Add a skeleton loading state to [the card, list or panel whose content loads]. While it loads, show gray blocks in the shapes and sizes of the content that is coming, such as a round avatar, lines of text and an image, and let them pulse between dimmer and brighter. When the content is ready, swap the blocks for it and fade it in. Match the shapes closely, because a skeleton that does not fit the content makes the page jump when it arrives. If the visitor has reduced motion turned on, keep the blocks still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A skeleton loader shows gray placeholder shapes in the layout of the content that is on its way. The blocks pulse gently to show that loading is going on, and the real content fades in over them when it arrives. Because people see the shape of what is coming, the wait feels shorter than it does with a blank area or a spinner.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pulse speed | Normal | How long one pulse takes: slow is 2.4s, normal 1.5s and fast 0.9s; one to two seconds feels calm, faster feels anxious |
- | Pulse strength | Medium | How far the blocks fade between pulses: soft, medium or strong; a soft pulse is enough |
- | Loading time | Medium | How long the placeholders show before the content fades in: short is 1s, medium 2s and long 3.5s |
-
-- **README See also:**
- - [Shimmer Effect](../shimmer-effect/) — a band of light sweeps across the placeholders
- - [Loading Spinner](../loading-spinner/) — a spinner for waits of unknown length
- - [Progress Animation](../progress-animation/) — a bar that shows how much is done
-- **README How it works:** unchanged
-- **README Production notes:** unchanged, except the last bullet (final fix wave, below)
-- **Final fix wave (after the category review):**
- - Screen readers read the real post text while the placeholders showed. `#real-content` now starts with `aria-hidden="true"`; `showPlaceholders()` sets it again on every play and `reveal()` removes it. So the text is hidden from screen readers exactly while the placeholders show (and hidden at once when Replay or Loop brings them back), and readable after the reveal. Nothing changes for sighted visitors.
- - README Production notes: the last bullet said skeleton plus shimmer "is the most polished loading state", which contradicted Shimmer Effect's README ("pick one"). It is now "Pulse or shimmer": a skeleton shows loading either by pulsing, as here, or with a sweeping band of light (Shimmer Effect); pick one, since the two together are redundant and visually loud.
-- **Category line:** `04.09 · Micro-Interactions`
-- **Pager:** Previous: Success Confetti (`../success-confetti/`) · Next: Shimmer Effect (`../shimmer-effect/`)
-
----
-
-## shimmer-effect — Shimmer Effect
-
-- **Kind:** loop. The band of light sweeps forever.
-- **Description:** A band of light sweeps over gray placeholders. Best for loading screens.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** the band sweeps across the card and the row forever (`@keyframes shimmer` on each `::after`, over Speed). Each cycle of Speed carries the band across twice: the tile is twice as wide as the block and its position travels four block widths, so a band crosses every half of Speed (every 1.2s at Slow, 0.75s at Normal, 0.45s at Fast). No page timers.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule goes (it stopped the sweep and dimmed the band, and Play must move it). Paused on arrival, the sweep holds at its start. There, the band's bright middle lies on each placeholder's right edge, so half of the band shows, still, brightening toward that edge.
-- **Stage font:** the stage has no text.
-- **Stage:** the card and one list row stay (owner decision: the card keeps its image placeholder).
- - The card keeps its round avatar, its two header lines, its image block and its two text lines. The image block (`.sk-img`) becomes 56px tall with `margin:10px 0 2px`.
- - The second list row goes: it looks the same as the first, and with both rows and the image the stage would not fit the phone height.
- - The stage gets `padding:16px` and `gap:12px`, and the card `padding:14px`. The row keeps its own padding.
- - The card and the row must not shrink: `.stage>*{flex-shrink:0}`. On a stage shorter than the content (a phone held sideways, or a window under about 620px tall, gives 260 to 288px) the flex column would squeeze the card, and its `overflow:hidden` would cut off the last text line. With the rule they keep their full height (176px and 66px) and use the stage's padding instead, ending 2px inside a 260px stage.
- - The note under the settings goes.
- - `hb-dots`: yes. Measured: 286px of the 298px inside the phone stage (the image's 2px bottom margin merges into the next line's 9px top margin), and the same on laptops. Keeping the image at its full 100px would need about 330px even with one row.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | One sweep every half second to a second feels calm. | `--shim-dur`: 2400ms / 1500ms / 900ms |
-| Brightness | Choice buttons | Soft · Medium · Bright | Medium | How strong the band of light is. | `--shim-bright`: 0.12 / 0.25 / 0.45 |
-| Highlight angle | Choice buttons | Upright · Slanted · Diagonal | Upright | The slant of the band as it sweeps across. | `--shim-angle`: 90deg / 115deg / 135deg |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Highlight color | Swatches (the demo's own colours) | White · Blue · Gold | White | Tinted light suits a branded loading screen. | `--shim-color`: `255,255,255` / `88,166,255` / `255,215,0` (swatch colours `#ffffff` / `#58a6ff` / `#ffd700`) |
-
-- **Removed:**
- - The two notes.
- - The second list row.
- - The Sweep Speed, Brightness and Angle sliders. They become Speed, Brightness and Highlight angle. The angle slider ran from −45° to 135° and so passed 0°, where the band lies flat and cannot be seen moving.
- - The Highlight Color menu. It becomes swatches; Silver goes, because at this brightness it looks the same as White.
- - The page's reduced-motion rule.
-- **Good for:** Feeds · Cards · Lists · Image galleries · **Avoid on:** Very short waits · Busy pages
-- **Prompt:**
-
- > Add a shimmer to [the skeleton placeholders on your loading screen]. Lay a band of light over each placeholder and sweep it across in one direction, again and again, so the gray shapes look like content streaming in. Every placeholder on the page should shimmer in the same direction, and each one must clip the band to its own edges so it never spills out. Keep the band see-through so it works on any placeholder color. If the visitor has reduced motion turned on, keep the placeholders still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A shimmer is a band of light that sweeps across gray placeholder shapes again and again while content loads. Where a pulse fades every block up and down together, a shimmer travels in one direction, so the placeholders look like content streaming in.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How often the light crosses: slow every 1.2s, normal every 0.75s and fast every 0.45s; more often than about every 0.4s it feels frantic |
- | Brightness | Medium | How strong the band of light is: soft, medium or bright; soft is subtle, bright suits a branded screen |
- | Highlight angle | Upright | Upright sweeps a straight band; Slanted and Diagonal tilt it; keep one angle across the whole page |
- | Highlight color | White | White works on any placeholder; blue or gold suit branded screens |
-
-- **README See also:**
- - [Skeleton Loader](../skeleton-loader/) — the placeholders pulse instead
- - [Loading Spinner](../loading-spinner/) — a spinner for waits of unknown length
- - [Progress Animation](../progress-animation/) — a bar that shows how much is done
-- **README How it works:** the sentence before the snippet, "A `::after` pseudo-element containing a translucent gradient is positioned absolutely over the skeleton block and translated from `-100%` to `+200%`:", becomes "A `::after` pseudo-element holding a translucent gradient covers each skeleton block, and its background position slides from one side to the other:". The snippet and the rest are unchanged, except that the sentence after the snippet gets one more sentence: "The tile is twice as wide as the block and its position travels four block widths per cycle, so the band crosses twice in each `--shim-dur`: every 0.75s at the default 1.5s."
-- **README Production notes:** the "Combining with pulse" bullet becomes: "**Combining with pulse**: pick one — a pulse and a shimmer together are redundant and visually loud." The rest is unchanged.
-- **Category line:** `04.10 · Micro-Interactions`
-- **Pager:** Previous: Skeleton Loader (`../skeleton-loader/`) · Next: Loading Spinner (`../loading-spinner/`)
-
----
-
-## loading-spinner — Loading Spinner
-
-- **Kind:** loop. The six spinners move forever.
-- **Description:** Six small shapes loop to show that something is loading. Best for short waits.
-- **Watch it help line:** default
-- **Player bar:** Pause (css) · Slow motion (css)
-- **Sequence:** the six spinners move forever, all over Speed. Ring, Orbit and Arc turn (`spin`), and the arc also stretches and shrinks (`arc-pulse`, over twice Speed). Bounce's dots rise in turn (`bounce`), Pulse's ring swells and fades (`pulse-ring`), and Square turns and shrinks (`sq-spin`). No page timers.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule (`animation-play-state:paused!important` on every spinner) goes, because it would stop Play from starting them.
-- **Stage font:** site font. `.spin-label` becomes 11px, keeping its capitals, its letter spacing and its `--ui-muted` grey.
-- **Stage:** the six cells stay, with their labels (Ring, Orbit, Arc, Bounce, Pulse, Square).
- - The grid keeps three columns on every screen: the phone rule that made two columns goes, because three rows would not fit the phone stage.
- - The columns are `repeat(3,minmax(0,1fr))`, not `repeat(3,1fr)`: with plain `1fr` a cell cannot shrink below its content, so at Large the three cells need 258px and the grid is only 254px wide on a 320px phone, which runs it 4px into the stage's padding and 2px off centre. With `minmax(0,1fr)` the cells are an equal 76.7px with 16px on each side; the 52px spinner and the longest label then overhang the cell's content box by less than a pixel per side, inside the cell's 12px padding.
- - `.grid` gets `gap:12px`, `.spin-cell` `padding:12px`, and the stage `padding:16px`.
- - `hb-dots`: yes. Measured: about 225px at Medium size and 250px at Large, on phones (320px wide included) and laptops, with no cell overflowing.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Fast spinning can feel anxious. | `--spd`: 1300ms / 800ms / 500ms |
-| Size | Choice buttons | Small · Medium · Large | Medium | Small fits inside a button; large fills an empty area. | `--sz`: 28px / 40px / 52px |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | Pick a color that stands out from the page. | `--clr`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657`, and the Pulse spinner's fill to the same colour with `26` added (15% opacity), as today |
-
-- **Removed:**
- - The two notes. The minimum display time they mention stays in the README's Production notes.
- - The Speed and Size sliders. They become Speed and Size.
- - The colour picker. It becomes the Color swatches.
- - The page's reduced-motion rule and the two-column phone rule.
-- **Good for:** Network waits · Buttons while sending · Short waits · **Avoid on:** Known-length tasks · Very quick loads
-- **Prompt:**
-
- > Add a loading spinner to [the place where people wait for something to load]. Use a small shape that keeps moving in a steady loop, such as a ring with one colored part turning around, dots circling or dots bouncing in turn, to show that work is going on when you cannot say how long it will take. Show it only for waits longer than about half a second, and tell screen readers that something is loading. If you know how far along the task is, use a progress bar instead. If the visitor has reduced motion turned on, fade it gently instead of spinning. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A loading spinner is a small shape that keeps moving in a loop to show that the system is busy. It says nothing about how long the wait will be, only that work is going on, so it suits waits of unknown length, such as a network request. The demo shows six common designs.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long one turn takes: slow is 1.3s, normal 0.8s and fast 0.5s; 0.6 to 1 second reads as calm, faster as anxious |
- | Size | Medium | Small is 28px, medium 40px and large 52px; small fits inside a button, large fills an empty area |
- | Color | Blue | The spinner's color; pick one that stands out from the page |
-
-- **README See also:**
- - [Progress Animation](../progress-animation/) — a bar that shows how much is done
- - [Skeleton Loader](../skeleton-loader/) — gray shapes stand in for the content
- - [Checkmark Draw](../checkmark-draw/) — the success sign once the wait is over
-- **README How it works:** unchanged
-- **README Production notes:** the `prefers-reduced-motion` bullet becomes: "**`prefers-reduced-motion`**: under reduced motion the demo starts paused, so the spinners stay still until the visitor presses Play. In production, reduce the spinner to a simple opacity pulse, or hide it and rely on an `aria-live` announcement." The rest is unchanged.
-- **Category line:** `04.11 · Micro-Interactions`
-- **Pager:** Previous: Shimmer Effect (`../shimmer-effect/`) · Next: Progress Animation (`../progress-animation/`)
-
----
-
-## progress-animation — Progress Animation
-
-- **Kind:** once. One play fills the bar, the ring and the steps to the chosen percentage and stops there; Loop repeats it.
-- **Description:** A bar, a ring and steps fill up to show progress. Best for uploads.
-- **Watch it help line:** default
-- **Player bar:** Replay · Loop · Slow motion
-- **Sequence:** every play is today's `startAnim()`.
- - It cancels the previous frame, clears all timers, removes `indet` from the bar and sets the three displays to 0 (`setProgress(0)`). Today only the Sliding bar change handler removed `indet`. Without this, switching Sliding bar off during a slide would leave the endless slide running, because the shared script's replay after a setting change starts a new play.
- - When Sliding bar is on, it starts the slide (`startIndet()`): the bar slides for 2 × Speed, then shows its real fill. The end of the slide goes through `later()`.
- - It fills to Fills to over Speed with Feel (today's animation-frame loop).
- - While Loop is on, the displays hold 1200ms after the last movement ends: the fill, or the slide when Sliding bar is on, since the slide ends later, at 2 × Speed. So every loop shows the bar's real fill before the next play starts again from 0. Loop is checked at that moment. Switching Loop off lets the displays finish filled.
-- **Slow motion:** page. While the switch is on, `dur` for the fill, `--prog-dur` for the sliding bar and the timer that ends the slide (2 × Speed) are multiplied by 3, from the next play. The 1200ms hold and the steps' 200ms colour change stay.
-- **Reduced motion:** as today, a play shows the result at once (the `reduceMotion` branch stays), and the sliding bar shows full and still (the demo's CSS rule stays). Replay plays once.
-- **Stage font:** site font. The labels become 11px, keeping their `--ui-muted` grey; the number in the ring keeps 12px bold.
-- **Stage:** the bar, the ring and the steps stay, each with its number.
- - "Linear Bar" becomes "Bar" and "Stepped" becomes "Steps".
- - The "▶ Start" button, the ring's caption (a line of code) and the "Start" / "Complete" labels under the steps go.
- - The stage gets `padding:24px` and `gap:24px`.
- - The numbers change every frame, so the three displays sit in one group with `role="img"` and an `aria-label` naming the target, set at the start of each play (for example "Progress filling to 100%").
- - The bar's fill moves to transform (see the preamble). `.prog-fill` becomes `width:100%` with `transform:translateX(-100%)`, which is empty. `setProgress(p)` sets `linearFill.style.transform='translateX('+(p-100)+'%)'` in place of its width.
- - The track's `overflow:hidden` and radius clip the part still outside, so the bar looks the same, round ends included. This was checked side by side at 1%, 10%, 50%, 97% and 100%. Only below about 3% does the thin sliver differ slightly: it shows the fill's rounded end instead of a tiny pill.
- - The sliding bar's `@keyframes indet` already moves by transform, and while it runs it overrides the inline transform; its 40% width is set once, not animated.
- - The sliding bar's reduced-motion rule adds `transform:none!important`, so under reduced motion it still shows full and still, as today.
- - `hb-dots`: yes. Measured: 234px on phones and laptops.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Fills to | Choice buttons | 50% · 75% · 100% | 100% | How far the progress goes in one play. | `target`: 50 / 75 / 100 |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the fill takes. | `dur` / `--prog-dur`: 3200ms / 2000ms / 1200ms |
-| Feel | Choice buttons | Smooth · Gentle · Even | Smooth | Smooth starts fast and eases into the end. | `ease`: `EASE['ease-out']` / `EASE['ease-in-out']` / `EASE.linear` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Sliding bar | Switch | on / off | off | For waits of unknown length: the bar slides instead. | `indetTog.checked`: each play also calls `startIndet()` / does not |
-| Fill color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The color of the bar, the ring and the steps. | `--prog-color`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-
-- **Removed:**
- - The note, the line about the circle's length, and the "▶ Start" button. Replay replaces the button, and the shared script turns Loop on at arrival.
- - The ring's caption and the labels under the steps.
- - The Duration and Target % sliders. They become Speed and Fills to.
- - The Easing menu. It becomes Feel.
- - The colour picker. It becomes Fill color.
- - "Indeterminate mode (bar)". It becomes Sliding bar.
-- **Good for:** Uploads · Downloads · Multi-step forms · Installs · **Avoid on:** Unknown waits · Fake progress
-- **Prompt:**
-
- > Add a progress indicator to [the upload, download or task whose progress you know]. Show how much is done with a bar that fills from left to right, a ring whose outline fills around the circle, or a row of steps that light up in turn, all driven by the same percentage and shown with the number. Fill it smoothly as progress arrives, and only show real progress: never race to near the end and stall. When the settings ask for it, slide a short piece along the bar for waits of unknown length. If the visitor has reduced motion turned on, jump straight to the current value. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A progress animation shows how much of a task is done by filling a shape: a bar, a ring or a row of steps. Unlike a spinner, it tells people how much is left, which makes a long wait easier. In the demo, all three are driven by the same percentage.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Fills to | 100% | How far one play fills: 50%, 75% or 100% |
- | Speed | Normal | How long the fill takes: slow is 3.2s, normal 2s and fast 1.2s; in a real app it follows the actual progress |
- | Feel | Smooth | Smooth starts fast and slows near the end, which feels natural; Gentle eases in and out; Even fills at one steady pace |
- | Sliding bar | off | For waits of unknown length: a short piece slides along the bar instead of filling it |
- | Fill color | Blue | The color of the bar, the ring and the steps |
-
-- **README See also:**
- - [Loading Spinner](../loading-spinner/) — a spinner for waits of unknown length
- - [Skeleton Loader](../skeleton-loader/) — gray shapes stand in for the content
- - [Checkmark Draw](../checkmark-draw/) — the success sign once it reaches the end
- - [Progress Bar](../../01-scroll-based/progress-bar/) — a bar that fills as you scroll
-- **README How it works:** the linear-bar part must match the new code. The ring and sliding-bar parts are unchanged.
- - The sentence "**Linear bar**: update `width` via a CSS transition, or animate it manually with `requestAnimationFrame` for easing control:" becomes "**Linear bar**: keep the fill as wide as the track and slide it in from the left with `transform: translateX()`; the track's `overflow: hidden` hides the part still outside, and a transform never makes the page lay out again. Move it with a CSS transition, or with `requestAnimationFrame` for easing control:".
- - The CSS snippet becomes:
-
- ```css
- .prog-track { overflow: hidden; border-radius: 4px; }
-
- .prog-fill {
- height: 100%;
- width: 100%;
- background: #58a6ff;
- transform: translateX(-100%); /* empty: the whole fill sits left of the track */
- transition: transform 2000ms ease-out;
- }
- ```
-
- - In the `requestAnimationFrame` snippet, `fill.style.width = (target * eased) + '%';` becomes `fill.style.transform = 'translateX(' + (target * eased - 100) + '%)';`.
-- **README Production notes:** the GSAP bullet becomes: "**GSAP**: `gsap.to(fill, { xPercent: -25, duration: 2, ease: "power2.out" })` slides a full-width fill to 75%. For circular rings, animate `strokeDashoffset` directly." The rest is unchanged.
-- **Category line:** `04.12 · Micro-Interactions`
-- **Pager:** Previous: Loading Spinner (`../loading-spinner/`) · Next: Checkmark Draw (`../checkmark-draw/`)
-
----
-
-## checkmark-draw — Checkmark Draw
-
-- **Kind:** do — a click effect: the visitor presses Submit, and Show me submits once and returns the button to its start. Today it also replays by itself every four seconds; that goes, because a do-it page shows itself once on arrival and then waits for the visitor.
-- **Description:** A tick draws itself in a circle once a task succeeds. Best for forms.
-- **Step 1:** Click it — help line: "Click or tap Submit (Reset brings it back), or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (css).
-- **What the visitor does:** clicking Submit runs today's `runSequence()`.
- - The label fades and a spinner turns in the button for 900ms.
- - Then the button shows ✓ and turns green while the circle and the tick draw. With Result set to Error, it shows ✕ (never the success tick) and turns red while the X draws and shakes. `runSequence()` sets the glyph from the run's result, `btnCheck.textContent=failed?'✕':'✓'`, just before it fades the glyph in.
- - The button then stays finished (disabled) until Reset.
-- **Show me:** starts from rest: `toRest()` is `reset()` without animating. Then:
- - `later(runSequence, 0, 300)` presses Submit. The sequence's own 900ms loading wait is a hold: it stays in `runSequence()`'s own timer, which does not go through `later()` and is never tripled.
- - `later(reset, 1.4*draw, 2400)` puts the button back to Submit, where `draw` is Speed.
- - The drawing takes 1.4 × Speed: the circle over Speed, the tick starting at 0.4 × Speed. The X and its shake end sooner.
- - The holds are 300ms before the press, the 900ms loading wait and 1.2 s on the finished result.
- - After the reset, the lines draw back out over Speed.
- - At the defaults: Submit at 300ms, the tick fully drawn by about 1900ms, back to Submit at 3100ms. With Slow motion, back at about 4.5 s, before the lines draw back out.
- - Stops on `hb:input`: the run's own timers stop, and a sequence already under way still finishes and stays finished until Reset.
- - The arrival press is the shared script's, not the visitor's. When the visitor has already pressed Submit (the button is disabled, whether it is still loading or finished), the page ignores an untrusted Show me press (`e=>{if(!e.isTrusted&&btn.disabled)return; ...}`), so the arrival run neither resets nor replaces the visitor's own sequence. The visitor's own Show me press still starts a run from rest.
-- **Reset:** calls `stopRun()`, then `reset()`: the finished button stays disabled otherwise, so this is the only way back to Submit besides Show me.
-- **Slow motion:** css (the drawing, the spinner, the shake and the button's colour). `later()` triples the drawing (1.4 × Speed), not the holds; the sequence's 900ms loading wait keeps its length.
-- **Reduced motion:** the demo's rule stays and also stops the button's spinner (`.sp{animation:none!important}` joins it). The spinner shows still, and the circle and tick, or the X, appear at once, with no shake. Show me still shows the spinner, then the finished result.
-- **Stage font:** site font. `.submit-btn` gets `font-family:inherit` in place of `var(--mono)`.
-- **Stage:** the button and the icon stay. The state label under the icon (`#state-label`) goes; it described each step. `.submit-btn`'s transition keeps only `background`, because its `width` never changes. `hb-dots`: yes. Measured: 230px on phones and laptops.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Result | Choice buttons | Success · Error | Success | Error draws a red X and gives it a shake. | `showError`, read by `runSequence()` at each run: `false` / `true` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the lines take to draw. | `--draw-dur`: 800ms / 500ms / 300ms |
-| Line thickness | Choice buttons | Thin · Medium · Thick | Medium | Thick looks confident; thin looks precise. | `--stroke-w`: 2 / 4 / 7 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Gentle · Even | Smooth | Smooth slows at the end, like a pen lifting. | `--draw-ease`: `ease-out` / `ease-in-out` / `linear` |
-| Tick color | Swatches | Pink · White · Blue · Purple · Green · Orange | Green | The circle and tick; the X stays red. | `--stroke-color`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-
-- **Removed:**
- - The note, the state label, the "↺ Replay" button and the four-second auto-replay. Show me and Reset replace them.
- - The Draw Duration and Stroke Width sliders. They become Speed and Line thickness.
- - The Easing menu. It becomes Feel.
- - The colour picker. It becomes Tick color.
- - "Show error (X) variant". It becomes Result.
-- **Good for:** Form success · Payments · Finished steps · **Avoid on:** Frequent small saves
-- **Prompt:**
-
- > Add a success check mark that draws itself to [the form or action that just finished]. After the visitor submits, show a short loading state in the button, then draw a circle and a tick inside it as if by hand: the circle first, then the tick, starting just before the circle closes. For a failure, draw a red X the same way and give it a short shake. Let the button turn green or red to match. If the visitor has reduced motion turned on, show the finished check or X at once. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A check mark that draws itself, as if by hand, to confirm that something worked. The circle and the tick are there from the start but hidden, and they are revealed along their length, so the line seems to be drawn. The same trick can draw a red X when something fails.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Result | Success | Success draws a circle and a tick and turns the button green; Error draws a red X, shakes it and turns the button red |
- | Speed | Normal | How long each line takes to draw: slow is 800ms, normal 500ms and fast 300ms; 200 to 800ms is easy to follow |
- | Line thickness | Medium | Thin is 2, medium 4 and thick 7 units wide; thick reads as confident, thin as precise |
- | Feel | Smooth | Smooth slows at the end like a pen lifting off; Gentle eases in and out; Even draws at one steady pace |
- | Tick color | Green | The color of the circle and the tick; the X stays red |
-
-- **README See also:**
- - [Progress Animation](../progress-animation/) — shows how much is done before the success
- - [Loading Spinner](../loading-spinner/) — the waiting sign before the tick
- - [Button Press Scale](../button-press-scale/) — the button shrinks while it is pressed
-- **README How it works:** unchanged
-- **README Production notes:** in the "Error state pairing" bullet, "(see toggle in the demo)" becomes "(the demo's Result setting shows it)". The rest is unchanged.
-- **Category line:** `04.13 · Micro-Interactions`
-- **Pager:** Previous: Progress Animation (`../progress-animation/`) · Next: Form Field Morph (`../form-field-morph/`)
-
----
-
-## form-field-morph — Form Field Morph
-
-- **Kind:** do — a focus effect: the visitor clicks into a field and types, and Show me fills in one field and moves on to the next.
-- **Description:** The label moves up out of the way as you type. Best for sign-up forms.
-- **Step 1:** Click it — help line: "Click or tap a field and type, or press Show me."
-- **Player bar:** Show me · Slow motion (css). No Reset, by the preamble's Reset rule: the visitor can clear a field, and Show me starts from an empty form.
-- **What the visitor does:** focusing a field raises its label and, on the underlined fields, grows the line (`:focus-within`); typing keeps the label up (`filled`, set on `input` and `blur`); leaving an empty field lets it drop back; Tab moves between the fields. All as today.
-- **Show me:** starts from rest: `toRest()` empties every field without animating (values emptied, `filled` removed, labels down). Then, with `f` for Speed:
- - `later(focusName, 0, 0)`: Full name gets `is-demo`, so its label rises and its line grows.
- - `later(type, f, 100+70*k)` for letter k (0 to 11) of "Ada Lovelace": the run types it one letter at a time, setting `value` and calling `syncFilled()` after each letter. Typing is a hold, not a movement.
- - `later(toCompany, f, 1300)`: Full name loses `is-demo`, and its label stays up because the field is filled. Company gets it: its border takes the focus color and its label rises.
- - `later(leaveCompany, 2*f, 2000)`: Company loses it, and its label drops back because the field is empty.
- - `later(clearName, 3*f, 2400)`: the run clears Full name, whose label drops back.
- - At the defaults these come at 0ms, 300 to 1070ms, 1500ms, 2400ms and 3000ms. The form is at rest by about 3.2 s, or about 4.8 s with Slow motion.
- - Every `:focus-within` rule also lists `.is-demo` (for example `.float-field:is(:focus-within,.is-demo) label`).
- - Stops on `hb:input` and on a trusted `focusin` inside the stage: a Tab press into the form from outside sends no `hb:input`, and the run moves no focus. Stopping removes `is-demo` from every field and clears the text the run typed, so a field the visitor clicks into starts empty.
-- **Reset:** none.
-- **Slow motion:** css. `later()` triples each label move (Speed), not the typing or the holds.
-- **Reduced motion:** the demo's rule stays: labels and lines move at once, without the transition. Show me still types and moves the labels.
-- **Stage font:** site font. The inputs and the textarea get `font-family:inherit` in place of `var(--mono)`; the labels keep their `--ui-muted` grey.
-- **Stage:** Full name (underlined), Company (boxed) and Message (underlined, several lines) stay. The Email address field goes (owner decision): it is a second underlined field like Full name, and without it the form fits the phone stage. The stage gets `padding:16px`, `.form` gets `gap:16px` (was 24px), and the textarea `min-height:56px` (was 80px). `hb-dots`: yes. Measured: 282px on phones and laptops.
- - The fields keep their own focus look: the line, the label colour and the box border. The site's focus ring (`body.hb :focus-visible`, specificity 0,2,1) beats their `outline:none` (0,1,1). It would draw an orange box around each focused field, through its raised label.
- - So the page adds `.stage .float-field :is(input,textarea):focus-visible,.stage .box-field input:focus-visible{outline:none}` (0,3,1).
- - The focused Company box stays opaque: its focused background mixes 4% of the focus colour into the stage's own `#0b0b0d` (`color-mix(in srgb,var(--focus-color) 4%,#0b0b0d)`, `rgb(14,17,23)` with Blue), not into `transparent`. Over `transparent` the stage's `hb-dots` grid showed through the focused box; the unfocused box was already opaque (`--ui-bg`). Changed in the final wave.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slow feels heavy on a long form. | `--field-dur`: 320ms / 200ms / 120ms |
-| How far it rises | Choice buttons | Low · Medium · High | Medium | Far enough to clear the text you type. | `--float-dist`: 16px / 22px / 28px |
-| Size when raised | Choice buttons | Small · Medium · Large | Medium | Smaller stays out of the way; larger reads easily. | `--label-scale`: 0.7 / 0.8 / 0.9 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Focus color | Swatches | Pink · White · Blue · Purple · Green · Orange | Blue | The raised label and the active line or border. | `--focus-color`: `#ff6f8b` / `#f4f4f2` / `#58a6ff` / `#d2a8ff` / `#56d364` / `#ffa657` |
-
-How far it rises and Size when raised move the underlined fields' labels; the boxed Company field keeps its own smaller rise, as today.
-
-- **Removed:**
- - The two notes and the Filled fields readout.
- - The Email address field.
- - The Animation Duration, Float Distance and Label Scale sliders. They become Speed, How far it rises and Size when raised.
- - The colour picker. It becomes Focus color.
-- **Good for:** Sign-up forms · Sign-in forms · Checkout · Settings · **Avoid on:** Long labels
-- **Prompt:**
-
- > Add floating labels to [the form fields you want to label]. Each label sits inside its field like a placeholder; when the field is focused or has text in it, the label moves up and shrinks so it stays visible above the text, and the field's line or border takes on the focus color. When an empty field loses focus, the label moves back down. Keep a real label element for each field so screen readers announce it, and shrink the label from its left edge so it does not drift sideways. If the visitor has reduced motion turned on, move the label without animating it. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Form field morph, also called a floating label, starts with each field's label inside the field, like a placeholder. When you click into the field or type in it, the label moves up and shrinks, so it stays visible above your text instead of disappearing the way a placeholder does.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the label takes to move: slow is 320ms, normal 200ms and fast 120ms; slower feels heavy on a form with many fields |
- | How far it rises | Medium | How far the label moves up on the underlined fields: low is 16px, medium 22px and high 28px; it must clear the typed text |
- | Size when raised | Medium | How big the raised label is on the underlined fields: small is 70%, medium 80% and large 90% of its size |
- | Focus color | Blue | The color of the raised label and the active line or border |
-
-- **README See also:**
- - [Focus Ring Animation](../focus-ring/) — a ring shows which item the keyboard is on
- - [Toggle / Switch Slide](../toggle-switch/) — a switch slides between on and off
- - [Accordion Open/Close](../accordion/) — a panel opens and closes smoothly
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `04.14 · Micro-Interactions`
-- **Pager:** Previous: Checkmark Draw (`../checkmark-draw/`) · Next: Notification Badge Pulse (`../badge-pulse/`)
-
----
-
-## badge-pulse — Notification Badge Pulse
-
-- **Kind:** loop. The badges pulse forever. Clicking an icon still clears its badge, as today, so the player bar also has Reset to bring the badges back. This is the only loop with Reset: without it a cleared badge would stay gone until the page is reloaded.
-- **Description:** A badge on an icon pulses to catch the eye. Best for unread messages.
-- **Watch it help line:** "It moves by itself. Pause it, or click an icon to clear its badge; Reset brings the badges back."
-- **Player bar:** Pause (css) · Reset · Slow motion (css). Reset is the do-it plan's Reset button (`id="btn-reset"`, `data-hb-reset`) and sits between Pause and Slow motion; on phones Pause and Reset share a row.
-- **Sequence:** the bell's and the inbox's badges pulse forever in the chosen Pulse style (`badge-scale`, `halo-grow` or both, over Speed). The avatar's online dot always grows and shrinks (`badge-scale`). No page timers. Clicking the bell or the inbox, or pressing Enter or Space on it, clears its badge (`display:none`), as today, and the icon's `aria-label` loses the count so that screen readers no longer announce a badge that is gone: "Notifications, 3 new" becomes "Notifications" and "Inbox, new messages" becomes "Inbox" (the full labels are kept for Reset; "Profile, online" never changes).
-- **Reset:** shows every cleared badge again, restores the full labels and restarts the pulses with `applyStyle()`. While paused, the restarted pulses wait at their first frame (the shared `hb-paused` class holds them) until Play.
-- **Slow motion:** css
-- **Reduced motion:** the demo's rule goes (it removed the pulses and hid the halos, and Play must move them).
-- **Stage font:** site font. `.icon-label` becomes 11px, keeping its `--ui-muted` grey; the number in the badge becomes 11px and dark (`#0b0b0d`), not white: white on the five badge colors is 3.35 to 1.94:1 and the dark number 5.87 to 10.15:1 (text needs 4.5:1).
-- **Stage:** the three icons stay. Their two-line labels become one word each: "Number", "Dot" and "Online" (were "Bell numbered", "Inbox dot" and "Avatar online"). The avatar's inline style moves into a class. `hb-dots`: yes. Measured: 90px of content (the badges stick out 8px above it), centred; it fits every stage, the 260px one included.
-- **Halo layering:** the halo (`::after`) is drawn over the badge's color and under its number: `.badge{isolation:isolate}` makes the badge a stacking context and `.badge::after{z-index:-1}` puts the halo inside it, below the text. A halo painted over the number took it below 4.5:1 (2.66:1 on Red at the start of every Ring or Both pulse, 3.27 to 4.15:1 at rest); with the halo under it the number measures 5.86:1 or better in every state.
-- **Halo and clicks:** the halo takes no pointer: `.badge::after,.dot-badge::after{pointer-events:none}` (a change of the final wave). It grows to 2.2 times the badge and, faded out or not, covered the empty stage around the icon's corner, so a click there reached the icon's handler and cleared the badge (up to 100 of 529 points sampled around the bell's badge, and 44 around the inbox dot, were such clicks). Now only the icon and the badge itself take a click.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pulse style | Choice buttons | Grow · Ring · Both | Grow | Grow stays contained; Ring spreads a soft halo. | the bell's and the inbox's class: `pulse-scale` / `pulse-halo` / `pulse-both`, then `applyStyle()`; pressing the style already chosen does nothing (it must not restart the pulses) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Fast feels urgent; slow is easy to miss. | `--pulse-dur`: 2.4s / 1.5s / 0.9s; every pulse is moved to the same point of its new length, so the picture stays (moving, paused or finished) |
-| How much it grows | Choice buttons | Slightly · Medium · A lot | Medium | Much bigger than a third starts to feel alarming. | `--pulse-scale`: 1.15 / 1.3 / 1.5 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Stops after three pulses | Switch | on / off | off | Pulses three times to be noticed, then rests. | every icon's `fade-mode` class on / off, then `applyStyle()`; the rule sets `animation-iteration-count:3` and `animation-fill-mode:forwards`, so the run ends on its last keyframes (badge at scale 1, halo invisible) and a finished pulse stays in `getAnimations()` for Speed |
-| Badge color | Swatches (Red, the default, added; White and Green left out) | Red · Pink · Blue · Purple · Orange | Red | Red reads as new and urgent. | `--badge-color`: `#f85149` / `#ff6f8b` / `#58a6ff` / `#d2a8ff` / `#ffa657` |
-
-White stays left out (it was left out when the number was white; the number is dark now, so White could be added if the owner wants it), and Green because the online dot is green. How much it grows also sets the online dot's pulse, whatever the Pulse style.
-
-- **Removed:**
- - The note and the "Click an icon to dismiss its badge." line; the help line says it.
- - The Pulse Duration and Scale Amount sliders. They become Speed and How much it grows.
- - The Pulse Style menu. It becomes Pulse style.
- - The colour picker. It becomes Badge color.
- - "Fade after attention (3 pulses)". It becomes Stops after three pulses.
- - The page's reduced-motion rule.
-- **Good for:** Notification bells · Inboxes · Chat icons · Online status · **Avoid on:** Items already seen · Many icons at once
-- **Prompt:**
-
- > Add a pulsing notification badge to [the icon that has something new, such as a bell or an inbox]. Place a small colored dot or number on the icon's corner and let it pulse, growing and settling back or sending a soft ring outward, so it catches the eye without demanding attention. Give the badge a thin border in the background color so it seems to float above the icon. Remove the badge once the visitor has opened what it points to, and when the settings ask for it, stop the pulse after three beats. If the visitor has reduced motion turned on, keep the badge still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A notification badge is a small colored dot or number on an icon that marks something new, such as unread messages. A gentle pulse, growing a little and settling back or sending out a soft ring, catches the eye at the edge of your vision without interrupting what you are doing.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pulse style | Grow | Grow scales the badge up and back; Ring sends a soft halo outward; Both does the two together |
- | Speed | Normal | How long one pulse takes: slow is 2.4s, normal 1.5s and fast 0.9s; fast feels urgent, slow is easy to miss |
- | How much it grows | Medium | How big the badge gets at the top of each pulse: slightly is 115%, medium 130% and a lot 150% of its size |
- | Stops after three pulses | off | The badges pulse three times and then rest; the online dot keeps going |
- | Badge color | Red | The badge's color; red reads as new and urgent |
-
-- **README See also:**
- - [Tooltip Reveal](../tooltip-reveal/) — pointing at an icon shows a short note
- - [Loading Spinner](../loading-spinner/) — another sign that something is going on
- - [Hover State Animation](../hover-state/) — items react when the pointer is over them
-- **README How it works:** the halo snippet gains `.badge{isolation:isolate}`, and `z-index:-1` and `pointer-events:none` on `.badge::after`, with a sentence saying the ring is drawn under the number. After the snippet, one sentence says why the ring takes no pointer (it grows to 2.2 times the badge, past the icon's corner, and catches clicks there even when faded out), and the next says the three-pulse run uses `animation-iteration-count:3` and `animation-fill-mode:forwards`; without the fill mode "the halo would fall back to its resting style, a faint ring around the badge". The rest is unchanged.
-- **README Production notes:** the `prefers-reduced-motion` bullet becomes: "**`prefers-reduced-motion`**: under reduced motion the demo starts paused, so the badges stay still until the visitor presses Play. In production, turn the pulse off: the badge stays visible, just without motion." The rest is unchanged.
-- **Category line:** `04.15 · Micro-Interactions`
-- **Pager:** Previous: Form Field Morph (`../form-field-morph/`) · Next: Tooltip Reveal (`../tooltip-reveal/`)
diff --git a/docs/superpowers/plans/2026-09-29-micro-content-part2.md b/docs/superpowers/plans/2026-09-29-micro-content-part2.md
deleted file mode 100644
index 567fe82f..00000000
--- a/docs/superpowers/plans/2026-09-29-micro-content-part2.md
+++ /dev/null
@@ -1,1171 +0,0 @@
-# Micro-Interactions — Content Sheet, Part 2
-
-This sheet decides, page by page, how the last fourteen Micro-Interactions pages (04.16 Tooltip Reveal to 04.29 Pull to Refresh, in home-page order) present their kind, settings, words and prompt on the guided-steps page. Part 1 (`2026-09-29-micro-content-part1.md`) covers 04.01 Hover State Animation to 04.15 Notification Badge Pulse. The conversion tasks of `2026-09-29-demo-page-rollout-parallel.md` follow each section exactly, together with "How to convert a page" in `2026-09-28-demo-page-rollout-text-typography.md`, the lessons in the rollout's Global Constraints and the do-it markup of `2026-09-29-demo-page-kinds-do-and-scroll.md`. Rotate In (`animations/02-entrance-and-exit/rotate-in/`) is the reference for everything a section does not mention.
-
-Every page in this half is a **do-it** page: nothing moves until the visitor points, presses or drags, so none is a plays-once, loop or scroll page. Accordion and Pull to Refresh scroll inside their own box, but scrolling is not what they show, so they are do-it pages too; their stage keeps its own overflow. Every page keeps settings, so every page has a Try it step. The rollout spec's special case "click demos: Show me plays one click and returns to rest" applies to Modal Expand, Toast Notification and every Click it page here.
-
-Every fit number in this sheet was measured in Chrome on the lane server, with each old demo put into the shared stage at the check tool's sizes (the stage is 960×380 at 1280×800, 960×327 at 1366×657, 692×440 at 768×1024, 343×300 at 375×812 and 288×300 at 320×640) and the site font.
-
-## How to read a section
-
-- **Kind** names the step 1 title: "Hover it", "Click it" or "Drag it". **Step 1 help line** is the page's own help line under it (the label Part 1 uses).
-- **Try it help line** is the same on every do-it page: "Change a setting, then try it again or press Show me." (A do-it page replays nothing when a setting changes: the shared script's replay needs a Replay button. The new setting shows the next time the visitor tries the demo or presses Show me, except where a row says it applies to the stage at once.)
-- **Show me** replaces the plays-once "Sequence": what one run does, its timeline, how it ends at rest and what `hb:input` does. Each timed step is written `later(step, movement, hold)` and counted from the moment Show me is pressed, at the default settings: the movement is the part of the wait that Slow motion stretches (a transition or animation the step waits for), and the hold is the part it never stretches. A step with no `later()` happens "at once". Each Slow motion line also gives the length of a slowed run, as in Part 1.
-- **Sets in the demo** lists one value per choice, in the same order as the choices, and names the variable, class or function exactly as today's script has it.
-- Switches in Try it keep their default in the markup (`checked` when the default is on), as on Rotate In. Only the player bar's Slow motion starts unchecked.
-- **Speed** always reads Slow · Normal · Fast. Today's default is Normal; Slow is about 1.6 times and Fast about 0.6 times it, rounded.
-- **Feel** uses the names shared with Part 1: Smooth (slows to a stop) is `ease-out`, Gentle (eases in and out) is `ease-in-out`, Even (one steady speed) is `linear`, and Springy goes a little past, then settles. A page's own old default curve keeps its exact value under the nearest name: Hamburger Menu Toggle's and Theme Toggle Morph's in-out curves are Gentle, and each Springy row keeps its page's own overshoot curve. The exact curve is in each row.
-- **Category line:** the pages have none today. NN is the page's position on the home page, which its card already shows: `04.16 · Micro-Interactions` (Tooltip Reveal) to `04.29 · Micro-Interactions` (Pull to Refresh).
-- **Accent:** every page keeps `--ui-accent:#ff9d5c`, which all 29 pages of the category already use.
-- **Gray stage text:** `:root`'s `--ui-muted` becomes `#8a8a92` (the site's own muted gray), as on the converted Entrance & Exit pages. The old `#77777e` is 4.2:1 on the demo cards' `#111114` and 4.4:1 on the stage's `#0b0b0d`; the new gray is 5.5:1 and 5.7:1. Stage text below 11px goes up to 11px, as in Part 1; each section names the rules this changes. Other sizes stay.
-- **Stage font:** every stage uses the site font. The shared stylesheet already maps `--disp` and `--mono` to it; each section still names the stage rules whose font changes (as the Text & Typography sheet did), including every literal `monospace`, which the shared stylesheet cannot map. On plain elements the `font-family` just goes. Stage buttons and inputs get `font-family:inherit` instead, as in Part 1, because a form control does not take the page's font by itself; the shared stylesheet sets no font on them.
-- **Stage:** the page owns the stage's height, border and corners, so each demo's `.stage` rule loses `height`, `min-height`, `--stage-h`, `flex`, `min-width`, `border` and `border-radius`, and keeps what its content needs (display, alignment, gap, padding, background, `position`, `overflow`). A `.stage-wrap` wrapper goes. The old phone block goes, except the rules a section keeps. `hb-dots` is used on plain dark stages and left off where the stage paints its own full background; each section says which. No page here takes typed text as a setting, so none uses `hb-grow`.
-
-## Do-it pages: Show me, Reset and `hb:input`
-
-- **Body:** `<body class="hb" data-hb-kind="do" data-hb-autoplay>`. Step 1's title and help line come from the section; steps are numbered 1 to 3.
-- **Player bar,** in this order: the Show me button exactly as in the do-it plan (`id="btn-demo"`, `data-hb-demo`); the Reset button exactly as in the do-it plan (`id="btn-reset"`, `data-hb-reset`), only where the section has one; then, only where the section has it, `<label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo="css" autocomplete="off"><span>Slow motion</span></label>`.
-- **On arrival** the shared script presses Show me once, 400ms after load; under reduced motion it runs nothing, and Show me and Reset still work when pressed. Under reduced motion the Slow motion switch is grayed out by the shared script.
-- **One run at a time,** with Part 1's helper, word for word, so the whole category runs Show me the same way. Every timer of a run goes through `later(fn, move, hold)`, which waits `move` (tripled while Slow motion is on, read when the timer is set) plus `hold`, which never stretches. Slow motion never stretches holds, Show me runs included: this is a rule for every kind of page. The listeners are registered at the top level of the page's inline script, and the page reaches the player controls by their ids, never by `data-hb-*`:
-
- ```js
- // Show me: one run at a time. Every timer of the run goes through later(); stopRun() cancels the whole run.
- // later(fn, move, hold) waits move*(slow?3:1) + (hold||0) ms: Slow motion triples the movement, never the hold.
- const slowTog=document.getElementById('slow-tog'); // only on pages with Slow motion
- let runTimers=[];
- function later(fn,move,hold){
- const slow=!!(slowTog&&slowTog.checked);
- const id=setTimeout(()=>{ runTimers=runTimers.filter(t=>t!==id); fn(); }, move*(slow?3:1)+(hold||0));
- runTimers.push(id);
- }
- function running(){ return runTimers.length>0; }
- function stopRun(){ runTimers.forEach(clearTimeout); runTimers=[]; /* plus what the section's "stops" line undoes */ }
- document.getElementById('btn-demo').addEventListener('click',()=>{ stopRun(); /* put the demo at rest, then play the steps with later() */ });
- document.addEventListener('hb:input',()=>{ if(running()) stopRun(); });
- ```
-
- In a section, `toRest()` is "put the demo at rest", the timeline gives the steps, and the "On `hb:input`" line says what `stopRun()` also undoes. A step written `later(close, Speed, 1500)` runs Speed + 1500ms after the press, or 3 × Speed + 1500ms while Slow motion is on. A run ends when its last timer has fired. Pages without Slow motion write every step as a hold, `later(step, 0, ms)`. The two drag pages (Swipe to Dismiss, Pull to Refresh) also draw a drag frame by frame: they keep its one pending frame in `runFrame`, their `running()` is also true while `runFrame` is set, and their `stopRun()` also does `cancelAnimationFrame(runFrame); runFrame=0`.
-- **A run starts from rest.** When the visitor left the demo changed (a panel open, another option chosen), `toRest()` puts it back as it is on arrival without animating: the pieces' transitions are turned off inline, the resting state is set, `void el.offsetWidth` forces a reflow, and the inline transitions are cleared. Pressing Show me during a run starts it again from rest.
-- **A run plays one example** of the interaction, about two to four seconds unless the section says otherwise, and ends at rest. It never moves the keyboard focus, never submits a form, never writes to the clipboard and never announces anything to screen readers that did not really happen.
-- **`hb:input`** comes from the visitor's own `pointerdown`, `keydown`, `wheel` or `touchstart` inside the stage. Hovering sends none, so the two Hover it pages (Tooltip Reveal, Cursor Follower) and Star Rating, whose row previews on hover, also stop a run on a trusted `pointermove` over the stage while one is under way, as in Part 1.
-- **Slow motion "css"** is on the pages whose movement is short CSS transitions and animations: the shared script plays every transition and animation on the stage at a third of its speed, including the visitor's own and ones that start later, and `later()` triples only the movement part of the run's waits; holds keep their length. The demo's own timers keep their length too (a tooltip's delays before showing and hiding), except the Copy button's revert, which counts its pulse as movement (see that section). The drag pages, Cursor Follower and Toast Notification leave Slow motion out; their sections say why.
-- **Reset** is on a page only where the visitor can leave the demo changed in a way its own controls cannot undo in one step: removed messages (Swipe to Dismiss), a stack of toasts (Toast Notification) and added items (Pull to Refresh). Reset calls `stopRun()`, then puts the demo back as it is on arrival. Everywhere else a second press of the same control undoes the change (a toggle, an open panel), and Show me starts from rest anyway.
-- **Reduced motion:** a pressed Show me plays the same steps, and the demo's own reduced-motion rules make each CSS change happen at once. Three runs move things themselves and still move when Show me is pressed, because the visitor asked for it: the scripted drags of Swipe to Dismiss and Pull to Refresh, and Cursor Follower's glide. Every run here changes the stage within 1.6 s, because the browser check presses Show me under reduced motion too and needs a visible change, and no stage here moves by itself.
-- **Settings change during a run:** the page applies them at once as today, and each step of the run reads the current values.
-- **Hover and touch:** every hover style stays inside `@media (hover: hover)`, and every hover has a tap equivalent (each section's **Touch** line). Drags use Pointer Events. No run in this half needs Part 1's pretend-hover class `is-demo`: each run calls the demo's own functions (`show()`, `open()`, `toggle()`, `render()` and so on) rather than relying on `:hover` or `:focus`.
-- **"How to convert a page"** applies as written, with `04.NN · Micro-Interactions` and `--ui-accent:#ff9d5c`, except in three places. Step 4's body and player bar are the ones above. Step 5's rules for plays-once pages and loops are replaced by this section; its rules for every page still apply (player controls by id, `choices()`, nothing left of the old controls). Step 8's browser check runs the do-it checks instead: Show me moves the stage within 1.6 s, and nothing moves by itself under reduced motion.
-
-## Owner decisions and lessons that apply here
-
-- Stage text uses the site font; no page here is a typing effect, so none keeps a monospace font.
-- Reduced motion runs nothing by itself and grays out Slow motion; Show me and Reset still work. Each demo keeps its own reduced-motion CSS, which makes a pressed Show me jump between states instead of moving.
-- Do-it pages show themselves once on arrival (the shared script presses Show me).
-- From the Text & Typography reviews: the pruning `later()`; the `hb:input` listener at the top level of the inline script; player controls reached by their ids (`btn-demo`, `btn-reset`, `slow-tog`); Show me restarts the pieces themselves from rest (reset them, force a reflow, then play), never through a double `requestAnimationFrame`.
-- No code on the page: four stages show code or CSS names today (Copy to Clipboard's JavaScript snippet, Accordion's answers, and texts on Modal Expand and Cursor Follower); their sections replace them with plain content.
-- **Transform and opacity only** (CLAUDE.md): no page here animates `width`, `height`, `top`, `left` or `box-shadow`. Cursor Follower now moves and grows with transforms, and Hamburger Menu Toggle's menu opens with transform and opacity instead of `max-height`; their sections say how. The owner allows two exceptions, because the height change is the effect itself: Accordion's opening answer and Swipe to Dismiss's closing row. Their READMEs say why, and how to keep it cheap.
-
----
-
-## tooltip-reveal — Tooltip Reveal
-
-- **Kind:** do it, step 1 "Hover it" — a tooltip appears only when the visitor points at, tabs to or taps an item.
-- **Description:** A small label fades in after a short pause. Best for icon buttons.
-- **Step 1 help line:** Point at an item, tab to it or tap it on a phone, or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: a tooltip hides by itself when the pointer or focus leaves. Slow motion helps here because the fade and the slight grow last only 90 to 250ms; the waits before showing and hiding are timers and keep their length.
-- **Show me:** `toRest()` removes `visible` from all four tooltips. The run is one hover of the first item, the gear button:
- - at once: the gear's own `show()` (its tooltip fades in after Delay before showing);
- - `later(hide, Speed, Delay before showing + 1600)`: the gear's own `hide()` (it fades out after Delay before hiding), and the run ends. About 2.3 s from press to rest at the defaults.
-
- Each item keeps its `show()` and `hide()` where the run can reach them (for example `wrap.show`, `wrap.hide`). The run also stops on a trusted `pointermove` over the stage (see the preamble). On that or on `hb:input`: `stopRun()`, then the gear's `hide()` unless the pointer or focus is on it (`wrap.matches(':hover,:focus-within')`).
-- **Slow motion:** css. The fade is the run's only movement (Speed); the delay before showing and the 1600ms are holds, and the items' own delays keep their length. A slowed run takes about 2.9 s.
-- **Reduced motion:** the demo's rule stays: the tooltip fades without growing.
-- **Touch:** today's `touchstart` toggle stays: a tap shows a hidden tooltip at once and hides a shown one only when the item already has the focus (`tip.classList.contains('visible')&&wrap.contains(document.activeElement)`). The tooltip Show me shows has no focus behind it, so a tap on the gear during the arrival run keeps it. Hiding it (the old condition looked only at `visible`) made it blink: it went at once and came back about 360ms later, when the tap's `focusin` showed it again (a change of the final wave).
-- **Stage font:** site font. `.help-input` gets `font-family:inherit` (was `var(--mono)`).
-- **Stage:** the four items stay: the gear button (tooltip below), the cut-off text (tooltip above), the Username field (tooltip to its right) and the avatar (tooltip above).
- - The "Total shown" readout goes, so `show()` no longer counts.
- - Escape hides a shown tooltip at once. A `keydown` listener on the document removes `visible` from every tooltip and clears their pending show and hide timers, so a tooltip comes back only when the pointer or focus leaves its item and returns. WCAG 1.4.13 asks that a tooltip can be dismissed without moving the pointer or the focus, and today's demo has no way to do it. With focus inside the stage, the Escape press also sends `hb:input`, which stops a Show me run.
- - Two rules of the old phone block stay, in a block of their own: the cut-off text is at least 44px tall with `line-height:24px`, and the field's side tooltip flips below the field (with its arrow). That block's media query becomes `max-width:720px` instead of 600px: the side tooltip (up to 200px wide) is cut off at the stage's right edge on screens from 601px to about 670px wide.
- - `hb-dots`: yes. Default height: the items take 270px of the 300px phone stage, and each tooltip, shown alone, stays inside it (measured).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Delay before showing | Choice buttons | None · Short · Medium · Long | Medium | The pause stops tips flashing as the pointer passes. | `showDelay`: 0 / 150 / 300 / 600 (ms) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How quickly the label fades and grows in. | `--tip-dur`: 250ms / 150ms / 90ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Delay before hiding | Choice buttons | None · Short · Long | Short | How long the tip stays after the pointer leaves. | `hideDelay`: 0 / 100 / 300 (ms) |
-| Shows an arrow | Switch | on / off | off | A small point that aims the tip at its item. | every `.tip-wrap` gets / loses `has-arrow` |
-
-- **Removed:**
- - The note.
- - The "Total shown" readout.
- - The Show Delay, Hide Delay and Duration sliders. They become Delay before showing, Delay before hiding and Speed.
- - "Show arrow" becomes Shows an arrow.
-- **Good for:** Icon buttons · Cut-off text · Form hints · Chart values · **Avoid on:** Key information · Long text
-- **Prompt:**
-
- > Add tooltips to [the icon buttons, shortened text or fields that need a short explanation]. When the pointer rests on an item, or keyboard focus reaches it, wait a moment, then fade the tooltip in beside it while it grows very slightly from the side facing the item, so it feels light rather than like a pop-up. The wait keeps tooltips from flashing while the pointer only passes by. When the pointer leaves, hide it again, after a pause if the settings include one, and let the Escape key close it at once. On touch screens, show and hide it with a tap. If the visitor has reduced motion turned on, fade it without growing. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A tooltip is a small label that appears next to an item when you point at it or reach it with the keyboard, giving a short explanation that does not fit on the page. It fades in and grows very slightly, and it waits a moment before it shows, so tooltips do not flash while the pointer is only passing over things. When the pointer leaves, it stays for a moment before it fades, so it does not vanish the instant the pointer slips off the item.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Delay before showing | Medium | How long the pointer must rest before the tooltip shows: none, short (150ms), medium (300ms) or long (600ms); 300ms keeps tooltips from flashing as the pointer passes, and 200ms can work for very small ones |
- | Speed | Normal | How long the fade and the slight grow take: slow is 250ms, normal 150ms and fast 90ms |
- | Delay before hiding | Short | How long the tooltip stays after the pointer leaves: none, short (100ms) or long (300ms); a short pause stops it vanishing the instant the pointer slips off its item |
- | Shows an arrow | off | Adds a small point that aims the tooltip at its item |
-
-- **README See also:** the second link's text changes from "Badge Pulse" to the page's real title.
- - [Hover State Animation](../hover-state/) — items that react when the pointer is on them
- - [Notification Badge Pulse](../badge-pulse/) — a dot that pulses to draw the eye
- - [Modal Expand](../modal-expand/) — a full window for content too big for a tooltip
-- **README How it works:** in the first paragraph, "On mouse-leave it hides after a short second delay — allowing the user to move the cursor from trigger to tooltip without it disappearing:" becomes "On mouse-leave it hides after a short second delay, so it does not vanish the instant the pointer slips off the trigger:", because the demo's tooltips take no pointer. After the JS snippet, add "Escape hides a shown tooltip at once, so it can be dismissed without moving the pointer or the focus:" and this snippet:
-
- ```js
- document.addEventListener('keydown', e => {
- if (e.key !== 'Escape') return;
- clearTimeout(showTimer);
- tip.classList.remove('visible');
- });
- ```
-
- The rest is unchanged.
-- **README Production notes:** in the WCAG 1.4.13 bullet, "The 100ms hide delay satisfies "hoverable."" becomes "The demo covers "dismissible": Escape hides a shown tooltip at once. A hide delay helps with "hoverable" only when the tooltip takes the pointer; the demo's tooltips have `pointer-events: none`, so a tooltip that must be hoverable needs pointer events on." The `pointer-events: none` bullet becomes "**`pointer-events: none`** on the tooltip keeps it from catching the pointer, so it never blocks the item or its neighbors; the cost is that the pointer cannot rest on the tooltip itself, which the WCAG bullet covers." The rest is unchanged.
-- **Category line:** `04.16 · Micro-Interactions`
-- **Pager:** Previous: Notification Badge Pulse (`../badge-pulse/`) · Next: Drawer / Panel Slide (`../drawer-slide/`)
-
----
-
-## drawer-slide — Drawer / Panel Slide
-
-- **Kind:** do it, step 1 "Click it" — the drawer opens only when the visitor presses the menu button.
-- **Description:** A side panel slides in over a dimmed page. Best for mobile menus.
-- **Step 1 help line:** Press the menu button, then close the drawer with × or a swipe, or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: ×, a tap on the dimmed page, a swipe or Esc close the drawer. Slow motion shows the point of the demo: the drawer slows as it arrives and speeds up as it leaves.
-- **Show me:** `toRest()` closes the drawer at once, without its transition. Then:
- - at once: `open()`, as the menu button does;
- - `later(close, Opening speed, 1500)`: `close()`, and the run ends. About 2 s from press to rest at the defaults.
-
- On `hb:input`: `stopRun()` only. The drawer stays as it is, and the visitor closes it.
-- **Slow motion:** css. The slide is the run's movement (Opening speed); the 1500ms is a hold. A slowed run takes about 3 s.
-- **Reduced motion:** the demo's rule stays: the drawer and the dimming appear and disappear without sliding or fading.
-- **Touch:** the swipe to close already uses Pointer Events (`pointerdown` on the drawer, `pointerup` on the document, 50px toward its edge).
-- **Mouse swipe:** the drawer has `user-select:none` (with the `-webkit-` prefix). Without it, the first mouse swipe selects the words it starts on, and the next swipe begins on selected text, which the browser turns into a native text drag: no `pointerup` arrives and the drawer stays open, although the help line promises "or a swipe". With it, every mouse swipe closes the drawer, on every side.
-- **Stage font:** site font. `.hamburger` gets `font-family:inherit` (was `monospace`), and so does `.close-btn`. The ☰ comes from the system's fallback font, as it does today.
-- **Stage:** the small app screen stays: the header with the menu button and "Atlas App", the gray content lines, the dimming layer and the drawer.
- - The State readout goes.
- - The drawer's list keeps four items (Home, Gallery, About, Contact). "Settings", pinned to the bottom, goes, and `.drawer-body`'s padding becomes 12px (was 16px). Measured: five items need 268px and the side drawer has 221px on a phone and 248px on a short laptop, so the list scrolled; four need 212px.
- - `--drawer-w` becomes `min(280px,80%)`, so on a 320px phone a strip of dimmed page stays to tap.
- - The top and bottom drawers keep their 200px height; their list scrolls inside, as a sheet does.
- - While closed, the drawer has the `inert` attribute (`close()` sets it, `open()` removes it, and it starts closed), so Tab cannot reach its hidden close button.
- - The stage's own rule keeps `position:relative;overflow:hidden;display:flex;flex-direction:column`.
- - `hb-dots`: no, because the app screen fills the stage. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Slides in from | Choice buttons | Left · Right · Top · Bottom | Left | The edge the drawer comes in from. | `side`: `'left'` / `'right'` / `'top'` / `'bottom'` (the drawer gets no class / `right` / `top` / `bottom`; an open drawer closes first and the class changes without a transition, as today) |
-| Opening speed | Choice buttons | Slow · Normal · Fast | Normal | It slows down as it arrives, like a panel landing. | `--open-dur`: 450ms / 280ms / 170ms |
-| Closing speed | Choice buttons | Slow · Normal · Fast | Normal | It speeds up as it leaves, so closing feels quick. | `--close-dur`: 350ms / 220ms / 130ms |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Page dimming | Choice buttons | None · Light · Medium · Dark | Medium | How dark the page behind the drawer gets. | `--backdrop-op`: 0 / 0.25 / 0.5 / 0.7 |
-
-- **Removed:**
- - The note.
- - The State readout.
- - The Drawer Side menu. It becomes Slides in from.
- - The Open Duration, Close Duration and Backdrop Opacity sliders. They become Opening speed, Closing speed and Page dimming.
- - The drawer's "Settings" item.
-- **Good for:** Mobile menus · Filters · Settings panels · **Avoid on:** Short messages · Main content
-- **Prompt:**
-
- > Add a slide-in drawer to [the menu or panel you want to open]. It waits just beyond one edge of the screen and slides in over the page when its button is pressed; when the settings include it, the page behind it dims. Let it slow down as it arrives, like a panel sliding to a stop, and speed up as it leaves, so closing feels quicker than opening. Close it with a close button, a tap on the page beside it, the Escape key or a swipe back toward its edge. Move only its position, and keep keyboard focus inside it while it is open. If the visitor has reduced motion turned on, show and hide it without sliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A drawer is a panel that waits just beyond one edge of the screen and slides in over the page when you press its button, usually holding a menu, filters or settings. The page behind it usually dims so the drawer stands out. It slows down as it arrives, like a panel sliding to a stop, and speeds up as it leaves, which makes closing feel quicker than opening.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Slides in from | Left | The edge the drawer comes from: left or right for menus and filters, top or bottom for sheets |
- | Opening speed | Normal | How long the slide in takes: slow is 450ms, normal 280ms and fast 170ms; it slows as it arrives |
- | Closing speed | Normal | How long the slide out takes: slow is 350ms, normal 220ms and fast 130ms; it speeds up as it leaves, and a little shorter than opening feels right |
- | Page dimming | Medium | How dark the page behind gets: none, light (25% black), medium (50%) or dark (70%); darker than about 70% feels like a dialog rather than a drawer |
-
-- **README See also:**
- - [Modal Expand](../modal-expand/) — a window that grows out of the button you pressed
- - [Accordion Open/Close](../accordion/) — sections that open in place instead of over the page
- - [Tooltip Reveal](../tooltip-reveal/) — a small label for a short explanation
-- **README How it works:** in the JS snippet, `open()` also does `drawer.inert = false;` and `close()` does `drawer.inert = true;`, with the comment `// a closed drawer cannot be reached with Tab`. The rest is unchanged.
-- **README Production notes:** the "Swipe-to-close on touch" bullet gets one more sentence: "With a mouse, give the drawer `user-select: none`, or the first drag selects its text and the next one becomes a native text drag." The rest is unchanged.
-- **Category line:** `04.17 · Micro-Interactions`
-- **Pager:** Previous: Tooltip Reveal (`../tooltip-reveal/`) · Next: Modal Expand (`../modal-expand/`)
-
----
-
-## modal-expand — Modal Expand
-
-- **Kind:** do it, step 1 "Click it" — the window opens only when the visitor presses a button, and it grows out of that button.
-- **Description:** A window grows out of the button you pressed. Best for detail views.
-- **Step 1 help line:** Press any of the five buttons and watch the window grow out of it, or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: Cancel, Confirm, a tap on the dimmed page or Esc close the window.
-- **Show me:** `toRest()` closes the window at once, without its transition. Each run presses one button, the next in turn each time Show me is pressed: Top right first (on arrival), then Bottom left, Center, Top left and Bottom right. It shows the point of the demo, a different starting point each time.
- - at once: `openModal(btn)` for that button (it does not move the focus);
- - `later(closeModal, Speed, 1500)`: `closeModal()`, and the run ends. About 2.1 s from press to rest at the defaults.
-
- On `hb:input`: `stopRun()` only. The window stays open, and the visitor closes it.
-- **Slow motion:** css. The window's grow and fade and the dimming slow down; the grow is the run's movement (Speed) and the 1500ms is a hold. A slowed run takes about 3.4 s.
-- **Reduced motion:** the demo's rule stays: the window appears at full size and disappears without growing or fading.
-- **Stage font:** site font. `.trig-btn`, `.modal-close` and `.modal-confirm` get `font-family:inherit` (was `monospace`).
-- **Stage:** the five buttons, the dimming layer, the window and the origin dot stay; the Origin readout goes.
- - The window's text becomes plain words. The title "Confirm action" stays. The body becomes "This window grew out of the button you pressed, so it feels connected to where it came from." Today's body names the CSS property.
- - The window is centred with `inset:0;margin:auto;height:fit-content` in place of `top:50%;left:50%` and the two negative margins. The old `margin-top:-80px` guessed its height: on a phone it sat 70px from the top and 42px from the bottom. `openModal()` measures with `offsetLeft` and `offsetTop`, which still give its laid-out corner.
- - The phone rule that makes Cancel and Confirm 44px tall stays.
- - The four "Open ↗" buttons get an `aria-label` naming their corner ("Open from the top left", and so on), because they share one text.
- - While closed, the window has the `inert` attribute (`closeModal()` sets it, `openModal()` removes it, and it starts closed), so Tab cannot reach its hidden buttons.
- - `hb-dots`: yes. Default height: with the plain text and 44px buttons the window is 196px tall, inside the 300px phone stage (measured).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the window takes to grow to full size. | `--modal-dur`: 500ms / 320ms / 200ms |
-| Starting size | Choice buttons | Tiny · Small · Medium | Small | How small it is as it leaves the button. | `--start-scale`: 0.05 / 0.1 / 0.3 |
-| Feel | Choice buttons | Springy · Smooth · Even | Springy | Springy goes a little past full size, then settles. | `--modal-ease`: `cubic-bezier(.34,1.3,.64,1)` / `ease-out` / `linear` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Marks where it grows from | Switch | on / off | on | A dot shows the point the window grows out of. | the switch keeps today's `debug-tog` role: `openModal()` shows the dot (`show`) only while it is on, and turning it off hides the dot at once |
-
-- **Removed:**
- - The note.
- - The Origin readout.
- - The Duration and Start Scale sliders. They become Speed and Starting size.
- - The Easing menu. It becomes Feel. Its "Smooth" curve (`cubic-bezier(.2,.7,.3,1)`) goes: it looked nearly the same as Ease out, which is now Smooth.
- - "Show origin point" becomes Marks where it grows from.
-- **Good for:** Detail views · Confirmations · Quick forms · Action buttons · **Avoid on:** Long content · Full pages
-- **Prompt:**
-
- > Add a modal that grows out of its button to [the button or card that opens a dialog or detail view]. When it is pressed, measure where that button sits and grow the modal from that spot to full size in the middle of the screen while the page behind it dims, so it clearly comes from what was pressed. Close it with its buttons, a tap on the dimmed page or the Escape key, and let it shrink back toward the same spot. Animate only its scale and opacity. Move keyboard focus into it, and back to the button when it closes. If the visitor has reduced motion turned on, show it at full size without growing. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Modal expand makes a dialog grow out of the button that opened it. The page measures where that button is and grows the window from that exact spot to its full size in the middle of the screen, so it is clear where the window came from and where it goes back to when it closes.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the window takes to grow: slow is 500ms, normal 320ms and fast 200ms |
- | Starting size | Small | How big the window is as it leaves the button: tiny is 5%, small 10% and medium 30% of its full size; too big and the growth is hard to see |
- | Feel | Springy | Springy goes a little past full size, then settles; Smooth slows to a stop; Even keeps one steady speed |
- | Marks where it grows from | on | Shows a small dot on the point the window grows out of |
-
-- **README See also:**
- - [Drawer / Panel Slide](../drawer-slide/) — a panel that slides in from an edge instead
- - [Tooltip Reveal](../tooltip-reveal/) — a small label for a short explanation
- - [FLIP Technique](../../03-page-transitions/flip-technique/) — the same measure-then-move idea for any layout change
-- **README How it works:** both snippets change to match the demo.
- - The JS snippet becomes:
-
- ```js
- function openModal(btn) {
- const sr = stage.getBoundingClientRect();
- const br = btn.getBoundingClientRect();
- // The button's centre, relative to the stage
- const bx = br.left + br.width / 2 - sr.left;
- const by = br.top + br.height / 2 - sr.top;
- // The same point, relative to the modal's laid-out corner (offsetLeft/Top ignore its scale)
- modal.style.transformOrigin = `${bx - modal.offsetLeft}px ${by - modal.offsetTop}px`;
- modal.classList.add('open');
- }
- ```
-
- - The CSS snippet becomes:
-
- ```css
- .modal {
- position: absolute;
- inset: 0; margin: auto; /* centred without a transform */
- width: clamp(240px, 55%, 320px); height: fit-content;
- transform: scale(var(--start-scale));
- opacity: 0;
- transition: transform var(--modal-dur) var(--modal-ease), opacity 200ms ease;
- pointer-events: none;
- }
- .modal.open { transform: scale(1); opacity: 1; pointer-events: auto; }
- ```
-
- - The sentences around them stay, except "compute the origin point relative to the modal's final centered position:", which becomes "compute the same point relative to the modal's own corner:".
-- **README Production notes:** unchanged
-- **Category line:** `04.18 · Micro-Interactions`
-- **Pager:** Previous: Drawer / Panel Slide (`../drawer-slide/`) · Next: Accordion Open/Close (`../accordion/`)
-
----
-
-## accordion — Accordion Open/Close
-
-- **Kind:** do it, step 1 "Click it" — an answer opens only when the visitor presses its question.
-- **Description:** Each question opens smoothly to show its answer. Best for FAQ pages.
-- **Step 1 help line:** Press a question to open its answer and again to close it, or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: every answer closes with its own question.
-- **Show me:** `toRest()` closes every answer at once, without its transition. Then:
- - at once: `toggle(items[0])` opens the first question, as a press does;
- - `later(close, Speed, 1500)`: `toggle(items[0])` closes it, and the run ends. About 2.1 s from press to rest at the defaults.
-
- On `hb:input` (a press, or a wheel or touch that scrolls the box): `stopRun()` only. The answer stays open.
-- **Slow motion:** css. The height or grid-row change, the arrow's turn and the text fade slow down; the opening is the run's movement (Speed) and the 1500ms is a hold. A slowed run takes about 3.3 s.
-- **Reduced motion:** the demo's rule stays: answers open and close at once, without fading.
-- **Stage font:** site font. `.acc-trigger` gets `font-family:inherit` (was `monospace`).
-- **Stage:** the five questions stay, and the stage scrolls: its own rule keeps `overflow:auto`, because open answers can make the list taller than the stage.
- - The questions and answers are rewritten in plain words, because today's name CSS properties and quote code:
- 1. "What is an accordion?" — "A stack of headings that each open to show more below them. It keeps a long page short and easy to scan."
- 2. "Why animate the height?" — "When an answer grows into place, the questions below slide down smoothly instead of jumping, so you keep your place."
- 3. "Can several stay open?" — "It depends on the page. Often opening one closes the others, which keeps the list short, while settings pages usually let several stay open."
- 4. "When should I use one?" — "For questions, settings or long sections that people read one at a time. If everything must be seen at once, show it all instead." and a second paragraph, "Avoid putting accordions inside accordions; two levels is the most people can follow." (it keeps the second paragraph, so the text fade has two pieces to stagger).
- 5. "Does it work with a keyboard?" — "Yes. Each question is a button, so Tab reaches it and Enter or Space opens it, and screen readers hear whether it is open."
- - To fit, `.acc-trigger`'s `min-height` becomes 48px (was 52px) and the stage's padding `clamp(12px,3vw,24px)` (was 24px). Measured: today the five closed questions need 334px, so the phone stage (298px inside) already scrolled before anything opened. After the change they need 290px on a phone and 314px on a short laptop (325px inside).
- - The old phone rule (`height:auto;min-height:500px`) goes.
- - The answers keep their height (or grid-row) animation: the owner allows it here, because the panel opening is the effect itself (see the preamble).
- - `hb-dots`: yes. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long an answer takes to open or close. | `--acc-dur`: 500ms / 300ms / 180ms |
-| Feel | Choice buttons | Gentle · Smooth · Even | Gentle | Gentle eases in and out; Smooth slows at the end. | `--acc-ease`: `ease-in-out` / `ease-out` / `linear` |
-| Several open at once | Switch | on / off | off | Off closes the open answer when you open another. | `multiOpen`: `true` / `false` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Built with | Choice buttons | Measured height · Grid rows | Measured height | Two ways to grow to the answer's height; they look alike. | `switchMethod()`: `'js'` / `'grid'` (open answers close first, as today) |
-| Arrow flips | Switch | on / off | on | The arrow turns to point up while an answer is open. | today's `chevron-tog` handler: every `.acc-chevron` gets no inline transform / `transform:none` |
-| Text fades in | Switch | on / off | off | The answer's text fades in as its box opens. | `applyStagger()`: every `.acc-body` gets / loses `stagger` |
-
-- **Removed:**
- - The note.
- - The Open items readout.
- - The Implementation menu. It becomes Built with.
- - The Duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel. Ease in goes: it starts slowly and stops abruptly, which suits neither opening nor closing.
- - "Allow multiple open", "Rotate chevron" and "Stagger child reveals" become Several open at once, Arrow flips and Text fades in.
-- **Good for:** FAQ pages · Settings · Menus · Long documents · **Avoid on:** Key information · Short content
-- **Prompt:**
-
- > Add an accordion to [the questions or sections you want to fold away]. Show only the headings at first; when one is pressed, its content box grows from nothing to its full height and the headings below slide down, and pressing it again shrinks it back. Animate the box to the content's real height, never to a large fixed maximum, or the timing looks wrong. When the settings include it, turn a small arrow to show which items are open. Make each heading a real button that tells screen readers whether it is open. If the visitor has reduced motion turned on, open and close the sections without animating. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > An accordion is a stack of headings that each open to show more content below them, and close again. The hard part is the movement: the content's box has to grow from nothing to its natural height, which browsers cannot animate on their own. The demo shows two ways to do it: measure the content's height first, or let a grid row grow from nothing to its full size.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long an answer takes to open or close: slow is 500ms, normal 300ms and fast 180ms |
- | Feel | Gentle | Gentle eases in and out, which suits opening and closing alike; Smooth slows at the end; Even keeps one steady speed |
- | Several open at once | off | Off closes the open answer when another opens, which keeps the list short; on suits settings pages |
- | Built with | Measured height | Measured height measures the answer before growing to it; Grid rows lets a grid row grow from nothing to its full size, with no measuring; both look the same |
- | Arrow flips | on | The arrow beside each question turns to point up while its answer is open |
- | Text fades in | off | The answer's text fades in and rises slightly while its box opens, each paragraph a moment after the one before |
-
-- **README See also:**
- - [Toggle / Switch Slide](../toggle-switch/) — a simple on and off with no height change
- - [Drawer / Panel Slide](../drawer-slide/) — a panel that slides in over the page instead
- - [FLIP Technique](../../03-page-transitions/flip-technique/) — moves other elements smoothly when a layout changes
-- **README How it works:** unchanged
-- **README Production notes:** the "Stagger on reveal" bullet ends "see the Text fades in setting in the demo." instead of "see the toggle in the demo." A new last bullet: "**Why the demo animates height**: the answer's box growing is the effect itself, so this demo animates its height (or its grid row) directly, an exception to animating only transform and opacity; keep it cheap by opening one short panel at a time and keeping heavy content, such as videos or large images, out of the panel and away from what moves below it." The rest is unchanged.
-- **Category line:** `04.19 · Micro-Interactions`
-- **Pager:** Previous: Modal Expand (`../modal-expand/`) · Next: Cursor Follower (`../cursor-follower/`)
-
----
-
-## cursor-follower — Cursor Follower
-
-- **Kind:** do it, step 1 "Hover it" — the dot moves only when the visitor moves the pointer over the box or taps in it.
-- **Description:** A dot trails your pointer and flips the colors under it. Best for portfolios.
-- **Step 1 help line:** Move your pointer over the box or tap in it, or press Show me.
-- **Player bar:** Show me. No Reset: nothing stays changed. No Slow motion: the dot follows the pointer on every animation frame, and Lag already sets how slowly it follows.
-- **Show me:** an invisible pointer visits four points, and the dot glides after it (today's `loop()` keeps drawing it). The run sets `mx`/`my`, `inside` and the follower's opacity itself, and adds or removes `expanded` itself when Grows over buttons is on. `toRest()` hides the dot (`inside=false`, opacity 0, no `expanded`).
- - at once: the middle of the first area. `fx`/`fy` jump there as well, as `mouseenter` does, and the dot appears;
- - `later(step, 0, 700)`: the "Button" in the second area, and the dot grows;
- - `later(step, 0, 1400)`: the "Button" in the third area; it stays grown;
- - `later(step, 0, 2100)`: the middle of the fourth area, and it shrinks back;
- - `later(end, 0, 2800)`: the run ends. The dot disappears (opacity 0; it has no fade), unless the pointer is over the stage: the run sets `inside = stage.matches(':hover')` and the opacity to match, so a pointer resting there keeps its dot. About 2.8 s.
-
- The run also stops on a trusted `pointermove` over the stage (see the preamble). On that, or on `hb:input` (a tap or press): `stopRun()` and remove `expanded`; the dot then follows the visitor.
-- **Slow motion:** none.
-- **Reduced motion:** the demo's rule becomes `#follower .shape,#follower circle{transition:none!important}`, so the dot grows at once. The dot still follows the visitor's own pointer with its lag, as today.
-- **Touch:** today the dot is hidden on touch screens (the `pointer:coarse` check), so phones showed nothing. That check goes. A `pointerdown` on the stage whose `pointerType` is not `mouse` sets `mx`/`my` to the tap point and shows the dot. The first tap places it there directly, as `mouseenter` does; later taps make it glide to each new point. The dot stays shown, and the page still scrolls with a swipe over the box (`touch-action` is unchanged).
-- **Stage font:** site font. `.hover-target` drops `font-family:monospace`.
-- **Stage:** the four colored areas and the dot stay.
- - The first area's "Move cursor over stage" becomes "Move your pointer here".
- - The fourth area's "Mix-blend-mode inverts here" becomes "Pass over these words". The old text named the CSS property.
- - The two "Hover target" labels become "Button".
- - The Position readout and both notes go.
- - `cursor:none` on the stage stays.
- - **The dot moves and grows with transforms only** (CLAUDE.md), where today it sets `left`, `top`, `width` and `height`.
- - `#follower` becomes a wrapper at `left:0;top:0`. The loop, the snap on `mouseenter`, the run and the tap move it with `transform:translate(Xpx,Ypx)`. `mix-blend-mode` and the `circle`, `ring`, `square`, `expanded` and `no-blend` classes stay on it.
- - Inside it, a new `.shape` element carries today's Circle and Square rules: its size `var(--follower-size)`, its fill and its corners. `no-blend` still turns its fill to today's `rgba(255,157,92,.5)`. It is centred with `transform:translate(-50%,-50%)` and has `transition:transform .2s ease,border-radius .2s ease` in place of today's `width`/`height` transitions.
- - Growing over a button scales the shape: `#follower.expanded .shape{transform:translate(-50%,-50%) scale(2.5)}`.
- - The square's corners become `1.6px` (4px ÷ 2.5) while expanded, so they still read as 4px.
- - **The Ring shape is drawn as an SVG circle stroke instead of a border.** A border cannot keep 2px: Chrome snaps border widths to whole device pixels. A `.8px` border scaled 2.5 times is 2.5px at 1×, 1.25px at 2× and 1.67px at 3× (today's ring is 2px everywhere), and it dips to about 1px in the first frames of the grow. `vector-effect:non-scaling-stroke` does not undo a CSS scale either (it drew about 5px). An SVG stroke is not snapped:
- - `.shape` holds `<svg aria-hidden="true"><circle/></svg>`, shown only for the Ring shape: `#follower .shape svg{display:none;position:absolute;inset:0;width:100%;height:100%;overflow:visible}` and `#follower.ring .shape svg{display:block}`. The ring's `.shape` has no border and no background, with Flips the colors under it on or off.
- - `#follower .shape circle{cx:50%;cy:50%;r:calc(50% - 1px);fill:none;stroke:#fff;stroke-width:2;transition:stroke-width .2s ease,r .2s ease}` and `#follower.expanded .shape circle{stroke-width:.8;r:calc(50% - .4px)}` use the same duration and easing as the scale. So the grown ring is 2px thick again, and its outer edge stays on the shape's edge: a 40px outer radius for the 32px dot, as today.
- - Mid-grow the ring can be up to about 0.45px thicker for a moment, because the thinning stroke and the growing scale multiply: (2 − 1.2e) × (1 + 1.5e) peaks at 2.45px halfway through.
- - With Flips the colors under it off, the ring keeps today's look: `#follower.no-blend.ring circle{fill:rgba(255,157,92,.5);stroke:var(--ui-accent)}`.
- - `hb-dots`: no, because the four areas fill the stage. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Lag | Choice buttons | Short · Medium · Long | Medium | A longer lag feels heavier and smoother. | `ease`: 0.35 / 0.15 / 0.06 (the share of the gap the dot closes in one 60 Hz frame; a frame that lasted longer or shorter closes the share that fits its time) |
-| Size | Choice buttons | Small · Medium · Large | Medium | How big the dot is before it grows. | `--follower-size`: 20px / 32px / 48px |
-| Flips the colors under it | Switch | on / off | on | Keeps the dot visible on light and dark areas. | the follower's `no-blend` class off / on |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shape | Choice buttons | Circle · Ring · Square | Circle | The outline of the follower. | the follower's class: `circle` / `ring` / `square` |
-| Grows over buttons | Switch | on / off | on | The dot swells while the pointer is on a button. | `expandOnHover`: `true` / `false` (off also removes `expanded`) |
-
-- **Removed:**
- - Both notes.
- - The Position readout.
- - The Size and Easing (lag) sliders. They become Size and Lag.
- - The Shape menu. It becomes Shape.
- - "mix-blend-mode: difference" becomes Flips the colors under it.
- - "Expand on hover targets" becomes Grows over buttons.
- - The check that hid the dot on touch screens.
-- **Good for:** Portfolios · Agency sites · Interactive stories · **Avoid on:** Forms and tools · Reading pages
-- **Prompt:**
-
- > Add a cursor follower to [the page or section where it should appear]. Draw a small shape that follows the pointer with a slight delay: each frame, close a share of the gap that is exponential in the time since the last frame, so it follows at the same pace on every screen. Hide it when the pointer leaves. When the settings include them, let it flip the colors beneath it so it stays visible on light and dark areas alike, and let it grow over buttons and links. Move it with transforms only. Touch screens have no pointer, so hide it there or let it glide to where the visitor taps. If the visitor has reduced motion turned on, keep the normal cursor instead. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A cursor follower is a small shape that trails the mouse pointer with a slight delay, so it glides after it and eases in as it catches up instead of sticking to it. When it flips the colors of whatever is under it, it stays visible on any background, light over dark areas and dark over light ones, without choosing a color for each.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Lag | Medium | How closely the dot follows: on a 60 Hz screen each frame closes 35% (short), 15% (medium) or 6% (long) of the gap to the pointer, and other screens close the share that fits their frame time, so the dot gets 95% of the way in about 0.1, 0.3 or 0.8 seconds everywhere; a longer lag feels heavier |
- | Size | Medium | The dot is 20px, 32px or 48px across |
- | Flips the colors under it | on | The dot inverts the colors beneath it, so it stays visible on light and dark areas; off, it is a see-through orange dot |
- | Shape | Circle | A filled circle, a ring or a small square |
- | Grows over buttons | on | The dot grows to two and a half times its size while the pointer is on a button |
-
-- **README See also:**
- - [Hover State Animation](../hover-state/) — items that react when the pointer is on them
- - [Tooltip Reveal](../tooltip-reveal/) — a label that appears where the pointer rests
- - [Click / Tap Ripple](../click-ripple/) — a ripple from the exact point you click
-- **README How it works:** the snippets follow the transform-only demo; the prose between them stays, except for the frame-rate fix (below).
- - In the first snippet, the loop's two `follower.style.left`/`top` lines become one:
-
- ```js
- follower.style.transform = `translate(${fx}px, ${fy}px)`; // transform only: nothing is laid out again
- ```
-
- - The CSS snippet becomes:
-
- ```css
- #follower {
- position: fixed;
- left: 0; top: 0; /* moved only by transform */
- mix-blend-mode: difference;
- pointer-events: none;
- will-change: transform;
- z-index: 9999;
- }
- #follower .shape {
- width: 32px; height: 32px;
- border-radius: 50%;
- background: #fff;
- transform: translate(-50%, -50%);
- transition: transform .2s ease;
- }
- #follower.expanded .shape { transform: translate(-50%, -50%) scale(2.5); }
- ```
-
-- **README Production notes:**
- - The "Touch devices" bullet gets a last sentence: "The demo sends the dot to each tap only so the effect can be seen on a phone."
- - In the "Performance" bullet, "Updating `left`/`top` (rather than `transform`) on every frame is less optimal — in production, update `transform: translate(x, y)` instead." becomes "The demo moves it with `transform: translate(x, y)` and grows it with `scale()`, so nothing is laid out again while it moves."
- - The rest is unchanged, except that the frame-rate fix (below) rewrites the "Lag calibration" and "GSAP QuickTo" bullets.
-- **Category line:** `04.20 · Micro-Interactions`
-- **Pager:** Previous: Accordion Open/Close (`../accordion/`) · Next: Error Shake (`../error-shake/`)
-- **Frame-rate fix (wrap-up):** `loop(ts)` closes `a = 1 - Math.pow(1 - ease, dt / FRAME)` of the gap each frame instead of `ease`, with `FRAME = 1000/60` and `dt = last === null ? FRAME : Math.min(ts - last, 50)`, so the dot lags the same on every screen: it gets 95% of the way in about 0.1, 0.3 or 0.8 seconds at Short, Medium and Long, at 30, 60, 120 and 144 Hz alike. `a` equals `ease` at 60 Hz. `last` is updated on every frame, also while the dot is hidden, and the loop now starts with `requestAnimationFrame(loop)` instead of a direct call, so its first frame has a timestamp and counts as one 60 Hz frame. The prompt says the share is "exponential in the time since the last frame" (130 words, the test's cap). README: the first snippet is the `loop(ts)` above, with the sentence before it and the paragraph after it rewritten (each 60 Hz frame closes 15%, a frame twice as long 28% and one half as long about 8%, so the follower reaches ~95% of the way in about 300ms on any screen), the Lag row of Key parameters, and the "Lag calibration" and "GSAP QuickTo" Production notes.
-
----
-
-## error-shake — Error Shake
-
-- **Kind:** do it, step 1 "Click it" — the field shakes only when the visitor signs in with a wrong or empty password.
-- **Description:** A field shakes side to side when the input is wrong. Best for sign-in forms.
-- **Step 1 help line:** Sign in with a wrong or empty password (the right one is letmein), or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: typing in the field clears the error, as today. Slow motion shows each swing getting smaller.
-- **Show me:** `toRest()` empties the field and clears its state (`clearState()`). Then:
- - at once: the field gets a wrong password, "abc123" (it shows as dots);
- - `later(shake, 0, 400)`: today's `shake('Incorrect password. Try again.')`, called directly as the old "Replay shake" button did. It does not submit the form and does not focus the field (the submit handler's `focus()` and `select()` would open a phone's keyboard);
- - `later(clear, Speed, 2000)`: the field is emptied and `clearState()` runs, and the run ends. About 2.6 s from press to rest at the defaults (the border and the message take 180ms to clear).
-
- On `hb:input`: `stopRun()`. If the field still holds the run's "abc123", it is emptied and `clearState()` runs, so the visitor starts from a clean field.
-- **Slow motion:** css. The shake (a CSS animation) and the border and message changes slow down. The shake is the run's movement (the Speed in the step that clears the field); the 400ms and 2000ms are holds. A slowed run takes about 3.7 s.
-- **Reduced motion:** the demo's rule stays: no shake, but the red border and the message still show.
-- **Stage font:** site font. The card's title drops `var(--disp)`; `.field input` and `.submit` get `font-family:inherit` (were `var(--mono)` and `var(--disp)`). `.field label` (10px) and `.msg` (10.5px) go up to 11px.
-- **Stage:** the sign-in card stays, with its field, message and Sign in button.
- - The hint line inside the card ("Password is letmein. Try a wrong value…") goes; its words move to the help line.
- - The card's `<h2>` becomes `<p class="card-title">` with the same look (the rule `.card h2` becomes `.card-title`), so the page's headings stay Watch it, Try it and Copy the prompt.
- - `buildShake()` keeps rewriting the `@keyframes shake` rule in `document.styleSheets[0]`. That is still the page's own `<style>`, because the shared stylesheet's link comes after it.
- - The old phone rule (`height:auto;min-height:420px`) goes.
- - `hb-dots`: yes. Default height: the card, with its hint, is 268px tall and fits the 300px phone stage (measured); without the hint it is shorter.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shake distance | Choice buttons | Small · Medium · Large | Medium | How far the field swings left and right. | `--shake-x`: 4px / 8px / 14px |
-| Number of swings | Choice buttons | Few · Medium · Many | Medium | Four to six swings read as a head shake. | `buildShake(n)`: 4 / 6 / 8 |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the whole shake lasts. | `--shake-dur`: 650ms / 400ms / 250ms |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note.
- - "↺ Replay shake". Show me replaces it.
- - The hint line in the card.
- - The Shake intensity, Oscillations and Duration sliders. They become Shake distance, Number of swings and Speed.
-- **Good for:** Sign-in forms · Codes and PINs · Form fields · **Avoid on:** Whole pages · Warnings
-- **Prompt:**
-
- > Add an error shake to [the form field that can be rejected, such as a password]. When the value is wrong or missing, move the field quickly left and right a few times, each swing smaller than the last, and end exactly where it started, like a head shaking no. Turn its border red and show a short message saying what went wrong, because movement and color alone do not explain the problem. Move only its horizontal position so the shake stays smooth, and restart the shake on every failed try. If the visitor has reduced motion turned on, skip the shake and keep the red border and the message. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > An error shake tells someone that what they entered was not accepted. The field swings left and right a few times, each swing smaller than the last, then settles exactly where it started, like a head shaking no. A red border and a short message come with it and say what went wrong.
-
-- **README Key parameters:** (the old Easing and Error color rows go: they are not settings, and How it works already shows both)
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Shake distance | Medium | How far the field swings: small is 4px, medium 8px and large 14px; under 4px barely shows and over about 16px feels violent |
- | Number of swings | Medium | How many times it swings: few is 4, medium 6 and many 8; four to six reads as a head shake, more feels frantic |
- | Speed | Normal | How long the whole shake lasts: slow is 650ms, normal 400ms and fast 250ms; under 250ms feels twitchy and over 600ms drags |
-
-- **README See also:** the second link's text changes from "Focus Ring" to the page's real title.
- - [Form Field Morph](../form-field-morph/) — a label that rises out of the field as you use it
- - [Focus Ring Animation](../focus-ring/) — a ring that follows keyboard focus
- - [Button Press Scale](../button-press-scale/) — a button that shrinks as you press it
- - [Checkmark Draw](../checkmark-draw/) — the tick that says yes
-- **README How it works:** after the CSS snippet, add: "The demo writes this keyframe rule from JavaScript, so the Number of swings setting can give it as many swings as it asks for, each smaller than the last." The rest is unchanged, except that the CSS snippet now shows the six-swing set (final fix wave, below).
-- **README Production notes:** unchanged
-- **Final fix wave (after the category review):**
- - The press the shared script makes on arrival no longer touches a visitor who is already typing. Show me's handler begins `e=>{if(!e.isTrusted&&stage.contains(document.activeElement))return;` (the guard Form Field Morph has), so a password being typed is not emptied and replaced by "abc123". A visitor's own press on Show me still runs the demo.
- - The comment above the stylesheet's `@keyframes shake` now says what is true: `buildShake()` rewrites the rule when the page loads, with swings that decay (six by default), and the copy in the stylesheet only stands in until then (its 80% and 90% swings return to full size).
- - README How it works: the CSS snippet is the six-swing decaying set that `buildShake(6)` writes, rounded: 0% and 100% at 0, then 14% −0.86, 29% 0.71, 43% −0.57, 57% 0.43, 71% −0.29 and 86% 0.14 times `--shake-x`. The old snippet swung back to full size at 80% and 90% while the text called the shake decaying.
-- **Category line:** `04.21 · Micro-Interactions`
-- **Pager:** Previous: Cursor Follower (`../cursor-follower/`) · Next: Swipe to Dismiss (`../swipe-to-dismiss/`)
-
----
-
-## swipe-to-dismiss — Swipe to Dismiss
-
-- **Kind:** do it, step 1 "Drag it" — a message goes only when the visitor drags it away.
-- **Description:** A card dragged sideways flies off and the list closes up. Best for inboxes.
-- **Step 1 help line:** Drag a message sideways and let go, or press Show me.
-- **Player bar:** Show me · Reset. No Slow motion: the card follows the visitor's own hand, and the settle and fly-off are short.
-- **Show me:** `toRest()` rebuilds the list (`build()`) when a message is missing. Then, on the first message (the page has no Slow motion, so each step is a hold, `later(step, 0, ms)`; each drag is drawn frame by frame through `runFrame`, and before each drag the card loses `settling` and `flung`, as today's `pointerdown` does):
- - at once: it is dragged right over 400ms to half the Distance to delete, then let go: today's `spring()` brings it back;
- - `later(drag, 0, 1100)`: it is dragged right over 600ms to the Distance to delete plus 15% of its width, then let go: today's `dismiss(row, card, 1)` flies it off and closes its row;
- - `later(rebuild, 0, 2600)`: the list is rebuilt, as Reset does, and the run ends. About 2.6 s.
-
- Each drag frame sets the card as today's `pointermove` does: `translateX(x)`, opacity `max(0.3, 1 − |x| / (0.9 × width))`, and the red strip (`show`) past 8px while Shows a Delete label is on. On `hb:input`: `stopRun()`. A card still being dragged by the run springs back; a card already gone stays gone, and Reset brings it back.
-- **Reset:** rebuilds all four messages (today's "Reset list", `build()`), after `stopRun()`.
-- **Slow motion:** none.
-- **Reduced motion:** the demo's rules stay: a dismissed row is removed at once (its `reduce` branch), and the spring back has no transition.
-- **Touch:** already Pointer Events with pointer capture; `touch-action:pan-y` on the cards lets the page scroll up and down.
-- **Stage font:** site font. `.reveal` and `.avatar` drop `font-family:var(--disp)`. `.meta .s` goes up to 11px (was 10px).
-- **Stage:** the message list stays, with four messages instead of five. Measured: five 66px rows need 362px, which overflows the 300px phone stage by 31px at the top and bottom and the 327px short-laptop stage by 17px; four need 288px.
- - "Theo Grant — Re: invoice — all sorted" goes.
- - "Kai Morgan — Deploy is green, shipping it" becomes "Kai Morgan — Booked the tickets for June", in plain words.
- - The empty-list line becomes "All cleared. Press Reset to bring them back."
- - The old phone rule (`height:auto;min-height:420px`) goes.
- - The row keeps its height animation as it closes: the owner allows it here, because the list closing up is the effect itself (see the preamble).
- - `hb-dots`: yes. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Distance to delete | Choice buttons | Short · Medium · Long | Medium | How far to drag before letting go deletes it. | `threshold`: 0.2 / 0.35 / 0.5 (share of the card's width) |
-| Shows a Delete label | Switch | on / off | on | A red Delete strip shows behind the card as you drag. | `showReveal`: `true` / `false` (every `.reveal` loses / gets `hidden`) |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note.
- - The Dismiss threshold slider. It becomes Distance to delete.
- - "Show delete background" becomes Shows a Delete label.
- - "↺ Reset list". The player bar's Reset replaces it.
- - The fifth message.
-- **Good for:** Inboxes · Notifications · Chat lists · To-do lists · **Avoid on:** Permanent deletes · Mouse-only tools
-- **Prompt:**
-
- > Add swipe to dismiss to [the list items people should be able to remove]. While an item is dragged sideways, it follows the finger exactly and fades a little; when the settings include it, a red Delete label shows behind it. On release, remove it if it went far enough or was flicked quickly: it slides off the edge and its row closes up so the list moves up smoothly. Otherwise it springs back into place. Use pointer events so mouse, touch and pen all work, and let up-and-down scrolling still pass through. Offer an undo, and a button for people who cannot drag. If the visitor has reduced motion turned on, remove the row at once without sliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Swipe to dismiss removes a list item when you drag it sideways. While you drag, the card follows your finger exactly; when you let go, it either flies off the edge while its row closes up, or springs back into place. A long drag or a quick flick removes it. It is the gesture behind swipe-to-delete in mail and message apps.
-
-- **README Key parameters:** (the old Velocity threshold, Fly-off distance and Collapse duration rows go: they are not settings; the flick moves into the first row)
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Distance to delete | Medium | How far a card must be dragged before letting go deletes it: short is 20%, medium 35% and long 50% of its width; a quick flick deletes it from a shorter drag |
- | Shows a Delete label | on | A red strip with the word Delete shows behind the card while it is dragged |
-
-- **README See also:** the first link's text changes from "Drawer Slide" to the page's real title.
- - [Drawer / Panel Slide](../drawer-slide/) — another panel moved by a gesture
- - [Modal Expand](../modal-expand/) — a window that grows out of the button you pressed
- - [Button Press Scale](../button-press-scale/) — a button that shrinks as you press it
- - [Toggle / Switch Slide](../toggle-switch/) — a smaller control that slides and settles
-- **README How it works:** unchanged
-- **README Production notes:** a new bullet after "Collapse the row, not the card": "**Why the demo animates height**: the list closing up is the effect itself, so the row's height goes to zero, an exception to animating only transform and opacity; it stays cheap because only one short row changes at a time, the card itself moves with transform and opacity, and the row is removed as soon as its height reaches zero." The rest is unchanged.
-- **Category line:** `04.22 · Micro-Interactions`
-- **Pager:** Previous: Error Shake (`../error-shake/`) · Next: Hamburger Menu Toggle (`../hamburger-menu-toggle/`)
-
----
-
-## hamburger-menu-toggle — Hamburger Menu Toggle
-
-- **Kind:** do it, step 1 "Click it" — the icon changes only when the visitor presses it.
-- **Description:** Three lines turn into an X as the menu opens. Best for mobile menus.
-- **Step 1 help line:** Press the button to open the menu and again to close it, or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: pressing the button again closes the menu.
-- **Show me:** `toRest()` closes the menu at once, with the transitions of the lines, the menu, its items and `.pair` switched off, so pressing Show me while the menu is open does not leave the button raised through the run. Today's click handler becomes a `toggle()` function, which the button and the run both call. Then:
- - at once: `toggle()` opens: the lines cross, and the menu drops in;
- - `later(toggle, Speed + 210, 1200)`: `toggle()` closes (the 210ms is the last menu item's delay), and the run ends. About 2.1 s from press to rest at the defaults.
-
- On `hb:input`: `stopRun()` only. The menu stays as it is.
-- **Slow motion:** css. The movement is Speed + 210ms (the lines, and the last menu item's delay); the 1200ms is a hold. A slowed run takes about 3.9 s.
-- **Reduced motion:** the demo's rule stays, and it lists the new `.pair` as well: the icon, the menu and the pair switch at once.
-- **Stage font:** site font (no rule to change).
-- **Stage:** the button and the menu stay. The "State: closed" readout goes, with its rules.
- - **The menu opens with transform and opacity instead of `max-height`** (CLAUDE.md).
- - `.menu` loses `max-height`, `overflow:hidden` and their transition, and keeps its full height in the layout.
- - It gets `opacity:0;transform:translateY(-8px);visibility:hidden;transition:opacity var(--dur) var(--ease),transform var(--dur) var(--ease),visibility 0s linear var(--dur)`.
- - `.menu.show` gets `opacity:1;transform:none;visibility:visible;transition:opacity var(--dur) var(--ease),transform var(--dur) var(--ease),visibility 0s`, so the closed menu is hidden from screen readers too.
- - The items keep their staggered slide and fade.
- - **The button stays centred at rest, as today, with transforms only.**
- - The button and the menu are wrapped in a new `.pair`: a centred flex column with `width:100%` and `gap:20px`, in place of the stage's 28px gap. The stage centres the pair. Without `width:100%` the pair would shrink to the 76px button, and the menu's `width:100%;max-width:280px` would shrink with it. With it, the menu is 280px wide on computers, 277px on a 375px phone and 222px on a 320px phone.
- - At rest the pair is moved down by half of the menu and its gap, so the button sits in the middle: `.pair{transform:translateY(calc(50% - 38px));transition:transform var(--dur) var(--ease)}`. Here 50% is half the pair's own height, and 38px is half the 76px button.
- - When the menu opens, `.pair:has(> .menu.show){transform:none}` slides the pair up with the same timing as the menu's fade and slide. So the pair re-centres as it does today, where the button rises as the menu grows.
- - `.menu` gets `flex-shrink:0` (today's has none). The pair is 278px tall (76 + 20 + 182), so the open menu and the button are centred in the 300px phone stage. Today the open menu is squeezed into what is left of the stage, which cuts off its last item on phones and short laptops (measured).
- - Short laptop windows get a 260px stage from the shared stylesheet, where the open pair (278px) would be cut off 10px at the top and the bottom. `@media (min-width:601px) and (max-height:640px){.pair{gap:12px}.menu ul{gap:4px}.menu li{padding:10px 14px}}` makes it 248px, which fits the 258px inside the stage with 5px to spare at each end (the width condition keeps portrait phones, whose 300px stage already fits the 278px pair, on the normal layout) (measured in a 1366×580 window). The stage's height does not change.
- - The old phone rule (`height:auto;min-height:400px`) goes.
- - `hb-dots`: yes. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the lines take to turn into an X. | `--dur`: 550ms / 340ms / 200ms |
-| Feel | Choice buttons | Gentle · Springy · Smooth · Even | Gentle | Springy lets the X overshoot a little, then settle. | `--ease`: `cubic-bezier(.65,0,.35,1)` / `cubic-bezier(.34,1.56,.64,1)` / `ease-out` / `linear` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Line thickness | Choice buttons | Thin · Medium · Thick | Medium | Thicker lines read better at small sizes. | `--bar-h`: 2px / 4px / 6px |
-
-- **Removed:**
- - The note, and the help text under the controls.
- - The State readout.
- - The Duration and Bar thickness sliders. They become Speed and Line thickness.
- - The Easing menu. It becomes Feel.
-- **Good for:** Mobile menus · Compact headers · Side panels · **Avoid on:** Wide desktop menus
-- **Prompt:**
-
- > Add a menu button whose three lines turn into an X to [the menu button in your header]. When it is pressed, the top and bottom lines move to the middle and turn to cross each other while the middle line fades away, and pressing it again reverses the change. Use the same three lines for both states, moving and turning them rather than swapping icons, and move each outer line exactly to the middle so the X meets at its center. Make it a real button that tells screen readers whether the menu is open. If the visitor has reduced motion turned on, switch between the two icons without movement. Match the settings listed below.
-
-- **README What it is:** keep
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the change takes: slow is 550ms, normal 340ms and fast 200ms; below about 200ms it snaps and above 500ms it drags |
- | Feel | Gentle | Gentle eases in and out; Springy lets the X overshoot a little, then settle; Smooth slows to a stop; Even keeps one steady speed |
- | Line thickness | Medium | The lines are 2px, 4px or 6px thick; thicker lines read better at small sizes |
-
-- **README See also:** each link gets a phrase, and the second link's text changes from "Drawer Slide" to the page's real title.
- - [Toggle / Switch Slide](../toggle-switch/) — a switch that slides between on and off
- - [Drawer / Panel Slide](../drawer-slide/) — the side panel such a button often opens
- - [Modal Expand](../modal-expand/) — a window that grows out of the button you pressed
-- **README How it works:** the snippet's open-state lines take today's calculation, which follows Line thickness (today's `translateY(16px)` is right only for 4px lines). The snippet becomes:
-
- ```css
- .bar{transition:transform var(--dur) var(--ease),opacity calc(var(--dur)*.6) var(--ease)}
- /* Half the 36px box minus half a line, so the lines meet at any thickness */
- .burger[aria-expanded="true"] .bar.top{transform:translateY(calc(18px - var(--bar-h)/2)) rotate(45deg)}
- .burger[aria-expanded="true"] .bar.mid{opacity:0;transform:scaleX(.2)}
- .burger[aria-expanded="true"] .bar.bot{transform:translateY(calc(var(--bar-h)/2 - 18px)) rotate(-45deg)}
- ```
-
- The prose stays, except the last sentence of the first paragraph (final fix wave, below).
-- **README Production notes:** unchanged
-- **Final fix wave (after the category review):**
- - README How it works: "Because only `transform` and `opacity` change, the morph stays on the compositor" was true of the bars only; the button's border color and the menu's visibility change too. The sentence now says the bars change only `transform` and `opacity`, so the morph stays on the compositor, and that around it the button's border turns orange with a color transition and the menu opens with `opacity` and `transform` (plus `visibility`, so a closed menu is out of reach). The page is unchanged.
-- **Category line:** `04.23 · Micro-Interactions`
-- **Pager:** Previous: Swipe to Dismiss (`../swipe-to-dismiss/`) · Next: Theme Toggle Morph (`../theme-toggle-morph/`)
-
----
-
-## theme-toggle-morph — Theme Toggle Morph
-
-- **Kind:** do it, step 1 "Click it" — the icon changes only when the visitor presses it.
-- **Description:** A sun turns into a moon as the colors switch to dark. Best for theme buttons.
-- **Step 1 help line:** Press the sun to switch to dark and the moon to switch back, or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: pressing the button again switches back to light, and Show me starts from light; today's "Reset to light" goes.
-- **Show me:** `toRest()` switches to light at once, without the transitions (`setDark(false)`). Then:
- - at once: `setDark(true)`, as a press does: the sun becomes the moon, and the card flips to dark;
- - `later(back, Speed, 1000)`: `setDark(false)`, and the run ends. About 2 s from press to rest at the defaults.
-
- On `hb:input`: `stopRun()` only.
-- **Slow motion:** css. The rays, the cut-out circle, the card flip and the button's color slow down; the change is the run's movement (Speed) and the 1000ms is a hold. A slowed run takes about 4 s.
-- **Reduced motion:** the demo's rule stays: the icon and the card switch at once.
-- **Stage font:** site font (no font rule to change). The card's `.face .st` ("preview card") goes up to 11px (was 9px).
-- **Stage:** the button and the flip card stay. The state label ("Light theme active") goes: it is a readout, and the button's own label says what it will do. That label is the button's `aria-label`, an action ("Switch to dark theme", then "Switch to light theme"), which `setDark()` sets together with the class. The button has no `aria-pressed`: a toggle's name must not change, and with both a screen reader says "Switch to light theme, toggle button, pressed", which contradicts itself.
- - To fit, `--toggle-size` becomes `clamp(72px,12vw,104px)` (the Toggle Size slider goes; see Removed), the card's width becomes `min(220px,80%)` (was `min(260px,80%)`) and the stage's `gap` becomes `clamp(20px,4vh,40px)` (was `clamp(28px,5vh,52px)`). Measured: today the button and the card need 327px on a short laptop, which fills the 327px stage from edge to edge, and 311px on a phone, which overflows its 300px stage. After the change they take about 296px on a short laptop and 270px on a phone.
- - The card's face texts stay; the card is `aria-hidden`, as today.
- - The old phone rule (`height:auto;min-height:440px`) goes.
- - `hb-dots`: yes. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the sun takes to become a moon. | `--morph-dur`: 800ms / 500ms / 300ms |
-| Feel | Choice buttons | Gentle · Springy · Even | Gentle | Springy overshoots a little, then settles. | `--morph-ease`: `cubic-bezier(.4,0,.2,1)` / `cubic-bezier(.34,1.56,.64,1)` / `linear` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note.
- - The state label.
- - "↺ Reset to light".
- - The Morph Duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel. "Ease in-out" goes: it looked nearly the same as the default curve, now Gentle.
- - The Toggle Size slider. The icon now follows the screen size, from 72px on phones to 104px on wide screens, and its size does not change the effect.
-- **Good for:** Theme buttons · Settings · Headers · **Avoid on:** Dense forms · Icons without labels
-- **Prompt:**
-
- > Add a theme toggle whose icon turns from a sun into a moon to [the button that switches your site between light and dark]. When it is pressed, the sun's rays shrink into its center while a circle slides across the sun and cuts it into a crescent, so the sun becomes the moon instead of being swapped for another icon. Switch the page's colors at the same moment and at the same pace. Make it a real button whose label says what pressing it will do, and remember the visitor's choice for their next visit. If the visitor has reduced motion turned on, switch the icon and the colors without movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A theme toggle morph is one icon that turns from a sun into a crescent moon when you switch a site from light to dark. The sun's rays shrink into its center while a hidden circle slides across the sun and cuts it into a crescent, so the two states are clearly the same shape changing. In the demo, a small preview card flips to its dark side at the same time.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the change takes: slow is 800ms, normal 500ms and fast 300ms; under about 200ms the crescent forms too fast to see, and over 800ms it drags |
- | Feel | Gentle | Gentle eases in and out; Springy overshoots a little, then settles; Even keeps one steady speed |
-
-- **README See also:** each link gets a phrase.
- - [Toggle / Switch Slide](../toggle-switch/) — a switch that slides between on and off
- - [Hamburger Menu Toggle](../hamburger-menu-toggle/) — three lines that turn into an X
- - [Checkmark Draw](../checkmark-draw/) — a tick that draws itself
-- **README How it works:** one sentence changes. "Only `transform` and `opacity` animate." becomes "The rays, the disc, the cut-out circle and the card change only `transform` and `opacity`. The icon's color fades from orange to lavender through a `color` transition on the button, which the SVG picks up with `currentColor`." The rest is unchanged.
-- **README Production notes:** the first sentence changes. "The control is a real `<button>` with `aria-pressed` reflecting the current mode and an `aria-label` that names the *action* ("Switch to dark theme"), updated on each toggle so screen readers announce the change." becomes "The control is a real `<button>` whose `aria-label` names the *action* ("Switch to dark theme") and changes with each press, so screen readers say what pressing it will do; leave `aria-pressed` off, because a toggle's name must not change and "Switch to light theme, pressed" contradicts itself (for `aria-pressed`, use a fixed name such as "Dark theme")." Later in the paragraph, "set the class and `aria-pressed`" becomes "set the class and the label". The rest is unchanged.
-- **Category line:** `04.24 · Micro-Interactions`
-- **Pager:** Previous: Hamburger Menu Toggle (`../hamburger-menu-toggle/`) · Next: Copy to Clipboard (`../copy-to-clipboard/`)
-
----
-
-## copy-to-clipboard — Copy to Clipboard
-
-- **Kind:** do it, step 1 "Click it" — the button confirms only when the visitor presses it.
-- **Description:** Copy turns into a tick and Copied, then changes back. Best for codes and links.
-- **Step 1 help line:** Press Copy and watch the button confirm, then change back, or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: the button changes back by itself.
-- **Show me:** plays the confirmation without copying anything. `toRest()` removes `copied` at once, without the transitions. Then the run adds `copied` to the button and starts the button's own revert timer (`timer`, Time before it changes back), exactly as a successful copy does. The run is only that step, so it ends at once (no run timer is left), and the button changes back on its own timer: about 1.8 s from start to rest at the defaults (1.3 s to 2.8 s).
- - It never writes to the clipboard: that would replace what the visitor copied, and browsers refuse a copy nobody pressed for.
- - It never writes "Copied to clipboard" into the live region.
- - A real press of Copy during the confirmation takes over the same timer, as today. `hb:input` has nothing to stop.
-- **Slow motion:** css. The icon change, the label change, the color change and the pulse slow down. The button's revert timer, for a real copy and for Show me alike, counts the 520ms pulse as movement and the rest as a hold: it waits 520ms × (3 while Slow motion is on) + (Time before it changes back − 520ms). So the button never changes back before the slowed pulse has ended; without Slow motion nothing changes. A slowed run takes about 3.4 s.
-- **Reduced motion:** the demo's rule stays: the icon and label swap without movement or pulse.
-- **Stage font:** site font. `.copy-btn` gets `font-family:inherit` (was `var(--mono)`); `pre` goes with the snippet (see Stage).
-- **Stage:** rewritten, because the page shows no code. Today the stage shows a five-line JavaScript snippet ("snippet.js").
- - It becomes an invite code: a small box with the label "Your invite code" (`--ui-muted`, 12px) and the code "MOTION-2026" (20px, weight 700), with the Copy button beside it. The box and the button sit in a centred row that wraps on narrow screens.
- - The code element keeps `id="snippet"`, so Copy copies "MOTION-2026". The button's `aria-label` becomes "Copy invite code" (today's says "Copy code snippet").
- - The "snippet.js / click copy to grab it" header goes, and so does the line "Uses navigator.clipboard.writeText with a document.execCommand fallback." (a note in code words).
- - The visually hidden live region stays.
- - The stage's own rule becomes `display:flex;align-items:center;justify-content:center;padding:24px`. It had no fixed height; now it has the default one.
- - `hb-dots`: yes.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How quickly the icon and label change. | `--dur`: 450ms / 280ms / 170ms |
-| Time before it changes back | Choice buttons | Short · Medium · Long | Medium | How long Copied! stays before the button resets. | `revert`: 1000 / 1500 / 2500 (ms; the revert timer counts its first 520ms as movement, see Slow motion) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Springy · Smooth · Even | Springy | Springy gives the tick a small bounce. | `--ease`: `cubic-bezier(.34,1.4,.5,1)` / `ease-out` / `linear` |
-
-- **Removed:**
- - Both notes.
- - The code snippet, its header and the line about the clipboard code.
- - The Revert delay and Animation duration sliders. They become Time before it changes back and Speed.
- - The Easing menu. It becomes Feel. "Ease in-out" goes: on a change this short it looked the same as Ease out, now Smooth.
-- **Good for:** Share links · Invite codes · Code blocks · API keys · **Avoid on:** Slow actions · Important saves
-- **Prompt:**
-
- > Add copy feedback to [the Copy button next to your code, link or key]. When the copy succeeds, turn the button's icon into a tick and its label into Copied!, with a brief flash of color, then change it back on its own after a moment so it is ready to use again. Stack both icons and both labels in the same place so the change never shifts the layout. Show the confirmation only once the copy has really worked, tell screen readers with a short status message, and say so if copying fails. If the visitor has reduced motion turned on, swap the icon and label without movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Copy feedback is the short confirmation a Copy button gives after it copies something. The clipboard icon turns into a tick, the label changes from Copy to Copied! and a brief flash of color marks the moment. After a second or two the button changes back, ready to use again.
-
-- **README Key parameters:** (the old Pulse row goes: it is not a setting)
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the icon and label take to change: slow is 450ms, normal 280ms and fast 170ms |
- | Time before it changes back | Medium | How long Copied! stays: short is 1 second, medium 1.5 and long 2.5; under a second feels rushed, and over about three seconds it lingers |
- | Feel | Springy | Springy gives the tick a small bounce; Smooth slows to a stop; Even keeps one steady speed |
-
-- **README See also:** the phrases lose their code words.
- - [Checkmark Draw](../checkmark-draw/) — a tick that draws itself
- - [Button Press Scale](../button-press-scale/) — a button that shrinks as you press it
- - [Success Confetti](../success-confetti/) — a bigger celebration for a bigger moment
-- **README How it works:** unchanged. The snippet still copies `snippet.innerText`, which is now the invite code.
-- **README Production notes:** unchanged
-- **Category line:** `04.25 · Micro-Interactions`
-- **Pager:** Previous: Theme Toggle Morph (`../theme-toggle-morph/`) · Next: Star Rating (`../star-rating/`)
-
----
-
-## star-rating — Star Rating
-
-- **Kind:** do it, step 1 "Click it" — the stars fill and pop only as the visitor points at them and chooses one.
-- **Description:** Stars fill up to your pointer and pop when you choose. Best for reviews.
-- **Step 1 help line:** Point along the stars and click or tap one to choose, or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: a click, or the arrow, Home and End keys, sets any rating.
-- **Show me:** `toRest()` sets the rating back to 3 (`rating=3; commit(false)`). Then an invisible pointer sweeps along the row (n is Number of stars). The sweep's steps and the wait for the pop are movement; the 1200ms is a hold:
- - `later(step, i × 120, 0)` for i = 0 to n − 1: `render(i + 1)`, and `later(step, n × 120, 0)`: `render(n − 1)`, as the pointer comes back one star;
- - `later(choose, (n + 1) × 120, 0)`: `rating = n − 1` (or n − 0.5 while Allows half stars is on) and `commit(true)`, which pops that star;
- - `later(back, (n + 1) × 120 + 420, 1200)`: `rating = 3; commit(false)`, and the run ends. About 2.5 s from press to rest with five stars (the last fill takes 180ms).
-
- The run does not call `rate.focus()`. It also stops on a trusted `pointermove` over the stage, as on the Hover it pages, because the row's own hover preview would fight the sweep. On that or on `hb:input`: `stopRun()` and `render(rating)`, so the stars show the committed rating.
-- **Slow motion:** css. The fill's color change and the pop slow down, and so do the sweep and the wait for the pop (movement); the 1200ms hold stays. A slowed run takes about 5.2 s from press to rest with five stars.
-- **Reduced motion:** the demo's rule stays: the stars fill at once, with no pop.
-- **Touch:** already Pointer Events. The row's `touch-action:none` lets a finger dragged along it preview, and a tap chooses.
-- **Stage font:** site font. `.value` drops `var(--disp)` and `.value small` drops `var(--mono)`.
-- **Stage:** the stars and the score under them ("3.0 / 5") stay. The score is part of the control: it gives the rating in numbers as well as color, as the README's accessibility note says.
- - The hint line ("Click a star, or focus the control…") goes; its words move to the help line.
- - The Committed readout goes.
- - `hb-dots`: yes. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pop size | Choice buttons | Small · Medium · Large | Medium | How much the chosen star grows as it pops. | `--pop`: 1.15 / 1.35 / 1.6 |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How quickly each star fills with color. | `--fill-dur`: 300ms / 180ms / 110ms |
-| Allows half stars | Switch | on / off | off | The left half of a star gives half a point. | today's half-star handler: `step` 0.5 / 1 (turning it off rounds the rating, then `commit(false)`) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of stars | Choice buttons | Three · Five · Ten | Five | Five is the usual scale; ten gives finer steps. | `count`: 3 / 5 / 10, then `build()` |
-
-- **Removed:**
- - The note.
- - The hint line on the stage.
- - The Committed readout.
- - The Star count, Pop intensity and Fill duration sliders. They become Number of stars, Pop size and Speed; the fill no longer reaches zero.
- - The panel's own half-star switch. It becomes Allows half stars.
-- **Good for:** Reviews · Surveys · Feedback forms · Media ratings · **Avoid on:** Precise scores
-- **Prompt:**
-
- > Add a star rating to [the review or feedback form]. As the pointer moves along the row, fill the stars up to the one under it so the choice shows before it is made, and bring back the chosen rating when the pointer leaves. Clicking or tapping a star chooses that rating and makes the star pop: it grows briefly, dips a little below its size and settles. On touch screens, a finger dragged along the row previews too. Make the row one control that the arrow keys can change, and show the rating as a number as well, so it never depends on color alone. If the visitor has reduced motion turned on, fill the stars without the pop. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A star rating lets someone give a score by choosing a star. As the pointer moves along the row, the stars fill up to the one under it, so the choice shows before it is made; clicking or tapping a star chooses it and makes it pop. The arrow keys change the rating too, and a setting lets each star count in halves.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pop size | Medium | How big the chosen star grows as it pops: 1.15, 1.35 or 1.6 times its size; above about 1.6 it looks rubbery |
- | Speed | Normal | How long each star takes to fill with color: slow is 300ms, normal 180ms and fast 110ms; it sets how smoothly the fill follows the pointer |
- | Allows half stars | off | Pointing at the left half of a star gives half a point, and the arrow keys move in halves |
- | Number of stars | Five | Three, five or ten stars; five is the usual scale |
-
-- **README See also:** the first link's text changes from "Heart Burst" to the page's real title, and the phrases get plainer.
- - [Heart / Like Burst](../heart-burst/) — a like button that bursts into small hearts
- - [Button Press Scale](../button-press-scale/) — a button that shrinks as you press it
- - [Toggle / Switch Slide](../toggle-switch/) — another small control that animates its state
-- **README How it works:** unchanged
-- **README Production notes:** unchanged, except the last sentence of the Touch targets bullet (final fix wave, below)
-- **Final fix wave (after the category review):**
- - The row's focus rule keeps a transparent outline: `.stage .rate:focus-visible{outline:2px solid transparent;…}` in place of `outline:none`, as on Segmented Control. Forced-colors mode removes `box-shadow`, so the row had no focus ring there; now the outline shows as a ring in the system color. Outside forced-colors mode the box-shadow ring looks exactly as before and the transparent outline is invisible.
- - The rule that wraps more than five stars into two equal rows now covers windows up to 870px wide (was 845px). With classic scrollbars, ten stars wrapped nine and one between 846px and 863px: they fit one row from 864px (846px without scrollbars), and 870px leaves room for wider scrollbars. Up to 870px ten stars now sit in two rows of five.
- - README Touch targets: the last sentence no longer says hover styling is gated behind `(hover: hover)`, because the page has had no `:hover` rule since 89c0379. It says there is no CSS `:hover` style, so nothing stays painted after a tap, that the preview comes from `pointermove`, and that a finger's drag asks `document.elementFromPoint` which star is under it.
-- **Category line:** `04.26 · Micro-Interactions`
-- **Pager:** Previous: Copy to Clipboard (`../copy-to-clipboard/`) · Next: Toast Notification (`../toast-notification/`)
-
----
-
-## toast-notification — Toast Notification
-
-- **Kind:** do it, step 1 "Click it" — a toast appears only when the visitor presses the button on the stage.
-- **Description:** Short messages slide into a corner, then leave on their own. Best for updates.
-- **Step 1 help line:** Send a toast, then tap or swipe it away early, or press Show me.
-- **Player bar:** Show me · Reset. No Slow motion: each toast's countdown bar is a CSS animation that decides when it leaves, so slowing the stage would also triple its time on screen.
-- **Show me:** `toRest()` removes any toasts at once (without their exit). Then the run presses the stage's button once: `spawn(DEMO)` brings in a neutral example, `DEMO = ['ok','Example','A toast like this confirms an action.']`. `spawn()` takes an optional `[type, title, text]` message and, given none, picks one of `TYPES` at random, as today. So a run is always the same, and screen readers, which hear every toast in the `role="status"` stack (on arrival too), hear an honest example rather than a pretend "Saved". The run is only that press, so it ends at once (no run timer is left). The toast then lives like any other: it comes in, its bar counts down Time on screen, and it leaves by itself.
- - From press to rest takes about 4.3 s at Medium (2.8 s at Short, 6.8 s at Long): the countdown starts as the toast arrives, and leaving takes 300ms. That is longer than most runs, because leaving on its own is the point of a toast.
- - `hb:input` has nothing to stop.
-- **Reset:** dismisses every toast, as "Dismiss all" did (each leaves the way it came), after `stopRun()`.
-- **Slow motion:** none.
-- **Reduced motion:** the demo's rules stay: toasts appear and disappear without movement, and the bar is hidden (`.toast .prog{visibility:hidden}`) but keeps counting down, so its `animationend` still dismisses each toast after Time on screen, and hover, focus inside the toast and a held finger still pause it. This is a change of the final wave: the bar used to be removed (`animation:none`) and a `setTimeout` in `spawn()` dismissed each toast whatever the pointer or the focus was doing, so a toast could go while it was hovered or while a keyboard user was on ×, and the focus fell back to `<body>`. The timer, and the `clearTimeout` calls for it in `leave()` and `toRest()`, are gone. A toast under reduced motion still lives Time on screen (measured 2.5 s and 4 s).
-- **Touch:** already Pointer Events: a drag past 35% of its width or a tap dismisses a toast. Holding a finger on a toast pauses its countdown (the `paused` class). Pointing at a toast pauses it too, inside `@media (hover: hover)`, as today.
-- **Stage font:** site font. `.toast .ic` and `.toast .ti` drop `font-family:var(--disp)`; `.toast .x` and the new `.send` get `font-family:inherit`. `.toast .ms` goes up to 11px (was 10.5px).
-- **Stage:** the corner stack stays.
- - The hint "Trigger a toast →" pointed at the old panel, so it goes, and so do the script's lines that hide and show it.
- - The old panel's "Trigger toast" button moves onto the stage as `<button class="send" id="send" type="button">Send a toast</button>`, with the old button's look (accent background, dark text, at least 44px tall), so the demo still works without the panel. Its listener is `()=>spawn()`: `addEventListener('click', spawn)` would pass the click event as the message.
- - The button sits at the edge opposite the corner, centred across: 16px from the bottom while toasts stack in a top corner, and 16px from the top while they stack in a bottom corner (the Corner handler toggles a class such as `at-top` on it).
- - `.toaster` gets `pointer-events:none` and `.toast` `pointer-events:auto`, so the stack's empty box no longer covers the button.
- - The stage's own `min-height:min(62vh,480px)` goes, because the page owns the height. Its own rule sets `--hb-stage-h-phone:420px`, and `position:relative;overflow:hidden` and its radial background stay.
- - Measured with the 11px message text on the 420px phone stage: four toasts end 281px down on a 375px phone, and 338px down on a 320px phone, where every message wraps to two lines (74px toasts). The button sits at 359–403px on every phone, so it clears both and its whole face stays pressable. At about 380px it would start at 319px, and the fourth toast would cover its top on a 320px phone. On tablets and computers the stack (300px wide, in a corner) never reaches the button, and four toasts fit every stage.
- - `hb-dots`: no, because the stage keeps its radial background.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Corner | Choice buttons | Top left · Top right · Bottom left · Bottom right | Top right | Where toasts appear and stack. | `corner`: `'tl'` / `'tr'` / `'bl'` / `'br'` (the stack's class `toaster tl` … at once, as today) |
-| How it comes in | Choice buttons | Slides · Fades · Grows | Slides | How each toast arrives and leaves. | `style`: `'slide'` / `'fade'` / `'scale'` |
-| Time on screen | Choice buttons | Short · Medium · Long | Medium | How long a toast stays before it leaves. | `dur`: 2.5 / 4 / 6.5 (seconds; each new toast's `--dur`) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Most at once | Choice buttons | Two · Three · Four | Four | The oldest leaves when a new one needs room. | `limit`: 2 / 3 / 4, then `enforce()` |
-
-- **Removed:**
- - The note.
- - The hint on the stage.
- - The Corner and Animation menus. They become Corner and How it comes in.
- - The Auto-dismiss and Stack limit sliders. They become Time on screen and Most at once. Five and six go: a stack of five (about 347px) does not fit the 327px short-laptop stage, and the newest toast would be cut off. One goes too: with room for a single toast, each new one pushes the last out, and the stacking never shows.
- - "Trigger toast" moves onto the stage as Send a toast.
- - "Dismiss all". The player bar's Reset replaces it.
-- **Good for:** Save confirmations · Upload updates · Sync notices · **Avoid on:** Errors that need action · Long messages
-- **Prompt:**
-
- > Add toast notifications to [the actions in your app that should be confirmed quietly, such as saving]. Each toast comes into a corner of the screen with a short message and a thin bar that empties as it counts down, then leaves on its own. New toasts stack; when one leaves, the others glide over to close the gap, moved with transforms rather than by changing the layout. Pause the countdown while the pointer is over a toast, and let a tap, a sideways swipe or a close button dismiss it early. Announce each message to screen readers without moving focus. If the visitor has reduced motion turned on, show and hide toasts without movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A toast is a small message that comes into a corner of the screen, stays for a few seconds and then leaves on its own, while a thin bar counts down the time it has left. Toasts stack when several arrive close together, and when one leaves, the others glide over to close the gap. A tap, a swipe or its close button dismisses one early.
-
-- **README Key parameters:** (the old Swipe threshold and Reflow duration rows go: they are not settings)
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Corner | Top right | Where toasts appear and stack; in the bottom corners the newest sits nearest the corner |
- | How it comes in | Slides | Slides in from its corner's side, fades in, or grows from slightly smaller; it leaves the same way |
- | Time on screen | Medium | How long each toast stays: short is 2.5 seconds, medium 4 and long 6.5; its bar counts down this time |
- | Most at once | Four | Two, three or four; when one more arrives, the oldest leaves |
-
-- **README See also:** the first link's text changes from "Drawer Slide" to the page's real title, and the phrases get plainer.
- - [Drawer / Panel Slide](../drawer-slide/) — a bigger panel that slides in from an edge
- - [Modal Expand](../modal-expand/) — a window that must be closed before you go on
- - [Success Confetti](../success-confetti/) — a celebration for a finished task
-- **README How it works:** unchanged
-- **README Production notes:** the "Respect reduced motion" bullet says to drop the slide/scale, to appear and disappear instantly, and to hide the bar but keep its countdown running unseen, so `animationend` still dismisses the toast and hover and focus still pause it (it advised a `setTimeout` fallback, which ignores both). The rest is unchanged.
-- **Category line:** `04.27 · Micro-Interactions`
-- **Pager:** Previous: Star Rating (`../star-rating/`) · Next: Segmented Control (`../segmented-control/`)
-
----
-
-## segmented-control — Segmented Control
-
-- **Kind:** do it, step 1 "Click it" — the highlight moves only when the visitor picks an option.
-- **Description:** A highlight slides to the option you pick. Best for switching views.
-- **Step 1 help line:** Press an option or move with the arrow keys, or press Show me.
-- **Player bar:** Show me · Slow motion (css). No Reset: pressing the first option brings the demo back.
-- **Show me:** `toRest()` chooses the first option at once (`current=0; move(0,false); paint()`). Then:
- - at once: `current = n − 1; move(n − 1, true); paint()` chooses the last option, so the highlight slides the whole way (n is Number of options);
- - `later(back, Speed, 1200)`: `current = 0; move(0, true); paint()` chooses the first again, and the run ends. About 1.9 s from press to rest at the defaults.
-
- The run uses `move()` and `paint()`, not `select()`, which would move the keyboard focus. On `hb:input`: `stopRun()` only.
-- **Slow motion:** css. The slide and the labels' color change slow down; the slide is the run's movement (Speed) and the 1200ms is a hold. A slowed run takes about 3.2 s.
-- **Reduced motion:** the demo's rule stays: the highlight jumps.
-- **Stage font:** site font. `.seg-opt` gets `font-family:inherit` (was `var(--mono)`).
-- **Stage:** the control stays; the "Selected" readout goes.
- - The control's class `seg` becomes `seg-track`, and the rules `.seg`, `.seg.underline .seg-ind` and `.seg.underline .seg-opt[aria-checked="true"]` follow, as does the script's `classList.toggle('underline', …)`. The shared stylesheet styles `.hb-page .seg` and its buttons as Try it choice buttons (borders, gaps, 15px text), which would restyle the demo; this was seen in the browser. `.seg-opt` and `.seg-ind` keep their names.
- - The stage's own `min-height` goes. Its padding `clamp(28px,6vw,64px) 20px` stays, and a phone rule sets its side padding to 10px (the old phone rule had 12px). Measured at 320px wide: five options need 252px and now have 266px. At 20px they had 246px and were squeezed into it, their labels overlapping. At 375px they need 256px of 321px.
- - `hb-dots`: yes. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the highlight takes to slide. | `--dur`: 550ms / 340ms / 200ms |
-| Feel | Choice buttons | Springy · Smooth · Even | Springy | Springy runs a little past, then settles. | `--ease`: `cubic-bezier(.5,1.6,.4,1)` / `ease-out` / `linear` |
-| Highlight | Choice buttons | Pill · Underline | Pill | A filled pill, or a thin line under the option. | the track's `underline` class: off / on (then `move(current,false)` on the next frame, as today) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of options | Choice buttons | Two · Three · Four · Five | Four | Up to five short options fit on one line. | `build(n)`: 2 / 3 / 4 / 5 |
-
-- **Removed:**
- - The note, and the help text under the controls.
- - The Selected readout.
- - The Segments slider. It becomes Number of options. Six goes: on a 320px phone six options need 272px, more than the 266px there is even with the 10px phone padding.
- - The Slide duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel. "Material smooth" and "Ease in-out" go: on this short slide they looked nearly the same as Ease out, now Smooth.
- - The Indicator style menu. It becomes Highlight.
-- **Good for:** View switchers · Filters · Date ranges · **Avoid on:** Many options · Long labels
-- **Prompt:**
-
- > Add a segmented control to [the row of options people switch between, such as Day, Week and Month]. Show the options side by side with one highlight behind the chosen one. When another option is chosen, slide the highlight over to it and stretch or shrink it to that option's width, while the labels' colors cross over as it lands. Measure the chosen option and move the highlight with transforms only, measuring again when fonts load or the window resizes. Make it one group of radio buttons that the arrow keys move through. If the visitor has reduced motion turned on, move the highlight without sliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A segmented control is a row of options where exactly one is chosen, marked by a highlight behind it. When you choose another option, the highlight slides over to it and stretches to its width while the labels change color, so the change reads as one thing moving. It is the switch behind view pickers such as Day, Week and Month.
-
-- **README Key parameters:** the table is replaced (today's has other columns and code names). The paragraph under today's table ("A spring curve with slight overshoot (control-point y > 1)…") moves to the end of How it works (see there), so Key parameters holds only the table:
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the highlight takes to slide: slow is 550ms, normal 340ms and fast 200ms |
- | Feel | Springy | Springy runs a little past the option, then settles; Smooth slows to a stop; Even keeps one steady speed |
- | Highlight | Pill | A filled pill behind the chosen option, or a thin line under it |
- | Number of options | Four | Two to five options; more, or long labels, do not fit on one line |
-
-- **README See also:** each link gets a phrase. The second link's text, "Tab Bar / Underline", is no page's title; it becomes the title of the page it opens.
- - [Toggle / Switch Slide](../toggle-switch/) — a switch that slides between two states
- - [Hover State Animation](../hover-state/) — items that react when the pointer is on them
- - [Accordion Open/Close](../accordion/) — sections that open and close in place
-- **README How it works:** unchanged, except that it ends with the paragraph moved from Key parameters, in plain words: "A curve that runs a little past its end (Springy) gives the highlight a sense of momentum; Smooth reads as more restrained. The labels' color change uses the same duration as the slide, so the two never drift apart."
-- **README Production notes:** unchanged
-- **Category line:** `04.28 · Micro-Interactions`
-- **Pager:** Previous: Toast Notification (`../toast-notification/`) · Next: Pull to Refresh (`../pull-to-refresh/`)
-
----
-
-## pull-to-refresh — Pull to Refresh
-
-- **Kind:** do it, step 1 "Drag it" — the list refreshes only when the visitor pulls it down from its top, or presses its refresh button.
-- **Description:** Pulling a list down shows a spinner, then new items. Best for feeds.
-- **Step 1 help line:** Drag the list down from the top and let go, or press Show me.
-- **Player bar:** Show me · Reset. No Slow motion: the pull follows the visitor's hand, and the spinner turns for as long as the refresh takes.
-- **Show me:** while a refresh is under way, Show me does nothing. Otherwise `toRest()` puts the list back to its six first items (`n` back to 0) and scrolls it to the top, as Reset does. The page has no Slow motion, so each step is a hold. Then:
- - at once, over 700ms, frame by frame through `runFrame`: `pull` eases from 0 to 1.25 × Pull distance, slowing as it goes like the rubber band. Each frame calls `setY(pull,false)` and `drawSpin()`, so the spinner fades in and turns, and the hint reads "Release to refresh" past the line;
- - `later(release, 0, 850)`: `release()` marks the refresh as the run's (`demoRefresh=true`) and calls `startRefresh()`, as a release past the line does. It spins for Refresh time, adds the new item at the top and springs back; the list is back up about 2.4 s after the press at the defaults;
- - when that refresh ends, `finishRefresh()` clears `demoRefresh` and runs `later(toRest, 0, 1500)`: the new item shows for 1.5 s, then `toRest()` puts the list back to its six first items, so the run ends at rest, as the preamble says of every run. The step is scheduled as the item arrives, not at the release, so a Refresh time changed during the refresh is counted and the item always shows its full 1.5 s. About 3.6 s after the press at the defaults (3.1 s at Short, 4.4 s at Long). The browser check needs this step: it compares the stage before and after a run, and under reduced motion nothing has run before it, so a run that leaves a seventh item could never match.
-
- A run's refresh is silent, as the preamble says of every run (it never announces anything that did not really happen): while `demoRefresh` is set, `startRefresh()` leaves the status line alone, and `finishRefresh()` schedules the clean-up and returns before it writes "Updated — 1 new item added.". The Refresh button, a real drag announce as before; a refresh the visitor has taken over (`stopRun()` clears `demoRefresh`, and the new item stays) announces only "Updated — 1 new item added.", since it began as Show me's and skipped "Refreshing…".
-
- `running()` is also true from the release until the new item arrives (`demoRefresh`); the clean-up after it is a run timer, so `running()` stays true until that has run. `stopRun()` also clears `demoRefresh`. On `hb:input`: `stopRun()`, so no clean-up follows. During the pull the list then springs back, `pull=0; setY(0,true); drawSpin()`, and the visitor's own drag takes over. Once the refresh has started, it finishes as usual and its new item stays (no spring back is drawn while `refreshing`).
-- **Reset:** puts the list back to its six first items (the new ones go, `n` returns to 0) and scrolls it to the top, after `stopRun()`. A refresh under way ends at once: `startRefresh()` keeps its timer in `refreshTimer`, which Reset clears; then the spinner stops, `refreshing` becomes false and the list is set back to 0 without a transition.
-- **Slow motion:** none.
-- **Reduced motion:** the demo's rules stay: the list snaps back without its tween, and new items appear without sliding in.
-- **Touch:** already Pointer Events, claimed only at the top of the list, with `touchmove` blocked once the pull is claimed. The list still scrolls normally.
-- **Pull curve:** today's `resist()` moved the list at 1/Resistance of the finger from the first pixel, and the line was 1.83 × Pull distance × Resistance of finger travel away: 235px at Medium/Medium, about the whole height of the feed (201px on the 260px stage, 241px on phones, 268 to 381px on the others). At the defaults a drag that stayed inside the stage refreshed only where the feed is tall, for example 1280×800, 1440×900, 1024×768, 768×1024, 1366×768, 1280×720 and 1920×1080. The curve becomes `function resist(dy){const max=threshold*(1+2.4/resistance);return max*dy/(dy+max)}`: the list follows the finger 1:1 at first and stiffens as the drag grows, and Resistance only sets how fast. Pull distance is still the pull after the curve, and the line is `threshold × (1 + resistance / 2.4)` of finger travel away. For Short · Medium · Long that is 68 · 91 · 113px at Low, 88 · 117 · 147px at Medium and 108 · 144 · 180px at High (checked in Chrome: 3px less springs back, 3px more refreshes). A drag from the middle of the first card to 4px above the stage's bottom edge (about 160px of room on the 260px stages, 170px at 1024×600, 200px on phones, 227px at 1366×657, 280px at 1280×800) therefore refreshes at the defaults on every stage, with a mouse and with a finger, and a 60px drag still springs back. Every combination refreshes inside the stage except Long/High (180px) on the 260px stages (1280×590, 1366×560, 667×375, 812×375) and at 1024×600 (feed 211px): that is the "long drag" the README names. Show me sets `pull` itself, so it does not change.
-- **Stage font:** site font. The new Refresh button gets `font-family:inherit`. `.indicator` and `.meta .s` go up to 11px (were 10px).
-- **Stage:** the list scrolls inside its own box. The stage's own rule keeps `position:relative;overflow:hidden` and adds `display:flex;flex-direction:column`.
- - The stage becomes a small app screen. At the top is a header bar with the title "Updates" and, at its right, a Refresh button: a ↻ icon, `aria-label="Refresh"`, 44×44px, calling `startRefresh()`. It is today's "↻ Refresh now" moved from the old panel onto the stage; the README calls it the keyboard way to refresh.
- - Below the header, a `.feed` box (`position:relative;flex:1;overflow:hidden`) holds the indicator and the scroller, which move into it unchanged. The indicator therefore comes down from under the header.
- - The status line ("Refreshing…", "Updated — 1 new item added.") stays as a visually hidden `role="status"` region on the stage, so screen readers still hear it.
- - The six first items are in plain words: "Design review moved to 3pm", "Your order has shipped", "Ana replied to your comment", "Weekly report is ready", "Invoice from Northwind paid", "Team notes posted". Today's "Build #482 passed on main" and "Ana commented on your PR" use developer words.
- - The old phone rule (`height:60vh;min-height:380px`) goes.
- - `hb-dots`: no, because the app screen fills the stage. Default height: the list scrolls inside the feed on every screen size, as a feed does (six items need 396px).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pull distance | Choice buttons | Short · Medium · Long | Medium | How far to pull before letting go refreshes. | `threshold`: 48 / 64 / 80 (px) |
-| Resistance | Choice buttons | Low · Medium · High | Medium | Higher makes the list fight back harder. | `resistance`: 1 / 2 / 3 (how fast the pull curve stiffens, see Pull curve) |
-| Spinner | Choice buttons | Ring · Dots · Bars | Ring | The shape that turns while it refreshes. | the spinner's class: `s-ring` / `s-dots` / `s-bars` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Refresh time | Choice buttons | Short · Medium · Long | Medium | How long it spins before new items arrive. | `dur`: 700 / 1200 / 2000 (ms) |
-
-- **Removed:**
- - The note.
- - The Pull threshold, Resistance and Refresh duration sliders. They become Pull distance, Resistance and Refresh time.
- - The Spinner style menu. It becomes Spinner.
- - "↻ Refresh now" moves onto the stage as the header's Refresh button.
- - The visible status line. It stays for screen readers only.
-- **Good for:** Feeds · Inboxes · Notifications · Order lists · **Avoid on:** Desktop-only pages · Lists that rarely change
-- **Prompt:**
-
- > Add pull to refresh to [the scrolling list or feed that should reload]. When the list is already at its top and the visitor drags it down, move it with the finger but make it resist more the further it goes, and show a spinner above it that fades in and turns as it is pulled. Let go past the line and the list stays down while the spinner keeps turning and new items load, then everything slides back up with the new items on top; a shorter pull just springs back. Also offer a refresh button for people who cannot drag. If the visitor has reduced motion turned on, snap back without sliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Pull to refresh reloads a list when you drag it down from its top. As you pull, the list follows your finger but resists more the further it goes, and a spinner above it fades in and turns. Let go past a set distance and the list stays down while the spinner keeps turning and new items load; then it slides back up with the new items on top.
-
-- **README Key parameters:** (the old Resting offset row goes: it is not a setting)
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pull distance | Medium | How far the list must be pulled before letting go refreshes: short is 48px, medium 64px and long 80px, measured after the resistance |
- | Resistance | Medium | How hard the list fights back as it is pulled: low, medium or high; with a long pull distance and high resistance, it takes a long drag |
- | Spinner | Ring | A turning ring, three blinking dots or four stretching bars |
- | Refresh time | Medium | How long the spinner turns before the new item arrives: short is 700ms, medium 1200ms and long 2000ms |
-
-- **README See also:** the third link's text changes from "Drawer Slide" to the page's real title, and the phrases get plainer.
- - [Swipe to Dismiss](../swipe-to-dismiss/) — the sideways drag that removes an item
- - [Loading Spinner](../loading-spinner/) — spinners on their own
- - [Drawer / Panel Slide](../drawer-slide/) — a panel that slides in from an edge
-- **README How it works:** brought in line with the page: the snippet's `resist()` is the pull curve above (so "follows the finger one to one at first" is true), its pointer lines follow the page's `pid` bookkeeping, "refresh duration" reads "refresh time", and the last paragraph names the Refresh button and Show me.
-- **README Production notes:** in the "Accessibility alternative" bullet, "this demo wires a "Refresh now" button to the identical code path and announces state through an `aria-live` region" becomes "this demo's Refresh button, in the list's header, runs the identical code path, and a live region announces the state". The rest is unchanged.
-- **Category line:** `04.29 · Micro-Interactions`
-- **Pager:** Previous: Segmented Control (`../segmented-control/`) · Next: none
diff --git a/docs/superpowers/plans/2026-09-29-scroll-content-part1.md b/docs/superpowers/plans/2026-09-29-scroll-content-part1.md
deleted file mode 100644
index 9ca25f49..00000000
--- a/docs/superpowers/plans/2026-09-29-scroll-content-part1.md
+++ /dev/null
@@ -1,1042 +0,0 @@
-# Scroll-Based — Content Sheet, Part 1
-
-This half of the Scroll-Based sheet decides, page by page, how the first thirteen Scroll-Based pages (home-page order, 01.01 Parallax Depth-of-Field to 01.13 Stagger Reveal) present their kind, step 1, settings, words and prompt on the guided-steps page. Part 2 (`2026-09-29-scroll-content-part2.md`) covers Horizontal Scroll to Scroll-Driven Background Color; this half follows its category rules wherever the two meet, so the 26 pages come out alike. The conversion tasks of `2026-09-29-demo-page-rollout-parallel.md` follow each section exactly, together with "How to convert a page" in `2026-09-28-demo-page-rollout-text-typography.md`, the rollout's Global Constraints, and the markup for pages without settings and scroll pages in `2026-09-29-demo-page-kinds-do-and-scroll.md`. Rotate In (`animations/02-entrance-and-exit/rotate-in/`) is the reference for everything a section does not mention; the do-it/scroll plan's scratch scroll page is the reference for a scroll page's step 1 and its scroller attributes.
-
-Fix round 1 (2026-09-29) is applied: the owner's decisions and the category rules shared with part 2 follow, word for word as in part 2, and every section below follows them. Where a section and a shared rule seem to differ, the shared rule wins.
-
-All thirteen are scroll pages. Parallax Depth-of-Field, ScrollTrigger Animation, Pin Animation and Scrollytelling have no settings, so they have no Try it step.
-
-## Owner decisions (all accepted, 2026-09-29)
-
-These decisions and the category rules below read the same in part 1 and part 2.
-
-1. Parallax Depth-of-Field, Scrollytelling (part 1) and Horizontal Scroll (part 2) have no Try it step.
-2. Snap Scrolling: Play glides through without snapping; snapping shows when the visitor scrolls, and the help line says so.
-3. Both parallax pages: the drawing stretches to fill the wide box (`preserveAspectRatio="none"`) instead of cropping the front layer.
-4. Cover Card: a short closing line fills the empty space at the end (steady scroll length kept).
-5. Stacking Cards: the big faded number becomes an absolutely placed background watermark (`aria-hidden`), so 7 cards fit.
-6. Stacking Cards: the decorative card button reads "View project →".
-7. The player's "Back to top" and the footer's "Back to top ↑" both stay as they are.
-8. Smooth (Inertia) Scroll is a do-it page: step 1 "Scroll it", with Show me and Reset (no Play / Back to top). Its step-1 help line ends ", or press Show me." (every do-it page does).
-9. Smooth Scroll's glide mode answers keys: arrows ±40px, PageUp/PageDown/Space 90% of the box, Home/End 0/maxScroll (a `keydown` handler on the viewport in glide mode that moves the glide target).
-10. Smooth Scroll's "Normal scrolling" switch stays out of the copied prompt (`data-hb-skip`).
-11. Scroll Velocity Skew shows 28 rows.
-12. Text Fill's paragraph is cut from 80 to 48 words.
-13. Text Fill's unread words are a readable grey (about 4.8:1).
-14. Background Color's text is pure white or black, flipping where both read equally (Forest flips too — say so wherever the sheet mentions only Daylight).
-15. Scrollspy's menu links may be 36px tall on short laptop screens so the whole menu fits; touch screens keep 44px. Implement as: `@media (min-width:601px) and (max-height:640px) and (pointer:fine)` → 36px links (6×36 + 22 + 16 = 254px fits the 258px stage); with a coarse pointer in that range (a phone turned sideways) the links stay 44px and the rail scrolls (`max-height:calc(100% - 32px);overflow-y:auto`), keeping the active link in view by setting the rail's own `scrollTop` — never `scrollIntoView()`, which also scrolls the page.
-
-## Category rules shared with part 2 (same wording in both halves)
-
-1. **Phone rules:** the old mobile block goes, but each page section keeps and names the phone rules its stage still needs (part 1's wording). Part 2 must list them for Sticky Section (`#sticky-inner{grid-template-columns:1fr}#vis-col{display:none}`) and Scrollspy (its strip rules and `.sec{padding:80px 20px 36px}`).
-2. **Focus ring on inner scrollers:** nothing on the page. The coordinator is adding `.hb-page .stage :focus-visible{outline-offset:-3px}` to the shared stylesheet, so everything focusable inside the stage (inner scrollers such as `[data-hb-scroller]`, `.viewport`, `.doc`, flush controls, Snap Scrolling's dots) gets the site ring drawn inset and never clipped. State this as a fact; drop any page-level scroller focus rule and the dots' `right:6px` idea. A stage that is its own scroller keeps the normal ring. A stage control with its own focus look still must beat `body.hb :focus-visible` (0,2,1).
-3. **Smallest stage:** measure fits at the smallest shared stage too — 258px inside at 1280×590 (the shared stage drops to 260px on short screens) — as well as 327px (laptop) and the phone sizes. Overlays such as rails and dots must fit it.
-4. **Trigger lines:** every trigger-line choice must be reachable within the box's scroll distance at every size, from the tallest box to a narrow window just over 600px (part 1: Reveal on Scroll, Stagger Reveal, ScrollTrigger Animation — check and state it).
-5. **`container-type:size`:** only on a scroller whose height comes from outside (the stage, or `height:100%` of it); never together with `hb-grow`; never padding on that scroller (cqh measures its content box); any `cqh` use needs that container (without one it falls back to the viewport). No `--box-h` script fallback.
-6. **Play stops on input:** the shared script stops Play on any trusted input anywhere inside the stage (pointer, wheel, touch, key). Sections state it as a fact; no page works around it (part 2's Scrollspy "blocker" line becomes a plain statement).
-7. **Snapping during Play:** while Play runs, the shared script marks the scroller with `data-hb-autoscrolling`, and a shared rule turns CSS scroll snapping off on a marked scroller (`scroll-snap-type:none !important`). When the run ends, is stopped, or Back to top is pressed, the mark goes and the scroller's own snapping applies again — whatever the page set, even during the run. Pages set snapping however they like, but never with `!important`; Snap Scrolling's Snapping setting sets an attribute (e.g. `data-snap="mandatory|proximity|off"` with three CSS rules). When a wheel turn stops Play, snapping returns and the box settles on the nearest point by itself.
-8. **Instant jumps:** Back to top, and Play restarting from the top, are instant jumps. Say so wherever an effect reads scroll speed or eases toward the scroll position; Velocity Skew ignores the frame after a jump (listen for clicks on `#btn-top` / `#btn-scroll`, by id) and measures speed per 1/60 s, so 120 Hz screens lean the same.
-9. **Small stage text:** paragraph text in the stage is at least 14px; small labels (chips, ticks, captions, buttons) at least 11px. Part 1: `.chip-name`, `.card-sub`, `.card-btn`, `.dir` grow to 11px. Part 2: Smooth Scroll's `.card-body` and Background Color's `p` go to 14px.
-10. **Text that changes every frame** (counters, depth numbers, frame counts): `role="img"` plus an `aria-label` with the real value, or `aria-hidden="true"` when it only repeats something else on the stage; never a live region (part 1: Scrollytelling's `#depth-num`, Scrub Animation's frame count and `.dir`).
-11. **Small SVG labels:** counter-scale them to screen size (part 2's SVG Line Draw approach), or hide them on phones only where something visible repeats them (part 1's Scrub Animation `.mark-label`: the ticks repeat 0–100%).
-12. **Decorative duplicates** (big numbers, repeated titles, picture SVGs) are `aria-hidden="true"` (part 1: Pin Animation's phone drawing, Stacking Cards' watermark).
-13. **No `h1`/`h2` inside the stage:** the page outline belongs to the step titles. Use `p` (or `h3` for a real sub-heading). Part 1: Cover Card's `<h1 class="cover-title">` becomes `<p class="cover-title">` keeping `.cover-title`'s own sizing (the shared `.hb-page h1` rule restyles any stage h1 — Critical); Pin Animation's intro/outro `h2` and Cover Card's article `h2`s.
-14. **Cue lines:** sentence case, centred, with side padding (`text-align:center;padding:0 24px`) — part 1's ScrollTrigger run-out cue included.
-15. **Unchanged shared rules** stay identical in both halves: accent, category line, "Scroll it" and its help lines, Play · Back to top, scroller attributes, `--ui-muted:#8a8a92`, no `hb-dots`, Feel names from Entrance & Exit, the no-settings format, and the Try it help line "Change a setting, then scroll again or press Play." (do-it pages: "Change a setting, then try it again or press Show me.").
-
-## Owner decisions and lessons that apply here
-
-- **Stage text uses the site font.** None of these effects is about typing, so every `font-family` on stage text goes (`var(--disp)`, `var(--mono)`, `serif`, `monospace`, and the `font-family` attribute on SVG text), and so do the `@font-face` lines. The site font is loaded upright only, so italics on the stage go too, as on the Text & Typography stages.
-- **Scroll pages show themselves once on arrival.** Every page uses `<body class="hb" data-hb-kind="scroll" data-hb-autoplay>`: 400ms after load the shared script presses Play, which scrolls the box from the top to its end at one steady speed, the whole box in about six seconds whatever its length.
-- **Reduced motion runs nothing by itself.** The box does not scroll on arrival, while Play and Back to top still work when pressed. A page's own scroll effect may be simplified; each section says what the page's own reduced-motion code keeps. No page here has Loop, Slow motion or Pause, so the shared script greys nothing out and adds no note.
-- **Long names in the top bar** (ScrollTrigger Animation, Fly-in Fly-out Contact List, Cover Card to Fixed Header, Reverse-Scrolling Columns) are cut with "…" by the shared stylesheet; the pages do nothing.
-- **Lessons from the Text & Typography reviews** that apply here:
- - The page reaches the player controls by their ids (`btn-scroll`, `btn-top`), never by their `data-hb-*` attributes. Only Reveal on Scroll and Stagger Reveal listen to them. No page here needs `hb:pause` or `hb:input`.
- - Text whose layout the script measures is measured again after `document.fonts.ready` (Reverse-Scrolling Columns, as today; Cover Card to Fixed Header; ScrollTrigger Animation; Scrub Animation, whose drawing size depends on the panel's text).
- - Nothing here is typed text, and no text is split into letters. Text that changes every frame follows shared rule 10: Scrollytelling's depth and Scrub Animation's frame count.
-
-## Rules for the whole category (as in part 2)
-
-- **Accent and category line:** every page keeps `--ui-accent:#6ea8ff`. The category line is `01.NN · Scroll-Based`, where NN is the page's position on the home page, which its card already shows (01.01 to 01.13 in this half).
-- **Step 1** is titled "Scroll it". Its default help line is "Scroll inside the box, or press Play and it scrolls for you." A section gives a page-specific line where it helps.
-- **Player bar of a scroll page:** the Play button and then the Back to top button, exactly as in the do-it/scroll plan, and nothing else (no Slow motion, Replay, Loop or Pause).
-- **Try it help line of a scroll page:** "Change a setting, then scroll again or press Play.", the fixed line for the kind; no page has its own. Most settings here redraw the box at once, where it is; the section says when a change waits for the next scroll.
-- **The scroller** is the `.stage` itself on eleven pages. On Snap Scrolling and Reveal on Scroll an overlay (the dots, the trigger line) has to stay in place while the content scrolls: there the `.stage` does the job of today's `.stage-wrap` and holds an inner scroller marked `data-hb-scroller`, as on part 2's Progress Bar and Scrollspy Navigation. An overlay the visitor can press (Snap Scrolling's dots) sits inside that scroller, in a zero-height sticky rail (`.snap-rail{position:sticky;top:0;height:0;z-index:1}` as the scroller's first child, the overlay absolutely placed in it with its `top` in `cqh`): beside the scroller it would be a dead strip where a swipe, a wheel turn, or a key pressed after a press, scrolled the page and not the box, and CLAUDE.md requires scroll-driven demos to work with touch scroll. An overlay that only shows something (Reveal on Scroll's trigger line) sits beside the scroller or over it with `pointer-events:none`, so input goes through to the box. Any other pressable overlay follows the rail rule (part 2's Scrollspy menu). The scroller's focus ring comes from the shared stylesheet (shared rule 2); the page adds nothing. Every scroller gets:
- - `tabindex="0" role="region"` and an `aria-label` (each section gives it), so keyboard users can focus it and scroll it with the arrow keys;
- - `overflow-y:auto` (was `scroll`), keeping today's hidden scrollbar (`scrollbar-width:none` and the `::-webkit-scrollbar{display:none}` rule);
- - `position:relative`, so the `offsetTop` of anything inside it is measured from its own top (Fly-in Fly-out Contact List and Pin Animation read `offsetTop` and have it today).
- - The old stage's `flex`, `min-width`, `width`, `height`, `border` and `border-radius` go; the page owns them.
-- **Stage height:** every page takes the shared stage height (300–440px on computers and tablets, 260–327px on short laptops, 300px on phones; 378px inside the border at 1280×800, 325px at 1366×657, 258px at 1280×590 and 298px on phones). No page sets `--hb-stage-h` or `--hb-stage-h-phone`, and none uses `hb-grow` (no page takes typed text). The old `--stage-h` (600–640px, and 480–560px on phones), its phone overrides and the old fixed stage heights go. Each section's fits were measured from the 258px box to the 438px box of a tablet and a 610px-wide window, and on 375px and 320px phones (shared rule 3).
-- **What was sized in stage heights inside the box** is sized in the scroller's own height, as in part 2 and under shared rule 5: the scroller gets `container-type:size`, and `var(--stage-h)` (or the old stage height written in pixels) becomes `100cqh`, so `calc(var(--stage-h) * 4)` becomes `400cqh`. A pinned part stays exactly one box tall at every stage height, and the scene keeps today's proportions to its box. Measured in headless Chrome on Parallax Depth-of-Field, Stacking Cards (including its CSS scroll timeline) and ScrollTrigger Animation: the same pictures and scroll lengths as sizing with a pixel value. No scroller that has `container-type` has padding. Pages that size nothing from the stage (Fly-in Fly-out Contact List, Reveal on Scroll, Stagger Reveal) leave `container-type` off.
-- **Every effect follows the scroller's `scroll` event**, an IntersectionObserver rooted on it, or a CSS scroll timeline, so it answers Play, Back to top, the wheel, touch and keys alike. No page reads the wheel itself or scroll speed. Any trusted input inside the stage stops Play (shared rule 6). While Play runs, the shared script turns snapping off (shared rule 7), so Snap Scrolling's Play glides through its sections. Back to top, and Play restarting from the top, jump at once (shared rule 8); the two pages that ease toward the scroll position (Parallax Depth-of-Field and Cover Card to Fixed Header) say so, and jump with the box when either button is clicked.
-- **`:root`** keeps `--ui-accent:#6ea8ff` and the variables the stage rules still use. `--stage-h`, `--disp` and `--mono` go, and `--ui-muted` becomes `#8a8a92` wherever stage text uses it (the old `#77777e` is 4.4:1 on `#0b0b0d` and 4.2:1 on the cards' `#111114`; the new grey is 5.5:1 or more). Stage text faded with `opacity` below 4.5:1 is fixed in its section.
-- **Small stage text** follows shared rule 9: paragraph text at least 14px, labels at least 11px (the old 8–10px labels were drawn in the monospace font). Each section gives the new sizes.
-- **`hb-dots`** is left off on every page: the dots would stay still while the content scrolls over them.
-- **Stage text shows no code.** Where a stage shows code or code names today (the cover card's code block, card texts such as "opacity 0 → 1", chips such as "IntersectionObserver"), the section gives plain replacement text.
-- **Removed on every page:** the aside with its note, its readouts and its Reset, Reset scroll, Reset playhead, Replay or Return to surface button (Back to top and Play replace them), the old `header`, `.layout`, the `.ah-bar` and its Copy source script, and the old mobile block. Each section names the phone rules its stage keeps (shared rule 1); a section that names none keeps none.
-- **Pages without settings** follow the do-it/scroll plan's Task 1: no Try it step, steps numbered 1 (Scroll it) and 2 (Copy the prompt), the `hb-chips` markup kept, a prompt without "Match the settings listed below.", a Copy prompt hint without "Your settings are added at the end." (the section gives it), and a README Key parameters table of the technique's own values, in plain words (no backticks: the page checks forbid code there).
-- **Stage class names:** no element on a stage uses the class `seg` or `swatches` (the shared stylesheet styles them for Try it). None does today.
-- **The page checks forbid the words "Read more"** anywhere on a page, so Stacking Cards' card button reads "View project →" (owner decision 6).
-- **Headings, decorations and cues on the stage:** no stage keeps an `h1` or `h2` (shared rule 13); picture SVGs and decorative duplicates are `aria-hidden="true"` (shared rule 12); closing cue lines use the cue style, sentence case and centred (shared rule 14): 13px `#8a8a92`, `letter-spacing:.1em`, `text-align:center;padding:0 24px`.
-
-## How to read a section
-
-- **Sets in the demo** lists one value per choice, in the same order as the choices, then what the page calls so the box shows it.
-- **Shown only when …** in the Control column means the setting's whole `div.hb-setting` gets the `hidden` attribute while it has no effect, so it also drops out of "Your settings".
-- Switches in Try it keep their default in the markup (`checked` when the default is on), as on Rotate In.
-- **Feel** uses the Entrance & Exit names where they fit: Smooth (slows to a stop), Gentle (eases in and out) and Even (one steady speed). Scrub Animation adds Slow start (starts slowly, then speeds up).
-- **What scrolling shows** is what the visitor sees as the box scrolls, by hand or by Play.
-- **Measured** sizes come from the site font in headless Chrome at the stage sizes above (the old page with the new sizes applied).
-
----
-
-## parallax-depth-of-field — Parallax Depth-of-Field
-
-- **Kind:** scroll. Scrolling moves five mountain layers at different speeds while the sharp focus travels from the far sky to the near ridge.
-- **Description:** Layers move at their own speed as the focus shifts. Best for cinematic intros.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Try it:** none (owner decision 1). The demo's only control, the Focal Plane slider, is not a setting: it moves the same 0–1 value that scrolling moves (a second way to scrub, like Scrub Animation's Seek slider), and the next scroll overwrites it. The page has steps 1 and 2.
-- **Scroller:** the stage.
-- **What scrolling shows:** a night landscape of five layers (sky, far peaks, mountains, hills, the ridge in front) held still in the box. As the box scrolls, each layer sinks by an amount that grows with its nearness, and the one sharp layer moves from the sky at the top to the ridge at the end; every other layer blurs by how far it sits from the sharp one. The layers ease toward the scroll position, so a wheel's jumps turn into a glide. Scrolling back reverses it. Back to top, and Play restarting from the top, jump the box at once, and the layers jump with it (a click on either button sets the eased value at once).
-- **Scroll distance and Play:** `.scene` 400cqh with the sticky `.pinned` 100cqh: three box heights of scrolling (1,134px at 1280×800, 894px on a phone). Play racks the focus from far to near in six seconds.
-- **Reduced motion:** nothing scrolls by itself. As today, the layers never move (the page's `reduced` flag keeps their offset at 0) and scrolling only moves the focus, without easing. The CSS rule `.layer{will-change:auto}` stays.
-- **Stage font:** no text on the stage.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="Mountain layers that move and blur as you scroll"`.
- - `.scene{height:400cqh}`; `.pinned{position:sticky;top:0;height:100cqh;overflow:hidden}` (were `calc(var(--stage-h) * 4)` and `var(--stage-h)`).
- - The five layer SVGs get `preserveAspectRatio="none"` (was `xMidYMid slice`), as on Parallax Scrolling (owner decision 3), and `aria-hidden="true"`. The scene is drawn for a 3:2 box; in the new box, about 2.5:1 on laptops, `slice` crops it, and at the end of the focus pull the sharp front ridge shows only 30–45px at 1280×800 and a few tips at 1366×657. Stretched to fill, every layer shows at every size (measured, 258–438px boxes and phones); the hills look a little flatter on wide screens.
- - The layers' travel becomes a share of the box: `measure()` sets `MAX_OFFSET = stage.clientHeight * 0.19`, and `* 0.125` up to 600px wide (today 120px of a 620px stage and 60px of a 480px one): 72px at 1280×800, 49px in the 258px box of a 1280×590 window, 83px in a 438px box and 37px on phones. Each layer still sinks its own share of it (sky 0, far peaks 10%, mountains 25%, hills 45%, front ridge 70%). The blur stays 14px (8px up to 600px wide).
- - Script: the slider, its `input` listener and the `manual` flag go; `onScroll()` runs on every `scroll` event. `render()` keeps the blur and offset writes; its readout lines (`VALUES`, `ROWS`, the progress and focal texts) go. `measure()` keeps its resize listener, with the travel above.
- - `hb-dots`: no. Default height.
-- **Removed:**
- - The note, and the Scroll Progress and Blur readouts.
- - The Focal Plane slider (see Try it).
-- **Good for:** Hero scenes · Story intros · Illustrated landscapes · **Avoid on:** Large photos · Text-heavy pages
-- **Prompt:**
-
- > Add a parallax depth-of-field effect to [your layered scene or illustration]. Split the scene into layers from far to near and hold it in place while the visitor scrolls through a taller section. As they scroll, move each layer by an amount that grows with its nearness, and move a point of sharp focus from the farthest layer to the nearest: blur each layer by how far it sits from that focus. Ease the layers toward the scroll position on every frame by a share of the distance left, exponential in the time since the last frame, so a wheel's jumps turn into smooth movement at the same pace on every screen. If the visitor has reduced motion turned on, keep the layers still and only shift the focus.
-
-- **Copy prompt hint:** "Replace the words in brackets with your own scene."
-- **README What it is:** rewritten:
-
- > Parallax depth-of-field combines two effects that follow the scroll. Each layer of a scene moves by an amount that matches how near it is, and a point of sharp focus travels from the farthest layer to the nearest, blurring every other layer by how far it sits from that focus. The result looks like a camera pulling focus through a landscape as you scroll.
-
-- **README Key parameters:** the technique's own values (the page has no settings):
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Focus | Follows the scroll | Sharp on the sky at the top of the scroll and on the front ridge at the end; each layer blurs by its distance from it |
- | Strongest blur | 14px (8px on phones) | The blur of a layer as far from the focus as a layer can be |
- | Layer travel | 19% of the box's height (12.5% on phones) | What the layers' sinking is measured against: over the whole scroll the front ridge sinks 70% of it, the hills 45%, the mountains 25%, the far peaks 10% and the sky not at all |
- | Easing | 14% per sixtieth of a second | How much of the remaining distance the layers cover in a sixtieth of a second; a longer frame covers more, so the layers settle in the same time on every screen; lower is smoother but lags more |
- | Pinned scene | Three box heights of scrolling | How much scrolling the whole focus pull takes |
-
-- **README See also:**
- - [Parallax Scrolling](../parallax-scrolling/) — the same layered depth, without the blur
- - [Reverse-Scrolling Columns](../reverse-scrolling-columns/) — columns move against each other as you scroll
-- **README How it works:** unchanged, except that the frame-rate fix (below) changes the easing snippet (`dt` and `last`, and `1 - Math.pow(1 - EASE, dt / FRAME)` in place of `current += (target - current) * EASE`) and adds a paragraph after it on `EASE`, `dt` and the 50ms cap.
-- **README Production notes:** unchanged
-- **Category line:** `01.01 · Scroll-Based`
-- **Pager:** Previous: none · Next: Parallax Scrolling (`../parallax-scrolling/`)
-- **Final fix wave (Scroll-Based final review, 2026-09-30).** A `click` listener on the document, for `#btn-top` and `#btn-scroll` (by id, as Velocity Skew and SVG Line Draw do), runs `onScroll(); current = target; render(current);`, so the layers stand at the box's new position in the same click instead of easing back over the whole focus pull. The shared script has already moved the box when the click reaches the document. README How it works gains a paragraph saying so.
-- **Frame-rate fix (wrap-up):** `tick(now)` eases by `current += diff * (1 - Math.pow(1 - EASE, dt / FRAME))`, with `EASE = 0.14` (the share covered in 1/60 s), `FRAME = 1000/60` and `dt = last ? Math.min(now - last, 50) : FRAME`. `schedule()` sets `last = 0` when it re-arms the parked loop, so the first frame after a restart counts as 1/60 s. The layers settle in the same time on a 30, 60 or 120 Hz screen (95% of the way in about a third of a second), where a fixed 14% a frame settled twice as fast at 120 Hz and half as fast at 30 Hz. At 60 Hz nothing changes. The prompt and the Easing row of Key parameters (above) say so in plain words.
-
----
-
-## parallax-scrolling — Parallax Scrolling
-
-- **Kind:** scroll. Scrolling moves four layers of a scene at different speeds.
-- **Description:** Far layers move slower than near ones as you scroll. Best for hero scenes.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** a night scene of four layers (sky, ridge, trees, grass) held still in the box. As the box scrolls, each layer sinks at its own speed: at the default the grass sinks the most and the sky barely moves, so the flat picture looks deep. The grass just leaves the box at the end of the scroll. Scrolling back reverses it.
-- **Scroll distance and Play:** `.scene` 300cqh with the sticky `.layers` 100cqh: two box heights of scrolling (756px at 1280×800, 596px on a phone). Play sinks the layers from start to end in six seconds.
-- **Reduced motion:** nothing scrolls by itself. As today, the layers never move (the `still` check), so the scene stays still while the box scrolls. The CSS rule `.layer{will-change:auto}` stays.
-- **Stage font:** no text on the stage.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="A landscape in four layers that move at different speeds"`.
- - `.scene{height:300cqh}` (1800px in a 600px stage today); `.layers{position:sticky;top:0;height:100cqh;overflow:hidden;background:#0a1628}`; `.layer{height:100%}`. The phone rule that set 400px goes.
- - The four layer SVGs get `preserveAspectRatio="none"` (was `xMidYMid slice`; owner decision 3) and `aria-hidden="true"`. The scene is drawn for a 4:3 box, and the new box is about 2.5:1 on laptops: `slice` crops the grass layer out of view there, so the layer that moves most never shows (measured). Stretched to fill, every layer shows at every size; the hills look a little flatter on wide screens.
- - The travel at 100% speed becomes a quarter of the box's height (`MAX_PARALLAX = stage.clientHeight / 4` in `update()`; 150px of a 600px stage today, 95px at 1280×800), so the grass still leaves the box exactly at the end of the scroll.
- - `update()` keeps the offsets; its readout lines (progress and the four offsets) go.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Depth | Choice buttons | Flat · Shallow · Normal · Deep | Normal | Deep spreads the layers' speeds; Flat moves them as one. | `LAYERS[i].speed` for sky, ridge, trees and grass: Flat 1, 1, 1, 1 (today's "Disable parallax") / Shallow 0.5, 0.65, 0.8, 1 / Normal 0.1, 0.3, 0.6, 1 (today's defaults) / Deep 0, 0.25, 0.7, 1.5; then `update()` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the Scroll Progress and Layer Offsets readouts.
- - The four Speed Multiplier sliders and "Disable parallax (all 100%)". They become Depth: four named sets of speeds, all within today's 0–150% sliders.
- - Reset to defaults. Choosing Normal does the same.
-- **Good for:** Hero scenes · Landing pages · Story sections · **Avoid on:** Text-heavy pages · Forms
-- **Prompt:**
-
- > Add a parallax scene to [your hero section or illustration]. Split the scene into layers from far to near, such as sky, hills, trees and ground, and hold it in place while the visitor scrolls through a taller section. As they scroll, move each layer by its own amount, as the settings choose; usually the farthest layer barely moves and the nearest moves most, which makes the flat picture feel deep. Base the movement on how far through the section the visitor has scrolled, so it starts and stops at the same place every time. If the visitor has reduced motion turned on, keep every layer still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Parallax scrolling moves the far layers of a scene less than the near ones as you scroll, so a flat picture seems to have depth. It copies what you see from a train window: nearby things rush past while distant hills barely move. Each layer gets its own speed, and how far apart those speeds are decides how deep the scene feels.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Depth | Normal | The speeds of the sky, ridge, trees and grass: normal is 10%, 30%, 60% and 100%; shallow 50%, 65%, 80% and 100%; deep 0%, 25%, 70% and 150%; flat moves all four together. At 100% a layer travels a quarter of the box's height over the whole scroll |
-
-- **README See also:**
- - [Parallax Depth-of-Field](../parallax-depth-of-field/) — the same layers, with a moving focus that blurs them
- - [Reverse-Scrolling Columns](../reverse-scrolling-columns/) — columns move against each other as you scroll
-- **README How it works:**
- - "Each layer has a speed multiplier `s ∈ [0, 1.5]`." becomes "Each layer has a speed multiplier `s` between 0 and 1.5, set by the Depth setting."
- - In the snippet, the comment `// MAX_PARALLAX = 150px` becomes `// MAX_PARALLAX = a quarter of the box's height`.
- - Final fix wave, three sentences to match the travel (`MAX_PARALLAX = stage.clientHeight / 4`; the grass is the layer at 100%): "scales a fixed travel budget by the layer's speed" becomes "scales the travel, a quarter of the box's height, by the layer's speed"; "Normalising first keeps the travel identical no matter how tall the scroll container is, and clamps the effect at both ends for free" becomes "Normalising first makes the movement the same whatever the length of the scroll, and clamps it at both ends for free"; and "Layers with high speed (foreground: 100%) track the scroll" becomes "Layers with high speed (the grass: 100%) move the most".
- - The rest is unchanged.
-- **README Production notes:** in the Accessibility bullet, "hold every layer at zero offset and show the static scene — but keep the numeric readouts tracking the scroll, so the panel isn't reporting stale values. Apply `will-change: auto` in the reduced-motion media query to avoid unnecessary layer promotion." becomes "hold every layer at zero offset and show the static scene, and apply `will-change: auto` in the reduced-motion media query to avoid unnecessary layer promotion." The rest is unchanged.
-- **Category line:** `01.02 · Scroll-Based`
-- **Pager:** Previous: Parallax Depth-of-Field (`../parallax-depth-of-field/`) · Next: Reverse-Scrolling Columns (`../reverse-scrolling-columns/`)
-- **Final fix wave:** README wording only: the travel is a quarter of the box's height whatever the length of the scroll, and the layer at 100% (the grass) moves the most rather than tracking the scroll (see README How it works above).
-
----
-
-## reverse-scrolling-columns — Reverse-Scrolling Columns
-
-- **Kind:** scroll. Scrolling moves the middle column with the scroll and the side columns the other way, all three looping.
-- **Description:** Side columns run the opposite way to the middle one. Best for portfolios.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** three columns of project cards held still in the box. As the box scrolls, the middle column's cards travel up with the scroll and the side columns' cards travel down, so they seem to flow against it. Each column holds two copies of its twelve cards and wraps around, so none ever runs out, whichever way the side columns go (see Stage). Under 600px wide the right column is hidden, as today.
-- **Scroll distance and Play:** `.scene` 320cqh (2000px in a 620px stage today) with the sticky `.columns` 100cqh: 2.2 box heights of scrolling (832px at 1280×800, 656px on a phone). Play moves the columns at about 140px a second (110px on phones).
-- **Reduced motion:** nothing scrolls by itself. As today, the columns stay still (`update()` returns early), so the box scrolls without moving them. The CSS rule `.col-inner{will-change:auto}` stays.
-- **Stage font:** site font. `.card-label` becomes 13px (was 11px) and `.card-meta` 12px `var(--ui-muted)` (was 10px).
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="Three columns of project cards"`.
- - `.scene{height:320cqh}`; `.columns{position:sticky;top:0;height:100cqh}` (with its flex, gap, padding and overflow). The phone rules that set 480px go; `.col-right{display:none}` under 600px stays.
- - `measure()` stays, with its re-measure on `document.fonts.ready` and `resize` (the loop period depends on the card height). It pre-offsets the side columns by one set (`marginTop = -singleSetH`) only while they move down (`mult < 0`); when they move up (`mult >= 0`) it sets their `marginTop` to 0. Today it always pre-offsets them, which only suits moving down: with Same way the side columns run out of cards, leaving up to 334px of empty column on a laptop (review measurement). With the change there is no gap at any speed in either direction, at any size (measured, 258–438px boxes and phones).
- - The card icons' `svg` in `makeSet()` get `aria-hidden="true"` (shared rule 12).
- - **Screen readers hear the twelve cards once (final fix wave).** The left and right `.col` get `aria-hidden="true"` (they repeat the middle column), and so does the second `.card-set` of every column, which only repeats the first so the column can loop: `el.appendChild(makeSet()).setAttribute('aria-hidden', 'true')`, with a comment. Before, each card was read six times (four on a phone, where the right column is hidden).
- - **Reduced motion switched on mid-visit clears the movement (final fix wave).** The reduced-motion line of `update()` sets the three inner transforms to `''` before it returns, and `motionMQ.addEventListener('change', update)` after the resize listener runs it when the setting changes, so the columns go back to rest at once and, switched off again, take up the scroll position. This replaces "`update()` returns early" in Reduced motion above. Before, the transforms stayed frozen where they were, and a later change of Side columns go emptied the side columns (measured at 1280×800, at 61% of the scroll: a 508px gap at the top of each side column after a switch to Same way); now every direction and speed leaves them full.
- - `update()` keeps the three transforms; its readout lines (progress and the three offsets) go.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Side columns go | Choice buttons | Opposite way · Same way | Opposite way | Same way shows the plain scroll, for comparison. | the sign of `mult`: −1 / +1, times Side column speed; then `measure()` (which sets the side columns' `marginTop` for the direction) and `update()` |
-| Side column speed | Choice buttons | Slower · Same · Faster | Same | Their speed compared with the middle column. | the size of `mult`: 0.5 / 1 / 1.5, with the sign from Side columns go; then `update()` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the Scroll Progress and Column Offsets readouts.
- - The Speed Multiplier slider (−2.0× to +2.0×) and "Match direction (+1.0×)". They become Side columns go and Side column speed; Same way at Same speed is today's Match direction. Faster stops at 1.5×: the README's Production notes advise against going above it.
- - Reset. Back to top and the settings' defaults replace it.
-- **Good for:** Portfolios · Agency sites · Image galleries · **Avoid on:** Reading pages · Forms
-- **Prompt:**
-
- > Add reverse-scrolling columns to [your grid of project cards or images]. Lay the cards out in three columns and hold them in view while the visitor scrolls through a taller section. Move the middle column up with the scroll, and move the two side columns in the direction and at the speed given in the settings; running them the opposite way makes them seem to flow against the scroll. Put two copies of the cards in each column and wrap the movement by exactly one copy's height, so the columns never run out. If the visitor has reduced motion turned on, keep the columns still. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Reverse-scrolling columns put a column that scrolls normally between two columns that move the opposite way. The counter-motion makes the layout feel deep and lively, the same cue parallax uses, made stronger. Each column holds two copies of its cards and wraps around, so the columns never run out.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Side columns go | Opposite way | Opposite way makes the side columns flow against the scroll; same way moves all three together, so the effect disappears |
- | Side column speed | Same | The side columns' speed compared with the middle one: slower is half, same is equal and faster is one and a half times; above that the motion gets uncomfortable |
-
-- **README See also:**
- - [Parallax Scrolling](../parallax-scrolling/) — layers move at different speeds as you scroll
- - [Parallax Depth-of-Field](../parallax-depth-of-field/) — layers move and blur as the focus shifts
-- **README How it works:** in the snippet, the comment `// (margin-top pre-offsets them by -singleSetH so there is content above)` becomes `// (moving down, margin-top pre-offsets them by -singleSetH so there is content above; moving up, it is 0)`. The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `01.03 · Scroll-Based`
-- **Pager:** Previous: Parallax Scrolling (`../parallax-scrolling/`) · Next: Cover Card to Fixed Header (`../cover-card-to-fixed-header/`)
-- **Final fix wave:** the side columns and the second card set of every column are hidden from screen readers (each card is read once, not six times), and reduced motion switched on mid-visit clears the column transforms (see the last two Stage bullets).
-
----
-
-## cover-card-to-fixed-header — Cover Card to Fixed Header
-
-- **Kind:** scroll. Scrolling shrinks a tall article cover into a slim header.
-- **Description:** A tall cover shrinks into a slim header as you scroll. Best for articles.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** an article page whose cover fills most of the box. As the box scrolls, the cover shrinks into a slim bar pinned at the top: the title scales down into the corner, the subtitle and date fade out first, the background dims and blurs, a thin line appears under the bar and the author's name fades into its corner. The article text then scrolls up under the bar, and a closing line fills the space after it. Scrolling back opens the cover again in reverse. Back to top, and Play restarting from the top, jump the box at once, and the cover jumps with it (a click on either button sets the eased value at once).
-- **Scroll distance and Play:** the scene is as tall as the full cover plus the article (below): about 1.3 box heights of scrolling at 1280×800 (498px) and 2.4 on a phone (701px). At the default Shrink distance, Play spends about four of its six seconds shrinking the cover (under three on phones), then scrolls the article up and ends on the closing line, with the article's last line or so above it (15px of it at 1280×800, none in the 258px box).
-- **Reduced motion:** nothing scrolls by itself. As today, the cover snaps between tall and slim at half the Shrink distance, with no easing (`snaps()` is true under reduced motion). The CSS rule for `will-change` stays.
-- **Stage font:** site font (the stage text only inherited the old body font). The blockquote drops its italic.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;overflow-anchor:none;container-type:size;background:#0b0b0d`, with `aria-label="An article with a tall cover"`. `overflow-anchor:none` stays (since the final fix wave the cover no longer changes height on scroll; the rule guards a resize, see the wave note).
- - The cover's full height becomes 85% of the box: `.cover{height:85cqh}` in the CSS, and `measure()` sets `FULL = Math.round(stage.clientHeight * 0.85)` (530px of a 620px stage today), so the whole cover shows on arrival: 321px at 1280×800, 276px at 1366×657, 219px at 1280×590 and 253px on phones (measured: its text, with its margins and padding, needs 171px there and 192px on phones). `--cover-full` goes; `--cover-min` stays (56px, 64px under 600px). The cover then moves with transforms and keeps its full height in the layout: `measure()` also sets `cover.style.height = FULL + 'px'` and `CONTENT = FULL − spacer height` (the cover's text with its margins and padding, read from `.cover-spacer`), and `render()` writes, for `v = q(lerp(FULL, MIN, e), 1)` and `d = FULL − v`: `translateY(-d)` on `.cover` and `.article-body`, `translateY(d)` on `#header-chip`, `translateY(d) scaleY(v / FULL)` on `#cover-bg` (`transform-origin:top`) and `translateY(max(0, CONTENT − v))` on `.cover-inner`. `.cover` and `.article-body` get `will-change:transform` (`auto` under reduced motion). (final review: height is no longer animated; layouts during a scroll fell from about one per two frames to none)
- - The scene's `min-height:2500px` goes. Today it leaves about 1,700px of empty box after the article, so Play would spend most of its six seconds on nothing. `measure()` sets `scene.style.minHeight = Math.max(FULL + article.offsetHeight, stage.clientHeight + 440) + 'px'`, so the box scrolls far enough to finish the longest shrink and its scroll length does not change while the cover shrinks. At every measured size the first term wins, so once the cover is slim, `FULL − MIN` of box is left empty after the article: 265px at 1280×800, 163px at 1280×590, 189px on phones. `measure()` also runs after `document.fonts.ready` (the article's height depends on the font).
- - A closing line fills that space (owner decision 4): `<p class="end-cue">The end · scroll back up and the cover opens again</p>`, the last child of `.scene`, with `position:absolute;left:0;right:0;bottom:0;margin:0;display:flex;align-items:center;justify-content:center` and the cue style (shared rule 14: 13px `#8a8a92`, `letter-spacing:.1em`, `text-align:center;padding:0 24px`). `measure()` sets its height to `FULL − MIN` (`.scene` is already `position:relative`).
- - The cover's title becomes `<p class="cover-title" id="cover-title">` (was an `h1`, shared rule 13): the shared rule `.hb-page h1` would restyle it at 64px. `.cover-title` keeps its own look (26px, `#d1f7d6`, `line-height:1.2`, `letter-spacing:-.5px`, `margin-bottom:8px`, `transform-origin:left top`) and gets `font-weight:700`, the weight the `h1` gave it. Measured: when the cover is slim, the title's two lines scale to half size and sit 22–53px down the 56px bar (64px on phones).
- - The code shown on the cover (`.cover-code`) goes, with its line in `render()` (`coverCode.style.opacity`).
- - Text on the cover: the subtitle becomes "Why a tall cover can fold into a slim bar as you read" (was "How browsers render scroll-driven animations at 60fps"); "Article · 8 min read", the title and "Matin M. · May 2026" stay. `.cover-meta`, `.author-name` and `.chip-name` become 11px (were 10px) and `.cover-sub` 14px (was 12px). `.cover-meta`, `.cover-sub` and `.author-name` use `#5fa577` (was `#3d7a52`, 3.1:1 on the cover's green; the new green is 5.3:1); `.chip-name` keeps `#d1f7d6`. The author chip (`#header-chip`) is `aria-hidden="true"`: it only repeats the author line on the cover.
- - The article is rewritten in plain words (today's text speaks of compositors, easing curves and the removed slider), with `.article-body p` at 14px (was 12px), the headings 12px (was 11px) and the blockquote 15px (was 13px). Its three headings become `h3` (were `h2`, shared rule 13), so the `.article-body h2` rule becomes `.article-body h3`. In order:
-
- | Part | Text |
- |---|---|
- | Heading | One number drives it all |
- | Paragraph | As you scroll, one number moves from 0 to 1. The cover's height, the size of the title, the fading background and the small author badge all follow that number, so every moment in between looks planned. |
- | Quote | A header should get out of the way without disappearing. |
- | Heading | Everything moves together |
- | Paragraph | The title shrinks toward the top-left corner while the subtitle and the date fade out first, so the slim bar never looks crowded. |
- | Paragraph | The author's name fades into the corner of the bar in the second half of the fold, when there is room for it. |
- | Heading | Room to read |
- | Paragraph | Once the cover has folded away, only a slim bar stays at the top, with the title and the author, and the rest of the box goes to the text. |
- | Paragraph | Scroll back up and the cover opens again, step by step, in exactly the reverse order. |
-
- - Script: the Collapse Override slider's code goes (`colSlider`, the `manual` flag and `overrideOf()`); the `scroll` listener always sets the target from the scroll. `render()` loses its readout and slider lines. The Binary toggle's handler moves to Snaps at halfway.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shrink distance | Choice buttons | Short · Medium · Long | Medium | How far you scroll before the cover is fully small. | `RANGE`: 200 / 320 / 440 (px), then `target = curveOf(clamp(stage.scrollTop / RANGE, 0, 1)); schedule();` |
-| Snaps at halfway | Switch | on / off | off | Jumps from tall to slim instead of shrinking smoothly. | `binaryTog.checked`, then today's handler (clears the cache `G`, sets the target from the scroll, `schedule()`) |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the Scroll and Collapse readouts.
- - The Collapse Override slider. Like the Seek slider on Scrub Animation, it moved the same progress value that scrolling moves, and scrolling or Play now does that.
- - The Transition Range slider (150–600px). It becomes Shrink distance; Long stops at 440px so the box can always finish the shrink.
- - "Binary (snap at midpoint)" becomes Snaps at halfway.
- - Reset scroll. Back to top replaces it.
- - The code on the cover.
-- **Good for:** Articles · Blog posts · Product pages · **Avoid on:** Short pages · App screens
-- **Prompt:**
-
- > Add a collapsing cover to [your article or page header]. Start with a tall cover pinned to the top that holds the title, a subtitle, the date and the author. As the visitor scrolls, shrink it into a slim header: the title scales down into the corner, the subtitle and date fade out first, and a small author badge fades in near the end. Unless the settings make it snap, tie every change to one number that runs from 0 to 1 with the scroll, so every moment in between looks planned and scrolling back reverses it. Turn off scroll anchoring on the scrolling area. If the visitor has reduced motion turned on, switch between the tall and slim cover halfway, without animating. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A cover card to fixed header starts a page with a tall cover that holds the title, a subtitle, the date and the author, and shrinks it into a slim header as you scroll. Every change, from the cover's height and the title's size to the fading background and the small author badge, follows one number that runs from 0 to 1 with the scroll, so every moment in between looks planned.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Shrink distance | Medium | How far you scroll before the cover is fully small: short is 200px, medium 320px and long 440px |
- | Snaps at halfway | off | Switches between the tall cover and the slim header at half the distance instead of shrinking with the scroll; reduced motion always does this |
-
-- **README See also:**
- - [Pin Animation](../pin-animation/) — one part holds still while the page scrolls past
- - [Stacking Cards](../stacking-cards/) — cards pile into a deck as you scroll
- - [Scrub Animation](../scrub-animation/) — scroll plays an animation forward and back
-- **README How it works:**
- - The sentence above the second snippet, "Eight properties are then interpolated against `e`", becomes "The cover's visible height and seven other values are then worked out from `e`", and in the snippet `cover.style.height = lerp(530, 56, e) + 'px';` becomes two lines (the cover moves with transforms, final review): `const h = lerp(FULL, 56, e), d = FULL - h; // FULL: 85% of the box's height` and ``cover.style.transform = `translateY(${-d}px)`; // the cover keeps its full height and slides up``.
- - In the same snippet, the comment `// also coverSub, coverCode` becomes `// also coverSub`.
- - The spacer sentence ("A `flex: 1` spacer inside the cover pushes content to the bottom …") becomes: "Nothing is resized: the cover keeps its full height in the layout and slides up by what it has shrunk, and the article slides with it; the badge and the backdrop are moved back into the visible part, and once the cover is shorter than its text the text starts at the top of the bar." (final review). The frame-rate fix (below) then adds a paragraph, "The scroll does not set `e` itself: it sets a target, and a loop moves the value that is drawn toward it, so a wheel notch glides instead of jumping. Each frame covers a share of the distance left that depends on how long the frame took, so the header settles in the same time on a 30, 60 or 120Hz screen:", and a three-line snippet after it (`dt`, `last` and `current += (target - current) * (1 - Math.pow(1 - EASE, dt / FRAME))`), and the sentence "Back to top and Play from the end set the eased value at once." comes last.
- - The rest is unchanged.
-- **README Production notes:** the bullet "The height animation triggers layout" becomes "**Move the cover; never animate its `height`.** Writing `height` lays the page out every frame. Keep the cover at full height, slide it and the content below with `translateY()`, and squeeze the backdrop with `scaleY()` from its top edge — as the demo does." (final review). The scroll-anchoring bullet gains "This demo moves the cover with transforms, so scrolling never changes its height; the rule stays as a guard for when the box is measured again after a resize." The rest is unchanged.
-- **Category line:** `01.04 · Scroll-Based`
-- **Pager:** Previous: Reverse-Scrolling Columns (`../reverse-scrolling-columns/`) · Next: Fly-in Fly-out Contact List (`../fly-in-fly-out-contact-list/`)
-- **Final fix wave (Scroll-Based final review, 2026-09-30).** The cover no longer animates `height`: it keeps its full height in the layout and moves with transforms (the cover-height bullet under Stage, above), so a scroll lays the page out about twice in 150 frames at 4× CPU throttling in a phone-sized box, down from 75. `overflow-anchor:none` stays as a guard: the first Stage bullet's reason now applies when `measure()` writes the cover's height after a resize. A click on Back to top or Play sets the eased value at once, so the cover does not open again after a jump (`render(current)` runs in the same click). `#header-chip` is `aria-hidden`. `index.html` grows from 299 to 308 lines.
-- **Frame-rate fix (wrap-up):** `tick(now)` eases by `current += d * (1 - Math.pow(1 - EASE, dt / FRAME))`, with `EASE = 0.16` (the share covered in 1/60 s), `FRAME = 1000/60` and `dt = last ? Math.min(now - last, 50) : FRAME`. `schedule()` sets `last = 0` when it re-arms the parked loop, so the first frame after a restart counts as 1/60 s. The header settles in the same time on a 30, 60 or 120 Hz screen (95% of the way in about 0.3 s), where a fixed 16% a frame settled twice as fast at 120 Hz and half as fast at 30 Hz. At 60 Hz nothing changes. Back to top and Play from the end still set the eased value at once. The prompt and Key parameters say nothing per frame and are unchanged.
-
----
-
-## fly-in-fly-out-contact-list — Fly-in Fly-out Contact List
-
-- **Kind:** scroll. Scrolling moves the rows through edge zones where they fly in and out.
-- **Description:** Rows fade and slide as they near the top or bottom edge. Best for long lists.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** a list of fifteen contacts. A row rising through the bottom band of the box fades in, slides up into place and grows to full size; a row rising through the top band does the reverse and leaves; rows in the middle band stay still and whole. The deeper a row is in its band, the further along it is, so scrolling back brings rows back the same way. At the very top the first row sits in the top band, so it starts mostly faded, as today.
-- **Scroll distance and Play:** the list's own height: about 1.74 box heights at 1280×800 (658px) and 2.4 on a phone (723px). Play carries the rows through the bands at about 110px a second (120 on a phone).
-- **Reduced motion:** nothing scrolls by itself. As today, rows never move or shrink; they only fade between 30% and full strength in the bands (the `reduced` branch of `applyRow()`). The CSS rule `.row{will-change:auto}` stays.
-- **Stage font:** site font. `.row-name` becomes 14px (was 12px), `.row-sub` 12px (was 10px), `.badge` and `.meta-time` 11px (were 9px and 8px), `.zone-label` 11px (was 8px).
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;background:#0b0b0d`, with `aria-label="A list of contacts"`.
- - The rows and the zone overlay stay; the overlay's labels keep "↑ exit zone" and "↓ entry zone", and the second label's inline style moves into a `.zone-label-end` rule (`position:absolute;bottom:2px`). The overlay is the stage's first child, before the list (`.contact-list` holds only the rows): `position:sticky;top:0;height:0`, so it sticks to the top of the box, is zero tall and first in the box, and showing it moves nothing. Its two bands run from edge to edge of the box, the first on the top edge and the second ending on the bottom edge, at every scroll position (measured at five sizes; inside the padded list they sat 12px low, and 12px in from each side, near the top).
- - Each row's avatar (its initials) gets `aria-hidden="true"` in the row template, because it repeats the name (shared rule 12).
- - Phone rule kept (under 600px): `.avatar{width:32px;height:32px;font-size:11px}` (its font was 10px).
- - In the 258px box of a 1280×590 window each band is 65px and two whole rows fit between them (measured).
- - The list ends with 70px of padding (`.contact-list{padding:12px 12px 70px}`), as much as the farthest a row can slide (the Far choice), so a row still arriving at the bottom never adds to the scroll length, which Play reads once when it starts. When the box jumps by more than half its height (Back to top, Play starting again, a dragged scrollbar), `update()` styles every row once instead of only the rows the observer has added, because a jump can bring in rows it has not added yet, still in the style they were left with; the first call counts as a jump, which gives the first picture its effect.
- - `update()` keeps the row styling; its Scroll and Visible rows readout lines go (`applyRow()` still returns whether the row is in view, unused).
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Effect | Choice buttons | All three · Move only · Fade only | All three | All three moves, fades and shrinks each row together. | `mode`: `'all'` / `'translate'` / `'fade'`, then `update()`; also shows How far rows move except with Fade only, and How much rows shrink only with All three |
-| Edge zone size | Choice buttons | Small · Medium · Large | Medium | How close to the edge a row starts to fly out. | `Z`: 0.15 / 0.25 / 0.35, then `updateOverlay()` and `update()` |
-| How far rows move | Choice buttons; shown only when Effect is not Fade only | Short · Medium · Far | Medium | The distance a row slides as it leaves. | `DIST`: 20 / 40 / 70 (px), then `update()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| How much rows shrink | Choice buttons; shown only when Effect is All three | A little · Medium · A lot | Medium | The size a row shrinks to at the edge. | `SCALE`: 0.97 / 0.94 / 0.88, then `update()` |
-| Shows the zones | Switch | on / off | off | Tints the two bands where rows fly in and out. | the zone overlay's `visible` class on / off |
-
-- **Removed:**
- - The note, and the Scroll and Visible rows readouts.
- - The Translate Distance, Scale Delta and Zone Size sliders. They become How far rows move, How much rows shrink and Edge zone size.
- - The Effect Mode radio buttons. They become Effect.
- - "Preview zones" becomes Shows the zones.
- - Reset. Back to top and the settings' defaults replace it.
-- **Good for:** Contact lists · Chat lists · Activity feeds · Search results · **Avoid on:** Short lists · Tables
-- **Prompt:**
-
- > Add a fly-in, fly-out effect to [your scrolling list, such as contacts or messages]. Treat a band at the top and a band at the bottom of the scrolling area as edge zones. As a row passes through the bottom band it arrives, and as it passes through the top band it leaves: the deeper it is in the band, the more it is faded, moved and shrunk, as the settings choose, and in the middle it shows in full. Work it out from the scroll position on every frame, so scrolling back brings rows back. If the visitor has reduced motion turned on, do not move or shrink rows; only fade them a little near the edges. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A fly-in, fly-out list animates its rows as they pass near the edges of the scrolling area. A row coming in at the bottom fades in, slides up and grows to full size; a row leaving at the top does the reverse; rows in the middle stay still. Because it follows the scroll position rather than playing once, scrolling back brings rows back the same way.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Effect | All three | Which changes a row makes in the bands: all three (moving, fading and shrinking) together read as physical motion; moving only or fading only feels flatter |
- | Edge zone size | Medium | How tall each band is: small is 15% of the box, medium 25% and large 35% |
- | How far rows move | Medium | How far a row slides at the very edge: short is 20px, medium 40px and far 70px |
- | How much rows shrink | Medium | The size of a row at the very edge: a little is 97%, medium 94% and a lot 88% |
- | Shows the zones | off | Tints the two bands, red for leaving and green for arriving |
-
-- **README See also:**
- - [Reveal on Scroll](../reveal-on-scroll/) — cards appear once as they cross a line
- - [Stagger Reveal](../stagger-reveal/) — items in a group appear one after another
- - [Cover Card to Fixed Header](../cover-card-to-fixed-header/) — a tall cover shrinks into a slim header
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `01.05 · Scroll-Based`
-- **Pager:** Previous: Cover Card to Fixed Header (`../cover-card-to-fixed-header/`) · Next: Stacking Cards (`../stacking-cards/`)
-- **Final fix wave (2026-09-30):** the final category review found the zone bands 12px low near the top, because the overlay sat inside the padded list (its sticky `top:0` only took effect after 12px of scrolling, and its bands were 12px in from each side). It is now the stage's first child, `.contact-list` holds only the rows, and its `margin-bottom:-6px` (which cancelled the list's gap) is gone. Measured at five sizes: the bands sit on the box edges at every scroll position, and with the zones off every picture is identical to the page as it was. The scroll, Play and band figures above are corrected to what the page measures.
-
----
-
-## stacking-cards — Stacking Cards
-
-- **Kind:** scroll. Scrolling stacks the cards into a deck.
-- **Description:** Cards stick at the top and pile into a deck. Best for step-by-step stories.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** white project cards scroll up one after another. Each sticks at the top of the box and the next slides over it, leaving a strip of every card underneath showing, and each covered card shrinks slightly from its top edge, so the pile reads as a deck. At the end the finished deck holds still for a moment. Scrolling back takes the deck apart.
-- **Scroll distance and Play:** a 25cqh lead-in, the cards (each one box tall less the strips and a 12px foot), and a 30cqh run-out inside the deck: at five cards about 4 box heights at 1280×800 (1,520px) and 3.9 on a phone (1,155px). Play lays a card on the deck about every 1.3 seconds.
-- **Reduced motion:** nothing scrolls by itself. As today, the cards still stack, but covered cards do not shrink (the demo's rule `animation:none!important`, and the fallback's check).
-- **Stage font:** site font. `.card-num` and `.card-title` drop `serif`; `.card-btn` drops `monospace`. `.card-sub` and `.card-btn` become 11px (were 10px) and `.card-body` 14px (was 12px), under shared rule 9.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="A stack of project cards"`.
- - `.spacer{height:25cqh}`, `.run-out{height:30cqh}`, and `.card__content{height:calc(100cqh - 12px - (var(--numcards) - 1) * var(--peek))}` (were in `var(--stage-h)`, with a 24px foot; measured: the same deck and the same CSS scroll timeline). The foot under the deepest card becomes 12px, so every card is 12px taller.
- - The card text is rewritten as plain project cards (today's cards explain the code). `ALL_CARDS` keeps each card's number and `vis`, and its `ac` except for four that are darkened (see "On white" below), with this text:
-
- | Card | Title | Kind (sub) | Line (body) |
- |---|---|---|---|
- | 01 | Harbor House | Architecture | A timber home on the edge of the water. |
- | 02 | Night Market | Photography | Forty evenings of food stalls and lanterns. |
- | 03 | Field Notes | Journal | Small drawings from a year of walks. |
- | 04 | Slow Roast | Brand | A new look for a family coffee roaster. |
- | 05 | North Line | Maps | A clearer map for a busy train network. |
- | 06 | Open Studio | Workshop | Two days of making things by hand. |
- | 07 | Tide Tables | App | Daily tides for every beach on the coast. |
-
- - The card button reads "View project →" (owner decision 6; the page checks forbid "Read more"). It is decoration: the card is not a link and the button takes no press, so `buildCards()` writes it as `<div class="card-btn" aria-hidden="true">` and a screen reader does not announce an action that is not there (before, it read "View project →" once for every card).
- - The big faded number becomes a watermark (owner decision 5): it keeps its 52px size and its opacity .1 but leaves the text column's flow, `.card-num{position:absolute;top:clamp(8px,3cqh,16px);right:clamp(12px,2.5vw,24px);margin:0;line-height:1}` with `.card__text{position:relative}`, and each number gets `aria-hidden="true"` in `buildCards()` (shared rule 12).
- - `.card__text` padding follows the box's height: `padding:clamp(14px,6cqh,32px) clamp(18px,3vw,32px)` (was `clamp(18px,3vw,32px)` all round; `6cqh` is 6% of the box).
- - On the shortest cards the one-line text hides, so the title, the kind and the button fit. `measure()` works out a card's height, `stage.clientHeight - 12 - (numCards - 1) * peekPx`, and toggles the class `short` on `#cards` when it is under 170px, with `#cards.short .card-body{display:none}`. `measure()` already runs after `buildCards()`, after a change of Edge that shows and on `resize`. The line hides only with seven cards and the Large edge (in the 258px and 288px boxes of short laptop windows and on phones), and with five cards and the Large edge or seven and Medium in the 258px box.
- - On white: `.card-sub` and `.card-body` drop their opacity and use `#5f5f66` (today about 2.9:1 and 3.9:1; the new grey is 6.3:1). The button label is 11px text too, and each card's `ac` sets both its text and its border. Four of today's seven `ac` colours are under 4.5:1 on the white card: `#c07030` 3.75:1 (Harbor House, the card a visitor sees on arrival), `#5a8a38` 4.10:1, `#9a7820` 4.13:1 and `#3a8a60` 4.21:1. Those four are darkened within their own hue (about 4.6:1) and the other three stay; only the label's text and border change, the `vis` gradients do not. `ALL_CARDS` takes these `ac` values:
-
- | Card | `ac` (label text and border) | On white |
- |---|---|---|
- | 01 | `#aa632b` (was `#c07030`) | 4.64:1 |
- | 02 | `#37835b` (was `#3a8a60`) | 4.61:1 |
- | 03 | `#3a70a8` | 5.17:1 |
- | 04 | `#90701e` (was `#9a7820`) | 4.64:1 |
- | 05 | `#548034` (was `#5a8a38`) | 4.65:1 |
- | 06 | `#8a3a68` | 7.28:1 |
- | 07 | `#3a5aa0` | 6.67:1 |
-
- - Phone rules (under 600px), in place of today's `grid-template-columns:1fr;grid-template-rows:1fr 140px`, which pushes the coloured half out of the 300px box: `.card__content{grid-template-columns:1fr;grid-template-rows:1fr}`, `.card__visual{display:none}` and `.card__text{gap:6px}`.
- - Measured, all 12 combinations of Number of cards and Edge that shows fit their text at every size: 1280×800, 1366×657, 1280×640, 1280×620, 1280×590, 768×1024, 610×1000 and 375px and 320px phones. The tightest is seven cards with the Large edge in the 258px box: 2px to spare, with its line hidden. No `container-type` is used on the cards (shared rule 5).
- - The debug badge goes, with its markup in `buildCards()`.
- - Script: the automatic fallback stays (`useJsFallback = !supportsSDCA`); the switch that forced it goes. `update()` keeps the fallback's scale writes; its Scroll and Topmost card lines go.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Edge that shows | Choice buttons | None · Small · Medium · Large | Medium | The strip of each card left showing above the next. | `peekPx` and `--peek`: 0 / 8 / 14 / 20 (px), then `measure()` and `update()` |
-| How much cards shrink | Choice buttons | A little · Medium · A lot | Medium | Covered cards shrink so the deck looks deep. | `scaleStep` and `--scale-step`: 0.05 / 0.10 / 0.12, then `lastScales` reset and `update()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of cards | Choice buttons | 3 · 5 · 7 | 5 | More cards make a taller deck and a longer scroll. | `numCards`: 3 / 5 / 7, then `buildCards()` |
-
-- **Removed:**
- - The note, and the Scroll and Topmost card readouts.
- - The Scale step, Peek offset and Card count sliders. They become How much cards shrink, Edge that shows and Number of cards.
- - Show indices, and the debug badges it showed.
- - JS fallback. It only chose how the same result is worked out; the page still falls back by itself where the browser has no scroll timelines.
- - Reset scroll. Back to top replaces it.
-- **Good for:** Portfolios · Case studies · Onboarding steps · Feature tours · **Avoid on:** Long text · Many cards
-- **Prompt:**
-
- > Add stacking cards to [your set of project or step cards]. Make each card stick to the top of the scrolling area so the next card slides up over it, and push each later card down by the offset in the settings so a strip of the cards underneath stays visible, like a deck. As a card is covered, shrink it slightly from its top edge, so buried cards look farther away. Leave some room after the last card so the finished deck stays on screen. Use scroll-driven animations where the browser supports them, with a small script as the fallback. If the visitor has reduced motion turned on, let the cards stack without shrinking. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Stacking cards pin each card to the top of the scrolling area, so the next card slides up over it and the cards pile into a deck. A strip of every card underneath stays visible, and each covered card shrinks slightly, so the pile looks deep. The stacking itself needs no script: the browser's sticky positioning does it.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Edge that shows | Medium | The strip of each card left showing above the next: none, small (8px), medium (14px) or large (20px) |
- | How much cards shrink | Medium | How much smaller each card gets for every card on top of it: a little is 5%, medium 10% and a lot 12% |
- | Number of cards | 5 | Three, five or seven cards; more make a taller deck and a longer scroll |
-
-- **README See also:**
- - [Pin Animation](../pin-animation/) — one part holds still while the page scrolls past
- - [Snap Scrolling](../snap-scrolling/) — the box settles on one section at a time
- - [Cover Card to Fixed Header](../cover-card-to-fixed-header/) — a tall cover shrinks into a slim header
-- **README How it works:** unchanged
-- **README Production notes:** in the "Size cards to include their own offset" bullet, `stage − 24px − (N−1) × peek` becomes `stage − 12px − (N−1) × peek`. The rest is unchanged.
-- **Category line:** `01.06 · Scroll-Based`
-- **Pager:** Previous: Fly-in Fly-out Contact List (`../fly-in-fly-out-contact-list/`) · Next: ScrollTrigger Animation (`../scroll-trigger/`)
-- **Final fix wave:** the decorative "View project →" button is `aria-hidden="true"` (see the card button under Stage): the accessibility tree no longer holds it, and the cards' titles and text are read as before.
-
----
-
-## scroll-trigger — ScrollTrigger Animation
-
-- **Kind:** scroll. Scrolling passes four zones, each starting, following or holding its animation.
-- **Description:** Animations start, follow and pin at set scroll points. Best for landing pages.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Try it:** none (the rollout spec: this demo has no settings). The page has steps 1 and 2.
-- **Scroller:** the stage.
-- **What scrolling shows:** four tinted zones in turn, each with a small label.
- 1. "Fades in": a heading and a line of text fade in while any part of that text is in the box, and hide once it has gone above or below it. Scrolling back up, the fade starts as the text's bottom edge comes into the box, so it is seen.
- 2. "Follows the scroll": a square turns half a turn, grows and changes colour as the square itself rises from 80% to 25% down the box (its centre), and turns back when you scroll back. It starts turning fully inside the box and stays inside it for the whole turn.
- 3. "Pinned": a card holds still in the middle of the box while the zone scrolls past it, and its text steps through three stages.
- 4. "Steps": five dots light up one by one as the row of dots rises from 80% to 25% down the box (its centre): the first lights with the row about three quarters of the way down, the last about a third of the way down, and none before the row is in view.
- Then a closing line: "That's the end · scroll back up to see each zone again".
-- **Scroll distance and Play:** zones 1, 2 and 4 at 90cqh, zone 3 at 200cqh and a 100cqh run-out: 4.7 box heights of scrolling (1,776px at 1280×800, 1,400px on a phone). Play shows each zone for about a second and holds the pinned card for about 1.3 seconds, a little under half a second per stage.
-- **Reduced motion:** nothing scrolls by itself. As today, zone 1's text appears and disappears without the fade (`.reveal-content{transition:none}`); the square, the card and the dots still follow the visitor's own scrolling.
-- **Stage font:** site font (the stage text only inherited the old body font).
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="Four scroll zones"`.
- - Sizes: `.zone{min-height:90cqh}` (550px in a 620px stage today); `.z3{min-height:200cqh}`; `.pin-card{top:calc(50cqh - 70px)}`; `.run-out{height:100cqh}`.
- - Zone labels (`.zone-tag`, 11px, was 9px): "Fades in", "Follows the scroll", "Pinned", "Steps" (were "Fade on Enter", "Scrub", "Pin + Scrub", "Snap"). Their `opacity:.8` goes: text faded below 4.5:1 is fixed in its section, and with it the four labels measure 4.22, 4.31, 4.22 and 3.47:1 (text and tinted background both fade over the zone), without it 5.74, 5.86, 5.75 and 4.68:1.
- - Zone 1: the heading reads "Fades in on arrival" and the text "This text fades in as it scrolls into the box, and hides again once it has gone." (today's text names onEnter and onLeave). `.reveal-sub` becomes 14px (was 13px). The fade is keyed to the text's own layout box (`#reveal`, by `offsetTop` and `offsetHeight`, which its 30px translate before it fades in does not change): active while any part of that box is in the box, not while any part of the zone is. Keyed to the zone, the text turned active when the zone's bottom edge came into the box, with the text still 84–138px above it, so scrolling back up showed no fade. On load, after Back to top and when Play restarts, the text is in the box at once and fades in as before.
- - Zone 2: the caption reads "The square turns, grows and changes color as you scroll." The "progress: 0%" readout under the square goes.
- - Zone 3: `PIN_STEPS` becomes:
-
- | Step | Title | Text |
- |---|---|---|
- | Step 1 of 3 | Held in place | The card stops here while the page keeps scrolling. |
- | Step 2 of 3 | Changing | Its text changes as you scroll through the zone. |
- | Step 3 of 3 | Let go | Scroll on and the card moves away with the page. |
-
- `.pin-body` becomes 14px (was 12px).
- - Zone 4: the caption reads "Scroll on to light up the dots, one at a time." The "0 / 5 lit" readout goes.
- - The two captions' inline styles move into a `.zone-cap` rule (13px, `var(--ui-muted)`, the zone 2 caption with `margin-bottom:4px`).
- - The run-out reads "That's the end · scroll back up to see each zone again" in the cue style (shared rule 14): sentence case (its `text-transform:uppercase` goes), `text-align:center;padding:0 24px`, 13px `#8a8a92` with `letter-spacing:.1em`, without the opacity .5 (today 10px capitals at about 2:1, left-aligned against the edge on phones).
- - Every zone's window is reached at every size, and happens where the visitor can see it (the binding rule: the effect is seen during Play and while scrolling by hand). The square and the row of dots each follow their own centre from 80% to 25% down the box: `clamp((scrollTop - (centre - 0.8 * box)) / (0.55 * box), 0, 1)`. A window keyed to the zone's top (80% to 20%, as the old page had it) ran about half a box too early, because a zone is 90% of the box tall and centres its content: dot 1 lit with the row 61–96px below the box, the row came into view with two or three dots already lit, and the square started turning below the box. An end line of 20% would also leave the finished square 7px above the 258px box; 25% keeps it inside (measured in boxes of 258–438px and on phones: dot 1 lights with the row centre at 74–75% down the box, dot 5 at 30–31%; the square starts turning at 161–252px of the 258px box and is done at 6–123px, inside the box for the whole turn). After zone 4 the one-box run-out lets the row rise well past 25% of the box, so all five dots light, and the pinned card's three stages fit inside zone 3's span (shared rule 4). In the 258px box of a 1280×590 window the zones are 232px (zone 2 is 236px: its content is taller), zone 2's content 170px (186px on phones, where its caption wraps; the square sits 40px under its caption: turned and grown it reaches 33px beyond its box, so it stays about 7px clear of the caption, 6.8px at the closest) and the pinned card, 136px tall with two lines of text at every width, sits 59–195px down the box (measured; phones 79–215px of 298).
- - Script: `update()` keeps the zone states, zone 1's class, the square, the card steps and the dots. The pills, the callback log and the progress readout go, with `logEvent()`, `NAMES`, `prevState`, `primed`, `cbEvents` and `EMPTY_LOG`. `measure()` also runs after `document.fonts.ready`, measures the zone tops against the stage's inner edge (`clientTop`, the 1px border) so they match `scrollTop`, and caches the place of the text (`#reveal`), the centre of the square and the centre of the row of dots from their layout boxes (the zone top plus `offsetTop`; `offsetHeight` for the height and the centre), not from their on-screen rectangles, which the turn, the scale and the 30px translate change.
- - `hb-dots`: no. Default height.
-- **Removed:**
- - The note, the Scroll progress readout, the Zone status pills and the Callback log.
- - The "progress" and "lit" readouts on the stage.
- - Reset scroll. Back to top replaces it.
-- **Good for:** Landing pages · Product pages · Feature sections · **Avoid on:** Short pages · Forms
-- **Prompt:**
-
- > Add scroll-triggered animations to [the sections of your page]. Split the page into zones and work out from the scroll position whether each zone is still ahead, on screen or already passed. Fade a zone's content in when the zone arrives and hide it again when it has gone. Tie another animation's progress to how far the visitor has scrolled through its zone, so it plays forward and back with the scroll. Pin one card in place while its text steps through a few stages, and light up a row of dots in steps. Leave some space after the last zone so it can finish. If the visitor has reduced motion turned on, show content without fading it.
-
-- **Copy prompt hint:** "Replace the words in brackets with your own sections."
-- **README What it is:** rewritten:
-
- > Scroll triggers start, follow or hold animations at chosen points as you scroll. Each zone of a page is either still ahead, on screen or already passed, and moving between those states starts or reverses its animation. The demo shows four common uses: fading content in as it arrives, tying an animation to the scroll, pinning a card while it changes, and lighting up steps. In production the GSAP ScrollTrigger plugin handles all of this; the demo does it by hand.
-
-- **README Key parameters:** the technique's own values (the page has no settings):
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Zone height | 90% of the box (zone 3: twice the box) | How much scrolling each zone takes |
- | Follow window | From 80% to 25% down the box | The square in zone 2 and the row of dots in zone 4 play while their own centre rises between these two lines, so each plays in full view |
- | Pinned span | Zone 3's height less one box | How long the card holds still; its three stages share it equally |
- | Run-out | One box height | Space after the last zone, so it can finish and leave |
-
-- **README See also:**
- - [Scrub Animation](../scrub-animation/) — scroll plays an animation forward and back
- - [Pin Animation](../pin-animation/) — one part holds still while its text changes
- - [Reveal on Scroll](../reveal-on-scroll/) — cards appear as they cross a line
-- **README How it works:**
- - "A change of state is a callback. Which one depends on the direction the state moved:" becomes "A change of state is a callback. Which one depends on the direction the state moved (the demo shows them through the text in zone 1, which fades in on enter and hides on leave):".
- - In that snippet, `log(ev); prev[i] = s;` becomes `prev[i] = s; // run the zone's enter or leave animation for ev`.
- - In the sentence before the scrub snippet, "it resolves to 0 before the zone and 1 after it — so a zone you skipped past still ends up in its finished state:" becomes "it resolves to 0 before its window and 1 after it — so a zone you skipped past still ends up in its finished state. The window belongs to the piece that animates (the square, the row of dots), not to the zone around it: here a zone is nearly a box tall and centres its content, so a window keyed to the zone's top would run before the piece could be seen:". In the snippet, the two lines `// enter window: 0 as the zone top passes 80% down the viewport, 1 at 20%` and `const p = clamp((stage.scrollTop - (top[i] - 0.8 * viewport)) / (0.6 * viewport), 0, 1);` become `// follow window: 0 as the piece's centre passes 80% down the box, 1 at 25%`, `// (centre: the middle of its layout box, measured against the stage and cached like the zone tops)` and `const p = clamp((stage.scrollTop - (centre - 0.8 * viewport)) / (0.55 * viewport), 0, 1);`.
- - The rest is unchanged.
-- **README Production notes:** two bullets lose the removed log and readout, and a third names the piece's window:
- - "**Prime the state before logging callbacks.** Comparing the first frame's state against a `null` starting value manufactures events that never happened: this log opened claiming zone 1 had fired `onEnterBack` and zones 2–4 `onLeaveBack`, before any scrolling." becomes "**Prime the state before firing callbacks.** Comparing the first frame's state against a `null` starting value manufactures events that never happened: zone 1 would fire `onEnterBack` and zones 2–4 `onLeaveBack` before any scrolling." Its last sentence stays.
- - In "**Leave a run-out after the last trigger.**", "— the snap dots here were stuck at 0/5 forever." becomes "— without it, the dots in zone 4 could never all light up."
- - In "**Anchor the scrub to where the section *enters*, not to where it reaches the top.**", after "here that moved each trigger roughly 0.8 of a viewport earlier." comes: "Anchor it to the piece that animates, too: a zone that is nearly a box tall and centres its content puts the piece half a box below the zone's top, so the demo uses `start: "center 80%"` / `end: "center 25%"` on the square and on the row of dots, and the animation plays where it can be seen."
- - The rest is unchanged.
-- **Category line:** `01.07 · Scroll-Based`
-- **Pager:** Previous: Stacking Cards (`../stacking-cards/`) · Next: Scrub Animation (`../scrub-animation/`)
-- **Final fix wave (2026-09-30):** the turning square cut into its caption (turned and grown it reaches 33px beyond its box, and the gap was 24px; on phones it covered "you scroll."). `.swatch` is now `margin:40px auto 24px`: measured over the whole follow window at eight sizes, the square stays about 7px clear of the caption (6.8px at the closest)'s line (30px would still overlap it by 3px), and only the 258px box changes (zone 2 is 236px there, the scroll 3px longer). Zone 1's stage text now says the fade is keyed to the text itself, and two README wordings are corrected ("half a box", and GSAP's "default" start and end).
-
----
-
-## scrub-animation — Scrub Animation
-
-- **Kind:** scroll. Scrolling moves a plane along a drawn route, forward and back.
-- **Description:** Scroll plays it forward and back, like dragging a video. Best for product tours.
-- **Step 1:** Scroll it · help line: "Scroll inside the box, down and back up, or press Play and it scrolls for you."
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** a dashed flight route with marks at 0, 25, 50, 75 and 100%, held still in the box above a small player panel. As the box scrolls, the plane flies along the route, turning with it, the route behind it fills in, the marks it has passed light up, and the panel's bar fills with a frame count from 000 to 120. Scrolling back flies it back; the panel's label reads Forward, Backward or Still.
-- **Scroll distance and Play:** `.track` 300cqh with the sticky `.pinned` 100cqh: two box heights of scrolling (756px at 1280×800, 596px on a phone). Play flies the whole route in six seconds.
-- **Reduced motion:** nothing scrolls by itself. As today, the glow round the plane is hidden (`.halo{display:none}`) and the plane still follows the visitor's own scrolling.
-- **Stage font:** site font. `.frame` drops `var(--disp)`, and `.frame span` and `.mark-label` drop `var(--mono)`. `.dir` becomes 11px (was 10px).
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="A plane on a flight route"`.
- - `.track{height:300cqh}`; `.pinned{position:sticky;top:0;height:100cqh}` (with its flex column, gap and padding). Measured: the route shrinks to fit above the panel at every size. The drawing is shown at 0.83 of its size at 1280×800, 0.62 at 1366×657, 0.35 in the 258px box of a 1280×590 window (87px tall, the panel still inside the box), 1.06 at 768×1024, 0.50 on a 375px phone and 0.42 on a 320px phone.
- - The player panel stays: it is the demo's picture of a video's playhead. Its label reads "Forward", "Backward" and "Still" (was "scrubbing", "rewinding" and "idle"); the frame count and the bar stay. The bar's fill and handle move with transforms, not width and left: `.seek` is an inline-size container (`container-type:inline-size`), the fill is a full-width strip inside a clipping `.seek-clip`, moved by `translateX(pct - 100%)`, and the handle moves by `translateX(pct cqw)`.
- - Text that changes every frame (shared rule 10): the frame count (`#frame`) gets `role="img"`, and `render()` sets its `aria-label` together with its text ("Frame 42 of 120"); the direction label (`#dir`) gets `aria-hidden="true"`, because it only repeats which way the plane is moving. Neither is a live region.
- - The route's labels (0%, 25% … 100%) keep one size on screen (shared rule 11, as part 2's SVG Line Draw does): today they are 9px in the drawing's units, so 7.5px on screen at 1280×800 and 3–6px on phones and short laptops. `.mark-label` loses its `font-size` and `stroke-width` in the CSS, and `buildMarks()` works out `k = 1 / rail.getScreenCTM().a` and gives each label `style.fontSize = 12 * k + 'px'`, `style.strokeWidth = 3 * k + 'px'` and `y = pt.y - 14 * k`, so they show at 12px, 14px above their mark, at every size. The `.flight` svg gets `overflow:visible;min-height:0`: `overflow:visible` keeps the 50% label over the top of the curve from being cut when the drawing is small, and `min-height:0` keeps the drawing shrinking, because the svg is a flex item and `overflow:visible` alone would make its smallest size its full 365px (measured: without it the drawing stays at 1.46 of its size and pushes the panel out of the box at 1280×800, 1366×657 and 1280×590; with it the scales above hold and the panel stays inside the box at every size). `.ticks` becomes 11px (was 9px).
- - Script: `easeSel.value` becomes a variable `ease` set by Feel; `render()` loses its side-panel readout lines (`progKv`, `frameKv`, `seekVal`, the slider), and `setDir()` loses `dirKv`. The Seek slider's listener goes. `measure()` (which calls `buildMarks()`) also runs after `document.fonts.ready`, because the drawing's size depends on the panel's text.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Even · Gentle · Smooth · Slow start | Even | Even follows the scroll exactly; the others reshape it. | `ease`: `'linear'` / `'inOut'` / `'out'` / `'in'` (the `EASES` curves), then clears the cache `G` and `update()` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the Scroll, Frame and Direction readouts in the side panel.
- - The Seek slider. It moved the same playhead as scrolling (it wrote `scrollTop`), so scrolling and Play cover it.
- - The Easing menu. It becomes Feel.
- - Reset playhead. Back to top replaces it.
-- **Good for:** Product tours · Explainers · Step-by-step diagrams · **Avoid on:** Short sections · Key information
-- **Prompt:**
-
- > Add a scroll-scrubbed animation to [your illustration or product explainer]. Hold the scene in view while the visitor scrolls through a taller section, and turn how far they have scrolled into a progress value from 0 to 1. Draw the whole route up front, place the moving object at the point on it that matches the progress, facing along the path, and fill in the part already traveled. Nothing plays on a timer: scrolling back simply moves it back. Shape the progress with the easing given in the settings. If the visitor has reduced motion turned on, drop decorative effects but keep the object following the scroll. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A scrub animation has no play button and no length in seconds: how far you have scrolled decides exactly which moment of the animation shows, like dragging the playhead of a video. Scroll down and it moves forward; scroll back and it moves back. The demo draws the whole flight route up front and fills it in as the plane flies, with a bar and a frame count underneath, so you can always see where you are.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Feel | Even | How scroll turns into progress: even follows the scroll one to one; gentle eases in and out; smooth slows toward the end; slow start begins slowly and speeds up |
-
-- **README See also:**
- - [ScrollTrigger Animation](../scroll-trigger/) — animations start, follow and pin at set scroll points
- - [Pin Animation](../pin-animation/) — one part holds still while the page scrolls past
- - [Progress Bar](../progress-bar/) — the same scroll progress, shown as a filling bar
-- **README How it works:** "Nothing here is time-based, which is why the Seek slider in the panel produces identical frames without any scrolling at all — it just writes `scrollTop` and lets the same code run. Scroll is one input to a position, not a trigger for playback." becomes "Nothing here is time-based: the Play button under the demo only scrolls the box at a steady speed, and the same code draws each frame. Scroll is one input to a position, not a trigger for playback." The rest is unchanged.
-- **README Production notes:** the Accessibility bullet becomes: "**Accessibility.** The page scrolls the box once on arrival, and not at all under `prefers-reduced-motion: reduce`; after that it moves only when the visitor scrolls, so this is direct manipulation rather than imposed motion. Under reduced motion the demo drops the decorative glow and keeps the mapping, since removing it entirely would leave the control inert rather than calmer." The rest is unchanged.
-- **Category line:** `01.08 · Scroll-Based`
-- **Pager:** Previous: ScrollTrigger Animation (`../scroll-trigger/`) · Next: Pin Animation (`../pin-animation/`)
-- **Final fix wave (2026-09-30):** the final category review found the playhead bar animating `width` and `left` (CLAUDE.md: transform and opacity only), so the fill and the handle now move with transforms (see the panel line above). Against the page as it was, only the bar's sub-pixel edges differ: at five sizes and eleven scroll positions everything outside the bar is identical, and inside it at most about 120 pixels of the handle's and the fill's edges change. The frame count still changes text on every frame, so the panel is still laid out then; this change is for compliance.
-
----
-
-## pin-animation — Pin Animation
-
-- **Kind:** scroll. Scrolling carries a phone and its text into view, holds them still while four features change, then lets them go.
-- **Description:** One part stays put while its text changes on scroll. Best for feature lists.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Try it:** none (the rollout spec: this demo has no settings). The page has steps 1 and 2.
-- **Scroller:** the stage.
-- **What scrolling shows:** an intro ("Scroll to begin"), then a phone drawing and its text rise into the box and hold still while the box keeps scrolling. Each quarter of that scrolling shows the next of four features: the phone's screen colour and number change with the text. After the fourth feature the phone and text scroll away and the closing panel rises. Scrolling back steps backwards.
-- **Scroll distance and Play:** a 100cqh intro, the 300cqh pinned section with its sticky frame 100cqh tall, and a 100cqh closing panel: four box heights of scrolling (1,512px at 1280×800, 1,192px on a phone). The phone holds still for two of them, so Play spends three of its six seconds on the four features, about 0.75 seconds each.
-- **Reduced motion:** nothing scrolls by itself, and nothing needs simplifying: the pin is not an animation and the features change at once. The demo's rule named the side panel's progress bar, which goes, so the rule goes too.
-- **Stage font:** site font. The phone's two SVG texts lose `font-family="monospace"` and `opacity="0.5"`: with the opacity the number and the title measured 2.3–3.0:1 on the four screen colours, under the 4.5:1 rule (stage text faded with `opacity` below it is fixed in its section); without it they measure 4.9–7.7:1 and the screen still reads as lit.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="A phone that holds still while its features change"`.
- - `.intro{height:100cqh}`, `.pin-section{height:300cqh}`, `.pin-inner{position:sticky;top:0;height:100cqh}`, `.outro{height:100cqh}` (were 620px and 1860px, 480px on phones).
- - The phone drawing gets `aria-hidden="true"`: it repeats the feature's number and title (shared rule 12). On computers it becomes `.phone-wrap svg{height:min(200px,72cqh);width:auto}`, so it fits the 258px box of a 1280×590 window, where it is 186px tall (today's 200px drawing and the 32px padding need 264px). Measured: the phone 35–221px and the text 48–212px down the 258px box; at 1280×800 and above it stays 200px.
- - Phone rules (under 600px): the phone stays beside its text (today it stacks above it, and the text is cut off in the 300px box; measured): `.pin-inner{gap:14px;padding:16px}` keeps its row (today's `flex-direction:column` goes), `.phone-wrap svg{width:72px;height:131px}` in place of `transform:scale(.8)`, and `#phone-icon{display:none}`: at 72×131 the screen's title would be 7px tall and an 11px title is wider than the 60px screen, so it is hidden where the text beside the phone repeats it (shared rule 11); the screen keeps its 18px number. Measured with the 14px text: the longest feature's text takes 150px on a 375px phone and 198px on a 320px phone (51–249px down the 298px box).
- - `.feat-desc` becomes 14px (was 12px), and so do the intro's and the closing panel's text (was 13px).
- - The intro's and the closing panel's titles become `<p class="panel-title">` (were `h2`, shared rule 13). Today's `.intro p` and `.outro p` rules would also match them, so the text rules exclude the titles and the titles get rules of their own:
- - `.intro p:not(.panel-title){font-size:14px;color:var(--ui-muted);max-width:340px;line-height:1.65}` and `.outro p:not(.panel-title){font-size:14px;color:var(--ui-muted);max-width:300px;line-height:1.6}` (were `.intro p` and `.outro p` at 13px);
- - `.intro .panel-title{font-size:clamp(20px,3vw,28px);font-weight:700;margin-bottom:12px}` and `.outro .panel-title{font-size:clamp(18px,2.5vw,24px);font-weight:700;margin-bottom:10px}` (were `.intro h2` and `.outro h2`), so the titles keep the stage's white and a normal line height.
- - The intro's text reads "The phone and its text will stop in the middle of the box and hold still while four features go by." (today it says CSS handles the pinning). The closing panel keeps "Pin released", and its text reads "The phone and its text let go and scroll away with the page again." (today it speaks of the document flow).
- - The four features' texts stay.
- - Script: `update()` keeps the feature index, the texts and the phone's colours; the Scroll, Lifecycle and Feature readouts and the segment bar go.
- - `hb-dots`: no. Default height.
-- **Removed:**
- - The note, the Scroll, Lifecycle and Feature readouts, and the Feature progress bar.
- - Reset scroll. Back to top replaces it.
-- **Good for:** Feature lists · Product tours · Onboarding · **Avoid on:** Short screens · Long text
-- **Prompt:**
-
- > Add a pinned section to [your product page, and the element that should stay in view]. Make the section several screens tall and pin the element and its text in the middle of the view while the visitor scrolls through it; the extra height is how long it stays. Split that distance into equal parts and show the next feature's text and picture in each part. When the section ends, let the element scroll away with the page. Use the browser's sticky positioning for the pin instead of moving it with a script. If the visitor has reduced motion turned on, change the features without animation.
-
-- **Copy prompt hint:** "Replace the words in brackets with your own page and element."
-- **README What it is:** rewritten:
-
- > A pin animation holds part of the page still while the rest scrolls past. In the demo, a phone and its text stop in the middle of the box while you scroll through a section three boxes tall, and its four features change as you go; at the end of the section they let go and scroll away. The browser's sticky positioning does the pinning, with no script moving anything.
-
-- **README Key parameters:** the technique's own values (the page has no settings):
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pinned section | Three box heights | The phone holds still for the two extra box heights; a taller section makes each feature last longer |
- | Number of features | 4 | The features share the pinned scrolling equally |
- | Pinned at | The top of the box | Where the pinned frame sticks; the phone sits in its middle |
-
-- **README See also:**
- - [Scrub Animation](../scrub-animation/) — scroll plays an animation forward and back
- - [ScrollTrigger Animation](../scroll-trigger/) — animations start, follow and pin at set scroll points
- - [Sticky Section](../sticky-section/) — a whole section holds still while its content changes
-- **README How it works:**
- - The CSS snippet becomes:
-
- ```css
- .stage {
- position: relative;
- overflow-y: auto;
- container-type: size; /* 100cqh is one box height */
- }
- .pin-section {
- height: 300cqh; /* three times the box */
- }
- .pin-inner {
- position: sticky;
- top: 0;
- height: 100cqh; /* one box tall */
- }
- ```
-
- - Delete "The lifecycle is derived from the same values:" and the snippet under it; the page no longer shows a lifecycle.
- - The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `01.09 · Scroll-Based`
-- **Pager:** Previous: Scrub Animation (`../scrub-animation/`) · Next: Snap Scrolling (`../snap-scrolling/`)
-
----
-
-## snap-scrolling — Snap Scrolling
-
-- **Kind:** scroll. Scrolling moves through five sections, and the box settles on one whole section at a time.
-- **Description:** The box settles on one whole section at a time. Best for slides and galleries.
-- **Step 1:** Scroll it · help line: "Scroll inside the box and let go: it settles on the nearest section. Press Play and it glides through without snapping." (owner decision 2)
-- **Player bar:** Play · Back to top
-- **Scroller:** `<div class="scroller" id="scroller" data-hb-scroller data-snap="mandatory" tabindex="0" role="region" aria-label="Five sections that the box snaps to"><div class="snap-rail"><div class="snap-dots" id="snap-dots"></div></div></div>` inside the `.stage`; the script appends the sections after the rail. The `.stage` does the job of today's `.stage-wrap`. The dots sit inside the scroller, in a zero-height sticky rail (category rule on the scroller), so they stay in place while the sections move and a swipe, a wheel turn or a key press that starts on them scrolls the box. Beside the scroller they were a 44×220px strip (13% of the width and 74% of the height of a 375px phone's box) where scrolling moved the page (found in review). The script calls it `scroller` wherever it said `stage`.
-- **What scrolling shows:** five full-box sections in different colours. Stop scrolling between two and the box glides to the nearer one, so a section always shows whole; with When close it only settles near a section, and with Off it stops anywhere. The dots at the right edge light up for the section in view, and pressing a dot glides to its section. Play glides straight through, because the shared script turns snapping off while it runs (shared rule 7); any input inside the stage stops Play (shared rule 6), snapping comes back, and the box settles on the nearest section by itself.
-- **Scroll distance and Play:** five sections at 100cqh: four box heights of scrolling (1,512px at 1280×800, 1,192px on a phone). Play glides through all five in six seconds, a section about every 1.5 seconds, without snapping (owner decision 2); the snapping shows when the visitor scrolls. The page does nothing for this: while Play runs, the shared script marks the scroller with `data-hb-autoscrolling` and a shared rule turns its snapping off; when the run ends or is stopped, the page's own snapping applies again, including a Snapping choice made during the run (shared rule 7).
-- **Reduced motion:** nothing scrolls by itself. As today, the box lands on a section at once instead of gliding, and the dots change without their transition: the demo's rule becomes `@media(prefers-reduced-motion:reduce){.scroller{scroll-behavior:auto!important}.dot::before{transition:none!important}}`.
-- **Stage font:** site font. The quote drops its italic.
-- **Stage:**
- - `.stage`: `position:relative;overflow:hidden;background:#0b0b0d`.
- - `.scroller`: `height:100%;overflow-y:auto;scrollbar-width:none;position:relative;container-type:size;scroll-behavior:smooth`, with the `::-webkit-scrollbar{display:none}` rule. The old stage's border and height go.
- - Snapping comes from an attribute (shared rule 7): the scroller starts with `data-snap="mandatory"`, and three rules read it: `.scroller[data-snap="mandatory"]{scroll-snap-type:y mandatory}`, `.scroller[data-snap="proximity"]{scroll-snap-type:y proximity}` and `.scroller[data-snap="off"]{scroll-snap-type:none}`. None uses `!important`, so the shared rule can turn snapping off during Play.
- - `.section{height:100cqh}` (was 620px, 480px on phones). The script's `620` becomes `scroller.clientHeight` (the dot and the section in view: `Math.min(Math.round(scroller.scrollTop / scroller.clientHeight), 4)`; the dot's jump: `scroller.scrollTo({ top: i * scroller.clientHeight })`, without `behavior`, so the box's own `scroll-behavior` decides: a glide, or a jump under reduced motion). `.section` is not positioned: a positioned section paints over the scroller's inset focus ring.
- - The dots sit at the right edge inside the box on every screen, in the rail: `.snap-rail{position:sticky;top:0;height:0;z-index:1}` (the scroller's first child, so it sticks to the top of the box while the sections scroll under it, and adds nothing to the scroll range, the section offsets or the first snap point at 0) and `.snap-dots{position:absolute;right:4px;top:50cqh;transform:translateY(-50%);display:flex;flex-direction:column}` (`50cqh` is half the scroller's height; a percentage would be of the 0px-tall rail); the phone rule that fixed them to the window goes. Each dot becomes `<button type="button" class="dot" aria-label="Section 1">` (to 5): `.dot{width:44px;height:44px;padding:0;border:0;background:none;font:inherit;display:grid;place-items:center;cursor:pointer}` (`font:inherit`: a button computes Arial otherwise, and the stage's font audit then finds only the site font), with the 8px dot drawn by `.dot::before{content:'';width:8px;height:8px;border-radius:50%;background:var(--ui-muted);transition:background .2s,transform .2s}` and `.dot.active::before{background:var(--ui-accent);transform:scale(1.4)}`. The active dot also gets `aria-current="true"`. The shared script stops Play on any press inside the stage, so a dot works during Play too. Five dots take 220px, which fits the 258px box of a 1280×590 window and the 298px phone box. The dots' focus ring comes from the shared stylesheet (shared rule 2).
- - The section texts are rewritten in plain words (today's speak of the browser engine, CSS and JavaScript):
-
- | Section | Title | Text |
- |---|---|---|
- | 01 | Pages, not pixels | Snap scrolling turns one long scroll into a few set stops. Each section is a place to land. |
- | 02 | Magnetic edges | Stop scrolling and the box pulls itself to the nearest section. |
- | 03 | A page at a time | Design in whole sections, not an endless strip. Each stop is a chapter. |
- | 04 | (quote) | "The feeling of deliberate motion is hard to achieve with code alone." — on scroll design (unchanged) |
- | 05 | That's the whole trick | The browser does the pulling. Nothing has to be timed or scripted. |
-
- Section 03's three figures read 5 "Sections", 5 "Resting points" and 0 "Stops in between" (were Snap points, Lines of CSS and JS needed), with `.stat-label` at 12px (was 10px). `.sec-sub` becomes 14px (was 13px). Measured: every section's text fits its box at every size; the tallest, section 03, needs 191px in the 258px box and 217px of 298 on a 320px phone.
- - Script: the Position, Title and Status readouts and `getStatus()` go; the `scroll` listener keeps the dots.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Snapping | Choice buttons | Always · When close · Off | Always | Scroll by hand to see it; Play glides without snapping. | `scroller.dataset.snap`: `'mandatory'` / `'proximity'` / `'off'` (the three CSS rules above set `scroll-snap-type`) |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the Position, Title and Status readouts.
- - The "y mandatory", "y proximity" and "none" buttons. They become Snapping.
- - The Jump to section buttons. They are navigation, and the dots, scrolling and Play cover them.
-- **Good for:** Slides · Galleries · Onboarding · Full-screen sections · **Avoid on:** Long articles · Uneven sections
-- **Prompt:**
-
- > Add snap scrolling to [your page of full-height sections, slides or gallery]. Make each section exactly as tall as the scrolling area and mark its top as a snap point, so that, as the settings choose, the view settles on the nearest section instead of stopping between two. Use the browser's built-in scroll snapping rather than a script. Add small dots that show which section is in view and take the visitor to a section when pressed. Check scrolling with the arrow keys too, because strict snapping can feel stiff there. If the visitor has reduced motion turned on, let the view settle without a smooth glide. Match the settings listed below.
-
-- **Copy prompt hint:** the template line, "Replace the words in brackets with your own element. Your settings are added at the end." (this section gave none; every other scroll page with settings uses the template line)
-- **README What it is:** rewritten:
-
- > Snap scrolling makes a scrolling area settle on set points instead of stopping anywhere. When you stop scrolling, the browser pulls the view to the nearest section, so each section is shown whole, like turning pages. The browser does the pulling on its own; no script is needed for it.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Snapping | Always | Always settles on a section after every scroll; when close settles only when the box stops near one; off never snaps |
-
-- **README See also:**
- - [Stacking Cards](../stacking-cards/) — cards pile into a deck as you scroll
- - [Section Wipe](../section-wipe/) — each section slides up over the one before
- - [Fly-in Fly-out Contact List](../fly-in-fly-out-contact-list/) — rows fade and slide as they near the edges
-- **README How it works:**
- - The CSS snippet becomes:
-
- ```css
- /* On the scroll container */
- .scroller {
- overflow-y: auto;
- container-type: size; /* 100cqh is the box's height */
- scroll-snap-type: y mandatory; /* or 'y proximity' */
- }
-
- /* On each section */
- .section {
- height: 100cqh; /* one box tall */
- scroll-snap-align: start;
- }
- ```
-
- - "The mode toggle in the demo changes `scroll-snap-type` live." becomes "The Snapping setting switches between the three through a `data-snap` attribute that three CSS rules read. While the Play button scrolls the box, a shared rule turns snapping off on it, and the page's own snapping applies again when it stops."
- - "Pagination dots and jump-to buttons use `scrollTo` with `behavior: 'smooth'`:" becomes "The dots scroll to their section; leaving out `behavior` lets the box's own `scroll-behavior` decide, so it glides, or jumps under reduced motion:", and its snippet becomes `scroller.scrollTo({ top: sectionIndex * scroller.clientHeight });`.
- - The last snippet becomes `const sectionIndex = Math.round(scroller.scrollTop / scroller.clientHeight);`.
-- **README Production notes:** unchanged
-- **Category line:** `01.10 · Scroll-Based`
-- **Pager:** Previous: Pin Animation (`../pin-animation/`) · Next: Scrollytelling (`../scrollytelling/`)
-- **Final fix wave (2026-09-30):** the final category review found no focus ring on the box: the sections were positioned, and a positioned section with an opaque gradient paints over the scroller's inset outline. `.section` is no longer positioned (nothing in a section is), the ring shows on a laptop and a phone, and 55 captures at five sizes are otherwise pixel-identical.
-
----
-
-## scrollytelling — Scrollytelling
-
-- **Kind:** scroll. Scrolling moves six ocean chapters past a porthole that changes with them.
-- **Description:** A picture beside the story changes as you read down. Best for data stories.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Try it:** none (owner decision 1). The demo has no settings today (its aside holds only a Jump to chapter list and Return to surface). The page has steps 1 and 2.
-- **Scroller:** the stage (a row: the porthole column sticks while the chapters scroll).
-- **What scrolling shows:** six chapters, from the surface down to the deepest trench, scroll up beside a porthole that holds still. As each chapter passes a reading line 42% down the box, the porthole's water and ring blend smoothly toward the next chapter's colours, darkening as you sink, and the depth under it counts up from 0 to 10,935 meters. Under 600px wide the porthole and the depth sit in a strip across the top and the chapters scroll under it.
-- **Scroll distance and Play:** six chapters of at least 90cqh (their text makes some taller): about 4.5 box heights at 1280×800 (1,683px) and 5.4 on a 375px phone (1,600px). Play sinks through a chapter about every second.
-- **Reduced motion:** nothing scrolls by itself, and nothing needs simplifying: the water's colour, the ring and the depth follow the visitor's own scrolling directly. The demo's `#ph-bg{transition:background 1.2s ease}` and its reduced-motion rule (`#ph-bg{transition:none!important}`) both go: a gradient background cannot be transitioned, so neither ever did anything.
-- **Stage font:** site font. `.ch-fact` drops its italic.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d;display:flex`, with `aria-label="Six chapters about the ocean's depths"`.
- - `.vis{height:100cqh}` and `.ch{min-height:90cqh}` (were `var(--stage-h)` and `calc(var(--stage-h) * 0.9)`).
- - The porthole shrinks in short boxes so the column fits: `#porthole{width:min(220px,85%,calc(100cqh - 106px))}` (was `min(220px,85%)`). Today, in the 258px box of a 1280×590 window, the porthole and the depth need 306px and overflow the column by 24px at each end; with the new width the porthole is 152px there (content 238px), 219px at 1366×657 and 220px from 1280×800 up (measured).
- - Phone rules (under 600px), today's with new sizes: `.stage{flex-direction:column}`; `.vis{position:sticky;top:0;width:100%;height:112px;flex-direction:row;gap:16px;padding:14px 16px;z-index:2;background:#0b0b0d}` (was 200px tall, two-thirds of the new 300px box, and without a background, so the text showed through it); `#porthole{width:84px;border-width:3px}` (was 140px); `.chapters{padding:12px 16px}`. Measured: the strip's content fits (14–98px of 112) and the chapters get 186px of the phone box.
- - Text sizes: `.ch-body` 14px (was 12px), `.ch-fact` 14px (was 10px), `.ch-eye` 11px (was 10px), `#depth-lbl` 11px `#8a8a92` without the opacity .4 (today about 3.5:1).
- - Text that changes every frame (shared rule 10): `#depth-num` gets `role="img"`, and `update()` sets its `aria-label` with its text ("1,000 meters deep"); `#depth-lbl` gets `aria-hidden="true"`, because its words are in that label. It is not a live region. The porthole (`#porthole`) gets `aria-hidden="true"` (shared rule 12).
- - The depth number and the chapter labels mix their chapter colour half and half with `#f4f4f2`: `depNum.style.color = lerpCol(col, '#f4f4f2', 0.5)`, and each `.ch-eye` gets `lerpCol(c.ac, '#f4f4f2', 0.5)` without its opacity .6. The three deepest colours (`#003d55`, `#001f30`, `#000e18`) are nearly invisible on the dark stage today; mixed, the darkest reads about 5:1. The porthole's ring and water keep the full colours, which is where the darkening shows.
- - The chapter texts stay.
- - Script: `update()` keeps the fraction, the depth, the water and the ring; the Scroll and Chapter readouts and the jump buttons' `on` class go, and so does the jump list's build.
- - `hb-dots`: no. Default height.
-- **Removed:**
- - The note, and the Scroll and Chapter readouts.
- - The Jump to chapter buttons. They are navigation, and scrolling, Play and Back to top cover them.
- - Return to surface. Back to top replaces it.
-- **Good for:** Data stories · Explainers · Long reads · **Avoid on:** Short pages · Quick reference
-- **Prompt:**
-
- > Add a scrollytelling layout to [your story and the picture that goes with it]. Put the story in a column of chapters that scrolls, and keep the picture in view beside it. Work out which chapter has passed a reading line about 40% down the view and how far it is toward the next, as a fraction, and blend every value in the picture between the two chapters with it, such as colors and a counting number, so the picture changes smoothly as the visitor reads. On phones, pin a short strip of the picture above the text. If the visitor has reduced motion turned on, change the picture without fading.
-
-- **Copy prompt hint:** "Replace the words in brackets with your own story and picture."
-- **README What it is:** rewritten:
-
- > Scrollytelling ties a picture to a story told in scrolling text. As you read down, the picture beside the text changes with you, blending smoothly between chapters instead of switching at each one. In the demo you sink through six layers of the ocean while the porthole's water darkens and the depth counts up to 10,935 meters.
-
-- **README Key parameters:** the technique's own values (the page has no settings):
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Reading line | 42% down the box | A chapter becomes current once its top passes this line; a higher line changes chapters later, a lower one sooner |
- | Chapter height | At least 90% of the box | How much scrolling each chapter takes; taller chapters make slower, finer blends |
- | Number of chapters | 6 | Each chapter adds its colours and its depth to the blend |
-
-- **README See also:**
- - [Sticky Section](../sticky-section/) — a whole section holds still while its content changes
- - [Scrub Animation](../scrub-animation/) — scroll plays an animation forward and back
- - [Reveal on Scroll](../reveal-on-scroll/) — cards appear as they cross a line
- - [Progress Bar](../progress-bar/) — a bar fills as you read
-- **README How it works:** unchanged
-- **README Production notes:** the Reduced motion bullet becomes: "**Reduced motion**: nothing here moves on its own; the colours and the depth follow the reader's scrolling, so there is nothing to switch off. A CSS transition on the porthole's gradient would not help anyway: gradients cannot be transitioned, which is why the blend is worked out in JavaScript." The rest is unchanged.
-- **Category line:** `01.11 · Scroll-Based`
-- **Pager:** Previous: Snap Scrolling (`../snap-scrolling/`) · Next: Reveal on Scroll (`../reveal-on-scroll/`)
-- **Final fix wave:** wording only. The Reading line row of the README's Key parameters (and the copy of it above) said a lower line changes chapters later; it is the other way round. A chapter is reached at the scroll position that equals its top in the content minus the line's distance down the box (`reach` in `update()`, with the line at 42% of the box's height), so a lower line is reached after less scrolling and changes chapters sooner, and a higher one later (measured at 1280×800, 40% of the way down the scroll: the depth reads 1,425 m with the line at 20% of the box, 2,159 m at 42% and 2,759 m at 60%).
-
----
-
-## reveal-on-scroll — Reveal on Scroll
-
-- **Kind:** scroll. Scrolling carries cards past a line, where each is revealed.
-- **Description:** Cards appear as they cross a line in the box. Best for long landing pages.
-- **Step 1:** Scroll it · help line: "Scroll inside the box, or press Play. Back to top hides the cards again."
-- **Player bar:** Play · Back to top
-- **Scroller:** `<div class="scroller" id="scroller" data-hb-scroller tabindex="0" role="region" aria-label="Seven cards that appear as you scroll">` inside the `.stage`. The `.stage` does the job of today's `.stage-wrap`: it holds the dashed trigger line beside the scroller, so the line stays in place while the cards move; `#trigger-line` has `pointer-events:none`, so a click, a touch or a wheel turn over it goes through to the scroller. The script calls it `scroller` wherever it said `stage`.
-- **What scrolling shows:** seven cards rise toward a dashed line across the box. Each stays hidden until its top passes the line, then settles into place in its own way: a fade, a rise, a slide from the left, a grow, a sharpen from a blur, a wipe from the left, and a group of four chips that arrive one by one. A card stays shown after that, unless Plays every time is on; then it hides again when it drops back below the line.
-- **Scroll distance and Play:** the cards' own height, with 200px of room after the last so it can pass the highest line: about 2.1 box heights at 1280×800 (800px) and 3.1 on a 375px phone (921px). At the Normal line the first cards show whole on arrival (the observer may already have revealed the next one, partly below the box edge): two at 1280×800, at 1366×657 and on a 375px phone, three in the 438px boxes (768×1024 and 610×1000), and one in the 258px box of a 1280×590 window and on a 320px phone. Play reveals the rest about a second apart.
-- **Every Trigger line is reached** (shared rule 4): at the end of the scroll the last card's top is at most 115px down the box (at 768×1024 and at 610×1000, where the box is 438px), always above even the Higher line at half the box; measured from the 258px box to the 438px box and on phones.
-- **Back to top and Play from the end:** Back to top, and Play pressed with the box at its end (Play then starts from the top), hide every card and arm the reveals again, as today's Reset all cards did. The page listens for clicks on `#btn-top`, and on `#btn-scroll` when `scroller.scrollTop >= scroller.scrollHeight - scroller.clientHeight - 2`: it calls `hide()` on every card and `buildObserver()` 50ms later, after the jump to the top. This relies on the order of the listeners: the page's inline script registers its click listeners before the shared script (loaded with `defer`) registers Play's and Back to top's, so on a click the page still sees the box at its end before Play jumps it to the top. The listeners must stay in the inline script's top level.
-- **Reduced motion:** nothing scrolls by itself. As today, each card appears at the line without moving (`.card, .card .stagger-child{transition:none!important}`).
-- **Stage font:** site font.
-- **Stage:**
- - `.stage`: `position:relative;overflow:hidden;background:#0b0b0d`.
- - `.scroller`: `height:100%;overflow-y:auto;scrollbar-width:none;position:relative`, with the `::-webkit-scrollbar{display:none}` rule. The old stage's width, border and height go, and so does `--stage-h`.
- - `#trigger-line` stays in the `.stage`, over the scroller: `updateLine()` sets its `top` to `scroller.clientTop + threshold / 100 * scroller.clientHeight`. Its label keeps "trigger", at 11px (was 9px). Today the line and its label each have `opacity:.7`, so the label reads about 2.7:1; the line drops its opacity and draws its dashes in `rgba(110,168,255,.7)` instead, and the label drops its own, so it shows in the full accent (7.9:1) while the dashes look as they do today. The line has `pointer-events:none` (the label inherits it), so input reaches the scroller underneath it.
- - The cards' texts are rewritten in plain words (today's bodies are CSS values such as "opacity 0 → 1"). The tag reads "Technique 01" to "Technique 07" (the code names after it go), at 11px without the opacity .7; the titles stay:
-
- | Card | Title | Text |
- |---|---|---|
- | 01 | Fade | Goes from see-through to solid. |
- | 02 | Slide Up | Rises a little as it fades in. |
- | 03 | Slide from Left | Slides in from the left as it fades in. |
- | 04 | Scale In | Grows from slightly smaller as it fades in. |
- | 05 | Blur In | Sharpens from a blur as it fades in. |
- | 06 | Mask Reveal | Uncovered from left to right. |
- | 07 | Stagger Group | (the four chips Alpha, Beta, Gamma and Delta, unchanged) |
-
- `.card-body` becomes 14px (was 11px) and `.stagger-chip` 12px (was 10px).
- - Script: `reveal()` and `hide()` keep the class change; their state-readout lines go, and so do `logEvent()`, `obsSnippet()` and the Card states list. `buildObserver()` watches each card where it changes, through `watched(el)`: the card itself, but for the Stagger Group card its row of chips, `.stagger-row` (the callback finds the card again with `e.target.closest('.card')`). The chips sit lower in the card, so watching the card's top would start their cascade below the box on the lower lines.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Trigger line | Choice buttons | Higher · Normal · Lower | Normal | How far up the box a card must come to appear. | `threshold`: 50 / 70 / 90 (% down the box), then `updateLine()` and `buildObserver()` |
-| Plays every time | Switch | on / off | off | Cards hide again below the line and replay each time. | `repeatTog.checked` (the switch keeps the id `repeat-tog`), then `buildObserver()` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the Observer config code, the Event log and the Card states list.
- - The Trigger position slider. It becomes Trigger line.
- - "Repeat on re-enter" becomes Plays every time.
- - Reset all cards. Back to top does it now (see above).
-- **Good for:** Landing pages · Feature lists · Blog sections · **Avoid on:** Key information · Forms
-- **Prompt:**
-
- > Add reveal-on-scroll animations to [the sections or cards on your page]. Keep each element in a hidden starting state, such as faded, shifted, shrunk, blurred or clipped, until it rises past a trigger line inside the view, then let it settle into its normal state. Watch the elements with the browser's intersection observer rather than on every scroll, and count an element that is already above the line as crossed, so a fast scroll never skips one. Reveal each element once, or every time it crosses, as the settings say. If the visitor has reduced motion turned on, show each element without movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A reveal on scroll keeps an element hidden, such as faded, shifted, shrunk, blurred or clipped, until it rises past a line in the view, then lets it settle into place. The browser reports when each element crosses the line, so nothing has to run on every scroll. The demo shows seven reveal styles behind one dashed line.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Trigger line | Normal | Where the dashed line sits: higher is halfway down the box, normal 70% down and lower 90% down; the higher the line, the further a card must scroll before it appears |
- | Plays every time | off | Off, each card appears once and stays; on, it hides again when it drops back below the line and replays the next time |
-
-- **README See also:**
- - [Stagger Reveal](../stagger-reveal/) — items in a group appear one after another
- - [ScrollTrigger Animation](../scroll-trigger/) — animations start, follow and pin at set scroll points
- - [Fly-in Fly-out Contact List](../fly-in-fly-out-contact-list/) — rows fade and slide as they near the edges
- - [Scrollytelling](../scrollytelling/) — a picture beside the story changes as you read
-- **README How it works:** in the snippet, `root: stage` becomes `root: scroller`. The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `01.12 · Scroll-Based`
-- **Pager:** Previous: Scrollytelling (`../scrollytelling/`) · Next: Stagger Reveal (`../stagger-reveal/`)
-- **Final fix wave:** sheet only. It now records that `#trigger-line` has `pointer-events:none` (Scroller and Stage lines above) and that the Stagger Group card is watched at its `.stagger-row` (Script line above).
-
----
-
-## stagger-reveal — Stagger Reveal
-
-- **Kind:** scroll. Scrolling brings three groups into the box, and each reveals its items one after another.
-- **Description:** Items in a group appear one after another as it scrolls in. Best for card grids.
-- **Step 1:** Scroll it · help line: "Scroll inside the box, or press Play. Back to top hides the groups again."
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** three groups: a grid of twelve cards (two columns on phones), a list of six people and a cluster of eight tags. As each group comes into the box, its items fade in and rise one after another, a short delay apart, in the chosen order. A group stays shown after that. On arrival the grid is in the box and plays at once; the list and the tags play as the box scrolls, each once half of it is in the box or its bottom edge is, so their cascades happen where the visitor can see them.
-- **Scroll distance and Play:** the groups' own height: about 1.3 box heights at 1280×800 (510px) and 2.7 on a phone (792px). Play reaches the list between about one and three seconds in (0.9 to 2.8 s: earlier in a tall box, later on a phone) and the tags about five seconds in (4.8 to 5.2 s), so their cascades end about when the six-second run does (only the grid plays on arrival, at every size).
-- **Every group plays** (shared rule 4): a group has no line. It plays once half of it is in the box, or its bottom edge has come into the box, so the last rows of a long group are never left hidden. The observers watch the group's items (`#grid`, `#list` and `#chips`), not the section around them (whose padding and heading made the cascade run before any item was on screen), and have a threshold every 5% (`Array.from({length:21},(_,i)=>i/20)`), so a jump straight to the end is not missed: a plain `threshold:.5` leaves the visible rows hidden at the end, and `[0,.5]` misses a jump from the top to the end. The box scrolls until the last group is wholly in view, so all three play at every size, and in Play 3 to 4 of the 6 list rows and all 8 tags are seen fading in at every size. Until a group plays, the items of it already in the box stay hidden (up to three list rows for about a second in Play).
-- **Back to top, Play from the end, and settings:** Back to top, Play pressed with the box at its end, and every settings change rebuild the three groups hidden and watch them again, as today's Replay all groups did (without its scroll to the top). A new helper `rebuild()` clears the timers still pending from the last reveal, rebuilds the grid, list and chips hidden, and calls `attachObservers()`; a group half in the box, or with its bottom edge in it, then plays at once with the current settings, and the others when they scroll in. The page calls it on clicks on `#btn-top`, and on `#btn-scroll` when `stage.scrollTop >= stage.scrollHeight - stage.clientHeight - 2`, at once in the same click, as a settings change does, so the difference shows where the box is. It does not wait for the jump to the top: the new observers first report on the next frame, after the shared script has jumped the box, so the groups in view play from the top and the finished groups are never drawn there (with a 50ms delay they stayed on screen for about four frames). This relies on the order of the listeners: the page's inline script registers its click listeners before the shared script (loaded with `defer`) registers Play's and Back to top's, so on a click the page still sees the box at its end before Play jumps it to the top. The listeners must stay in the inline script's top level.
-- **Reduced motion:** nothing scrolls by itself. As today, the items appear in the same order and with the same delays, but without moving (`.item{transition:none!important}`).
-- **Stage font:** site font.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;background:#0b0b0d`, with `aria-label="Three groups of items"`.
- - The group headings read "01 · Grid", "02 · List" and "03 · Tags" (were "01 · Card Grid (4 × 3)", "02 · List Rows" and "03 · Tag Chips"), without the opacity .7.
- - The delay badges on the grid ("0ms", "50ms" …) go: they are readouts.
- - Phone rule kept (under 600px): `.grid{grid-template-columns:repeat(2,1fr)}`.
- - The tags become plain words (today they are code names such as IntersectionObserver and rAF): Design, Travel, Music, Food, Books, Film, Sport, Science. The grid's Greek letters and the list's six people stay.
- - Text sizes: `.grid-cell` 12px (was 10px), `.list-label` 13px (was 11px), `.list-meta` 12px `#8a8a92` without its opacity .4 (today about 3.5:1), `.chip` 12px (was 10px).
- - Script: `staggerIn()` keeps each pending timer in a list that `rebuild()` clears, and loses its badge argument. The matrix code (`updateMatrix()` and the matrix build) goes.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Delay between items | Choice buttons | Short · Medium · Long | Medium | Longer delays make the order easier to see. | `staggerMs`: 30 / 50 / 80 (ms), then `rebuild()` |
-| Order | Choice buttons | First to last · Last to first · From the middle · Random | First to last | Which item appears first. | `direction`: `'forward'` / `'reverse'` / `'center'` / `'random'`, then `rebuild()` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the Preview matrix (a readout of the order).
- - The Stagger delay slider. It becomes Delay between items.
- - The Cascade direction buttons (with their arrows). They become Order.
- - Replay all groups. Back to top, Play from the end and every settings change do it now.
-- **Good for:** Card grids · Search results · Menus · Galleries · **Avoid on:** Long lists · Key information
-- **Prompt:**
-
- > Add a stagger reveal to [your grid, list or group of items]. When the group scrolls into view, reveal its items one after another instead of all at once: each item fades in and rises a little, starting a short delay after the one before, in the order the settings choose. Make each item's own animation longer than the delay between items, so they overlap into one sweep, and keep the whole cascade under about 600ms on long lists. If the visitor has reduced motion turned on, show the items without movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A stagger reveal shows a group of items one after another instead of all at once, with a short delay between them, so the group appears as a sweep. The order can run from first to last, last to first, from the middle outward, or at random. The demo plays it on a grid of cards, a list and a cluster of tags as each scrolls into view.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Delay between items | Medium | The wait before each next item: short is 30ms, medium 50ms and long 80ms; 40 to 60ms reads as a sweep, and under 30ms the items seem to arrive together |
- | Order | First to last | Which item goes first: first to last, last to first, from the middle outward, or a random order each time |
-
-- **README See also:**
- - [Reveal on Scroll](../reveal-on-scroll/) — one element appears as it crosses a line
- - [Fly-in Fly-out Contact List](../fly-in-fly-out-contact-list/) — rows fade and slide as they near the edges
- - [Stacking Cards](../stacking-cards/) — cards pile into a deck as you scroll
- - [Snap Scrolling](../snap-scrolling/) — the box settles on one section at a time
-- **README How it works:** delete the last sentence of the paragraph after the snippet, "The side panel's preview matrix renders those same ranks as numbered, brightness-coded dots so the cascade is legible before you scroll."; the page no longer has the matrix. The rest is unchanged.
-- **README Production notes:** the Reduced motion bullet becomes: "**Reduced motion**: transitions are disabled under `prefers-reduced-motion`, so each item simply appears at its turn, without moving — the stagger is decorative, never load-bearing." The rest is unchanged.
-- **Category line:** `01.13 · Scroll-Based`
-- **Pager:** Previous: Reveal on Scroll (`../reveal-on-scroll/`) · Next: Horizontal Scroll (`../horizontal-scroll/`)
-- **Final fix wave:** wording only. The page comments, the README and the rebuild line above no longer say that no visible row is left hidden or that the groups in the box replay. A group half in the box, or with its bottom edge in it, plays at once (also after a rebuild); a group less than half in view whose bottom edge is still below the box waits, hidden, until more of it scrolls in. Checked after a rebuild at 1280×800 and 375×812: a group 30% or 45% in view stays hidden and one 60% in view plays; a group 30% in view with its bottom edge in the box plays.
diff --git a/docs/superpowers/plans/2026-09-29-scroll-content-part2.md b/docs/superpowers/plans/2026-09-29-scroll-content-part2.md
deleted file mode 100644
index 62b1ead4..00000000
--- a/docs/superpowers/plans/2026-09-29-scroll-content-part2.md
+++ /dev/null
@@ -1,1164 +0,0 @@
-# Scroll-Based — Content Sheet, Part 2
-
-This half of the Scroll-Based sheet decides, page by page, how the last thirteen Scroll-Based pages (home-page order, 01.14 Horizontal Scroll to 01.26 Scroll-Driven Background Color) present their kind, step 1, settings, words and prompt on the guided-steps page. Part 1, written at the same time by another writer, covers Parallax Depth-of-Field to Stagger Reveal. The conversion tasks of `2026-09-29-demo-page-rollout-parallel.md` follow each section exactly, together with "How to convert a page" in `2026-09-28-demo-page-rollout-text-typography.md`, the rollout's Global Constraints, and the markup for pages without settings, do-it pages and scroll pages in `2026-09-29-demo-page-kinds-do-and-scroll.md`. Rotate In (`animations/02-entrance-and-exit/rotate-in/`) is the reference for everything a section does not mention; the do-it/scroll plan's scratch scroll page is the reference for a scroll page's step 1 and its scroller attributes.
-
-Twelve of these pages are scroll pages. Smooth (Inertia) Scroll is a do-it page; its section says why. Horizontal Scroll and Sticky Section have no settings, so they have no Try it step.
-
-The two lists below, A and B, were settled after both halves were reviewed. They read the same in both halves' preambles; sections refer to them as "owner decision N" (list A) and "rule BN" (list B).
-
-## A. Owner decisions (all accepted, 2026-09-29)
-
-1. Parallax Depth-of-Field, Scrollytelling (part 1) and Horizontal Scroll (part 2) have no Try it step.
-2. Snap Scrolling: Play glides through without snapping; snapping shows when the visitor scrolls, and the help line says so.
-3. Both parallax pages: the drawing stretches to fill the wide box (`preserveAspectRatio="none"`) instead of cropping the front layer.
-4. Cover Card: a short closing line fills the empty space at the end (steady scroll length kept).
-5. Stacking Cards: the big faded number becomes an absolutely placed background watermark (`aria-hidden`), so 7 cards fit.
-6. Stacking Cards: the decorative card button reads "View project →".
-7. The player's "Back to top" and the footer's "Back to top ↑" both stay as they are.
-8. Smooth (Inertia) Scroll is a do-it page: step 1 "Scroll it", with Show me and Reset (no Play / Back to top). Its step-1 help line ends ", or press Show me." (every do-it page does).
-9. Smooth Scroll's glide mode answers keys: arrows ±40px, PageUp/PageDown/Space 90% of the box, Home/End 0/maxScroll (a `keydown` handler on the viewport in glide mode that moves the glide target).
-10. Smooth Scroll's "Normal scrolling" switch stays out of the copied prompt (`data-hb-skip`).
-11. Scroll Velocity Skew shows 28 rows.
-12. Text Fill's paragraph is cut from 80 to 48 words.
-13. Text Fill's unread words are a readable grey (about 4.8:1).
-14. Background Color's text is pure white or black, flipping where both read equally (Forest flips too — say so wherever the sheet mentions only Daylight).
-15. Scrollspy's menu links may be 36px tall on short laptop screens so the whole menu fits; touch screens keep 44px. Implement as: `@media (min-width:601px) and (max-height:640px) and (pointer:fine)` → 36px links (6×36 + 22 + 16 = 254px fits the 258px stage); with a coarse pointer in that range (a phone turned sideways) the links stay 44px and the rail scrolls (`max-height:calc(100% - 32px);overflow-y:auto`), keeping the active link in view by setting the rail's own `scrollTop` — never `scrollIntoView()`, which also scrolls the page.
-
-## B. Category rules (the same in both halves)
-
-1. **Phone rules:** the old mobile block goes, but each page section keeps and names the phone rules its stage still needs (part 1's wording). Part 2 must list them for Sticky Section (`#sticky-inner{grid-template-columns:1fr}#vis-col{display:none}`) and Scrollspy (its strip rules and `.sec{padding:80px 20px 36px}`).
-2. **Focus ring on inner scrollers:** nothing on the page. The coordinator is adding `.hb-page .stage :focus-visible{outline-offset:-3px}` to the shared stylesheet, so everything focusable inside the stage (inner scrollers such as `[data-hb-scroller]`, `.viewport`, `.doc`, flush controls, Snap Scrolling's dots) gets the site ring drawn inset and never clipped. State this as a fact; drop any page-level scroller focus rule and the dots' `right:6px` idea. A stage that is its own scroller keeps the normal ring. A stage control with its own focus look still must beat `body.hb :focus-visible` (0,2,1).
-3. **Smallest stage:** measure fits at the smallest shared stage too — 258px inside at 1280×590 (the shared stage drops to 260px on short screens) — as well as 327px (laptop) and the phone sizes. Overlays such as rails and dots must fit it.
-4. **Trigger lines:** every trigger-line choice must be reachable within the box's scroll distance at every size, from the tallest box to a narrow window just over 600px (part 1: Reveal on Scroll, Stagger Reveal, ScrollTrigger Animation — check and state it).
-5. **`container-type:size`:** only on a scroller whose height comes from outside (the stage, or `height:100%` of it); never together with `hb-grow`; never padding on that scroller (cqh measures its content box); any `cqh` use needs that container (without one it falls back to the viewport). No `--box-h` script fallback.
-6. **Play stops on input:** the shared script stops Play on any trusted input anywhere inside the stage (pointer, wheel, touch, key). Sections state it as a fact; no page works around it (part 2's Scrollspy "blocker" line becomes a plain statement).
-7. **Snapping during Play:** while Play runs, the shared script marks the scroller with `data-hb-autoscrolling`, and a shared rule turns CSS scroll snapping off on a marked scroller (`scroll-snap-type:none !important`). When the run ends, is stopped, or Back to top is pressed, the mark goes and the scroller's own snapping applies again — whatever the page set, even during the run. Pages set snapping however they like, but never with `!important`; Snap Scrolling's Snapping setting sets an attribute (e.g. `data-snap="mandatory|proximity|off"` with three CSS rules). When a wheel turn stops Play, snapping returns and the box settles on the nearest point by itself.
-8. **Instant jumps:** Back to top, and Play restarting from the top, are instant jumps. Say so wherever an effect reads scroll speed or eases toward the scroll position; Velocity Skew ignores the frame after a jump (listen for clicks on `#btn-top` / `#btn-scroll`, by id) and measures speed per 1/60 s, so 120 Hz screens lean the same.
-9. **Small stage text:** paragraph text in the stage is at least 14px; small labels (chips, ticks, captions, buttons) at least 11px. Part 1: `.chip-name`, `.card-sub`, `.card-btn`, `.dir` grow to 11px. Part 2: Smooth Scroll's `.card-body` and Background Color's `p` go to 14px.
-10. **Text that changes every frame** (counters, depth numbers, frame counts): `role="img"` plus an `aria-label` with the real value, or `aria-hidden="true"` when it only repeats something else on the stage; never a live region (part 1: Scrollytelling's `#depth-num`, Scrub Animation's frame count and `.dir`).
-11. **Small SVG labels:** counter-scale them to screen size (part 2's SVG Line Draw approach), or hide them on phones only where something visible repeats them (part 1's Scrub Animation `.mark-label`: the ticks repeat 0–100%).
-12. **Decorative duplicates** (big numbers, repeated titles, picture SVGs) are `aria-hidden="true"` (part 1: Pin Animation's phone drawing, Stacking Cards' watermark).
-13. **No `h1`/`h2` inside the stage:** the page outline belongs to the step titles. Use `p` (or `h3` for a real sub-heading). Part 1: Cover Card's `<h1 class="cover-title">` becomes `<p class="cover-title">` keeping `.cover-title`'s own sizing (the shared `.hb-page h1` rule restyles any stage h1 — Critical); Pin Animation's intro/outro `h2` and Cover Card's article `h2`s.
-14. **Cue lines:** sentence case, centred, with side padding (`text-align:center;padding:0 24px`) — part 1's ScrollTrigger run-out cue included.
-15. **Unchanged shared rules** stay identical in both halves: accent, category line, "Scroll it" and its help lines, Play · Back to top, scroller attributes, `--ui-muted:#8a8a92`, no `hb-dots`, Feel names from Entrance & Exit, the no-settings format, and the Try it help line "Change a setting, then scroll again or press Play." (do-it pages: "Change a setting, then try it again or press Show me.").
-
-## Earlier owner decisions and lessons that apply here
-
-- **Stage text uses the site font.** None of these effects is about typing, so every `font-family` on stage text goes (Bricolage, PlexMono, `var(--disp)`, `var(--mono)`), and so do the `@font-face` lines. A button on a stage gets `font:inherit`, because a button does not take the page font by itself.
-- **Scroll and do-it pages show themselves once on arrival.** Scroll pages use `<body class="hb" data-hb-kind="scroll" data-hb-autoplay>`: 400ms after load the shared script presses Play, which scrolls the box from the top to its end at one steady speed, the whole box in about six seconds whatever its length. Smooth (Inertia) Scroll uses `data-hb-kind="do"`, and the shared script presses Show me once.
-- **Reduced motion runs nothing by itself.** The box does not scroll on arrival and Show me does not run, while Play, Back to top, Show me and Reset still work when pressed. A page's own scroll effects may be simplified; each section says what the page's own reduced-motion code keeps. None of these pages has Loop, Slow motion or Pause, so the shared script greys nothing out and adds no note.
-- **Long names in the top bar** (Scroll-Driven Background Color, SVG Line Draw on Scroll, Smooth (Inertia) Scroll) are cut with "…" by the shared stylesheet; the pages do nothing.
-- **Lessons from the Text & Typography reviews** that apply here:
- - The page reaches the player controls by their ids (`btn-scroll`, `btn-top`, `btn-demo`, `btn-reset`), never by their `data-hb-*` attributes.
- - Smooth (Inertia) Scroll registers its `hb:input` listener at the top level of its inline script. The listener only stops a Show me run that is under way, so it is safe to receive again and again (owner decision 8).
- - Text that changes every frame gets `role="img"` and an `aria-label` with the real text, and no live region (Counter Animation's numbers). Text that only repeats what the stage already shows is hidden from screen readers instead (Progress Bar's ring).
- - Text whose layout the script measures is measured again after `document.fonts.ready` (Scrollspy Navigation's section tops, Smooth (Inertia) Scroll's content height).
-
-## Rules for the whole category
-
-- **Accent and category line:** every page uses `--ui-accent:#6ea8ff`, the colour 25 of the 26 pages already have (Scroll Image Sequence, which has none, gets it). The category line is `01.NN · Scroll-Based`, where NN is the page's position on the home page, which its card already shows (01.14 to 01.26 in this half).
-- **Step 1** is titled "Scroll it". Its default help line is "Scroll inside the box, or press Play and it scrolls for you." A section gives a page-specific line where it helps.
-- **Player bar of a scroll page:** the Play button and then the Back to top button, exactly as in the do-it/scroll plan, and nothing else (no Slow motion, Replay, Loop or Pause).
-- **Try it help line of a scroll page:** "Change a setting, then scroll again or press Play.", the fixed line for the kind; no page has its own. Most settings redraw the stage at once, where it is; the others (a count's speed, how far rows lean) show at the next scroll.
-- **The scroller** is the `.stage` itself, or, on Progress Bar and Scrollspy Navigation, an inner element marked `data-hb-scroller`. On those two the `.stage` does the job of today's `.stage-wrap`: Progress Bar's indicators sit beside the scroller with `pointer-events:none`, and Scrollspy's menu sits inside it, in a zero-height sticky rail (`.spy-rail`). Every scroller gets:
- - `tabindex="0" role="region"` and an `aria-label` (each section gives it), as on the scratch scroll page, so keyboard users can focus it and scroll it with the arrow keys;
- - `overflow-y:auto` (was `scroll`), keeping today's hidden scrollbar (`scrollbar-width:none` and the `::-webkit-scrollbar{display:none}` rule);
- - `position:relative`, so the `offsetTop` of anything inside it is measured from its own top. Sticky Section and Zoom Into Image read `offsetTop` without it today, so it is measured from the top of the page and their steps and their zoom start about 100px of scrolling late (measured: 111px and 103px).
- - No focus rule of its own: the shared stylesheet draws the focus ring inset on everything focusable inside the stage (rule B2), which covers the inner scrollers of Progress Bar, Scrollspy Navigation and Smooth (Inertia) Scroll. A stage that is its own scroller keeps the normal ring.
- - The old stage's `flex`, `min-width`, `width`, `height`, `border` and `border-radius` go; the page owns them.
-- **Stage height and scroll distance:** the stage takes the shared height (300–440px on computers and tablets, 260–327px on short laptops, 300px on phones; inside its border that is 258px at 1280×590, 325px at 1366×657, 378px at 1280×800, 438px at 768×1024 and 298px on phones). Every fit a section states is measured at the smallest of these, 258px, as well (rule B3). The old `--stage-h` (600px or 620px, and 460px or 480px on phones), its phone overrides and the old stage border go. What was sized in stage heights is sized in the scroller's own height instead: the scroller gets `container-type:size`, and `var(--stage-h)` becomes `100cqh` (for example `calc(var(--stage-h) * 4)` becomes `400cqh`). A pinned part therefore stays exactly one box tall at every stage height, and the scroll distance keeps its proportions. Each section gives the distance in box heights and what Play's six-second pass shows.
-- **Every effect follows the scroller's `scroll` event** (or an IntersectionObserver rooted on it), so it answers Play, Back to top, the wheel, touch, keys and dragging alike. No page reads the wheel itself, except Smooth (Inertia) Scroll.
-- **`:root`** keeps `--ui-accent:#6ea8ff` and the variables the stage rules still use. `--stage-h`, `--disp` and `--mono` go, and `--ui-muted` becomes `#8a8a92` wherever stage text uses it (the old `#77777e` is 4.4:1 on `#0b0b0d`).
-- **Cue lines** in the empty space before or after a demo ("Scroll down ↓") are 13px `#8a8a92` (5.7:1) with `letter-spacing:.1em`, in sentence case, centred, with side padding (`text-align:center;padding:0 24px`; rule B14). Today they are 11px at opacity .25, about 2:1.
-- **`hb-dots`** is left off on every page: the dots would stay still while the content scrolls over them, which reads as a parallax effect these demos do not have.
-- **Removed on every page:** the aside with its note, its readouts and its Reset scroll, Reset or Replay button (Back to top and Play replace them), the old `header`, `.layout`, the `.ah-bar` and its Copy source script, and the old mobile block. Each section's Stage list names the phone rules its stage still needs, or says there are none (rule B1). No page takes typed text, so none uses `hb-grow`.
-- **Stage text shows no code, and holds no `h1` or `h2`** (rule B13). Where a stage shows code or code names today, the section gives plain replacement text; stage headings become `h3` (a real sub-heading) or `p`.
-- **Pages without settings** (Horizontal Scroll, Sticky Section) follow the do-it/scroll plan's Task 1: no Try it step, steps numbered 1 (Scroll it) and 2 (Copy the prompt), the `hb-chips` markup kept, a prompt without "Match the settings listed below.", a Copy prompt hint without "Your settings are added at the end.", and a README Key parameters table of the technique's own values.
-
-## How to read a section
-
-- **Sets in the demo** lists one value per choice, in the same order as the choices, then what the page calls so the stage shows it.
-- **Shown only when …** in the Control column means the setting's whole `div.hb-setting` gets the `hidden` attribute while it has no effect, so it also drops out of "Your settings".
-- Switches in Try it keep their default in the markup (`checked` when the default is on), as on Rotate In.
-- **Feel** uses the Entrance & Exit names where they fit: Smooth (slows to a stop), Springy (goes a little past, then settles) and Even (one steady speed). Counter Animation adds Slow finish.
-- **Swatches** keep each demo's own colours, named, with the colour's name as each button's `aria-label`: the default is the category blue `#6ea8ff`, which is not in the Text & Typography palette.
-- **What scrolling shows** is what the visitor sees as the box scrolls, by hand or by Play.
-- **Phone rules** in a Stage list are the rules from today's mobile block that the stage still needs under 600px wide (rule B1); "none" means today's block held only the stage height, the aside and its controls.
-- **Measured** sizes come from the site font in headless Chrome, at the stage sizes above, including the smallest (258px inside at 1280×590). Where a block of text is centred in a pinned frame, the section gives the text's own height: a short stage then only eats into the padding around it.
-
----
-
-## horizontal-scroll — Horizontal Scroll
-
-- **Kind:** scroll. Scrolling down through a tall pinned section slides a strip of panels sideways.
-- **Description:** Scroll down and a row of panels slides sideways. Best for portfolios.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Try it:** none. The demo has no settings today (its aside holds only a Jump to panel list and Reset scroll), so the page has steps 1 and 2.
-- **Scroller:** the stage.
-- **What scrolling shows:** the cue "Scroll down ↓"; then the section reaches the top of the box and holds still while the strip of five panels slides left in step with the scroll, one box width per panel, and scrolling back slides it back. After the fifth panel the section lets go and the cue "The page moves on ↓" scrolls in.
-- **Scroll distance and Play:** a 60cqh lead-in, the pinned section at `calc(100cqh * var(--panels))` (500cqh) with its sticky frame 100cqh tall, and a 60cqh lead-out: 5.2 box heights of scrolling at any stage height (1,560px on a 300px phone). The strip moves during 4 of them, so Play slides it for about 4.6 of its six seconds, about 1.2 seconds a panel.
-- **Reduced motion:** nothing scrolls by itself. The strip still follows the visitor's own scrolling exactly; it has no easing to remove. The demo's reduced-motion rule goes: the track never had a transition, and the dots it named are gone.
-- **Stage font:** site font. `.panel-num` and `.panel-title` use `font-weight:700` (was `bold`).
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="Panels that slide sideways as you scroll"`.
- - `.spacer`: `height:60cqh` and the cue style; the texts are "Scroll down ↓" and "The page moves on ↓".
- - `#pin-section{height:calc(100cqh * var(--panels));position:relative}` and `#pin-inner{position:sticky;top:0;height:100cqh;overflow:hidden}`. `--panels:5` stays on `:root`.
- - The panels are sized to fit every stage, down to the smallest. `.panel` centres its content, so a short stage only eats into the padding. Measured, the tallest panel's content is 196px at 1366×657 (292px with its padding), 189px at 1280 wide (where the smallest stage is 258px) and 194px on a 320px phone:
- - `.panel{padding:clamp(24px,4vw,48px)}`;
- - `.panel-num{font-size:clamp(48px,6vw,80px)}`, with `aria-hidden="true"` on each number;
- - `.panel-title{font-size:clamp(22px,2.4vw,32px);line-height:1.2}`;
- - `.panel-body{font-size:clamp(14px,1.2vw,16px);line-height:1.6;color:#d6d6da}`. Today it is opacity .6, which is 3.6:1 on the green and teal panels; `#d6d6da` is at least 5.2:1 on every panel.
- - The fifth panel's title colour `#58a6ff` becomes `#a5d6ff`: the old one is 3.0:1 on the light end of its teal gradient, the new one 4.8:1.
- - Each panel's "Panel 01" tag goes (it repeats the big number), and so do the dots under the panels (`#panel-dots`, which showed which panel was in view).
- - The panel copy is rewritten in plain words (today's copy names scrollTop, Math.round and GSAP):
-
- | Panel | Title | Text |
- |---|---|---|
- | 1 | Scroll down, move sideways | The panels sit side by side in one long strip. As you scroll down, the strip slides left, one panel at a time. |
- | 2 | The box holds still | While the strip slides, the section around it stays pinned in place, so the page seems to pause. |
- | 3 | Your scroll does the work | There is no sideways scrolling to learn. The ordinary scroll you already use moves everything. |
- | 4 | Scroll back, it slides back | The strip follows your scroll exactly, so scrolling up brings the earlier panels back. |
- | 5 | Then the page moves on | Once the last panel is in view, the section lets go and the page scrolls on as normal. |
-
- - Script: `update()` keeps the translate maths (`budget`, `progress`, `maxShift`); its readout, dot and jump-button lines go. The `scroll` and `resize` listeners stay.
- - Phone rules: none. Today's mobile block also set `.panel{padding:24px}`, which the `clamp()` padding now gives on phones.
- - `hb-dots`: no. Default height.
-- **Removed:**
- - The note, and the Overall scroll, Track progress and Panel readouts.
- - The Jump to panel list. It is navigation, not a setting, and scrolling, Play and Back to top cover it.
- - Reset scroll. Back to top replaces it.
- - The panel dots and the "Panel 01" tags on the stage.
-- **Good for:** Portfolios · Timelines · Product features · Step-by-step tours · **Avoid on:** Long text · Forms
-- **Prompt:**
-
- > Add a horizontal scroll section to [the panels or projects you want to show]. Place the panels side by side in one long strip inside a section that is several screens tall. As the visitor scrolls down through that section, pin its inner frame in place and slide the strip to the left in step with the scroll, so scrolling down moves the panels sideways; once the last panel is in view, release the frame and let the page scroll on. Give the strip an explicit width so it can move. Keep the visitor's own scrolling, touch included, so scrolling back up slides the panels back. If the visitor has reduced motion turned on, keep the strip tied exactly to their scrolling, with no easing or snapping added.
-
-- **Copy prompt hint:** "Replace the words in brackets with your own panels."
-- **README What it is:** rewritten:
-
- > Horizontal scroll turns ordinary downward scrolling into sideways movement. A row of panels sits in a long strip inside a tall section; while you scroll through that section, it holds still and the strip slides left, one panel after another, and then the page carries on. You never have to scroll sideways yourself.
-
-- **README Key parameters:** the technique's own values (the page has no settings):
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Number of panels | 5 | Each panel is one box wide, and the strip is as wide as all of them together |
- | Pinned section height | Five box heights | The strip slides while the box scrolls through it; a taller section makes each panel pass more slowly |
- | Lead-in and lead-out | Six tenths of a box height each | The space before and after the section, so you see it arrive, hold still and let go |
-
-- **README See also:**
- - [Sticky Section](../sticky-section/) — the section holds still while its content changes instead
- - [Scrub Animation](../scrub-animation/) — scrolling moves a plane along its path, both ways
- - [Scrollytelling](../scrollytelling/) — a picture beside the text changes as a story scrolls by
-- **README How it works:**
- - The first snippet becomes:
-
- ```css
- .stage { container-type: size; } /* 100cqh is one stage height */
- #pin-section { height: calc(100cqh * var(--panels)); }
- /* 5 panels × a 380px stage = 1900px tall section */
- ```
-
- - Delete the "Panel jump links" paragraph and its snippet; the page no longer has them.
- - The track-sizing and translation snippets stay.
-- **README Production notes:**
- - In the "column flex layout" bullet, "When the side panel stacks below the stage on mobile" becomes "When a side panel stacks below the scroll container on phones".
- - The "Mobile consideration" bullet's first sentence becomes "The pin section is five stage heights tall: 1,500px on a 300px phone stage."
- - The rest is unchanged.
-- **Category line:** `01.14 · Scroll-Based`
-- **Pager:** Previous: Stagger Reveal (`../stagger-reveal/`) · Next: Sticky Section (`../sticky-section/`)
-
----
-
-## sticky-section — Sticky Section
-
-- **Kind:** scroll. The section holds still while the scrolling steps its content through four states.
-- **Description:** A section holds still while its content changes. Best for feature tours.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Try it:** none (the rollout spec: this demo has no settings). The page has steps 1 and 2.
-- **Scroller:** the stage.
-- **What scrolling shows:** the cue "Scroll down ↓"; then a two-column section (text on the left, a picture on the right) reaches the top of the box and holds still, and each quarter of the scrolling through it fades in the next of four steps, the text over 0.5 s and the picture over 0.6 s. Scrolling back steps backwards. After the fourth step the section scrolls away and the cue "The page moves on ↓" follows. Under 600px wide the picture column is hidden and the text takes the whole width, as today.
-- **Scroll distance and Play:** a 60cqh lead-in, the 400cqh wrapper with its sticky frame 100cqh tall, and a 60cqh lead-out: 4.2 box heights of scrolling. The section holds still for 3 of them, so Play spends about 4.3 of its six seconds on the four steps, about 1.1 s each; both ends of the box show part of the section.
-- **Reduced motion:** nothing scrolls by itself. The demo's rule stays: the steps switch without fading (`.state,.illus{transition:none!important}`).
-- **Stage font:** site font. `.state-head` uses `font-weight:700` (was `bold`).
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="A section that holds still while its content changes"`. `position:relative` also puts the steps back in the right place: today `wrap.offsetTop` is measured from the top of the page.
- - `.spacer`: `height:60cqh` and the cue style; the texts are "Scroll down ↓" and "The page moves on ↓".
- - `#sticky-wrap{height:400cqh}`; `#sticky-inner`, `#text-col` and `#vis-col` each get `height:100cqh`.
- - The text is sized to fit every stage, down to the smallest. Each step centres its text, so a short stage only eats into the padding. Measured, the tallest step's text is 183px at 1366 and 1280 wide (263px with its padding), which fits the 258px smallest stage; 164px on a 375px phone; and 187px on a 320px phone and at 601px wide, where the text column is narrowest. All of these fit:
- - `.state{padding:clamp(24px,4vw,40px)}`;
- - `.state-eye{font-size:12px;font-weight:600}`, keeping its capitals, letter spacing and inline colour, without the opacity .6;
- - `.state-head{font-size:clamp(20px,2.6vw,28px);line-height:1.2}`;
- - `.state-body{font-size:15px;line-height:1.6;color:#adadb2}` (was 12px at opacity .6).
- - The step copy is rewritten in plain words (today's copy speaks of 0–1 values, thresholds and integer indices):
-
- | Step | Eyebrow | Heading | Text |
- |---|---|---|---|
- | 1 | Step 01 · Hold | The section stays put. | Once it reaches the top of the box, the whole section stops moving while you keep scrolling. |
- | 2 | Step 02 · Change | Scrolling changes what is inside. | Each stretch of scrolling swaps the words and the picture for the next step, instead of moving the page. |
- | 3 | Step 03 · Fade | Each step fades into the next. | The change is a quick fade, so the section reads as one frame stepping forward. |
- | 4 | Step 04 · Release | Then the page moves on. | After the last step, the section scrolls away and the page carries on as normal. |
-
- - The four pictures stay, each `svg` with `aria-hidden="true"`. The fourth step's "Continue scrolling →" box (`.state-cta`) goes: it looked like a button but did nothing.
- - Script: `update()` keeps `p`, `si` and the two class toggles; its readout lines and the segment-bar loop go.
- - Phone rules, kept from today's mobile block: `@media(max-width:600px){#sticky-inner{grid-template-columns:1fr}#vis-col{display:none}}`. Without them the two columns stay side by side on a phone and the text is cut off.
- - `hb-dots`: no. Default height.
-- **Removed:**
- - The note, and the Overall, Lifecycle, State and Internal readouts.
- - The State segments bar, a progress readout.
- - Reset scroll. Back to top replaces it.
- - The "Continue scrolling →" box.
-- **Good for:** Feature tours · How-it-works steps · Product pages · **Avoid on:** Long text · Short pages
-- **Prompt:**
-
- > Add a sticky section to [the steps or features you want to walk through]. Make the section several screens tall and pin its inner frame to the top of the screen while the visitor scrolls through it. Split that scroll distance into equal parts, one per step, and as each part is reached, fade the text and the picture over to the next step while the frame itself stays still. After the last step, let the section scroll away so the page carries on. Work out the step from the scroll position, so scrolling back up steps backwards. If the visitor has reduced motion turned on, switch the steps without fading.
-
-- **Copy prompt hint:** "Replace the words in brackets with your own steps."
-- **README What it is:** rewritten:
-
- > A sticky section holds a whole section still while you scroll, and uses that scrolling to step its content through a sequence instead of moving the page. The section sits inside a tall wrapper, and how far you have scrolled through the wrapper decides which step shows, so scrolling back steps backwards. In the demo, a text column and a picture change together through four steps, then the section scrolls away.
-
-- **README Key parameters:** the technique's own values (the page has no settings):
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Number of steps | 4 | Each step owns an equal share of the scrolling while the section holds still |
- | Wrapper height | Four box heights | The section holds still for three of them; a taller wrapper makes each step last longer |
- | Fade between steps | 0.5 s | How long the text takes to fade to the next step; the picture takes 0.6 s |
-
-- **README See also:**
- - [Pin Animation](../pin-animation/) — one element holds still while the rest scrolls past
- - [Scrub Animation](../scrub-animation/) — scrolling moves a plane along its path, both ways
- - [Scrollytelling](../scrollytelling/) — a picture beside the text changes as a story scrolls by
- - [Section Wipe](../section-wipe/) — each section slides up over the one before
-- **README How it works:**
- - "Multiplying by the state count gives the active state index and the fraction within it:" becomes "Multiplying by the state count gives the active state index:".
- - In the snippet, `const si = Math.min(Math.floor(p * 4), 3), sf = p * 4 - si; // state index + fraction` becomes `const si = Math.min(Math.floor(p * 4), 3); // state index`, and the segmented progress loop goes (from its `for (let i = 0; i < 4; i++) {` line, with its comment, to its closing brace).
- - Delete the sentence "The three lifecycle phases — `approaching`, `stuck`, `released` — come from comparing `scrollTop` against the pin's start and end."; it described the removed readout.
- - "States themselves crossfade via a CSS `opacity` transition on `.visible`; only the segment bars use the raw fraction, so the section reads as pinned frames advancing rather than a continuous scrub." becomes "States crossfade via a CSS `opacity` transition on `.visible`, so the section reads as pinned frames advancing rather than a continuous scrub."
-- **README Production notes:** unchanged
-- **Category line:** `01.15 · Scroll-Based`
-- **Pager:** Previous: Horizontal Scroll (`../horizontal-scroll/`) · Next: Counter Animation (`../counter-animation/`)
-- **Final fix wave (2026-09-30):** the final category review found both ends of the box empty but for the cue (first picture, and the rest after the arrival run), because the lead-in and lead-out were a whole box tall. They are 60cqh, as on Horizontal Scroll and Zoom Into Image, so both ends show part of the section. Measured in headless Chrome: 4.2 box heights of scrolling at every size (1,588px in a 378px box, 1,252px in a 298px phone box, 1,084px in a 258px box), the steps changing every 0.75 box, and in Play at 1.9, 3.0 and 4.1 s (gaps of 1.07 to 1.08 s).
-
----
-
-## counter-animation — Counter Animation
-
-- **Kind:** scroll. The numbers count up when the box scrolls them into view.
-- **Description:** Numbers count up when they scroll into view. Best for stats.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** the cue "Scroll down ↓", then four tiles (active users, uptime, revenue, experience). When the top of the tiles passes the line that Starts counting sets, the four numbers may count up from zero to 12,847, 98.4%, $2.4M and 8 yrs, formatted the whole way. Each number starts once the one before it has (200 ms later with One after another on) and once half of it is inside the box, so the lower row, still below the box when the tiles pass the line, is seen counting when it scrolls in (started by the line alone, revenue and experience were already 50–100% counted, at most sizes 88–100%, when they were half in view). All four show zero together when a count starts. Scrolling back above the line and down again counts again, and the numbers keep their totals until then. Once the tiles are out of the box altogether (their top less than 8px inside it, when no number shows yet), the numbers go back to zero, so after Back to top, Play at the end or the Home key they scroll in at zero and never show the old totals first. The revenue reads $9,999 and below, then $10K to $999K, then $1.0M to $2.4M, so no string is wider than "12,847".
-- **Scroll distance and Play:** a 100cqh lead-in, then `#stats`, which holds the tiles. Measured, the tiles need 292px on phones, 345px at 768×1024 and 402px on laptops; at 768×1024 the 80cqh minimum below (350px) is the taller. The empty spacer after the tiles goes, so the box ends with the tiles in view instead of an empty screen. `#stats` gets `min-height:80cqh`, so the box always scrolls at least 80cqh. Late needs 70cqh, so every Starts counting choice is reached at every size (rule B4). Measured on a prototype at 610×1000, 640×1000, 768×1024, 1280×590, 1366×657, 1280×800, 375×812 and 320×640: all three lines are reached at each. At the default (Middle), Play reaches the line 1.6 s into its pass at 1280×590, 2.0 s at 1366×657, 2.5 s on phones and 3.0 s on tablets. The upper two numbers have finished by 3.9–5.3 s; the lower two start when they come into the box, at about 4.4–5.0 s, so at the defaults the last number finishes 0.4–0.6 s after the box stops at about 6.4 s (measured 0.40–0.58 s at 1280×590, 1366×657, 1280×800, 768×1024, 375×812 and 320×640), and about 1.7 s after it with Late on a tablet (768×1024). The numbers are then at rest in view.
-- **Reduced motion:** nothing scrolls by itself. As today, the numbers jump to their totals when the tiles pass the line (the `motionOk` branch stays), all four at the same moment: no cascade, and no waiting for the lower row to come into the box. The CSS rule `.tile-num{transition:none}` goes: the numbers have no transition.
-- **Stage font:** site font. `.tile-num` drops `var(--disp)` and keeps weight 700.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="Numbers that count up as they scroll into view"`.
- - `.spacer`: `height:100cqh` and the cue style, with the text "Scroll down ↓" (was "scroll down to trigger ↓").
- - `#stats` keeps its grid, gap and padding and adds `min-height:80cqh;align-content:start`, so the tiles stay packed at the top of that space.
- - `.tile-label` becomes 12px `#8a8a92` (was 10px at opacity .5). Each `.tile-icon` gets `aria-hidden="true"`.
- - Each `.tile-num` gets `role="img"` and an `aria-label` with its total as shown at the end ("12,847", "98.4%", "$2.4M", "8 yrs"), because its text changes every frame.
- - `.tile` gets `container-type:inline-size`, and `.tile-num` gets `font-size:min(clamp(28px,4.5vw,44px),26cqw)` (was `clamp(28px,4.5vw,44px)`) and `white-space:nowrap`. The site font's tabular figures make every digit, comma, period and % 0.635em wide, so "12,847" is 107px at 28px and did not fit a phone tile narrower than that (its content box is 84px at 320px and 104px at 360px). The number is 27px at 360px, 21.8px at 320px and unchanged from 375px up. Measured over every value each number shows, up to 112% of its total (Springy's overshoot), at 18 sizes from 1280×590 to 320×640, two of them landscape phones: no string is wider than its tile's content box (tightest 0.8px, at 320px).
- - The revenue reads `$9,999` and below, `$10K` to `$999K` (`Math.floor(v / 1e3)`), then `$1.0M` to `$2.4M`, instead of `$999,999` below a million: that string is 5em wide and stuck out of its tile's border by 4–14px on phones up to 390px wide, for about 0.3 s (about 1.2 s with Even and Slow). The final "$2.4M" and the aria-label are unchanged. Numbers are formatted with `toLocaleString('en-US')`, so the commas always match the aria-labels.
- - Script: the counting observer is as before (it reads the last entry). Each number starts once the number before it has begun (plus 200 ms with the cascade on) and once its middle is above the box's bottom edge, checked on every frame; all four are set to zero when a count starts, and speed, feel and cascade are read then. A second observer on `#stats`, with `rootMargin:'0px 0px -8px 0px'`, stops a count in progress and puts the numbers back to zero once the tiles are out of the box. The margin must not be 0, because at scrollTop 0 the tiles touch the box's bottom edge and still count as intersecting. It must stay under the smallest Early line (a tenth of the box: about 25px at 258px): 32px was built first, and it reset the numbers while the counting observer still saw the tiles past its line, so with Early on a box under 320px tall they stayed at zero after the visitor scrolled back up and stopped between the two (found at review, fixed). Reduced motion is read when a count starts.
- - Phone rules: none. Today's mobile block repeated the two-column grid.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Starts counting | Choice buttons | Early · Middle · Late | Middle | How far the numbers scroll into the box before counting. | `threshold`: 90 / 60 / 30, then `buildObserver()` (its bottom `rootMargin` is −10% / −40% / −70%); a number also waits until half of it is inside the box |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the numbers take to reach their totals. | `duration`: 2900 / 1800 / 1100 (ms), used from the next count |
-| Feel | Choice buttons | Smooth · Slow finish · Springy · Even | Smooth | Springy goes a little past each total, then settles. | `easing`: `'outCubic'` / `'outExpo'` / `'outBack'` / `'linear'`, used from the next count |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| One after another | Switch | on / off | on | Each number starts a moment after the one before. | `staggerTog.checked`: each number starts 200 ms after the one before / all together (each still waits until half of it is inside the box), used from the next count |
-
-- **Known limits (accepted at the Task 9 review, 2026-09-30):**
- - Early and Middle start close together on short boxes: a number cannot start before half of it is inside the box, and the first number is about 70–96px below the tiles' top. Scroll position where the first number and the lower row start, for Early · Middle · Late (measured, Play from the top): 1280×590 121/297 · 121/297 · 182/297 (Early and Middle at the same place); 1366×657 121/297 · 132/297 · 229/297; 1280×800 121/297 · 153/297 · 266/297; 768×1024 101/258 · 177/258 · 308/332; 601×700 88/225 · 148/225 · 258/278; 375×812 86/221 · 121/221 · 209/230. At laptop sizes the lower row starts at the same place whichever choice is picked.
- - The end timing (see Scroll distance and Play): the last number settles in view, after the box has stopped.
- - An End-key jump (or a very fast wheel) at 1280×590 lets the upper two numbers finish counting just above the box: the wait looks at the bottom edge only, so a number already above the box when its turn comes counts unseen (after End they change 102 and 94 times while wholly above it, and end 46px above its top edge). At 1366×657, 1280×800, 768×1024, 375×812 and 812×375 they stay at least partly in view. Play and paced scrolling show every number.
-- **Removed:**
- - The note, and the Live values readouts (they repeated the numbers).
- - Replay counters. Scrolling back above the line and down again counts again, and so do Back to top and Play.
- - The Trigger threshold and Duration sliders. They become Starts counting and Speed.
- - The Easing buttons (Linear, Cubic, Expo, Back). They become Feel.
- - Stagger counters becomes One after another.
- - The empty spacer after the numbers (`#stats` gets its minimum height instead).
-- **Good for:** Stats · Annual reports · Landing pages · Dashboards · **Avoid on:** Prices · Data tables
-- **Prompt:**
-
- > Add a count-up animation to [the numbers in your stats section]. When the numbers scroll far enough into view, count each one up from zero to its total, and format it on every step so commas, currency signs and units show the whole way through, not just at the end. Count again if the numbers leave the view and come back. When the settings include it, start each number a moment after the one before for a cascade. Screen readers should hear each final number once, never the steps in between. If the visitor has reduced motion turned on, show the final numbers straight away. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A counter animation counts numbers up from zero to their totals when they scroll into view, so a row of statistics seems to arrive rather than just sit there. Each number keeps its commas, currency sign or unit the whole way up, and usually slows down as it reaches its total, so it settles into place.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Starts counting | Middle | The line the top of the tiles must pass before the numbers may count: early is a tenth of the way up the box, middle 40% of the way up and late 70%. Each number then waits until half of it is inside the box, so on a short box early and middle start at almost the same place |
- | Speed | Normal | How long each count takes: slow is 2.9 s, normal 1.8 s and fast 1.1 s |
- | Feel | Smooth | Smooth slows to a stop; Slow finish races to near the total, then creeps through the last digits; Springy goes a little past and settles back; Even counts at one steady pace, which feels mechanical |
- | One after another | on | Each number starts 200ms after the one before, so the four count in a cascade |
-
-- **README See also:**
- - [Reveal on Scroll](../reveal-on-scroll/) — cards appear as they scroll into view
- - [Stagger Reveal](../stagger-reveal/) — items appear one after another as their group scrolls in
-- **README How it works:** the text and snippets stay, with these changes so that it matches the code. The observer snippet reads `entries[entries.length - 1]` instead of `[e]`, and the frame snippet uses `begun` (when a number's own count started) instead of `start` and `delay`. After the paragraph that ends "not suddenly at the final value." come three paragraphs: every count starts from zero, each number starts once the one before it has and half of it is inside the box, speed, curve and cascade are read when a count starts, and reduced motion jumps straight to the totals; the revenue changes format as it grows; and a second observer, shrunk by 8px at the bottom, puts the numbers back to zero when the tiles leave the box (its margin is smaller than any counting line, so a count can start again on the way down). The "Easing functions available:" sentence and its snippet move from Key parameters to the end of How it works, because the Key parameters section may hold no code. The sentence becomes "The four Feel choices use these curves: Even is `linear`, Smooth is `outCubic`, Slow finish is `outExpo` and Springy is `outBack`:".
-- **README Production notes:** unchanged
-- **Category line:** `01.16 · Scroll-Based`
-- **Pager:** Previous: Sticky Section (`../sticky-section/`) · Next: Progress Bar (`../progress-bar/`)
-
----
-
-## progress-bar — Progress Bar
-
-- **Kind:** scroll. The indicator fills as the article scrolls.
-- **Description:** A bar fills as you read down the page. Best for long articles.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** `<div class="scroller" id="scroller" data-hb-scroller tabindex="0" role="region" aria-label="An article with a reading progress indicator">` inside the `.stage`. The `.stage` does the job of today's `.stage-wrap`: it holds the three indicators beside the scroller, with `pointer-events:none`, so they stay in place while the article moves and a wheel turn or a touch over them still scrolls the article. The script calls it `scroller` wherever it said `stage`. The page adds no focus rule: the shared stylesheet draws the scroller's focus ring inset, inside the stage (rule B2).
-- **What scrolling shows:** the article scrolls, and the chosen indicator (a bar along the top, a ring in the top-right corner with the percentage inside, or a rail down the right edge) fills from empty to full, reaching full exactly at the end of the article.
-- **Scroll distance and Play:** the article does not depend on the stage height (measured: 846px on laptops and 1,126px on a 375px phone), so the box scrolls about 1.5 box heights on laptops and nearly 3 on phones. Play fills the indicator from 0 to 100% in six seconds.
-- **Reduced motion:** nothing scrolls by itself, and nothing needs simplifying: the indicators have no transition. The demo's rule goes (it named the old scroller and transitions that do not exist).
-- **Stage font:** site font. `.art-title` and `.art-h2` use `font-weight:700` (was `bold`); `.circ-text` drops `var(--mono)`.
-- **Stage:**
- - `.stage`: `position:relative;overflow:hidden;background:#0b0b0d`.
- - `.scroller`: `height:100%;overflow-y:auto;scrollbar-width:none;position:relative`, with the `::-webkit-scrollbar{display:none}` rule. The old stage's border and height go.
- - `#top-bar`, `#side-rail` and `svg#circ` get `aria-hidden="true"`: they repeat what scrolling shows, and the ring's text changes every frame.
- - The ring grows from 40px to 48px (`width="48" height="48"`; the `viewBox` stays `0 0 36 36`), and `.circ-text` gets `font-size:9px;font-weight:600;fill:#f4f4f2`, about 12px on screen (today 5.6px).
- - The ring's thickness comes from CSS: `.circ-bg,.circ-fg{stroke-width:var(--bar-thick)}` in place of `stroke-width:3`, and the Thickness handler's two `setAttribute('stroke-width', …)` calls go. Today the CSS `stroke-width:3` beats those attributes, so the thickness slider never changed the ring.
- - Article text: `.art-body{font-size:15px;line-height:1.8;color:#adadb2}` (was 13px at opacity .7); `.art-byline{font-size:12px;color:#8a8a92}` (was opacity .4); `.art-pull{color:#d6d6da}` (was opacity .8); `.art-h2` keeps its size without the opacity.
- - `.art-title{padding-right:40px}` keeps the title clear of the ring in the top-right corner (48px wide, 8px in from the box's edge): with the Ring indicator on, the title's text ends 394px, 233px, 34px and 19px short of it at 1280×800, 768×1024, 375×812 and 320×640 (the title wraps to two lines on the two phone sizes).
- - The article is rewritten in plain words (today's paragraphs describe scrollTop, requestAnimationFrame and dash arrays). In order:
-
- | Part | Text |
- |---|---|
- | Title | How a reading progress bar works |
- | Byline | Animation Handbook · Reference (unchanged) |
- | Paragraph | A progress bar tells readers how far through an article they are. It fills as they scroll down, and it is full when the last line comes into view. |
- | Pull quote | “It answers one question: how much is left?” |
- | Paragraph | It compares how far the page has scrolled with how far it can scroll in total, so the bar reaches the end exactly when there is nothing left to read. |
- | Heading | Where to put it |
- | Paragraph | A bar across the top is the most noticeable choice. It sits in plain sight and tells readers this is a long piece. A thin rail down the side does the same job more quietly, which is why many magazines prefer it. |
- | Paragraph | A ring in the corner takes the least room. It fills around its edge like a clock face and can show the percentage in the middle. |
- | Heading | How thick to make it |
- | Paragraph | A hairline bar is almost invisible until you look for it; a thick one is hard to miss. News sites tend to keep it thin, while documentation often makes it bolder, because readers there want to keep track of their place. |
- | Heading | Keeping it smooth |
- | Paragraph | Whatever it looks like, the indicator should move with the scroll and never make the page stutter, especially on phones. |
-
- - Script: `update()` keeps the three fills and the ring's text; the Read readout line goes, and so does the reading-time line.
- - Phone rules: none. Today's mobile block held only control sizes.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Indicator | Choice buttons | Top bar · Ring · Side rail | Top bar | The top bar is the loudest; the side rail the quietest. | `setStyle()`: `'top'` / `'circ'` / `'rail'` |
-| Thickness | Choice buttons | Thin · Medium · Thick | Medium | Thin is barely there; thick is hard to miss. | `--bar-thick`: 2px / 3px / 6px (the ring's two circles follow it through their CSS `stroke-width`) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Color | Swatches | Blue · Green · Orange · Purple | Blue | The color of the bar, the ring or the rail. | `--bar-color`: `#6ea8ff` / `#56d364` / `#ffa657` / `#d2a8ff` |
-
-- **Removed:**
- - The note, and the Read and Reading time readouts.
- - Reset scroll. Back to top replaces it.
- - The Indicator style buttons become Indicator, and the Bar thickness slider becomes Thickness.
- - The four colour squares (not buttons, so not reachable by keyboard) become the Color swatches.
-- **Good for:** Long articles · Documentation · Tutorials · Reports · **Avoid on:** Short pages
-- **Prompt:**
-
- > Add a reading progress indicator to [your article or long page]. Work out how far the reader has scrolled as a share of the total distance they can scroll, and show it as a bar that fills along the top, a ring that fills in a corner, or a thin rail down the side, so it is full exactly when the last line is in view. Keep the indicator outside the scrolling content so it stays in place, and grow it with a transform rather than by changing its width, so scrolling stays smooth. Hide the indicator from screen readers; it only repeats what scrolling shows. It follows the reader's own scrolling, so reduced motion needs no change. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A reading progress indicator shows how far through an article the reader is. It fills as they scroll and is full exactly when the last line comes into view. The demo shows three styles of the same idea: a bar along the top, a ring in the corner and a thin rail down the side.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Indicator | Top bar | The top bar is the most noticeable; the ring in the corner takes the least room and shows the percentage; the side rail is the quietest |
- | Thickness | Medium | Thin is 2px, medium 3px and thick 6px; thin is almost invisible until you look for it, thick is hard to miss |
- | Color | Blue | The color of the fill |
-
-- **README See also:**
- - [Scrub Animation](../scrub-animation/) — the same scroll progress moves a plane instead of filling a bar
- - [Sticky Section](../sticky-section/) — scroll progress steps a section through its states
- - [Scrollspy Navigation](../scrollspy-nav/) — a menu shows which section you are reading
-- **README How it works:**
- - In the first snippet, `stage` becomes `scroller` (four times: once in the listener line, three times in the `update()` formula).
- - "All three indicators are `position: absolute` children of `.stage-wrap` (the `position: relative` wrapper around the scroll container), not children of the scroll container itself:" becomes "All three indicators are `position: absolute` children of `.stage` (the `position: relative` box around the scroll container), not children of the scroll container itself:".
- - The HTML snippet becomes:
-
- ```html
- <div class="stage"> <!-- position: relative; overflow: hidden -->
- <div id="top-bar"></div> <!-- absolute, top:0, left:0, right:0 -->
- <div id="side-rail">...</div> <!-- absolute, top:0, right:0, bottom:0 -->
- <svg id="circ">...</svg> <!-- absolute, top:8px, right:8px -->
- <div class="scroller" id="scroller"> <!-- overflow-y: auto -->
- <div class="article">...</div>
- </div>
- </div>
- ```
-
- - "`overflow: hidden; border-radius: 8px` on `.stage-wrap` clips all three indicators to the stage boundary." becomes "`overflow: hidden` on the rounded `.stage` clips all three indicators to its corners."
-- **README Production notes:**
- - In the first bullet, "The formula must use `stage.scrollTop` and `stage.scrollHeight / stage.clientHeight` from the actual scroll element." becomes "The formula must use `scroller.scrollTop` and `scroller.scrollHeight / scroller.clientHeight` from the actual scroll element."
- - Delete the bullet about apostrophes in JavaScript string literals: it is about writing JavaScript, not about progress bars.
- - The rest is unchanged.
-- **Category line:** `01.17 · Scroll-Based`
-- **Pager:** Previous: Counter Animation (`../counter-animation/`) · Next: Section Wipe (`../section-wipe/`)
-- **Final fix wave:** sheet only. It now records that the three indicators (`#top-bar`, `#side-rail`, `svg#circ`) have `pointer-events:none` (Scroller line) and that `.art-title` has `padding-right:40px` to stay clear of the ring (the Stage bullet after Article text).
-
----
-
-## section-wipe — Section Wipe
-
-- **Kind:** scroll. Each full-box section slides up over the one before as the box scrolls.
-- **Description:** Each section slides up over the one before. Best for full-screen stories.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** four sections, each exactly one box tall and each stuck to the top of the box. The next section slides up and covers the one before, which shrinks a little as it is covered (Shrink) and so seems to sink behind it. The fourth section is never covered, and it stays on screen for the last stretch of scrolling.
-- **Scroll distance and Play:** four 100cqh sections and an 80cqh end spacer: 3.8 box heights of scrolling. Play spends about 1.6 s on each of the three wipes, then holds the fourth section for about 1.3 s.
-- **Reduced motion:** nothing scrolls by itself. As today, the sections still wipe (that is layout) but the covered one does not shrink: the `motionOk` early return in `update()` and the `.sec-content{will-change:auto}` rule stay.
-- **Stage font:** site font. `.sec-num` and `.sec-title` use `font-weight:700` (was `bold`).
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="Sections that slide up over each other"`.
- - `.section{position:sticky;top:0;height:100cqh;overflow:hidden}`, keeping the inline `z-index` 1 to 4.
- - `.end-spacer`: `height:80cqh`, empty. It only adds scrolling at the end: the stuck sections cover it (measured at the end of today's scroll), so its "end of stack" text never showed, and the text goes.
- - The section content is sized to fit every stage, down to the smallest. `.sec-content` centres it, so a short stage only eats into the padding. Measured, the tallest content is 211px at 1366×657 (307px with its padding), 202px at 1280 wide (where the smallest stage is 258px) and 208px on a 320px phone:
- - `.sec-content{padding:clamp(24px,4vw,48px)}`;
- - `.sec-num{font-size:clamp(56px,6.4vw,88px)}`, with `aria-hidden="true"` on each number;
- - `.sec-title{font-size:clamp(22px,2.6vw,34px)}`;
- - `.sec-body{font-size:clamp(14px,1.2vw,16px);line-height:1.7;color:#d6d6da}` (was opacity .65; `#d6d6da` is at least 5.2:1 on every section).
- - The section copy is rewritten in plain words (today's copy names z-index, top:0 and GSAP):
-
- | Section | Title | Text |
- |---|---|---|
- | 1 | Each section stays put | Every section sticks to the top of the box, and the next one slides up over it, like a card landing on a pile. |
- | 2 | The one below sinks back | As a section is covered it shrinks a little, so it seems to slip behind the one arriving. |
- | 3 | It follows your scroll | Stop halfway and the wipe stops halfway. Scroll back up and the section slides away again. |
- | 4 | The last one stays on top | Nothing covers the final section, so it never shrinks. |
-
- - Script: `update()` keeps the coverage and scale maths; its two readout lines go.
- - Phone rules: none. Today's mobile block held only the stage height and the aside.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shrink | Choice buttons | None · A little · A lot | A little | How far the section underneath sinks back. | `scaleFloor`: 1 / 0.96 / 0.88, then `update()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shrink speed | Choice buttons; shown only when Shrink is not None | Quick · Medium · Gradual | Gradual | Quick finishes shrinking early in the wipe. | `wipeRange`: 0.3 / 0.6 / 1, then `update()` |
-
-- **Removed:**
- - The note, and the Scroll and Top section readouts.
- - Reset scroll. Back to top replaces it.
- - The Scale floor and Wipe range sliders. They become Shrink and Shrink speed.
-- **Good for:** Full-screen stories · Landing pages · Case studies · **Avoid on:** Long text · Documentation
-- **Prompt:**
-
- > Add a section wipe to [the full-screen sections of your page]. Make each section exactly one screen tall, stick each one to the top as the visitor scrolls, and stack them so every section sits above the one before; the next section then slides up and covers the current one instead of pushing it away. While a section is being covered, shrink its content in step with the scroll so it seems to sink behind the one arriving, unless the settings turn the shrink off. Nothing ever covers the last section. If the visitor has reduced motion turned on, keep the wipe but skip the shrink. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A section wipe replaces each full-screen section with the next by sliding the new one up over it, instead of scrolling the old one away. Every section sticks to the top of the screen and sits above the one before, so the next one covers it as you scroll. The covered section can shrink slightly, so it seems to sink behind the one arriving.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Shrink | A little | How small the covered section gets: none keeps it full size, a little is 96% and a lot 88%; smaller sinks it deeper |
- | Shrink speed | Gradual | How much of the wipe the shrink takes: gradual spreads it over the whole wipe, medium over the first 60% and quick over the first 30% |
-
-- **README See also:**
- - [Sticky Section](../sticky-section/) — one section holds still while its content changes
- - [Stacking Cards](../stacking-cards/) — cards pile up into a deck as you scroll
- - [Cover Card to Fixed Header](../cover-card-to-fixed-header/) — a big cover shrinks into a slim header as you scroll
- - [Snap Scrolling](../snap-scrolling/) — scrolling stops on one whole section at a time
-- **README How it works:** unchanged
-- **README Production notes:** unchanged
-- **Category line:** `01.18 · Scroll-Based`
-- **Pager:** Previous: Progress Bar (`../progress-bar/`) · Next: Zoom Into Image (`../zoom-into-image/`)
-
----
-
-## zoom-into-image — Zoom Into Image
-
-- **Kind:** scroll. A small window onto a picture opens up to fill the box as the box scrolls.
-- **Description:** A small window opens up to fill the box as you scroll. Best for hero images.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** the cue "Scroll down ↓"; then the picture (a moonlit lake between mountains: a round full moon, two ranges of dark mountains and the lake with the moon's reflection, all in view on every box from a 3.7:1 laptop box to a phone; see the recomposed drawing under Stage) reaches the top of the box and holds still while its window opens outward in step with the scroll, its rounded corners squaring off, until the picture fills the box. A faint outline stays where the window began, and fades out over the last eighth of the opening while the caption "Through the Portal" fades in, so the outline never crosses the caption text. Scrolling back closes the window again. Then the cue "The page moves on ↓" scrolls in.
-- **Scroll distance and Play:** a 60cqh lead-in, the 250cqh section with its sticky frame 100cqh tall, and a 60cqh lead-out: 2.7 box heights of scrolling. The window opens during 1.5 of them, about 3.3 of Play's six seconds.
-- **Reduced motion:** nothing scrolls by itself. As today, the full picture and its caption show from the start and do not change as the box scrolls (the demo's CSS rule and the `motionOk` early return stay). The starting-frame outline is hidden then (`.frame-border{opacity:0!important}` in the same rule): the caption is on from the start, and on a short box the outline would cross it.
-- **Stage font:** site font. The caption title (`.cap-title`, today's `#caption h2`) uses `font-weight:700` (was `bold`).
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="A picture that opens up as you scroll"`. `position:relative` also makes the window start opening as soon as the picture reaches the top: today `zoomSec.offsetTop` is measured from the top of the page.
- - `.spacer`: `height:60cqh` and the cue style; the texts are "Scroll down ↓" and "The page moves on ↓".
- - `#zoom-section{height:250cqh}` and `#zoom-sticky{height:100cqh}`.
- - The picture's `svg` gets `role="img"` and `aria-label="A lake under a full moon, between dark mountains"`.
- - The caption holds no heading (rule B13): `<h2>Through the Portal</h2><p>Scroll to exit</p>` becomes `<p class="cap-title">Through the Portal</p><p class="cap-sub">Keep scrolling</p>`. The `#caption h2` rule becomes `#caption .cap-title` and the `#caption p` rule becomes `#caption .cap-sub`, each with the same values (the small line stays 11px, a caption label).
- - `#zoom-img` keeps `clip-path:inset(30% round 16px)` and the frame keeps `inset:28%`, which match the defaults.
- - **The outline gives way to the caption (Task 11 fix round 1, 2026-09-30).** The reviewer found the outline drawn over the caption text on short boxes (its bottom edge crosses the title at 258px and 325px with Medium, and the title or the small line with Large at 258px to 438px). `#frame` now comes before `#caption` in the DOM, so the caption is drawn over it, and `update()` sets `frameBorder.style.opacity` to 1 minus the caption's opacity, so the outline is gone once the caption is fully in (the switch's own `#frame` opacity and its 0.4s fade are untouched). Moving `#frame` alone was not enough: rendered, the line still ran along the title from behind.
- - **The drawing is recomposed (Task 11 fix round 1, 2026-09-30; the owner's pick, option B).** Under `preserveAspectRatio="xMidYMid slice"` (kept) a wide box shows only the middle band of the 800×600 drawing: viewBox y 192–408 on a 958×258 box (3.7:1), y 164–436 on 958×325 and y 142–458 on 958×378. The old drawing had the moon at y 62–118 and the lake below y 420, so no laptop or desktop box ever showed the moon and at most a strip of lake, while the `aria-label` and the words above describe a lake under a full moon. The recomposition is a coordinate-only edit of the same drawing (same gradients, colours and shapes, and no stretching, so the moon stays round):
- - the sky rect ends at y 345 (was 420); the moon and its glow move to `cy` 218 (was 90), the moon to `r` 24 (was 28) and the glow to `r` 70 (was 80);
- - both mountain polygons stand on y 345 (was 420) with their heights halved: distant peaks at y 245–300 (were 220–330), near ones at y 275–315 (were 280–360);
- - the water rect starts at y 345 (`height` 255); the shimmer lines are at y 365, 385 and 410 (were 440, 460 and 485); the reflection ellipses at `cy` 372 and 395 (were 470 and 500);
- - the stars at (760,130) and (50,180) go, and five stars at (90,205), (250,226), (380,199), (470,232) and (740,236) fill the band; the other six stay.
- - The moon (y 194–242) and the mountains (y 245–345) lie wholly inside y 192–408, and so does the top of the lake (y 345–408), so the widest box (3.7:1) keeps all three. The starting window still shows mountains at every setting.
- - Measured in headless Chrome, fully open, box sizes inside the border, distances from the top edge of the box: 958×258 (1280×590): moon 57px across and round, 2px down; distant peaks 63px, near peaks 99px; lake 75px tall. 958×325 (1366×657): moon 35px down, lake 109px. 958×378 (1280×800): moon 62px down, lake 135px. 705×438 (768×1024): moon 42px across, lake 180px. 745×258 (a phone held sideways, 812×375): moon 45px across, lake 87px. 341×298 and 286×298 (phones): moon 24px across, lake 127px. The moon is a 1:1 circle at every size, both reflection ellipses are inside the box, and the caption never covers the moon. Under the starting window (Small / Medium / Large) the mountains fill 67–100% / 31–81% / 15–56% of what shows, at every size.
- - Script: `update()` keeps the inset, radius and caption maths; the readout line goes, and the clip no longer checks the removed portal switch. It also sets the outline's fade, as above.
- - Phone rules: none. Today's mobile block held only the stage height and the aside.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Starting window | Choice buttons | Small · Medium · Large | Medium | How much of the picture shows before you scroll. | `startPct`: 40 / 30 / 20 (the inset on each side, so the window is 20% / 40% / 60% of the box wide), and the frame's inset `(startPct − 2)%`: 38% / 28% / 18%; then `update()` |
-| Corners | Choice buttons | Square · Rounded · Very rounded | Rounded | The window's corners straighten as it opens. | `brStart` and `--br-start` (which rounds the frame's corners): 0 / 16 / 32; then `update()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Shows the starting frame | Switch | on / off | on | A faint outline marks where the window began. | `frameEl.style.opacity`: `'1'` / `'0'` (the outline inside it also fades out with the caption, as under Stage) |
-
-- **Removed:**
- - The note, and the Section readout.
- - Reset scroll. Back to top replaces it.
- - The Start size and Border radius start sliders. They become Starting window and Corners.
- - Portal clip-path mode. Turning it off only removed the rounded corners, which Corners: Square now does.
- - Show frame becomes Shows the starting frame.
-- **Good for:** Hero images · Gallery intros · Section breaks · **Avoid on:** Small images · Text-heavy pages
-- **Prompt:**
-
- > Add a zoom-into-image effect to [your featured picture]. Pin the picture in place while the visitor scrolls through a section a couple of screens tall, and show only a small window of it at first. As they scroll, open that window outward in step with the scroll until the picture fills the whole frame, then fade in a caption. Uncover the picture by clipping it rather than scaling it up, so it stays sharp, and let scrolling back up close the window again. If the visitor has reduced motion turned on, show the full picture and the caption from the start. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Zoom into image starts with a small window onto a picture and opens it up to fill the screen as you scroll, as if you were flying into the picture. The picture itself never grows: more of it is simply uncovered, so it stays sharp. The window's rounded corners square off as it opens, and a caption fades in at the end.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Starting window | Medium | How much of the picture shows at first: small is a window a fifth of the box wide, medium two fifths and large three fifths |
- | Corners | Rounded | How round the window's corners are at the start: square, 16px or 32px; they straighten as the window opens |
- | Shows the starting frame | on | A faint outline stays where the window began, so you can see how far it has opened; it fades out as the caption fades in |
-
-- **README See also:** the last link's text changes from "Parallax Depth of Field" to the page's real title.
- - [Sticky Section](../sticky-section/) — the pinning this effect is built on
- - [Scrub Animation](../scrub-animation/) — scroll position drives the movement, both ways
- - [Cover Card to Fixed Header](../cover-card-to-fixed-header/) — a big cover changes shape as you scroll
- - [Parallax Depth-of-Field](../parallax-depth-of-field/) — layers move and blur for depth as you scroll
-- **README How it works:** in the snippet, the three lines from `zoomImg.style.clipPath = portalTog.checked` to its `: ` alternative become one line: ``zoomImg.style.clipPath = `inset(${inset.toFixed(2)}% round ${radius.toFixed(1)}px)`;``. Fix round 1: the caption line becomes three lines that also fade the outline, `const cap = p > 0.88 ? ((p - 0.88) / 0.12).toFixed(3) : '0';`, `caption.style.opacity = cap;` and `frameBorder.style.opacity = (1 - cap).toFixed(3);` (with a short comment), and the sentence after the snippet adds ", and the faint starting-frame outline fades out over the same stretch, so it never crosses the caption". The rest is unchanged. No README line describes the drawing itself.
-- **README Production notes:** unchanged, except that the Reduced motion bullet now reads "shows the caption immediately and hides the starting-frame outline" (fix round 1).
-- **Category line:** `01.19 · Scroll-Based`
-- **Pager:** Previous: Section Wipe (`../section-wipe/`) · Next: Scroll Image Sequence (`../scroll-image-sequence/`)
-- **Final fix wave:** the Small window's range in the measured line under Stage is 67–100%, not 82–100% (Task 11 re-review). Like the other two ranges it comes from a coarse 12×12 hit-test of the starting window at the seven box sizes; a denser 48×48 grid reads 72–98%, 32–82% and 20–56%, so the three ranges are good to a few points.
-
----
-
-## scroll-image-sequence — Scroll Image Sequence
-
-- **Kind:** scroll. Rebuilt, as the rollout spec asks, to scroll inside its stage: today the whole window scrolls through a 340vh track.
-- **Description:** Scrolling plays a series of pictures like a flip-book. Best for products.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** a wireframe cube with a smaller shape inside it, drawn on a canvas that holds still while the box scrolls. Each scroll position shows one frame of a sequence: scrolling down turns the cube one and a half times while it opens out and closes again, and scrolling up plays it backwards. With few frames the steps between pictures are easy to see.
-- **Scroll distance and Play:** the track is 340cqh with its sticky frame 100cqh tall: 2.4 box heights of scrolling, the same proportion as today's 340vh track in a 100vh window. Play plays the whole sequence (120 frames at the default) in six seconds. Back to top, and Play restarting from the top, are instant jumps (rule B8), and the picture jumps with them, with or without Glides between frames (a click on either button sets the shown frame at once).
-- **Reduced motion:** nothing scrolls by itself. As today, the picture jumps straight to the frame for each position, with no easing (`smoothing` is false under reduced motion).
-- **Stage font:** no text stays on the stage.
-- **Stage (rebuilt):**
- - Markup: `<div class="stage" id="stage" tabindex="0" role="region" aria-label="A picture sequence that plays as you scroll"><div class="track" id="track"><div class="pin"><canvas id="c" role="img" aria-label="A wireframe cube with a smaller shape inside, turning and opening out as you scroll"></canvas></div></div></div>`.
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#04060c`, with the `::-webkit-scrollbar{display:none}` rule.
- - `.track{height:340cqh}`; `.pin{position:sticky;top:0;height:100cqh}`; `canvas{display:block;width:100%;height:100%}`.
- - The frame counter and its "PROCEDURAL FRAME" label (`.hud`), the progress bar along the bottom (`.bar`) and the "Scroll to scrub ⇅" hint go, as readouts and a caption. The `.pin` padding and the settings panel inside it go.
- - `:root` becomes `--ui-accent:#6ea8ff` (the old `--accent`, `--stage`, `--text`, `--muted` and `--mono` go with the parts that used them).
- - Script:
- - `updateTarget()` measures the track in the stage: `const span=track.offsetHeight-stage.clientHeight; const p=span>0?Math.min(Math.max((stage.scrollTop-track.offsetTop)/span,0),1):0;` then `targetFrame=p*(TOTAL-1)` as today.
- - It listens to the stage's `scroll` event (`stage.addEventListener('scroll',updateTarget,{passive:true})`) instead of the window's. The window's `resize` listener stays (`resize(); updateTarget();`).
- - `resize()`, `drawFrame()` and the `loop()` are unchanged, except that `loop()` no longer writes the frame counter and, since the frame-rate fix (below), takes the time `now` and eases by it.
- - Phone rules: none. Today's mobile block held only the settings panel.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Number of frames | Choice buttons | Few · Normal · Many | Normal | Fewer frames step visibly; more frames look smooth. | `TOTAL`: 24 / 120 / 240, then `updateTarget()` |
-| Glides between frames | Switch | on / off | on | Off, the picture jumps straight to each frame. | `smoothEl.checked`: each frame, `shownFrame` moves `1 - (1 - EASE) ** (dt / FRAME)` of the way to `targetFrame` (`EASE = 0.18`, so 0.18 at 60 Hz) / equals it |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The frame counter, the progress bar and the hint on the stage.
- - The note.
- - The Total frames slider. It becomes Number of frames.
- - "Smoothing (lerp between frames)" becomes Glides between frames.
- - The whole-window scrolling: the tall track now scrolls inside the stage.
-- **Good for:** Product reveals · 3D objects · Launch pages · **Avoid on:** Slow connections · Text content
-- **Prompt:**
-
- > Add a scroll-driven image sequence to [your product or object animation]. Export the animation as a numbered series of pictures and load them all before the section comes into view. Pin a canvas in place while the visitor scrolls through a section a few screens tall, turn their scroll position into a frame number, and draw that frame whenever it changes, so scrolling plays the sequence like a flip-book and scrolling back plays it in reverse. When the settings include it, let the picture ease toward the frame the scroll points at instead of jumping. Give the canvas a text description for screen readers. If the visitor has reduced motion turned on, jump straight to each frame. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A scroll image sequence plays a series of still pictures as you scroll, like flipping through a flip-book: each scroll position shows one picture, so scrolling down plays the animation and scrolling up plays it backwards. Product pages use it to turn a pre-rendered animation, such as a phone turning around, into something the reader controls. The demo draws its pictures as it goes, a turning wireframe cube, so it needs no image files.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Number of frames | Normal | How many pictures the sequence has: few is 24, normal 120 and many 240; more frames scrub more smoothly but are more images to load in production |
- | Glides between frames | on | The picture eases toward the frame the scroll points at instead of jumping to it |
-
-- **README See also:**
- - [Scrub Animation](../scrub-animation/) — scroll position moves a plane along its path
- - [Pin Animation](../pin-animation/) — the pinning this effect relies on
- - [Sticky Section](../sticky-section/) — a whole section holds still while its content changes
- - [Zoom Into Image](../zoom-into-image/) — a picture opens up as you scroll
-- **README How it works:**
- - The first snippet becomes:
-
- ```js
- function updateTarget(){
- const span = track.offsetHeight - stage.clientHeight; // the stage is the scroll box
- const p = span > 0 ? Math.min(Math.max((stage.scrollTop - track.offsetTop) / span, 0), 1) : 0;
- targetFrame = p * (TOTAL - 1);
- }
- stage.addEventListener('scroll', updateTarget, {passive:true}); // fires for wheel AND touch
- ```
-
- - "(the smoothing toggle)" becomes "(the Glides between frames setting)".
- - The frame-rate fix (below) changes the easing line of the second snippet to the time-based form (`dt`, `last`, and `(1 - Math.pow(1 - EASE, dt / FRAME))` in place of `* 0.18`) and adds a paragraph after it on `EASE`, `dt` and `last`.
- - The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `01.20 · Scroll-Based`
-- **Pager:** Previous: Zoom Into Image (`../zoom-into-image/`) · Next: Smooth (Inertia) Scroll (`../smooth-scroll/`)
-- **Final fix wave (Scroll-Based final review, 2026-09-30).** A `click` listener on the document, for `#btn-top` and `#btn-scroll` (by id, as Velocity Skew and SVG Line Draw do), runs `updateTarget(); shownFrame=targetFrame`, so the picture stands at the frame for the box's new position in the same click instead of playing backwards through the exploded frames. The shared script has already moved the box when the click reaches the document. README How it works: "…multiply by the frame count, and draw that frame" becomes "…and multiply it by the frame count; a frame loop draws that frame" (the scroll handler only sets the target frame; the loop draws), and a sentence says a click on either button sets the shown frame to the target at once.
-- **Frame-rate fix (wrap-up):** `loop(now = 0)` eases `shownFrame` by `1 - Math.pow(1 - EASE, dt / FRAME)` of the distance left, with `EASE = 0.18` (now a named constant: the share covered in 1/60 s), `FRAME = 1000/60` and `dt = last ? Math.min(now - last, 50) : FRAME`. The loop never stops, so `last` is kept from frame to frame; the first direct call at load passes no time, which leaves `last` at 0, so the first real frame counts as 1/60 s. The picture catches up with the scroll in the same time on a 30, 60 or 120 Hz screen (95% of the way in about a quarter of a second), where a fixed 18% a frame took half as long at 120 Hz and twice as long at 30 Hz. At 60 Hz nothing changes. The prompt and Key parameters say nothing per frame and are unchanged.
-
----
-
-## smooth-scroll — Smooth (Inertia) Scroll
-
-- **Kind:** do (owner decision 8). The effect is in how the visitor's own wheel, swipe, drag or keys move the content. In the glide mode the page moves the content with a transform and the box itself never scrolls, so Play would have nothing to drive, and a steady automatic scroll would not show the glide anyway. Show me plays one flick instead. Body: `<body class="hb" data-hb-kind="do" data-hb-autoplay>`.
-- **Description:** Scrolling glides to a stop instead of jumping. Best for portfolio sites.
-- **Step 1:** Scroll it · help line: "Scroll or drag inside the box, or press Show me."
-- **Player bar:** Show me · Reset, exactly as in the do-it/scroll plan.
-- **Try it help line:** "Change a setting, then try it again or press Show me.", the fixed line for do-it pages.
-- **Show me** (`id="btn-demo"`): one flick and back, about three seconds at the default glide.
- - `showMe()` clears `showTimer`, calls `measure()`, and remembers where the content is: `from` is `target` in the glide mode, or `viewport.scrollTop` with Normal scrolling on.
- - It sends the content one and a half box heights down, or up when `from` is past the middle of `maxScroll`, clamped to 0 and `maxScroll`. In the glide mode it sets `target`, so the cards speed off and slow to a stop; with Normal scrolling on it sets `viewport.scrollTop`, so they jump.
- - `showTimer=setTimeout(…,1600)` then sends the content back to `from` the same way, and sets `showTimer=0`. At Medium the whole run takes about 3 s (the cards settle about 1.5 s after the return starts); at Long about 4.3 s, the last part a settle too small to see.
-- **Reset** (`id="btn-reset"`): clears `showTimer`, sets `target` and `current` to 0, puts the content at the top at once (`translate3d(0,0,0)` in the glide mode, `viewport.scrollTop=0` with Normal scrolling on) and moves the rail fill to the top (`paint(0)`).
-- **Visitor input:** a listener on `document` for `hb:input`, at the top level of the script, clears `showTimer` (and sets it to 0), so the flick's return never runs; the visitor's wheel, drag, touch or key then moves the content from wherever it is. It only clears that timer, so it is safe to receive again and again (owner decision 8). Changing Normal scrolling clears `showTimer` too.
-- **Keys in the glide mode** (owner decision 9): `enableSmooth()` adds a `keydown` listener on the viewport, and `disableSmooth()` removes it, like the other listeners. For the keys it handles, it moves `target` (clamped to 0 and `maxScroll`) and calls `preventDefault()`, so the page itself does not scroll. It leaves the key alone while Ctrl, Alt or Cmd is held.
- - ArrowDown and ArrowUp: 40px down or up.
- - PageDown and PageUp: 90% of `viewport.clientHeight` down or up.
- - Space: the same as PageDown, and Shift+Space as PageUp.
- - Home and End: to 0 and to `maxScroll`.
-
- The viewport takes focus from Tab (`tabindex="0"`) and from a click in it. With Normal scrolling on, the browser scrolls the focused viewport with the same keys by itself.
-- **On arrival:** the shared script presses Show me once, 400ms after load (not under reduced motion).
-- **Reduced motion:** nothing runs by itself. As today, the page starts with Normal scrolling on and the switch cannot be turned off (it is `checked` and `disabled`, and its row gets the page's own rule `label.hb-switch-row:has(input:disabled){opacity:.45;cursor:not-allowed}`). Show me and Reset still work; Show me then jumps, as normal scrolling does.
-- **Stage font:** site font. `.card-title` drops `var(--disp)` and keeps 700; `.card-num` uses `font-weight:700` (was `bold`).
-- **Stage:** restructured so the rail and the hint stay in place with Normal scrolling on as well (today they scroll away with the content in that mode):
- - `.stage`: `position:relative;overflow:hidden;background:#111114`. It holds `<div class="viewport" id="viewport" tabindex="0" role="region" aria-label="Cards that glide as you scroll">` with `.content` inside, and, beside the viewport, `.rail` and `.hint`. The `.stage-wrap` goes.
- - `.viewport{height:100%;overflow:hidden;touch-action:none;cursor:grab;container-type:size}`; `.viewport.native{overflow-y:auto;touch-action:auto;cursor:auto;scrollbar-width:none}` with its `::-webkit-scrollbar{display:none}` rule; `.viewport.dragging{cursor:grabbing}`. The viewport has no padding (the cards carry their own), as `container-type:size` requires (rule B5).
- - The page adds no focus rule: the shared stylesheet draws the viewport's focus ring inset, inside the stage (rule B2).
- - The script uses `viewport` wherever it used `stage`: the wheel, pointer and scroll listeners, `setPointerCapture`, the `native` and `dragging` classes, `scrollTop` and `clientHeight`.
- - `.card{min-height:72cqh}` (was `calc(var(--stage-h) * 0.72)`).
- - `.card-num` gets `aria-hidden="true"`; `.card-body{font-size:14px;color:#adadb2}` (was `clamp(12px,1.4vw,14px)` at opacity .6; rule B9); `.hint{font-size:12px;color:#8a8a92}` (was 10px at opacity .35), reading "Drag or scroll ↑↓" in the glide mode and "Normal scrolling" with Normal scrolling on.
- - `measure()` also runs after `document.fonts.ready`, because the cards' height depends on the font.
- - The card copy is rewritten in plain words (today's copy names translate3d, lerp and scrollTop):
-
- | Card | Title | Text |
- |---|---|---|
- | 1 | It catches your scroll | Instead of letting the browser jump, the box catches each turn of the wheel or swipe and turns it into a place to go. |
- | 2 | Where to go, where it is | It keeps two positions: where you asked to go, and where the content is now. The gap between them is the glide. |
- | 3 | A little closer each frame | Many times a second, the content moves part of the way toward where you asked to go, so it speeds off and then eases in. |
- | 4 | It slides the content | The content moves as one piece instead of being scrolled, which keeps the movement smooth. |
- | 5 | Momentum comes free | Flick and let go: the content keeps gliding after your hand stops, then settles. |
- | 6 | Mind the trade-offs | Taking over scrolling can break keyboard scrolling, links to headings and find-in-page. Use it with care, and turn it off for visitors who ask for less motion. |
-
- - Phone rules: none. Today's mobile block held only the stage height and the aside.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Glide | Choice buttons | Long · Medium · Short | Medium | How long the content keeps moving after you stop. | `ease`: 0.05 / 0.09 / 0.16 (the share of the remaining distance covered in a sixtieth of a second) |
-| Normal scrolling | Switch; its `div.hb-setting` has `data-hb-skip` (owner decision 10), so it stays out of "Your settings" and the copied prompt | on / off | off | Turn it on to compare with the browser's own scroll. | `nativeChk.checked`: `enableNative()` / `enableSmooth()`; either way `showTimer` is cleared |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note (it showed code).
- - The Target, Current, Progress and Mode readouts.
- - The Ease / lerp factor slider and its "lower = heavier glide" line. It becomes Glide.
- - "Compare: native scroll" becomes Normal scrolling.
-- **Good for:** Portfolio sites · Brand pages · Scroll stories · **Avoid on:** Documentation · Forms · Dashboards
-- **Prompt:**
-
- > Add smooth scrolling to [the scrolling area or page you want to glide]. Catch the visitor's wheel, swipe and drag and turn each one into a target position, then on every frame move the content part of the remaining distance toward that target, so it glides and slows to a stop instead of jumping. Make that part exponential in the time since the last frame (one minus a fixed fraction to the power of that time), so the pace is the same on every screen. Move the content with a transform and keep a custom scrollbar in step with it. Keep keyboard scrolling, links to headings and find-in-page working. If the visitor has reduced motion turned on, use the browser's normal scrolling with no glide. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Smooth scroll makes scrolling glide. Instead of moving the content exactly as far as each turn of the wheel or swipe, it treats each one as a place to go and moves the content a little closer on every frame, so it speeds off, then slows to a stop. The result feels weighted, with momentum, rather than like the browser's instant scroll.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Glide | Medium | How much of the remaining distance the content covers in a sixtieth of a second: long is 5%, medium 9% and short 16%; a longer frame covers more, so the glide takes as long on every screen; long feels heavy and floaty, short is closer to normal scrolling |
- | Normal scrolling | off | Turns the glide off so the box scrolls the browser's own way, to compare the two |
-
-- **README See also:**
- - [Parallax Scrolling](../parallax-scrolling/) — layers move at different speeds; pairs well with a glide
- - [Scrub Animation](../scrub-animation/) — scroll-driven movement, which a glide makes smoother
- - [Horizontal Scroll](../horizontal-scroll/) — scrolling down moves a row of panels sideways
-- **README How it works:**
- - In the first snippet, `stage.addEventListener('wheel'` becomes `viewport.addEventListener('wheel'`.
- - The loop at the end of that snippet is the time-based one (frame-rate fix, below): `const FRAME = 1000 / 60;`, then `loop(now)` with `raf = 0;`, `const dt = last ? Math.min(now - last, 50) : FRAME;`, `last = now;`, `current += (target - current) * (1 - Math.pow(1 - ease, dt / FRAME));` and `raf = requestAnimationFrame(loop)`, followed by `function kick() { if (!raf) { last = 0; raf = requestAnimationFrame(loop); } }`.
- - "The demo keeps all of this inside a scoped stage element with `overflow: hidden`" becomes "The demo keeps all of this inside a scoped box with `overflow: hidden`".
- - After the paragraph on touch drag, add: "The keyboard moves the same target: in the glide mode a `keydown` handler on the box moves it 40px for an arrow key, 90% of the box for Page Up, Page Down and Space, and to the top or the bottom for Home and End."
- - The paragraph "A fixed lerp factor is frame-rate dependent … `1 - Math.pow(1 - ease, dt * 60)`." moves from Key parameters to the end of How it works, because the Key parameters section may hold no code. The frame-rate fix (below) rewrites it, since the demo now does what it advised: "The share moved each frame depends on how long the frame took. A fixed lerp factor per frame is frame-rate dependent: the same value settles twice as fast on a 120Hz display as on 60Hz, and half as fast on a 30Hz phone. Here `ease` is the share covered in 1/60 s, and a frame that lasted `dt` covers `1 - Math.pow(1 - ease, dt / FRAME)` of the distance left, so the distance left shrinks exponentially with time and the glide takes the same time on every screen. `kick()` clears `last`, so the first frame after a start counts as 1/60 s rather than the time since some old frame, and `dt` is capped at 50ms, so a hidden tab does not make the content jump."
-- **README Production notes:** unchanged
-- **Category line:** `01.21 · Scroll-Based`
-- **Pager:** Previous: Scroll Image Sequence (`../scroll-image-sequence/`) · Next: Text Fill on Scroll (`../text-fill-on-scroll/`)
-- **Frame-rate fix (wrap-up):** `loop(now)` moves `current` by `1 - Math.pow(1 - ease, dt / FRAME)` of the distance left, with `ease` the share covered in 1/60 s (the Glide values 0.05 / 0.09 / 0.16 are unchanged), `FRAME = 1000/60` and `dt = last ? Math.min(now - last, 50) : FRAME`. `kick()` sets `last = 0` when it starts the loop, so the first frame after a start counts as 1/60 s; a `kick()` while the loop runs leaves it alone. The glide takes as long on a 30, 60 or 120 Hz screen (Medium stops after about 1.4 s), and so do Show me's flick and its glide back, and a touch drag. At 60 Hz nothing changes. The prompt gained a sentence (130 words, the test's cap), and the Glide row of Key parameters and the closing paragraph of How it works changed (above). The stage's card "A little closer each frame" stays, because it is still true.
-
----
-
-## text-fill-on-scroll — Text Fill on Scroll
-
-- **Kind:** scroll. A pinned paragraph lights up word by word as the box scrolls.
-- **Description:** Words light up one by one as you scroll. Best for key statements.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** a paragraph that holds still in the middle of the box; its words turn from grey to white one by one in step with the scroll, with the next word to fill in the highlight color, and scrolling back up un-lights them.
-- **Scroll distance and Play:** the 350cqh track with its sticky frame 100cqh tall: 2.5 box heights of scrolling. At the default the last word lights at 90% of the scroll, so Play fills the paragraph in about 5.4 s and holds it lit for the rest.
-- **Reduced motion:** nothing scrolls by itself. The demo's rule stays: each word changes color at once, without its 180ms fade (`.fill-text .w{transition:none}`).
-- **Stage font:** site font. `.fill-text` drops `var(--disp)` and keeps weight 700.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d`, with `aria-label="A paragraph that fills word by word as you scroll"`.
- - `.track{height:350cqh}`; `.pinned{height:100cqh}`.
- - The paragraph is shortened from 80 words to 48, and its size becomes `font-size:clamp(17px,2.4vw,24px)`: today's paragraph needs 393px on phones and 538px on laptops, more than the stage. `.pinned` centres the paragraph, so a short stage only eats into the padding. Measured with the new text, the paragraph is 216px high at 1366 and 1280 wide (304px with its padding), which fits the 258px smallest stage. It is 179px on a 375px phone and 230px on a 320px phone, both inside the 298px phone stage. The new text:
-
- > Scroll is not a play button. It is a position. Every word here watches how far you have read. Words behind that point light up; words ahead wait in the dark. Stop anywhere and the sentence holds still. Scroll back up and it un-reads itself, word by word.
-
- - The unread color `--dim` becomes `#7c7c84` (was `rgba(244,244,242,.16)`, 1.5:1, so the unread words could hardly be seen): 4.8:1 on the stage, and lit words stay 3.8 times brighter. `.w.on{color:#f4f4f2}`.
- - The words stay real text in their spans (one span per word, so screen readers read them normally; the letters rule does not apply).
- - The "scroll to read" hint goes; the help line says it.
- - Script: `render()` keeps its guarded writes; its two readout lines go.
- - Phone rules: none. Today's mobile block held only the stage height and the aside.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Highlights the current word | Switch | on / off | on | The next word to fill shows in color, like a cursor. | `cursorTog.checked`, then `render()` |
-| Fill finishes | Choice buttons | Early · Normal · At the end | Normal | Early leaves the whole text lit for a while. | `completeAt`: 0.7 / 0.9 / 1, then `render()` |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Highlight color | Swatches; shown only when Highlights the current word is on (More options, which holds only it, is hidden with it) | Blue · Green · Orange | Blue | The color of the word being filled. | `--fill-accent` on the text: `#6ea8ff` / `#5fd88a` / `#ff9d5c` |
-
-- **Removed:**
- - The note, and the Scroll and Words filled readouts.
- - The "scroll to read" hint on the stage.
- - The Fill completes at slider. It becomes Fill finishes.
- - "Highlight active word" becomes Highlights the current word, and the Highlight swatches become Highlight color.
-- **Good for:** Key statements · Manifestos · Landing page intros · **Avoid on:** Body text · Long articles
-- **Prompt:**
-
- > Add a scroll-driven text fill to [the statement or paragraph you want read]. Pin the paragraph in place while the visitor scrolls through a section a few screens tall. Split it into words, show every word in a dim but readable gray, and light the words up one by one in step with the scroll, so how far the reader has scrolled decides how much is lit and scrolling back up un-lights them. When the settings include it, show the next word to fill in a highlight color, like a reading cursor. Keep it real text for screen readers. If the visitor has reduced motion turned on, change each word's color without fading. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Text fill on scroll lights a paragraph up word by word as you scroll, as if it were being read at your pace. The paragraph holds still while you scroll through its section, and how far you have scrolled decides how many words are lit, so stopping holds the sentence mid-read and scrolling back un-reads it.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Highlights the current word | on | The next word to fill shows in the highlight color, like a reading cursor |
- | Fill finishes | Normal | How far through the scrolling the last word lights: early at 70%, normal at 90% and at the end at 100%; finishing early leaves a moment to read the whole text |
- | Highlight color | Blue | The color of the word being filled |
-
-- **README See also:**
- - [Reveal on Scroll](../reveal-on-scroll/) — whole cards appear as they scroll into view; this is the continuous version for one paragraph
- - [Scrub Animation](../scrub-animation/) — scroll position drives a drawing, both ways
- - [Kinetic Typography](../../05-text-typography/kinetic-typography/) — words that each move in their own way, on a timer instead of the scroll
-- **README How it works:** "one or two class toggles instead of eighty" becomes "one or two class toggles instead of fifty". The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `01.22 · Scroll-Based`
-- **Pager:** Previous: Smooth (Inertia) Scroll (`../smooth-scroll/`) · Next: Scroll Velocity Skew (`../scroll-velocity-skew/`)
-- **Final fix wave (2026-09-30):** the final category review found More options opening onto nothing when Highlights the current word is off, because Highlight color is the only setting in it. `details.hb-options` is now hidden together with the color setting (`colorSetting.hidden = moreOptions.hidden`), as Section Wipe does, and shows again with the switch.
-
----
-
-## scroll-velocity-skew — Scroll Velocity Skew
-
-- **Kind:** scroll. Rows lean by how fast the box scrolls and straighten when it stops.
-- **Description:** Rows lean when you scroll fast and straighten when you stop. Best for galleries.
-- **Step 1:** Scroll it · help line: "Scroll fast inside the box and stop, or press Play and it scrolls for you."
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** a list of media rows (a coloured thumbnail, a title and two grey text lines). While the box scrolls, every row leans in proportion to the scroll speed; when it stops, the lean springs back to straight.
-- **Scroll distance and Play:** the list grows from 14 rows to 28 (the fourteen names twice, numbered 01 to 28, colours continuing as today): about 2,550px on phones and 4,170px on laptops. Play moves at one steady speed, which for 28 rows is about 375px a second on a phone and 630px a second on a laptop, so at the defaults the rows hold a steady lean of about 2° and 3.7° while it runs, then straighten when it stops. Speed is measured per 1/60 s, so a 120Hz screen leans the same (rule B8). With today's 14 rows the lean during Play would be under 1° on phones, too little to see. A quick flick of the wheel or a swipe leans them further.
-- **Reduced motion:** nothing scrolls by itself. As today, the rows stay straight however fast the box scrolls (`reduce` holds the skew at 0); the demo's `rmq` change listener stays, without the note text it used to write.
-- **Stage font:** site font. `.m-title` drops `var(--disp)` and keeps 700.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;background:#111114`, with `aria-label="Rows that lean as you scroll"`.
- - The rows are built by the script as today, with `for(let i=0;i<28;i++)`, the title `String(i+1).padStart(2,'0')+' — '+NAMES[i%14]`, and the hue `(210+i*22)%360`.
- - The "scroll to shear" line on every row (`.m-tag`) goes.
- - Script: `tick()` and `applySkew()` stay; the readout lines, `measure()` and `maxScroll` go (they only fed the Position readout). Two changes follow rule B8:
- - **Speed per 1/60 s.** `tick(now)` works out `dt`, the time since the previous frame, at least 1ms and with no upper limit: `dt=lastTime?Math.max(now-lastTime,1):FRAME`, with `FRAME=1000/60`. It uses `raw=(top-lastTop)*FRAME/dt`, and the smoothing step uses the same time: `vel+=(raw-vel)*(1-Math.pow(1-SMOOTH,dt/FRAME))`. So a 120Hz screen leans and springs back as a 60Hz one does. Where the `scroll` listener starts the loop, it also sets `lastTime=0`, so the first frame of a run counts as 1/60 s. A frame's timestamp can be earlier than the moment the loop started, so a measured first `dt` would inflate the speed. A stalled frame counts for its real length, so the step it saw is divided by the time it took and the speed stays the speed the box was moving at (a cap at 50ms, the first version, read a 200ms stall as four times the speed).
- - **Instant jumps are ignored.** Back to top, and Play restarting from the top, move the box in one frame, which today leans the rows to the full limit for a moment. The shared script moves the box while it handles the click, before the click reaches the document, so a `click` listener on the document (for `#btn-top` and `#btn-scroll`, matched by id) sets `lastTop=seenTop=stage.scrollTop`: the jump adds no speed, and no flag is left behind that could swallow a later move. Built as the review of Task 13 accepted it, replacing the `jumped` flag that `tick()` would read. A `resize` listener does the same, because a resize can move the box too (1280×800 to 768×1024 while resting at the end leaned the rows to -12° for a second).
- - **A run starts from where the box was before its first move.** `seenTop` is where the last `scroll` event left the box. When the listener starts a run it sets `lastTop=seenTop` (the original set it to the position after the move), so a single instant notch of the wheel counts as speed (5.04° at Normal; 0° with the original start, in a browser with smooth scrolling off).
- - `.content` gets `overflow:clip`: a leaning row draws outside its box, which made the scrollable area up to 131px taller while the rows leaned and shorter again afterwards. Clipping at the padding box changes no picture (the clip edges are the edges of the scrolling content) and keeps the range constant.
- - Phone rules: none. Today's mobile block held only the stage size and the aside.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Strength | Choice buttons | Subtle · Normal · Strong | Normal | How far the rows lean for the same scroll speed. | `INTENSITY`: 0.2 / 0.35 / 0.6 (degrees for each pixel scrolled per 1/60 s) |
-| Lean | Choice buttons | Tilt · Slant | Tilt | Tilt tips each row; Slant leans it like italics. | `setAxis()`: `'skewY'` / `'skewX'` |
-| Spring back | Choice buttons | Slow · Normal · Quick | Normal | How quickly the rows react and straighten again. | `SMOOTH`: 0.07 / 0.12 / 0.2 |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Most it leans | Choice buttons | Small · Medium · Large | Medium | A limit, so a hard flick cannot fold the rows over. | `MAX`: 6 / 12 / 20 (degrees) |
-
-- **Removed:**
- - The note, with the reduced-motion text it showed.
- - The Velocity, Skew, Direction and Position readouts.
- - The Intensity, Max skew and Smoothing sliders. They become Strength, Most it leans and Spring back.
- - The skewY and skewX buttons. They become Lean.
- - The "scroll to shear" line on the rows.
-- **Good for:** Galleries · Portfolios · Project lists · **Avoid on:** Reading content · Forms
-- **Prompt:**
-
- > Add a velocity skew to [the rows or cards in your list or gallery]. Measure how far the list scrolls on each frame, smooth that speed so it rises and falls gradually, and lean every row by an angle in proportion to it, up to a limit. Fast scrolling leans the rows; when the scrolling stops, the speed falls to zero and they spring back straight. Lean each row on its own rather than the whole list, and stop the frame loop once everything is still. This effect can make some people feel unwell, so if the visitor has reduced motion turned on, keep the rows straight and scroll normally. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Scroll velocity skew leans content by how fast you scroll, not by where you are. Scroll quickly and the rows tilt in the direction of travel; stop and they spring back straight. It makes scrolling feel physical, as if the content bends under its own momentum.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Strength | Normal | How far the rows lean for a given scroll speed: subtle is 0.2°, normal 0.35° and strong 0.6° for each pixel scrolled in a sixtieth of a second |
- | Lean | Tilt | Tilt tips each row like a slope, the classic look; Slant leans it sideways like italic text |
- | Spring back | Normal | How quickly the lean follows the scroll speed and fades after you stop; slow feels heavy, quick feels twitchy |
- | Most it leans | Medium | The largest angle allowed: 6°, 12° or 20°, so a fast flick cannot fold the rows over |
-
-- **README See also:** the last link's text changes from "Marquee Ticker" to the page's real title.
- - [Smooth (Inertia) Scroll](../smooth-scroll/) — scrolling that glides to a stop, often paired with this effect
- - [Scrub Animation](../scrub-animation/) — movement tied to where you are, not how fast you go
- - [Marquee / Ticker](../../05-text-typography/marquee-ticker/) — text that scrolls sideways forever, often sped up by scrolling
-- **README How it works:**
- - In the paragraph before the snippet, "the per-frame difference in `scrollTop`" becomes "the change in `scrollTop` from one frame to the next, counted per sixtieth of a second".
- - The snippet becomes:
-
- ```js
- function tick(now) {
- const dt = lastTime ? Math.max(now - lastTime, 1) : FRAME; // ms since the last frame
- lastTime = now;
- const raw = (el.scrollTop - lastTop) * FRAME / dt; // px moved per 1/60 s
- lastTop = el.scrollTop;
- vel += (raw - vel) * (1 - Math.pow(1 - SMOOTH, dt / FRAME)); // low-pass filter the spikes
- const skew = clamp(vel * INTENSITY, -MAX, MAX);
- rows.forEach(r => r.style.transform = `skewY(${skew}deg)`);
- requestAnimationFrame(tick);
- }
- ```
-
- - At the end of the paragraph after it, add: "Speed is measured per sixtieth of a second (`FRAME` is 1000/60 ms), so a 120Hz screen leans as much as a 60Hz one. Back to top, and Play starting again from the top, move the box in a single frame, and so can a window resize (the browser keeps the list inside its new range); when either button is clicked or the window is resized, the demo takes the box's new position as its starting point, so that jump does not count as speed. A run of scrolling starts the same way, from where the box was before its first move, so even a single notch of the wheel leans the rows."
- - The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `01.23 · Scroll-Based`
-- **Pager:** Previous: Text Fill on Scroll (`../text-fill-on-scroll/`) · Next: SVG Line Draw on Scroll (`../svg-line-draw/`)
-- **Final fix wave:** `dt` has no upper limit any more: the page, the README snippet and the two places above that quote the formula (Speed per 1/60 s, and README How it works) lost the 50ms cap. With the cap a stalled frame's step was divided by 50ms instead of the time it took, so at 630px/s (Normal, a laptop) a stall of 100, 200 or 400ms added 1.2°, 3.5° and 8.2° of lean; now it adds under 0.03° (and under 0.03° at 375px/s on a phone). Ordinary scrolling is unchanged: the steady lean at 630px/s is 3.67° before and after.
-
----
-
-## svg-line-draw — SVG Line Draw on Scroll
-
-- **Kind:** scroll. A long route draws itself down the box as it scrolls.
-- **Description:** A line draws itself along a route as you scroll. Best for timelines.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage.
-- **What scrolling shows:** a winding route with a faint dashed copy underneath; the solid line draws itself in step with the scroll, and five labelled stops (Depart, River crossing, Basecamp, Summit ridge, Arrive) pop in as the line reaches them. Scrolling back up erases the line and hides the stops again. The route ends at "— end of route —".
-- **Scroll distance and Play:** the drawing is 3.67 times as tall as it is wide, so the content does not depend on the stage height: about 1,240px on a 375px phone and 3,450px on a laptop (3.5 to 13.4 box heights). At the defaults the line is complete at the end of the scroll, as Play ends (6 s). Early and Near the end finish at 70% and 85% of it. Fix round 1 (2026-09-30): the default was 85% ("Normal"), and with the route 3.5 to 13.4 boxes tall in the shared box the tip then left the box after about 40% of a laptop scroll (in the box for 51% of the scroll at 1280×800, 43% at 1366×657, 41% at 1280×590, 44% for a phone held sideways, 69% at 768×1024, 86% at 375×812). With the line finishing at the end the tip is in the box for the whole scroll at every size with Even (with Smooth it draws ahead early in the scroll), and every stop pops in view.
-- **Reduced motion:** nothing scrolls by itself. The demo's rule stays: the stops appear without their pop (`.pop{transition:none}`); the line still draws with the scroll. With nothing drawn on arrival the first picture is the route's dashed guide, which is why the guide is drawn at .35 alpha (see Stage).
-- **Stage font:** site font. `.wp-label` and `.wp-sub` drop `var(--mono)`.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;background:#0b0b0d`, with `aria-label="A route that draws itself as you scroll"`. The `svg` keeps `aria-hidden="true"`.
- - **The stops keep one size on every screen.** Today their text is sized in the drawing's own units, so it shrinks with the drawing: about 7px on phones and 20px on laptops.
- - `measure()` works out `k = 600 / map.getBoundingClientRect().width`, and each stop's `transform` becomes `translate(x y) scale(k)`. The dot, the labels, their offsets and the 5px outline under the labels are then the same size on screen at every width, while the route itself scales.
- - `.wp-label{font-size:14px;font-weight:600}` and `.wp-sub{font-size:12px}` (its fill `var(--ui-muted)`, now `#8a8a92`).
- - So that the labels fit at narrow widths, Depart's two texts move to the left of their dot (`x="-20" text-anchor="end"`) and River crossing's to the right (`x="20"`, without `text-anchor`).
- - At 320px wide, Basecamp's small line still runs 5px past the drawing's right edge. So the drawing gets `overflow:visible` (`.scene svg{display:block;width:100%;height:auto;overflow:visible}`), and that line draws into the scene's 10px padding instead of being cut off. At 375px it has 20px to spare.
- - `.scene-cap` becomes 13px `#8a8a92` (was 10px `#77777e`).
- - `.guide` stroke becomes `rgba(255,255,255,.35)` (was `.13`, 1.4:1 on the stage): about 3:1, so the route reads on arrival, above all under reduced motion, where nothing is drawn until Play or a scroll.
- - Script: `update()` keeps the dash maths; its three readout lines go. The Easing menu's value becomes the `easeMode` variable that Feel sets, and the slider's `caSl.value/100` becomes `completeAt` (default 1). Beyond the original, accepted at the review of Task 13:
- - `measure()` also works out `MAXS = scrollHeight - clientHeight - 1` (one pixel less, so the line finishes at the true end at fractional box heights), the box height and each stop's place in the scrolling content (`y`, measured from the inside of the stage's border). It runs at load, after `document.fonts.ready` and on resize, and the resize handler measures and draws at once, without a debounce.
- - A stop is on when the line has reached it and it has come into view: `drawn >= w.len && w.y - 16 < scrollTop + boxHeight` (16px is how far its label reaches above its dot). The route is many boxes tall, so the line can be drawn well ahead of the box; a stop that popped below the box's bottom edge would pop unseen. No still picture changes, because a stop below the box cannot be seen.
- - After a jump the stops change at once (`.jump .pop{transition:none}` for that one update), so no stop fades out after the line that led to it has gone. A jump is a click on Back to top or Play (a click listener on the document redraws in the same task as the click) or a move of more than half a box in one frame.
- - Phone rules: none. Today's mobile block held only the stage size and the aside.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Even · Smooth | Even | Even keeps the tip with your scroll; Smooth runs ahead. | `easeMode`: `'linear'` / `'out'` (the `EASES` key), then `update()` |
-| Shows the stops | Switch | on / off | on | Labeled points pop in as the line reaches them. | the drawing's `no-wps` class off / on |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Line finishes | Choice buttons | Early · Near the end · At the end | At the end | Early leaves the whole route on show for a while. | `completeAt`: 0.7 / 0.85 / 1, then `update()` |
-
-- **Removed:**
- - The note (it showed code), and the Scroll, Path drawn and Waypoints passed readouts.
- - The Line completes at slider. It becomes Line finishes.
- - The Easing menu. It becomes Feel.
- - "Waypoints" becomes Shows the stops.
-- **Good for:** Timelines · Journey maps · Process steps · Delivery tracking · **Avoid on:** Short pages
-- **Prompt:**
-
- > Add a scroll-drawn route to [your timeline, journey or process steps]. Draw a long winding path down the page with a faint dashed copy underneath, and reveal the solid line in step with the scroll so its tip travels down with the visitor. Measure the path's length once and reveal it by sliding a single dash that is exactly as long as the path. When the settings include them, place labeled stops along the path and pop each one in as the line reaches it; scrolling back up erases the line and hides them again. If the visitor has reduced motion turned on, show each stop without the pop. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A scroll-drawn line is a long winding route that draws itself as you scroll down it, like a journey being traced on a map. Labeled stops along the way pop in as the line reaches them, and scrolling back up erases the line again. A faint dashed copy of the route shows where it is heading.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Feel | Even | Even keeps the tip of the line level with your scroll; Smooth draws quickly at first and slows toward the end |
- | Shows the stops | on | Five labeled stops pop in as the line reaches them and hide again when you scroll back |
- | Line finishes | At the end | How far through the scrolling the line is complete: early at 70%, near the end at 85% and at the end at 100%; finishing early shows the whole route before you reach the bottom |
-
-- **README See also:**
- - [Scrub Animation](../scrub-animation/) — a short pinned path moves as you scroll; here a long path lives in the content
- - [SVG Path Animation](../../06-3d-advanced/svg-path-animation/) — drawings trace themselves over time instead of with the scroll
- - [Scrollytelling](../scrollytelling/) — a picture beside the text changes as a story scrolls by
-- **README How it works:**
- - In the waypoint snippet, ``wp.group.setAttribute('transform', `translate(${pt.x} ${pt.y})`);`` becomes ``wp.group.setAttribute('transform', `translate(${pt.x} ${pt.y}) scale(${k})`);``.
- - After that snippet, add: "Each stop is also scaled by `k`, which is 600 divided by the drawing's width on screen, so its dot and labels keep the same size on every screen while the route itself scales." Then a paragraph on the stop rule: "A stop also waits until it has come into view, meaning its top edge is above the bottom edge of the box. The route is many boxes tall, so the line can be drawn well ahead of the box, and a stop that popped below the bottom edge would pop where nobody can see it; this way its pop plays as it scrolls in. A still picture is the same either way, because a stop that is below the box cannot be seen." The snippet gets `wp.y = svgTop + pt.y / k;` at init and `const on = drawn >= wp.len && wp.y - 16 < scrollTop + boxHeight;` per frame.
- - In the first snippet, `const p = clamp(stage.scrollTop / maxScroll, 0, 1);` becomes `const p = ease(clamp(stage.scrollTop / maxScroll, 0, 1));` (comment: Feel: p for Even, 1 - (1 - p)^3 for Smooth) and the comment on `drawn` says `COMPLETE_AT` below 1 finishes before the scroll does. After the snippet add: "`COMPLETE_AT` is 1 by default, so the line finishes as the scroll does and its tip stays inside the box while it is drawn. A smaller value finishes the line earlier: the rest of the scroll then shows the finished route, but the tip runs ahead of the box, because the route is many boxes tall."
- - In the paragraph on the pop, after "so it un-pops." add: "After a jump — Back to top, Play starting again from the top, or any move of more than half a box in one frame — the transition is switched off for that one update, so no stop fades out after the line that led to it has gone."
- - The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `01.24 · Scroll-Based`
-- **Pager:** Previous: Scroll Velocity Skew (`../scroll-velocity-skew/`) · Next: Scrollspy Navigation (`../scrollspy-nav/`)
-- **Final fix wave:** wording and figures only. The route's length is one range, 3.5 to 13.4 box heights (the scrolling content divided by the box: 3.47 on a 320px phone up to 13.36 in the 258px box of 1280×590), in place of the two ranges above (3 to 10 and 5 to 13). The README's "its tip stays inside the box" holds for Even only. Measured at ten screen sizes from 320×640 to 1280×590: with Even the tip is in the box for the whole scroll at every size; with Smooth only for 8% to 29% of it (the tip is out of the box from 3% to 17% of the scroll on).
-
----
-
-## scrollspy-nav — Scrollspy Navigation
-
-- **Kind:** scroll. The menu follows the section being read; pressing a link also scrolls the box, so the page mixes scrolling and clicking.
-- **Description:** A menu highlights the section you are reading. Best for long docs.
-- **Step 1:** Scroll it · help line: "Scroll inside the box or pick a section in the menu, or press Play and it scrolls for you."
-- **Player bar:** Play · Back to top
-- **Scroller:** `<div class="doc" id="doc" data-hb-scroller tabindex="0" role="region" aria-label="Documentation sections">` inside the `.stage`. The `.stage` does the job of today's `.stage-wrap`, the box around the scroller; the menu (`nav.spy-nav`) sits inside the scroller, in the sticky zero-height `.spy-rail` (`position:sticky;top:0;height:0;z-index:1`, the scroller's first child), so the menu stays in place while the sections move and a wheel turn or a swipe that starts on it still scrolls the box. The script calls the scroller `doc` wherever it said `stage`. The page adds no focus rule: the shared stylesheet draws the focus ring of the scroller and of the menu links inset, inside the stage (rule B2).
-- **Play and the menu:** the shared script stops Play on any trusted input anywhere inside the stage (rule B6), including a press on a menu link, so Play has stopped before the link scrolls the box. The link handler needs nothing more.
-- **What scrolling shows:** six documentation sections scroll by. As a section's heading passes the line that Link changes at sets, its link lights and the marker slides to it; at the very bottom the last link lights. Pressing a link glides (or jumps) to its section and lights that link at once, without flickering through the links in between. Under 600px wide the menu is a strip across the top, as today.
-- **Scroll distance and Play:** six sections of at least 500px and a 40cqh run-out. In the site font the sections are exactly 500px (3,000px in all) from 375px wide up. On a 320px phone the text wraps more, and each section is 564px (3,384px in all). Measured, that is about 6 box heights on a 440px tablet stage, 8.6 at 1366×657, 9.5 on a 375px phone, 10.8 on a 320px phone and 11 in the smallest stage (1280×590). Play passes about one section a second, so the marker steps down the menu about once a second.
-- **Every Link changes at choice reaches every section** (rule B4). At the end of the scroll even the highest line (20% down) sits 0.4 × the box height above the bottom of the last section. That section is at least 500px tall, so the line has passed its heading in any box up to 1,250px tall. The last link is also forced on at the very bottom, as today.
-- **Reduced motion:** nothing scrolls by itself. As today, a link jumps to its section instead of gliding (`reduced` in the click handler), and the marker and link colours change without their transitions (the demo's rule stays).
-- **Stage font:** site font. The section headings become `h3` (rule B13; the script builds them), and `.sec h3` takes today's `.sec h2` rule without `var(--disp)`, keeping weight 800. `.spy-link` gets `font:inherit;font-size:14px;font-weight:500` in place of `font-family:var(--mono)` and 11px.
-- **Stage:**
- - `.stage`: `position:relative;overflow:hidden;background:#0b0b0d`.
- - `.doc`: `height:100%;overflow-y:auto;scrollbar-width:none;position:relative;container-type:size`, with the `::-webkit-scrollbar{display:none}` rule. The old stage's border and height go.
- - `.runout{height:40cqh}`.
- - The menu keeps its place and look: top-left over the content, and a strip across the top under 600px. Measured in the site font, the rail is 145px wide and 286px tall with 44px links, so below its 16px top offset it needs a stage of 302px, which every stage at least 641px of screen tall gives. Shorter screens follow owner decision 15:
- - `@media (min-width:601px) and (max-height:640px) and (pointer:fine){.spy-link{min-height:36px}}`. The rail is then 6 × 36 + 22 = 238px, and 254px with its top offset, which fits the 258px smallest stage. The marker takes the link's height, as today (`moveInd()` reads `offsetHeight`).
- - `@media (min-width:601px) and (max-height:640px) and (pointer:coarse){.spy-nav{max-height:calc(100% - 32px);overflow-y:auto;scrollbar-width:none}}`. On a phone turned sideways the links stay 44px and the rail scrolls; `setActive(i)` keeps the active link in view (below).
- - Link and body colours: `.spy-link` stays `var(--ui-muted)` (now `#8a8a92`, 5.5:1 on the menu) and the active link `var(--ui-accent)`; `.sec p` becomes 14px `#8a8a92` (was 11px `#77777e`; 5.4:1 on the section tints).
- - `setActive(i)` also moves `aria-current="true"` to the active link, and when the menu itself scrolls it scrolls the menu, never the page, so the active link shows:
- - the phone strip: when `nav.scrollWidth > nav.clientWidth`, `nav.scrollLeft = l.offsetLeft - (nav.clientWidth - l.offsetWidth) / 2`. The six links need 629px and the strip is about 325px wide on a 375px phone, so today the active link is often out of sight;
- - the scrolling rail: when `nav.scrollHeight > nav.clientHeight`, `nav.scrollTop = l.offsetTop - (nav.clientHeight - l.offsetHeight) / 2`.
-
- Neither uses `scrollIntoView()`, which would also scroll the page.
- - `measure()` and `spy()` also run after `document.fonts.ready` (the section tops depend on the font); the `load` listener stays.
- - Script: the two readout lines go (`roActive`, `roPct`).
- - Phone rules, kept from today's mobile block (its layout, aside and stage-height lines go): `@media(max-width:600px){.spy-nav{flex-direction:row;top:8px;left:8px;right:8px;overflow-x:auto;padding:6px;scrollbar-width:none}.spy-ind{display:none}.spy-link{padding:0 12px;border-radius:6px}.spy-link.on{background:rgba(110,168,255,.14)}.sec{padding:80px 20px 36px}}`. Without them the 145px rail would sit over sections whose 200px left padding leaves about 58px for text.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Link changes at | Choice buttons | Near the top · A third down · Halfway | A third down | How far up a heading must scroll before its link lights. | `activation`: 0.2 / 0.35 / 0.5, then `spy()` |
-| Glides to the section | Switch | on / off | on | Off, a link jumps straight to its section. | `smoothTog.checked`, read at each click |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, and the Active section and Scroll readouts.
- - The Activation line slider. It becomes Link changes at.
- - "Smooth scroll on click" becomes Glides to the section.
-- **Good for:** Documentation · Long articles · Settings pages · **Avoid on:** Short pages
-- **Prompt:**
-
- > Add a scrollspy menu to [your documentation or long page and its section headings]. Keep a menu of section links in place beside the content and highlight the link for the section being read, with a marker that slides to it: a section becomes current once its heading scrolls up past a chosen line, and the last link lights up at the very bottom. Clicking or tapping a link scrolls to its section and lights that link at once, without flickering through the links in between. On phones, turn the menu into a strip across the top. If the visitor has reduced motion turned on, jump to sections instead of gliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > Scrollspy is the menu beside a long page that always highlights the section you are reading. As a section's heading scrolls up past a line near the top, its link lights up and a marker slides to it; clicking a link scrolls to that section. The menu and the page stay in step both ways.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Link changes at | A third down | Where a section's heading must reach before its link lights: near the top is 20% down the box, a third down 35% and halfway 50%; a higher line switches later |
- | Glides to the section | on | A link glides to its section; off, it jumps there at once, as it always does under reduced motion |
-
-- **README See also:** each link gets a plain phrase.
- - [ScrollTrigger Animation](../scroll-trigger/) — things start, scrub and pin as parts of the page scroll past
- - [Progress Bar](../progress-bar/) — a bar shows how far you have read
- - [Snap Scrolling](../snap-scrolling/) — scrolling stops on one whole section at a time
-- **README How it works:** in the snippet (the section's one code block), `stage` becomes `doc` wherever it appears. The rest is unchanged.
-- **README Production notes:** the "`offsetTop` is the recurring trap" bullet is wrong about this demo (its scroller is positioned, so `offsetTop` would be measured from it). The words "here it would be body-relative and every comparison would be wrong" become "and then every comparison is wrong (this demo positions its scroller, but still measures as below, which works whatever sits in between)". The rest is unchanged.
-- **Category line:** `01.25 · Scroll-Based`
-- **Pager:** Previous: SVG Line Draw on Scroll (`../svg-line-draw/`) · Next: Scroll-Driven Background Color (`../scroll-background-color/`)
-- **Final fix wave:** sheet only. The menu is not beside the scroller: it sits inside it, in the sticky zero-height `.spy-rail` (the Scroller line above and the category rule at the top of this half). Checked at 1280×800: the rail is the scroller's first child, and a 300px wheel turn over a menu link scrolls the box while the menu stays 16px below its top edge.
-
----
-
-## scroll-background-color — Scroll-Driven Background Color
-
-- **Kind:** scroll. The box's background blends from one section's color to the next as it scrolls.
-- **Description:** The background color changes as you scroll through sections. Best for stories.
-- **Step 1:** Scroll it · help line: default
-- **Player bar:** Play · Back to top
-- **Scroller:** the stage. It is also the element whose background the script rewrites, which the shared stage allows (the demo owns the stage's background).
-- **What scrolling shows:** five chapters scroll by while the box's background blends through the palette, one color per chapter, in step with the scroll both ways. When the background turns light, as it does on Daylight and on Forest, all of the text turns from white to black.
-- **Scroll distance and Play:** five chapters of 90cqh each: 3.5 box heights of scrolling. Play moves through one color change about every 1.5 s.
-- **Reduced motion:** nothing scrolls by itself. As today, the blend stays: a change of color is not movement (the README says so). The note text the script wrote under reduced motion goes with the note.
-- **Stage font:** site font. The chapter titles become `h3` (rule B13; the script builds them), and `.stage h3` takes today's `.stage h2` rule without `var(--disp)`, keeping weight 800.
-- **Stage:**
- - `.stage`: `position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0d1124`, with `aria-label="Sections whose background color blends as you scroll"`.
- - `section{min-height:90cqh}`.
- - **The text stays readable over every color.** Today `p` and `.num` are see-through, and with the flip at the demo's 0.55 luma they fall to about 2:1 on the Daylight and Forest palettes (`h2` to about 3:1).
- - All section text is full-strength `#fff` on dark backgrounds and `#000` on light ones: `.num`, `h3` and `p` become `#fff`, and in `.stage.light` `#000`, with no opacity (owner decision 14).
- - The flip uses relative luminance: `const lin=c=>(c/=255)<=0.03928?c/12.92:((c+0.055)/1.055)**2.4; const lum=0.2126*lin(r)+0.7152*lin(g)+0.0722*lin(bl);` and `light=lum>0.18`, the point where white and black text contrast equally.
- - Checked over every blended color of the three palettes (10,000 steps between each pair of colors): at least 4.57:1 everywhere, the lowest on Daylight. Dusk never flips; Daylight and Forest each flip to dark text and back.
- - `.num` becomes 13px, weight 600, keeping its letter spacing. `.stage p` becomes `font-size:14px` (was `clamp(11px,1.4vw,13px)`; rule B9).
- - The chapter lines are rewritten in plain words where they named code or settings (luminance, the blend window, snapping):
-
- | Chapter | Title | Text |
- |---|---|---|
- | 01 | Departure | The first section owns the darkest color. Scroll down and the ground shifts under the text. (unchanged) |
- | 02 | Ascent | Halfway between two sections, the background is an even mix of both colors. |
- | 03 | Meridian | When the background turns light, the text turns dark so it stays readable. |
- | 04 | Descent | Each section has a color of its own, and the change happens as you move between them. |
- | 05 | Arrival | The last color stays as you reach the end. |
-
- - Script: `update()` keeps the blend maths and the guarded write; the swatch, hex, percentage and segment readout lines go.
- - Phone rules: none. Today's mobile block held only the stage size and the aside.
- - `hb-dots`: no. Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Colors | Choice buttons | Dusk · Daylight · Forest | Dusk | On Daylight and Forest the text turns dark on light colors. | `PAL`: `THEMES.dusk` / `THEMES.daylight` / `THEMES.forest`, then `update()` |
-| Blend | Choice buttons | Gradual · Quick · Hard cut | Gradual | Hard cut shows the change with no blending at all. | Gradual: `WIN` 1 and `SNAP` false / Quick: `WIN` 0.3 and `SNAP` false / Hard cut: `SNAP` true; then `update()` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note, with the reduced-motion text it showed.
- - The Scroll, Segment and Background readouts.
- - The Theme menu. It becomes Colors.
- - The Blend window slider and the Snap at boundaries checkbox. Together they become Blend: Gradual is today's default, Quick is the narrowest window, and Hard cut is Snap.
-- **Good for:** Stories · Portfolios · Case studies · **Avoid on:** Text-heavy pages · Forms
-- **Prompt:**
-
- > Add a scroll-driven background color to [the sections of your page]. Give each section a color, and as the visitor scrolls, change the page background from one section's color to the next in step with their position, blending between them unless the settings ask for a hard cut, so the color follows the scroll both ways. Blend in a perceptual color space so the colors in between stay clean. Check the text against the background at every point, and switch the text to dark when the background turns light. A change of color is not movement, so keep it when the visitor has reduced motion turned on. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A scroll-driven background color gives each section of a page its own color and blends from one to the next as you scroll, so the whole page seems to change mood. Halfway between two sections the background is a mix of both colors. When the background turns light, the text switches to dark so it stays readable.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Colors | Dusk | The palette, one color per section: Dusk stays dark; Daylight passes through pale colors and Forest through a light green, and the text turns dark on those |
- | Blend | Gradual | Gradual changes the color the whole way between sections; Quick holds each color and changes it near the boundary; Hard cut switches at the boundary with no blend, to show why the blend matters |
-
-- **README See also:**
- - [Scrollytelling](../scrollytelling/) — a picture beside the text changes as a story scrolls by
- - [Animated Gradient Background](../../07-ambient-background/animated-gradient-background/) — colors that shift on their own, with no scrolling
- - [Section Wipe](../section-wipe/) — each section slides up over the one before
-- **README How it works:**
- - "swapping the section text from light ink to dark ink:" becomes "swapping all of the section text from white to black:".
- - The second snippet becomes:
-
- ```js
- const lin = c => (c /= 255) <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
- const lum = 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b); // relative luminance
- stage.classList.toggle('light', lum > 0.18); // white and black text contrast equally at 0.18
- ```
-
- - The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `01.26 · Scroll-Based`
-- **Pager:** Previous: Scrollspy Navigation (`../scrollspy-nav/`) · Next: none
-- **Final fix wave:** each chapter's text is one paragraph, `<p>${c[1]} ${c[2]}</p>`, with no `<br>`, so it wraps on its own (the table lists the text, not where it breaks). The forced break had left "background" and "text." alone on a line at 375px. Without it a chapter could still end on one word at 320-344px and 352-373px (360px, for example), so `.stage p` also has `text-wrap:pretty`. Measured at every width from 320 to 1600px: no chapter has a one-word line (47 widths had one without `text-wrap:pretty`), and the wraps from 374px up (375, 390 and 414px, tablets, laptops) are the same as without it. On laptops and tablets chapters 1 to 4 take two lines and chapter 5 one, and the section heights and the scroll length are unchanged, except in the 258px box of a 1280×590 window, where chapter 5 now takes one line and its section is 5px shorter. A browser that ignores `text-wrap:pretty` wraps as before and can still end a chapter on one word at those narrow widths.
diff --git a/docs/superpowers/plans/2026-09-29-transitions-content.md b/docs/superpowers/plans/2026-09-29-transitions-content.md
deleted file mode 100644
index 39c4dd96..00000000
--- a/docs/superpowers/plans/2026-09-29-transitions-content.md
+++ /dev/null
@@ -1,1095 +0,0 @@
-# Page Transitions — Content Sheet
-
-This sheet decides, page by page, how the twelve Page Transitions pages present their kind, settings, words and prompt on the guided-steps page. The conversion tasks of `2026-09-29-demo-page-rollout-parallel.md` follow each section exactly, together with "How to convert a page" in `2026-09-28-demo-page-rollout-text-typography.md`, the do-it markup of `2026-09-29-demo-page-kinds-do-and-scroll.md` (Task 2) and the category rules below. Rotate In (`animations/02-entrance-and-exit/rotate-in/`) is the reference for everything a section does not mention.
-
-## Owner decisions that apply here
-
-- **Stage text uses the site font.** No page here is about typing, so no stage uses a typewriter font.
-- **Do-it pages show themselves once on arrival:** the shared script presses Show me 400ms after load. Under reduced motion nothing runs by itself, Slow motion is shown switched off and cannot be switched on (with the shared note), and Show me and Reset still work when pressed.
-- **Long names in the top bar are cut with "…"** by the shared stylesheet. Several pager names here are long (Shared Element Transition, Flash / Light Leak Transition); nothing to do on the page.
-- **Lessons from the Text & Typography reviews** apply to every page:
- - every timer goes through the pruning `later()` (a fired timer's id leaves `timers`);
- - no double `requestAnimationFrame` (see "Starting a transition" below);
- - the `hb:input` listener is registered at the top level of the page's inline script. It only clears `afterMove` and the way-back timer, so it is safe to run many times for one gesture (one touch sends both `touchstart` and `pointerdown`); it never calls `settle()`, and only `settle()` advances the View Transitions run counter;
- - the page reaches the player controls by their ids (`btn-demo`, `btn-reset`, `slow-tog`), never by `data-hb-*`.
-- The Pause decisions ("Pause stops at once", the `wait()`/`freeze()`/`thaw()` helper, the css Pause) do not apply: no page in this category is a loop.
-- The category keeps `--ui-accent:#b98cff` and the category line `03.NN · Page Transitions`, NN being the page's position on the home page (03.01 View Transitions API to 03.12 FLIP Technique).
-
-## Rules for every page in this category
-
-### Kind, step 1 and player bar
-
-- **Kind:** every page is a do-it page: `<body class="hb" data-hb-kind="do" data-hb-autoplay>`. Each demo waits for the visitor to click inside it: ten of them switch between three small pages, Shared Element Transition opens a project and goes back, and FLIP Technique rearranges cards.
-- **Step 1:** titled "Click it", with the help line each section gives.
-- **Player bar:** Show me, Reset and Slow motion, in that order: the exact Show me and Reset buttons of the do-it plan (ids `btn-demo`, `btn-reset`), then Rotate In's Slow motion switch written without a value (`<label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>`), unchecked. Every demo here has a state to return to, so every page has Reset.
-- **Try it help line:** exactly "Change a setting, then try it again or press Show me." (the same line on every do-it page, in every category). On do-it pages a setting change updates the chips and shows at the next transition; nothing replays by itself.
-
-### Show me and Reset
-
-- **Show me is one visit and the way back.** It plays one transition to another page (or view, or layout), holds it for 1200ms, then plays the transition back to where the run started, so the demo ends at rest where it began. A single transition lasts 0.5 to 1.25s at the default settings, below the two to four seconds a Show me run should last; the way back also shows the transition a second time, and on direction-aware demos (Slide Transition) it shows the reverse direction. Each section gives its run and its length at the default settings.
-- **The run, on the ten page-change demos (the ones with page names):**
- 1. Show me first calls `settle()`: it clears every pending timer, cancels the page's running animation frame, skips a running view transition, and puts the demo in its resting state for `current` at once, with `animating=false`.
- 2. It goes to the next page, `(current + 1) % 3`, through the same `navigate()` a click on that page's name runs. It passes a callback that runs when this transition has ended, at the point where the page's code sets `animating=false` today. Under reduced motion the page swaps with no movement, and the callback runs straight away. Keep the callback in one page-level variable (for example `afterMove`): the transition's end code runs it once and clears it, and `settle()` and `hb:input` clear it too.
- 3. That callback schedules the way back with `later()` 1200ms later: `navigate()` to the page the run started from. This hold is not stretched by Slow motion.
- Shared Element Transition and FLIP Technique follow the same three steps with their own transitions (see their sections).
-- **`hb:input` stops a run under way.** It fires when the visitor presses, types, scrolls or touches inside the stage. It cancels the step not yet started: the end-of-transition callback and the 1200ms timer of the way back. A transition already moving finishes normally and nothing follows, so the visitor is in control. A click on a page name during the hold therefore cancels the way back and plays the visitor's own transition. One gesture can send `hb:input` more than once (a touch sends `touchstart` and `pointerdown`), so the handler does nothing but clear `afterMove` and the way-back timer: running it twice is harmless. It never calls `settle()` and never touches the View Transitions run counter, which only `settle()` advances. **A run that hides or swaps what a keyboard can reach also stops when the visitor tabs into the stage** (Shared Element Transition hides Back at the end of its run; Portal / Tunnel Zoom swaps the pages and moves focus to the new page's portal). A trusted `focusin` inside the stage that the page did not cause does what `hb:input` does, clearing `afterMove` and the way-back or close timer, so the visitor's focus stays where they put it instead of being dropped to `<body>` or moved to another control. The page's own `focus()` calls must not count, because a programmatic focus is a trusted `focusin` too: each is wrapped in a flag, `{ownFocus=true;….focus({preventScroll:true});ownFocus=false}`, and the listener does nothing while the flag is set. The other page-name demos need no such rule (checked on Crossfade).
-- **Reset** calls `settle()`, then shows the demo's first state at once, with no transition (for the page-change demos: the first page, Home, with its name highlighted, the other pages hidden, and their inline transition, transform, filter, clip-path and animation styles cleared). The old "← Return to Home" did the same but ignored clicks during a transition; Reset works at any moment. Reset also cancels the animations still running on the elements it resets (`getAnimations()`, then `cancel()`): a fade already heading for the resting value keeps going when its inline `transition` is cleared, so without this it would run on after Reset (measured on Shared Element Transition and on the View Transitions API page without the API; the other ten pages already cancel).
-- **A click on the page already shown does nothing,** as today. Clicks during a transition are still ignored (`animating`), as today.
-
-### Starting a transition (no double requestAnimationFrame)
-
-Eight demos put an element in its starting state with `transition:none` and start the transition inside `requestAnimationFrame(()=>requestAnimationFrame(…))`: Blur, Crossfade (one after the other), Dissolve, Elastic (planned path), FLIP, Shared Element, Slide and Zoom. Flash waits for one frame before its fade-out. Frames only come while the page is being drawn: in a hidden browser pane or a background tab they stop, so the transition never starts, the demo stays with `animating=true` and every later click is ignored until the page is drawn again, while timers such as a Show me hold keep running. This happened to the Dissolve demo in the in-app browser while this sheet was written. The conversion sets the starting state, forces a reflow (`void el.offsetWidth` on the element that moves), then sets the transition and the end state in the same task. Timers that wait for the transition start at that same moment, outside any frame callback. Frame loops that draw the animation itself stay: Morph's point loop and Elastic's live spring.
-
-### Slow motion
-
-`data-hb-slowmo` without a value: the page stretches its own timing. When a transition starts, the page reads `slowTog.checked`. If it is on, the transition's durations, delays and the timers that wait for them are multiplied by 3. The 50ms safety margins in those timers and the 1200ms Show me hold stay as they are. A change on the switch shows from the next transition. The shared script's `replay()` does nothing on these pages, since they have no Replay. Each section names what is multiplied.
-
-### Stage
-
-- The aside goes entirely: the note, the State readouts, the live value readouts and the frame loops that updated them, the History log, and "← Return to Home" / "← Return to Grid" / "Reset layout", which the player bar's Reset replaces. The injected `.ah-bar`, its `ah-inject` style and its copy script go, as in "How to convert a page".
-- `.stage` keeps the demo's own `display:flex;flex-direction:column;overflow:hidden;background:var(--bg)`. It drops `flex:1`, `min-width:0`, `height:var(--stage-h)`, `border` and `border-radius`, because the shared stylesheet owns the stage's size, border and corners. `--stage-h` goes, and so does the old phone block (stacking, `--stage-h:480px`, button heights). `hb-dots`: no, on every page: the mini nav and the pages fill the stage.
-- **Height:** the default height fits every page-change demo. This was measured with a scratch copy of the mini pages on the shared stage: the page area is 313px tall at 1280×800, 260px at 1366×657 and 233px on a 375px or 320px phone, and the tallest mini page, Work, ends inside it on every size (at 253px, 226px and 205px). **Short windows** (1280×590 and 812×375, where the stage is 260px and the page area 193px) get a spacing rule on every page-change page, `@media(max-height:640px){.pc{gap:8px}.gi{padding:12px}}` (Flash adds `.pp{line-height:1.5}.pgrid,.pstat{margin-top:0}`), which keeps at least 11px above and below every mini page at a 193px page area. Portal / Tunnel Zoom sets a phone height, and FLIP Technique uses `hb-grow`; see their sections.
-- `:root` keeps `--bg`, `--ui-bg`, `--ui-border`, `--ui-accent:#b98cff`, `--ui-text`, `--ui-muted` and the demo variables its CSS reads. `--disp`, `--mono`, `--stage-h` and the variables nothing reads (each section names them) go. `--ui-muted` becomes `#8a8a92`: the old `#77777e` is 4.2:1 on the nav's `#111114`, and the new one is 5.5:1.
-- **Site font:** remove `font-family` from `.nav-btn`, `.tb-btn` and `.nav-back`; the other rules that set it (`body`, `select`) go with the old layout. Stage text inherits Schibsted Grotesk.
-- **Mini nav** (the ten page-change demos):
- - `.nav-btn` gets `font-size:13px;padding:0 12px;min-height:44px` at every size (was 10px text, and 36px tall on computers on eight of the pages). With the Morph logo, this still fits a 320px phone (measured).
- - Its hover rule stays inside `@media (hover: hover)`.
- - Where the mini nav is a `<nav>`, it gets `aria-label="Demo pages"` so screen readers do not mistake it for the site's navigation.
-- **Mini pages** (Home, Work or Gallery, About):
- - Each page's `<h2 class="ph">` becomes `<p class="ph">`, so the demo's sample headings do not join the page's outline of steps. `.ph` keeps its size and `font-weight:bold`.
- - `.pe` and `.pstat span` go from `opacity:.4` to `.6`: 3.4:1 becomes 5.7:1 on the pages' backgrounds. `.pp` stays at `.6` (5.7:1), or `.55` on Flash (5.7:1).
- - **Pages not on show are out of the accessibility tree,** so a screen reader does not read Home, Work and About as one page: a hidden page is `inert` (Flash and Portal / Tunnel Zoom use `visibility:hidden` on the page instead), set together with the `active` class or in the code that shows a page. The shown page's name carries `aria-current="page"` and the other names `"false"`, as on Dissolve (`updateNav`).
-- **Timers:** every timer goes through `later()`, and `settle()` clears them all.
-
-### Settings
-
-- Duration sliders become Speed (Slow · Normal · Fast): the old default is Normal, and Slow and Fast are about 1.6× and 0.6× of it.
-- Easing menus become Feel, using the Entrance & Exit names: Smooth (slows to a stop), Springy (goes a little past, then settles), Gentle (eases in and out), Even (one steady speed). Portal adds Speeds up (starts slowly and speeds up) for its `ease-in`. Each row gives the exact curve. Near-duplicate curves go: the menus' `ease-out` and `cubic-bezier(.2,.7,.3,1)` look almost the same, so only one of them stays, as Smooth.
-- Teaching overlays go, as on Clip-Path Reveal: Morph's control points, Dissolve's tile mask and FLIP's Invert badges. They show how the demo is built, are not part of the effect, and would end up in the copied prompt as settings.
-- A setting takes effect at the next transition. Values a transition reads (Speed, Feel, style) are read when it starts, as today.
-
-### README
-
-- **What it is** is rewritten in plain words, with no code.
-- **Key parameters** has one row per setting, with the same names as the page.
-- **See also** link texts equal the target page's `<h1>`, each followed by one plain phrase. The h1s here are: View Transitions API, Shared Element Transition, Morph Transition, Crossfade Transition, Slide Transition, Zoom Transition, Flash / Light Leak Transition, Blur Transition, Elastic Transition, Portal / Tunnel Zoom, Dissolve Transition, FLIP Technique. The home cards use shorter names for three of them (Crossfade, Flash / Light Leak, Dissolve). The page titles stay as they are, and every link uses the h1.
-- **How it works** changes where the code changes, mostly to replace the double `requestAnimationFrame` with the reflow.
-- **When to use it** and **Production notes** are unchanged unless the section says otherwise.
-
----
-
-## view-transitions-api — View Transitions API
-
-- **Kind:** do it. The visitor clicks a page name; the browser animates the change.
-- **Description:** The browser animates the change between two pages for you. Best for web apps.
-- **Step 1:** Click it · help line: "Click Work or About at the top of the box, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run goes from Home to Work with the chosen transition style, holds 1200ms after the view transition's `finished` promise resolves, then goes back to Home: about 2.2s.
- - `settle()` calls `skipTransition()` on a view transition still running and marks the demo idle at once. The old navigation's `await t.finished` must then not run its end code; a run counter compared after the `await` handles this.
- - A view transition skipped while the browser is still taking its first picture still runs its update callback afterwards. With today's `switchPage(prev,next)` that callback could undo a Reset made in the same frame, so the update callback shows the resting state for `current` as it is when the callback runs (`startViewTransition(()=>showPage(current))`), not the pages the navigation started with.
- - `hb:input` cancels the way back. A view transition already running finishes.
- - **Presses during a view transition.** While a view transition runs (half a second at Normal), Chrome sends every press on the page to the root element (`<html>`), so the shared script never hears a press on the stage and no `hb:input` is sent. The page therefore listens for `pointerdown` and `click` on the root (capture phase, passive): when the event is trusted, its target is the root, the page's own view transition is running and the point lies inside the stage, it sends the same `hb:input` event, so a click on the stage during a transition still cancels the way back. Presses on the player bar (Show me, Reset, Slow motion) do nothing until the transition ends, and `::view-transition{pointer-events:none}` does not change that while the root is captured, which is the default (checked in Chrome 154, on the top pseudo-element and on every view-transition pseudo-element). Only with `:root{view-transition-name:none}` as well does a press on Reset get through, and then only to content that is not named itself; the page keeps the default capture. The README's Production notes say so.
-- **Reset:** yes. Home at once; a running view transition is skipped first, and without the API a fallback fade still running is cancelled.
-- **Slow motion:** each navigation sets `--vt-dur` to Speed × 3 before it starts the view transition. The fallback crossfade for browsers without the API is stretched too: its 300ms fade becomes 900ms, and its 350ms wait becomes 950ms.
-- **Reduced motion:** the demo's rule (`::view-transition-old(page-content),::view-transition-new(page-content){animation:none}`) and its `motionOk` branch (`switchPage()` at once) stay. Show me swaps to Work and back with no movement.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav and the page area stay. `.page-area` keeps `view-transition-name:page-content`, and every `::view-transition-*` rule and keyframe stays.
- - **Special case:** the browser draws the old and new pictures above the whole page, in the top layer. The stage's `overflow:hidden` therefore cannot clip them. The demo's own `::view-transition-group(page-content){overflow:clip}` keeps the slide and zoom inside the page area's box, and `::view-transition-old(root),::view-transition-new(root){animation:none}` keeps the rest of the page still. That group rule also gets `border-radius:0 0 11px 11px`, so the page area keeps the stage's rounded bottom corners mid-transition (the stage's 12px radius inside its 1px border).
- - **The site's top bar stays drawn above the transition** (owner decision). The page area's pictures are drawn above everything, so a stage scrolled partly under the sticky top bar would cover the bar for the length of a transition. The page's own `<style>` names the bar and keeps its pictures still: `.hb-bar{view-transition-name:hb-bar}`, `::view-transition-group(hb-bar),::view-transition-old(hb-bar),::view-transition-new(hb-bar){animation:none}` and `::view-transition-old(hb-bar){opacity:0}`. The old picture is hidden so the bar stays exactly as it looks at rest: with `animation:none` both pictures show at full strength, one over the other, and the bar's slightly see-through background would turn more solid for the length of a transition. The bar paints above the page area (z-index 50), so its group is drawn above the page area's. `page-content` and `hb-bar` are the only two names; the shared page adds none.
- - The support banner goes (it was in the aside); the fallback stays in the code, and Production notes describe it.
- - `.pstat b` stays `#58a6ff`.
- - Unused variables: none.
- - Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Transition style | Choice buttons | Fade · Slide · Zoom · Tilt | Fade | The same click, animated four different ways. | `style`: `'crossfade'` / `'slide'` / `'zoom'` / `'custom'` (replaces `styleSel.value`). Each navigation sets `data-vt` on `<html>` from it, `''` for Fade, as today. |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the change from page to page takes. | `dur`: 800 / 500 / 300 (ms). Each navigation sets `--vt-dur` from it (× 3 in slow motion). |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Gentle · Even | Gentle | Gentle eases in and out; Even keeps one steady pace. | `--vt-ease` on `<html>`: `ease-out` / `ease-in-out` / `linear` (set at once, as the menu did) |
-
-- **Removed:**
- - The note and the support banner.
- - The Page readout and the History log.
- - The Transition style menu. It becomes choice buttons.
- - The Duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel, and its `cubic-bezier(.2,.7,.3,1)` "Smooth" goes, because it looked almost the same as Ease out, which is now Smooth.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Web apps · Page changes · Tabs and filters · Galleries · **Avoid on:** Frequent updates
-- **Prompt:**
-
- > Add page transitions to [your site's pages or views] with the browser's View Transitions API. Wrap each page change in a view transition: the browser takes a picture of the page before and after the change and animates between the two pictures. Name the content area so that only it animates, and turn off the default animation of the whole page. Style how the old and new pictures move with CSS, for example a fade, a slide or a zoom. Check that the browser supports the API, and simply swap the content when it does not. If the visitor has reduced motion turned on, swap the content with no animation. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > The View Transitions API is a browser feature that animates a change of page for you. You tell the browser when the page is about to change; it takes a picture of the page before and after, then animates from one picture to the other. CSS decides how the pictures move, so the same click can fade, slide, zoom or tilt.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Transition style | Fade | Fade blends the two pictures; Slide pushes the old one out to the left as the new one comes in from the right; Zoom shrinks the old one away as the new one settles from slightly larger; Tilt turns both slightly as they fade |
- | Speed | Normal | How long the change takes: slow is 800ms, normal 500ms and fast 300ms; under about 150ms it reads as an instant swap |
- | Feel | Gentle | Gentle eases in and out; Smooth slows to a stop; Even keeps one steady pace |
-
-- **README See also:** the first link's text becomes the page's real title.
- - [Crossfade Transition](../crossfade/) — the same fade, built by hand
- - [Slide Transition](../slide-transition/) — pages slide, with a sense of direction
- - [Zoom Transition](../zoom-transition/) — three ways to zoom between pages
- - [Shared Element Transition](../shared-element-transition/) — one picture grows into the next page
-- **README How it works:** follows the code (`showPage(current)`, `--vt-dur`, the skipped-transition sentence).
-- **README Production notes:** the support banner is gone, so the first bullet says what browsers without the API see: "the demo does exactly this so unsupported browsers still transition." becomes "the demo does exactly this, so browsers without the API still get a simple 300ms fade, whatever the Transition style and Speed." The rest changes as follows:
- - **Browser support** is a new bullet after Feature-detect: "Same-document view transitions — `document.startViewTransition()`, as in this demo — work in Chrome and Edge 111 and later, Safari 18 and Firefox 144. Cross-document ones, turned on for full page loads with `@view-transition { navigation: auto; }`, work in Chrome and Edge 126 and Safari 18.2; check current support for Firefox. Keep the fallback for older browsers." The versions were checked against MDN's compatibility data for `Document.startViewTransition()`, `ViewTransition` and `@view-transition` (Firefox has no cross-document support yet).
- - The unique-name bullet now says two elements sharing a name "make the browser skip the transition: the page still changes, with no animation" (it said this "throws and aborts the transition").
- - **Presses wait for the transition** is a new bullet before the library line: "While a view transition runs, Chrome sends every press on the page to the root element, so buttons do not respond until it ends (`pointer-events: none` on the transition's pseudo-elements does not change this while the root is captured, as it is by default); keep page transitions short. The demo passes a press over its box on as the visitor taking over, so a click there still stops Show me."
- - **Library equivalents** is rewritten: "Astro's `<ClientRouter />` (named `<ViewTransitions />` before Astro 5) and React's `<ViewTransition>` component, which Next.js's App Router supports, wrap this API for client-side page changes; between full page loads the CSS rule `@view-transition { navigation: auto; }` does it without JavaScript. Barba.js and Swup predate the API and animate the old and new page content themselves; on supported browsers you often no longer need them." (The old line said Astro and Next.js wrapped it for cross-document navigation, and that Barba.js and Swup work by taking snapshots.)
-- **Category line:** `03.01 · Page Transitions`
-- **Pager:** Previous: none · Next: Shared Element Transition (`../shared-element-transition/`)
-- **Final fix wave:** the page names carry `aria-current` (`"page"` on the shown page's name, `"false"` on the others); `showPage` makes the pages not shown `inert` and cancels any transition or fade still running on them, so Reset also stops the fallback fade; the README's Production notes gain browser support and the presses-wait note, and lose three wrong statements (duplicate names, the Astro and Next.js line, snapshots).
-
----
-
-## shared-element-transition — Shared Element Transition
-
-- **Kind:** do it. The visitor opens a project and goes back.
-- **Description:** A picture grows from the list into the next page's header. Best for galleries.
-- **Step 1:** Click it · help line: "Click a project to open it, then Back, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run starts from the grid: `settle()`, and if the detail view is open it closes at once, as Reset does.
- - It opens the last project, Lumen, at the bottom right: its picture grows from the thumbnail into the header of the detail view while the grid fades and the detail text fades in. Lumen's picture travels furthest, so the movement is easy to follow.
- - 1200ms after the opening ends (the `dur+50` timer that hides the copy and shows Back), the run closes the detail view the way Back does.
- - This takes about 2.3s.
- - `hb:input` cancels the pending close. An opening already under way finishes.
- - So does a trusted `focusin` inside the stage that the page did not cause: a keyboard visitor who tabs from Show me back to Back during the hold takes over, so the close no longer hides Back under them (which dropped their focus to `<body>`). The page's own two `focus()` calls, Back after an opening and the project after Back, are wrapped in an `ownFocus` flag (`{ownFocus=true;….focus({preventScroll:true});ownFocus=false}`) and do not count, since a programmatic focus is a trusted `focusin` too.
-- **Reset:** yes. The grid at once: the copy is hidden, the detail view closed and `inert` again, its inline `opacity` and `transition` cleared, the grid's inline `opacity`, `transition` and `pointer-events` cleared (so it shows and takes clicks again) and its `inert` removed, the title back to "Projects" and Back hidden. The fades still running on the grid, the detail view and Back are cancelled (`getAnimations()`, then `cancel()`): a fade already heading for its resting value keeps going when its inline `transition` is cleared.
-- **Slow motion:** multiplies `dur` by 3 wherever it is used: the copy's travel, the grid's fade (0.4 × `dur`), the detail's fade and its delay (0.4 and 0.6 × `dur`), the close fade (0.3 × `dur`), and the matching parts of the `dur+50` and `0.3×dur+50` timers.
-- **Reduced motion:** the demo's `motionOk` branches open and close the detail view at once, and the rule `#flip-el{transition:none!important}` stays. Show me opens Lumen and closes it again with no movement.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav (Back and the title) and the page area (grid, detail view and the moving copy `#flip-el`) stay.
- - **Special case:** the copy is `position:fixed` and moves in viewport coordinates, so the stage's `overflow:hidden` does not clip it. The conversion must not give the stage or any of its ancestors a `transform`, `filter`, `backdrop-filter`, `perspective`, a `will-change` naming one of these, or `contain` with `layout` or `paint`: any of them would become the copy's containing block and shift or clip it. `container-type` and `contain:size` or `style` do not make one in Chrome; leave them off too, simply because the stage needs no containment. The copy keeps its own `will-change:transform`. **The copy moves with a `transform` only,** because CLAUDE.md rules out animating `top`, `left`, `width` and `height`. It is placed on the header's rectangle with `transform-origin:0 0`; a `translate` and a `scale` draw it back onto the thumbnail (INVERT), and the transition plays that transform to `none` (PLAY) together with `border-radius`, which starts at `10/sx` by `10/sy` (the scale factors) so the corners look 10px round while the copy is shrunk, and ends at 0. The copy starts and ends on the same rectangles as the `top`/`left`/`width`/`height` version it replaces (0px difference at six screen sizes) and reaches the same Springy peak (1007×142 against the 958×141 header at 1280×800); a trip costs 2 or 3 layouts instead of about 32 (375×812, CPU slowed 4×).
- - `#flip-el`'s `z-index:100` becomes `40`: above the stage's content, below the site's sticky top bar (50), so a stage scrolled partly under the bar does not draw the copy over it (owner decision).
- - `.nav-back` becomes 13px text, `min-height:44px` at every size, in `var(--ui-muted)`. `.nav-title` becomes 13px. The unused `.nav-label` rule goes.
- - **The projects become buttons, so a keyboard can open them.** Today each thumbnail is a `div` with a click listener, which a keyboard cannot reach on a "Click it" page.
- - Each becomes `<button type="button" class="thumb">`. `.thumb` adds `border:0;font:inherit;color:inherit;text-align:left;cursor:pointer`.
- - Its two lines become `<span class="thumb-label">` and `<span class="thumb-sub">` with `display:block`, because a button may only hold inline content.
- - Hidden controls leave the Tab order. While the detail view is open, the grid gets `inert` (removed when the grid shows again). `.nav-back` adds `visibility:hidden` and `transition:opacity .2s,visibility 0s .2s`: when hidden it fades out, then leaves the Tab order, so it is not an invisible Tab stop in the grid view. `.nav-back.show` gets `visibility:visible;transition:opacity .2s`, so Back is visible, and can take focus, the moment `show` is added. A visibility transition on showing would keep Back hidden for about two frames, and `focus()` in the same step would silently fail. Under reduced motion that same step is the only chance (checked in Chrome). The closed detail view is `inert` too (set in the markup, removed when a project opens, set again when the detail view closes and on Reset), so a screen reader does not read its placeholder text or the last project's text.
- - Focus follows the view. When the visitor opens a project, by click or by key, focus moves to Back once it shows (`focus({preventScroll:true})`). Back returns focus to that project's button once the grid shows. A mouse click gets no focus ring, because the browser shows the ring only after keyboard use. Show me and Reset move no focus.
- - `.thumb-sub` goes from `opacity:.5` to `.8`: 3.0:1 becomes 5.1:1 on the thumbnails.
- - Two thumbnail title colours change so the 11px titles read on their thumbnails, and the detail view's title uses the same colours: Atlas `#79c0ff` becomes `#a5d6ff` (4.49:1 becomes 5.7:1), and Prism `#56d364` becomes `#7ee787` (4.1:1 becomes 5.1:1).
- - Unused variables: `--dur` and `--ease` go.
- - Default height: the grid and the longest detail text fit the 233px page area on a 320px phone. On small stages, `@media(max-height:640px),(max-width:600px){#detail-body{padding:12px 16px}#detail-title{font-size:18px;margin-bottom:4px}#detail-sub{margin-bottom:6px}#detail-desc{line-height:1.5}}` tightens the text block under the header, so the header keeps its 45% share instead of being squeezed (86 of 193px at 1280×590, with 12px under the text).
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the picture takes to grow into place. | `dur`: 800 / 500 / 300 (ms) |
-| Feel | Choice buttons | Smooth · Springy | Smooth | Springy grows a little past the header, then settles. | `ease`: `cubic-bezier(.2,.7,.3,1)` / `cubic-bezier(.34,1.56,.64,1)` (replaces `easeSel.value`) |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note.
- - The View and Selected readouts.
- - The Duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel, and Ease out goes, because it looked almost the same as Smooth.
- - "← Return to Grid". Reset replaces it.
-- **Good for:** Galleries · Product grids · Card lists · Media libraries · **Avoid on:** Unrelated pages
-- **Prompt:**
-
- > Add a shared element transition to [your list of items and their detail pages]. When a visitor opens an item, its picture should grow from its place in the list into the large header of the detail page, while the list fades away and the detail text fades in just after the picture lands. Measure where the picture starts and where it ends, then move a copy from one to the other with a transform only, never by changing its position or size, so it reads as one continuous element. Going back fades the detail page out and the list back in. If the visitor has reduced motion turned on, open and close the detail page without the movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A shared element transition keeps one piece of content in view while the page changes around it: a thumbnail in a grid grows and moves into the large picture at the top of its detail page, instead of the two pages simply swapping. It feels as if you travel with the content rather than jump to a new screen. The demo measures where the picture starts and where it ends, then moves a copy of it from one to the other.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the picture takes to travel and grow: slow is 800ms, normal 500ms and fast 300ms; 300 to 600ms feels responsive without dragging |
- | Feel | Smooth | Smooth slows to a stop; Springy grows a little past the header's size, then settles |
-
-- **README See also:** the descriptions lose their code, and "Portal Zoom" becomes the page's real title.
- - [View Transitions API](../view-transitions-api/) — the browser can do this itself
- - [FLIP Technique](../flip-technique/) — the measure-then-move method on its own
- - [Portal / Tunnel Zoom](../portal-zoom/) — the next page opens out of a clicked circle
- - [Morph Transition](../morph-transition/) — a shape changes instead of moving
-- **README How it works:**
- - The first paragraph ends "…(Last), place a fixed copy on the header's rectangle and draw it back onto the thumbnail with a transform (Invert), then transition that transform to none (Play):".
- - The snippet follows the page's code, with the `requestAnimationFrame` wrapper replaced by a reflow and `easeSel.value` written `ease`. After `heroRect` it inverts, commits the inverted start and plays:
-
- ```js
- // INVERT: the copy sits on the header's rectangle; a transform draws it back onto the thumbnail
- const sx = thumbRect.width / heroRect.width, sy = thumbRect.height / heroRect.height;
- flipEl.style.cssText =
- `background:${p.bg};top:${heroRect.top}px;left:${heroRect.left}px;`+
- `width:${heroRect.width}px;height:${heroRect.height}px;transform-origin:0 0;`+
- `transform:translate(${thumbRect.left-heroRect.left}px,${thumbRect.top-heroRect.top}px) scale(${sx},${sy});`+
- `border-radius:${10/sx}px/${10/sy}px;transition:none;display:block`;
- void flipEl.offsetWidth; // commit the inverted start
- flipEl.style.transition = // PLAY
- `transform ${dur}ms ${ease},border-radius ${dur}ms ${ease}`;
- flipEl.style.transform = 'none';
- flipEl.style.borderRadius = '0';
- ```
-
- - The paragraph after it says "copy" throughout and ends: "Reading `offsetWidth` after placing the copy makes the browser apply the inverted start before the transition is switched on — without it the copy would jump straight to the end. The corners are set to `10/sx` by `10/sy` so they still look 10px round while the copy is shrunk."
-- **README Production notes:** the second bullet and the library line change, because the copy moves with a transform. The second bullet becomes: "**The clone is `position:fixed`**, so it moves in viewport coordinates and ignores the scroll and layout of the pages underneath it. It moves with `transform` alone (a shift and a scale), so the browser lays nothing out while it travels; only its corners are repainted. A scaled copy stretches what is inside it, which suits a picture or a colour but not text." The library line ends "…automate FLIP; GSAP's Flip plugin offers the same measure-invert-play primitive." (it used to name Next.js, which has no such primitive). The rest is unchanged.
-- **Category line:** `03.02 · Page Transitions`
-- **Pager:** Previous: View Transitions API (`../view-transitions-api/`) · Next: Morph Transition (`../morph-transition/`)
-- **Final fix wave:** the closed detail view is `inert`; Reset cancels running fades; the copy moves with a `transform` instead of `top`, `left`, `width` and `height` (CLAUDE.md), with the same look; a trusted `focusin` the page did not cause stops a Show me run, with an `ownFocus` flag around the page's own focus moves; the prompt and the README say the copy moves with a transform only.
-
----
-
-## morph-transition — Morph Transition
-
-- **Kind:** do it. The visitor clicks a page name; the logo reshapes to match the page.
-- **Description:** The logo changes shape to match each page you visit. Best for brand marks.
-- **Step 1:** Click it · help line: "Click Gallery or About at the top of the box, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run goes from Home to Gallery: the logo morphs from the circle to the hexagon while the pages fade across.
- - It holds 1200ms after the morph's `done` callback, then goes back to Home (hexagon to circle): about 2.6s.
- - `hb:input` cancels the way back.
-- **Reset:** yes. Home at once, with the logo drawn as the circle in its colour (`SHAPES[0]`).
-- **Slow motion:** multiplies the morph's duration (`dur`, read into `d` when a morph starts) by 3. The pages' 300ms fade is multiplied too: `.page`'s transition becomes `opacity var(--fade,300ms) ease`, and each navigation sets `--fade` to 900ms in slow motion or 300ms otherwise. `settle()` and Reset set `--fade` to `0ms` before they switch the pages, so they switch at once instead of fading over 300ms; the next navigation sets it again.
-- **Reduced motion:** the demo's rule `.page{transition:none}` stays; the rule's `.pts-overlay` part goes with the overlay. `startMorph()`'s `motionOk` branch, which draws the new shape at once, also stays. Show me swaps to Gallery and back with no movement.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav (the logo and the page names in `#nav`) and the page area stay.
- - The logo grows from 32×32 to 44×44 (the height of the page names), so the morph is easier to see.
- - The control-point layer goes: the empty `#pts-layer` circle, `drawPts()` and `ptsGroup`.
- - The `.shape-row`, `.shape-btn`, `.pts-overlay` and `.tog` rules go with their controls.
- - `.pstat b` stays `#58a6ff`.
- - Unused variables: `--dur` and `--ease` go.
- - Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the logo takes to change shape. | `dur`: 1100 / 700 / 400 (ms) |
-| Feel | Choice buttons | Smooth · Springy · Gentle · Even | Gentle | Springy stretches a little past the new shape. | `ease`, which `easeFn()` reads in place of `easeSel.value`: `'ease-out'` / `'springy'` / `'ease-in-out'` / `'linear'` |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note.
- - The Page and Shape readouts and the History log.
- - The "Jump to shape" buttons. A click on a page name morphs the logo into that page's shape, which shows the same morph.
- - "Show control points", a teaching overlay. Its dots are too small to read on the logo.
- - The Morph duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Logos · Brand marks · Icons that change state · **Avoid on:** Detailed pictures · Text
-- **Prompt:**
-
- > Add a morphing logo to [your logo or icon, and the pages it belongs to]. Give each page its own shape for the logo, and when the visitor changes page, let the outline flow from the old shape into the new one while the page content fades across. Draw every shape with the same number of points in the same order, so each point has a partner to move to and the outline never tears or twists. Move the points yourself on every frame, because CSS cannot blend two different shapes. If the visitor has reduced motion turned on, switch to the new shape at once. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A morph transition turns one shape into another by moving each point of its outline toward a matching point in the new shape. Instead of swapping pictures, the outline flows: a circle unfolds into a hexagon, and a hexagon sharpens into a star. In the demo, a small logo changes shape to match each page as you move between Home, Gallery and About.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the change of shape takes: slow is 1100ms, normal 700ms and fast 400ms; slower reads as more deliberate |
- | Feel | Gentle | Gentle eases in and out; Smooth slows to a stop; Springy stretches a little past the new shape and settles back; Even keeps one steady pace |
-
-- **README See also:** "Flip Technique" and "Crossfade" become the pages' real titles.
- - [Shared Element Transition](../shared-element-transition/) — one element moves instead of changing shape
- - [FLIP Technique](../flip-technique/) — elements glide to their new places
- - [Crossfade Transition](../crossfade/) — the fade that carries the page content
- - [Elastic Transition](../elastic-transition/) — a spring that goes past and settles
-- **README How it works:** delete the last sentence of the last paragraph, "A "show control points" toggle overlays the 12 vertices so the correspondence is visible." The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `03.03 · Page Transitions`
-- **Pager:** Previous: Shared Element Transition (`../shared-element-transition/`) · Next: Crossfade Transition (`../crossfade/`)
-- **Final fix wave:** the pages that are not on show are `inert` (`showPage` sets it on all three pages and `navigate` on the two that swap), so a screen reader reads only the page on show and Tab cannot enter a hidden one. The name of the page on show carries `aria-current="page"` and the other two `"false"` (`updateNav`).
-
----
-
-## crossfade — Crossfade Transition
-
-- **Kind:** do it. The visitor clicks a page name; the pages fade across.
-- **Description:** The old page fades out as the new one fades in. Best for calm page changes.
-- **Step 1:** Click it · help line: "Click Work or About at the top of the box, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run goes from Home to Work, holds 1200ms after the fade ends (the `dur+50` timer, or the second `half+50` timer when the fades run one after the other), then goes back to Home.
- - This takes about 2.3s together, or 2.4s one after the other.
- - `hb:input` cancels the way back.
-- **Reset:** yes. Home at once.
-- **Slow motion:** multiplies `dur` by 3 (and so each half when the fades run one after the other), along with the `dur` and `half` parts of the timers.
-- **Reduced motion:** the demo's rule `.page{transition:none!important}` and its `motionOk` branch stay: the pages swap at once. Show me swaps to Work and back.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav and the page area stay.
- - The frame loop `trackOp()` that fed the opacity readouts goes.
- - `.pstat b` stays `#58a6ff`.
- - Unused variables: `--dur` (the slider wrote it, but nothing read it) and `--ease` go.
- - Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Fade order | Choice buttons | Together · One after the other | Together | Together, both pages show at half strength midway. | `mode`: `'true'` / `'seq'` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the whole fade takes. | `dur`: 800 / 500 / 300 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Gentle · Even | Gentle | Even keeps one steady pace, the plainest fade. | `ease`: `ease-out` / `ease-in-out` / `linear` (replaces `easeSel.value`) |
-
-- **Removed:**
- - The note.
- - The Page, Outgoing and Incoming opacity readouts, and the frame loop that updated them.
- - The History log.
- - The Mode buttons. They become Fade order.
- - The Duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel, and its `cubic-bezier(.2,.7,.3,1)` "Smooth" goes, because it looked almost the same as Ease out, which is now Smooth.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Tabs · Image galleries · Content swaps · Calm sites · **Avoid on:** Step-by-step flows
-- **Prompt:**
-
- > Add a crossfade between [the pages or views you want to switch between]. Stack the old and the new page in exactly the same place, then fade the old one out and the new one in. When the two fades run together, both pages are half visible for a moment and blend; one after the other, a short blank moment falls between them. Nothing moves; only how see-through each page is changes. It is the calmest page change and suits content that has no order. If the visitor has reduced motion turned on, switch pages instantly. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A crossfade switches pages by fading the old page out while the new one fades in, so for a moment both are half visible and blend into each other. That overlap is what makes it a crossfade: fading the old page out first and the new one in afterwards leaves a short blank moment instead. The demo can do both, so you can compare them.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Fade order | Together | Together overlaps the two fades so the pages blend; One after the other fades the old page out first, leaving a blank moment |
- | Speed | Normal | How long the whole change takes: slow is 800ms, normal 500ms and fast 300ms; one after the other gives each fade half of it |
- | Feel | Gentle | Gentle eases in and out; Smooth slows to a stop; Even keeps one steady pace, which reads most evenly for a pure fade |
-
-- **README See also:** "Dissolve" becomes the page's real title.
- - [View Transitions API](../view-transitions-api/) — the browser's own fade between pages
- - [Dissolve Transition](../dissolve/) — the fade broken into tiles
- - [Slide Transition](../slide-transition/) — pages move sideways instead
- - [Blur Transition](../blur-transition/) — a blur joins the fade
-- **README How it works:**
- - The sentence "A `requestAnimationFrame` loop samples both computed opacities live so you can watch them cross:" becomes "With Together, both pages get the same opacity transition and fade at once; with One after the other, each gets half the duration and the new page starts when the old one has gone. Both are ordinary CSS transitions on `opacity`:". The README names the two orders as the page does, not "simultaneous" and "sequential".
- - In the snippet, `easeSel.value` becomes `ease`, and the two comments read "Together: …" and "One after the other: …". In the One after the other part, `requestAnimationFrame(()=>requestAnimationFrame(()=>{ newEl.style.opacity='1'; }));` becomes these two lines:
-
- ```js
- void newEl.offsetWidth; // commit the transparent start
- newEl.style.opacity='1';
- ```
-
- - The One after the other part also sets each page's transition, as the page does; read literally, the pages would snap without these lines. ``oldEl.style.transition=`opacity ${half}ms ${ease}`;`` goes before `oldEl.style.opacity='0';`, and ``newEl.style.transition=`opacity ${half}ms ${ease}`;`` is the first line inside the timer.
- - The paragraph after the snippet uses the same two names: "With Together the outgoing page reaches ~0.5 … with One after the other the stage passes through a fully blank frame …".
- - The rest is unchanged.
-- **README Production notes:** unchanged apart from the second bullet, which now names the two orders Together and One after the other (final fix wave)
-- **Category line:** `03.04 · Page Transitions`
-- **Pager:** Previous: Morph Transition (`../morph-transition/`) · Next: Slide Transition (`../slide-transition/`)
-- **Final fix wave:** `rest()` sets `inert` on a page that is not on show, so a screen reader reads only the page on show and Tab cannot enter a hidden one; a page fading in becomes reachable when its fade ends, where `rest()` runs. The name of the page on show carries `aria-current="page"` and the other two `"false"` (`updateNav`). In the README's Production notes, the second bullet also uses the page's names for the two orders (it said "Simultaneous double-fade" and "Sequential"); it is the only change there.
-
----
-
-## slide-transition — Slide Transition
-
-- **Kind:** do it. The visitor clicks a page name; the pages slide.
-- **Description:** Pages slide across, and going back slides the other way. Best for step flows.
-- **Step 1:** Click it · help line: "Click Work or About at the top of the box, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run goes from Home to Work, then back to Home 1200ms after the slide ends (the `dur+stagger+50` timer).
- - With Forward and back, Work comes in from the right and Home comes back from the left, so the run shows both directions.
- - This takes about 2.3s.
- - `hb:input` cancels the way back.
-- **Reset:** yes. Home at once; the other pages are parked at `translateX(100%)`, as today.
-- **Slow motion:** multiplies `dur` and `stagger` by 3, along with those parts of the timer.
-- **Reduced motion:** the demo's rule `.page{transition:none!important}` and its `motionOk` branch stay: the pages swap at once. Show me swaps to Work and back.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav and the page area stay.
- - `.pstat b` stays `var(--ui-accent)` (6.4:1 on the About page).
- - Unused variables: `--dur` and `--ease` go.
- - Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Direction | Choice buttons | Forward and back · Left to right · Right to left · Top to bottom | Forward and back | Forward and back reverses the slide when you go back. | `dirMode`: `'auto'` / `'ltr'` / `'rtl'` / `'vertical'` (read by `getDir()` in place of the menu) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each slide takes. | `dur`: 800 / 500 / 300 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Springy · Even | Smooth | Springy goes a little past, then settles. | `ease`: `cubic-bezier(.2,.7,.3,1)` / `cubic-bezier(.34,1.56,.64,1)` / `linear` (replaces `easeSel.value`) |
-| Gap between pages | Choice buttons | None · Small · Large | None | The new page starts a moment later, leaving a gap. | `stagger`: 0 / 80 / 160 (ms) |
-
-- **Removed:**
- - The note.
- - The Page and Direction readouts and the History log.
- - The Direction mode menu. It becomes Direction.
- - The Duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel, and Ease out goes, because it looked almost the same as Smooth.
- - The Stagger slider. It becomes Gap between pages.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Step-by-step flows · Checkout · Onboarding · Carousels · **Avoid on:** Unrelated pages
-- **Prompt:**
-
- > Add slide transitions to [the pages or steps you want to move between]. When the visitor changes page, move the old page out of one side while the new page comes in from the other, like panels on a track. When the direction follows the navigation, going forward slides to the left and going back slides to the right, as phone apps do. Move the pages with transforms only, never by changing their position or size, and keep pages that are off screen from catching taps. If the visitor has reduced motion turned on, switch pages without sliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A slide transition moves the old page out of one side while the new page comes in from the other, like panels on a track. When the direction follows the navigation — forward slides to the left, back slides to the right — it gives visitors a sense of where they are, as phone apps do. The demo can also always slide the same way, or slide down.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Direction | Forward and back | Forward and back slides left for the next page and right for the previous one; the other choices always slide the same way |
- | Speed | Normal | How long each slide takes: slow is 800ms, normal 500ms and fast 300ms; 300 to 500ms matches phone apps, longer drags |
- | Feel | Smooth | Smooth slows to a stop; Springy goes a little past and settles back; Even keeps one steady pace |
- | Gap between pages | None | How much later the new page starts: none, small (80ms) or large (160ms); a delay leaves a gap between the pages |
-
-- **README See also:** "Crossfade" becomes the page's real title.
- - [View Transitions API](../view-transitions-api/) — the browser can slide pages too
- - [Zoom Transition](../zoom-transition/) — pages move in depth instead
- - [Crossfade Transition](../crossfade/) — pages fade instead of moving
- - [Elastic Transition](../elastic-transition/) — the slide with a springy finish
-- **README How it works:**
- - In the snippet, `getDir()` reads `dirMode` in place of `dirMode.value`, and its first line (`const m=dirMode.value;`) goes, so its checks read `dirMode==='ltr'` and so on. `easeSel.value` becomes `ease`.
- - The snippet's `doTransition` takes the values it reads as the page's does, and defines the two pages it moves: its first line is `function doTransition(prev,next,dur,stagger,ease){`, followed by ` const oldEl=pages[prev], newEl=pages[next];`. Before, `oldEl`, `newEl`, `dur`, `stagger` and `ease` were not defined anywhere in it.
- - The `requestAnimationFrame(()=>requestAnimationFrame(()=>{ … }));` wrapper is replaced by a reflow, with the four lines it held following directly:
-
- ```js
- void newEl.offsetWidth; // commit the parked position
- oldEl.style.transition=`transform ${dur}ms ${ease}`;
- newEl.style.transition=`transform ${dur}ms ${ease} ${stagger}ms`;
- oldEl.style.transform=`translate${dir}(${sign*100}%)`; // both move the same way
- newEl.style.transform='translate(0,0)';
- ```
-
- - "A stagger control adds an optional delay on the incoming page so it trails the outgoing one slightly." becomes "The Gap between pages setting adds an optional delay on the incoming page so it trails the outgoing one."
-- **README Production notes:** the bullet "**The double `requestAnimationFrame`** is required…" becomes "**Commit the parked position.** Reading `offsetWidth` after parking the new page off-screen makes the browser apply that position before the transition is switched on; without it the two writes merge and the new page jumps straight in with no slide." In the bullet "**Match direction to platform expectation.**", "The auto mode encodes this." becomes "The Forward and back setting encodes this." The rest is unchanged.
-- **Category line:** `03.05 · Page Transitions`
-- **Pager:** Previous: Crossfade Transition (`../crossfade/`) · Next: Zoom Transition (`../zoom-transition/`)
-- **Final fix wave:** `rest()` sets `inert` on a page that is not on show (the pages parked to the right), so a screen reader reads only the page on show and Tab cannot enter a parked one. The name of the page on show carries `aria-current="page"` and the other two `"false"` (`updateNav`).
-
----
-
-## zoom-transition — Zoom Transition
-
-- **Kind:** do it. The visitor clicks a page name; the pages zoom.
-- **Description:** The pages zoom as they swap, as if moving in depth. Best for opening details.
-- **Step 1:** Click it · help line: "Click Work or About at the top of the box, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run goes from Home to Work, then back to Home 1200ms after the zoom ends (the `dur+50` timer): about 2.4s.
- - `hb:input` cancels the way back.
-- **Reset:** yes. Home at once.
-- **Slow motion:** multiplies `dur` by 3, along with that part of the timer.
-- **Reduced motion:** the demo's rule `.page{transition:none!important}` and its `motionOk` branch stay: the pages swap at once, without scaling. Show me swaps to Work and back.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav and the page area stay.
- - `.pstat b` stays `var(--ui-accent)`.
- - Unused variables: `--dur` and `--ease` go.
- - Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Zoom style | Choice buttons | Zoom in · Zoom out · Pull through | Zoom in | Zoom in feels like arriving, zoom out like leaving. | `variant`: `'zoom-in'` / `'zoom-out'` / `'pull'` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the zoom takes. | `dur`: 900 / 550 / 330 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Smooth · Springy · Gentle | Smooth | Springy grows a little past full size, then settles. | `ease`: `cubic-bezier(.2,.7,.3,1)` / `cubic-bezier(.34,1.56,.64,1)` / `ease-in-out` (replaces `easeSel.value`) |
-
-- **Removed:**
- - The note.
- - The Page, Old scale and New scale readouts, and the History log.
- - The Variant buttons. They become Zoom style.
- - The Duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel, and Ease out goes, because it looked almost the same as Smooth.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Opening details · Galleries · Lightboxes · **Avoid on:** Step-by-step flows
-- **Prompt:**
-
- > Add a zoom transition to [the pages or views you want to move between]. When the page changes, scale the old and the new page while one fades out and the other fades in, so the change seems to move through depth rather than across the screen. Zooming in, where the new page grows into place, feels like going deeper; zooming out feels like stepping back; a pull-through, where the new page rushes in from larger, feels like traveling forward. Scale with transforms only, and keep the fade so no hard edge shows. If the visitor has reduced motion turned on, swap pages without scaling. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A zoom transition scales the pages as they fade, so the change seems to move through depth rather than across the screen. The direction carries meaning: zooming in feels like arriving or going deeper, zooming out like backing away, and a pull-through — where the new page rushes in from larger and settles — feels like traveling forward.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Zoom style | Zoom in | Zoom in grows the new page from 75% as the old one shrinks to 90%; Zoom out grows the old page past the frame as it fades; Pull through shrinks the old page to 70% while the new one settles from 130% |
- | Speed | Normal | How long the zoom and the fade take: slow is 900ms, normal 550ms and fast 330ms |
- | Feel | Smooth | Smooth slows to a stop; Springy grows a little past full size and settles; Gentle eases in and out |
-
-- **README See also:** "Portal Zoom" becomes the page's real title.
- - [View Transitions API](../view-transitions-api/) — the browser can zoom pages too
- - [Portal / Tunnel Zoom](../portal-zoom/) — the next page opens out of a clicked circle
- - [Slide Transition](../slide-transition/) — pages move sideways instead
- - [Shared Element Transition](../shared-element-transition/) — one picture grows into the next page
-- **README How it works:**
- - The first paragraph's "then on the next frame both transition" becomes "then both transition".
- - In the snippet, `requestAnimationFrame(()=>requestAnimationFrame(()=>{` and its closing `}));` go. A reflow line goes in their place, before the three lines they held:
-
- ```js
- void n.offsetWidth; // commit the start scales
- ```
-
- - The last paragraph's "and the double `requestAnimationFrame` ensures the start scale is painted before the transition kicks off" becomes "and reading `offsetWidth` makes the browser apply the start scale before the transition begins".
-- **README Production notes:** unchanged, except the library line (the last bullet), which now reads: "the View Transitions API can zoom with `scale` keyframes on `::view-transition-old`/`-new` (the Zoom style of the View Transitions API demo). Framer Motion's `scale` variants in `AnimatePresence` and GSAP's `scale` tweens express the same scale-plus-fade." Before, it said the API "ships a zoom style" and listed "Next.js transitions"; neither is a zoom of its own.
-- **Category line:** `03.06 · Page Transitions`
-- **Pager:** Previous: Slide Transition (`../slide-transition/`) · Next: Flash / Light Leak Transition (`../flash-transition/`)
-- **Final fix wave:** `rest()` sets `inert` on a page that is not on show, so a screen reader reads only the page on show and Tab cannot enter a hidden one. The name of the page on show carries `aria-current="page"` and the other two `"false"` (`updateNav`). The README's library line is corrected, as recorded under Production notes above.
-
----
-
-## flash-transition — Flash / Light Leak Transition
-
-- **Kind:** do it. The visitor clicks a page name; a flash hides the change.
-- **Description:** A burst of light hides the moment the page changes. Best for bold, lively sites.
-- **Step 1:** Click it · help line: "Click Work or About at the top of the box, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run goes from Home to Work, then back to Home 1200ms after the flash has faded (the `flashOut` timer): about 2.2s.
- - That is two flashes about 1.7s apart, well under the limit of three flashes a second.
- - `hb:input` cancels the way back.
-- **Reset:** yes. Home at once. The overlay's transition is turned off, its opacity set to 0 and `blur-on` removed.
-- **Slow motion:** multiplies `flashIn` and `flashOut` by 3, along with their timers.
-- **Flash rate:** never more than two flashes a second, however the visitor presses (WCAG 2.3.1, level A, allows three; the floor keeps a margin, because a flash that Show me or Reset cuts short peaks where it is cut, which can bring the peaks of two flashes closer together than their starts).
- - No rise starts less than 500ms after the previous rise began (`MIN_CYCLE`). The page keeps the time of the last rise (`lastRise`).
- - A change asked for sooner waits, with the overlay at 0 and the pages unchanged, and its rise starts when the 500ms are over. `settle()` cancels a waiting rise, and the next change measures from the same `lastRise`, so no input can start two rises too close together. This covers page names, Show me (clicked, or held with the key repeating) and Reset followed by a page name.
- - `settle()` still puts the demo at rest at once (the overlay is at 0 immediately); only a new rise waits. A waiting rise belongs to the change under way, so `hb:input` does not cancel it.
- - In normal use the wait is not noticed: a page name clicked after a flash has ended never waits at Normal (520ms a flash) or Slow (830ms), a Show me run holds 1200ms between its flashes, and at Fast (310ms a flash) a page name clicked right after a flash waits at most 190ms. It matters when Show me or Reset is pressed over and over, or a page name is clicked during a flash they cut short. The fade-out timer stays `flashOut`.
-- **Reduced motion:** the demo's rule `#flash-overlay{display:none}` and its `motionOk` branch stay: the pages swap at once with no flash. Show me swaps to Work and back.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav, the page area and `#flash-overlay` stay.
- - The frame this demo waited for before the fade-out goes: at the peak, the page swap and the fade-out happen in the same timer callback. The fade-out's own `transition` is set in the same step as its new opacity, which is enough for the browser to use it.
- - The pages keep their own sizes (`.ph` up to 40px, `.pp` 13px at `.55`, 5.7:1).
- - The old phone rule `.stage{flex:0 0 auto}` goes with the old layout.
- - `.pstat b` stays `var(--ui-accent)`.
- - Unused variables: `--flash-in` and `--flash-out` go; `--flash-color` stays.
- - Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Flash color | Swatches (these four, each with its name as its `aria-label`) | White · Gold · Cyan · Red | White | White looks like a camera flash; colors, a light leak. | `--flash-color`: `#ffffff` / `#f5d78e` / `#7ae8f0` / `#f07a7a` |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the flash rises and fades. | `flashIn`: 320 / 200 / 120 and `flashOut`: 510 / 320 / 190 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Flash strength | Choice buttons | Full · Strong · Soft | Full | Below full, the page change shows through. | `intensity`: 1 / 0.75 / 0.5 |
-| Blurs the flash | Switch | on / off | off | Softens the flash's edges into a glow. | `blurTog.checked`: the overlay gets `blur-on` during the flash / does not |
-
-- **Removed:**
- - The note.
- - The Page and Stage readouts, the enter, peak and exit timeline, and the History log.
- - The four colour squares, which were `div`s with `role="button"`. They become the Flash color swatches, which are real buttons.
- - The Flash-in duration and Flash-out duration sliders. They become Speed, which keeps the fade 1.6 times as long as the rise.
- - The Intensity slider. It becomes Flash strength.
- - "Add blur during flash". It becomes Blurs the flash.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Product launches · Music and fashion · Photo stories · **Avoid on:** Frequent page changes · Calm sites
-- **Prompt:**
-
- > Add a flash transition to [the pages or scenes you want to switch between]. Cover the content with a full-size colored layer that rises to its peak, swap the page while it is covered, then fade the layer away to reveal the new page, like a burst of light hiding a cut in a film. At full strength the change is completely hidden. Let the fade-out take a little longer than the rise. Keep flashes rare, never several in one second, to protect people who are sensitive to flashing light. If the visitor has reduced motion turned on, switch pages with no flash. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A flash transition hides a page change inside a burst of light. A colored layer covers the page and rises to full strength, the page is swapped while it is covered, and the layer then fades away to reveal the new page. The eye reads it as one bright moment, so the swap itself is never seen — the same trick films use to hide a cut.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Flash color | White | White reads as a camera flash; gold, cyan and red read as a colored light leak |
- | Speed | Normal | How fast the flash rises and fades: slow is 320ms up and 510ms down, normal 200ms and 320ms, fast 120ms and 190ms; the fade is always a little longer than the rise |
- | Flash strength | Full | How solid the flash gets: full hides the page change completely; strong (75%) and soft (50%) let it show through |
- | Blurs the flash | off | Softens the flash's edges into a glow |
-
-- **README See also:** "Crossfade" and "Dissolve" become the pages' real titles.
- - [Crossfade Transition](../crossfade/) — the plain fade this dresses up
- - [Dissolve Transition](../dissolve/) — tiles hide the change instead
- - [Blur Transition](../blur-transition/) — a blur hides the change instead
- - [Portal / Tunnel Zoom](../portal-zoom/) — the next page opens out of a clicked circle
-- **README How it works:**
- - In the snippet, the `requestAnimationFrame(() => {` line and its closing `});` go. The two fade-out lines they held stay in the timer callback, right after the page swap.
- - The sentence "The swap is deferred to a `requestAnimationFrame` after the class change so the browser commits the new transition before starting the fade-out." becomes "The fade-out sets its own transition in the same step as the new opacity, so it runs over `flashOut` rather than `flashIn`."
- - One sentence follows it: "No flash starts less than half a second after the previous one began, whatever is pressed (page names, Show me or Reset), so the demo never flashes more than twice a second; a change asked for sooner waits for that moment with the overlay clear."
- - The snippet also follows the page's signature and glow: the function is `doTransition(prev, next, flashIn, flashOut)` (the page passes the two times it read when the flash started, three times as long in slow motion), and two `blur-on` lines are added, `flashEl.classList.toggle('blur-on', blurTog.checked); // the optional glow` right after the rise's `transition` line and `flashEl.classList.remove('blur-on');` after the fade-out's opacity line.
-- **README Production notes:** unchanged
-- **Category line:** `03.07 · Page Transitions`
-- **Pager:** Previous: Zoom Transition (`../zoom-transition/`) · Next: Blur Transition (`../blur-transition/`)
-- **Final fix wave:** the name of the page on show carries `aria-current="page"` and the other two `"false"`, set by `updateNav()` (the same function as Dissolve's), so a screen reader hears which page is shown. In this sheet, the flash-rate line now says that a page name clicked after a flash has ended never waits, and a README bullet records the snippet's signature and its `blur-on` lines.
-
----
-
-## blur-transition — Blur Transition
-
-- **Kind:** do it. The visitor clicks a page name; the pages blur across.
-- **Description:** The old page blurs away and the new one comes into focus. Best for photo sites.
-- **Step 1:** Click it · help line: "Click Work or About at the top of the box, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run goes from Home to Work, then back to Home 1200ms after the new page is sharp (the `dur+50` timer): about 2.9s.
- - `hb:input` cancels the way back.
-- **Reset:** yes. Home at once.
-- **Slow motion:** multiplies `dur` by 3: both halves, the swap point, and the timers.
-- **Reduced motion:** the demo's rule `.page{transition:none!important;filter:none!important}` and its `motionOk` branch stay: the pages swap at once, sharp. Show me swaps to Work and back.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav and the page area stay.
- - The frame loop `trackBlur()` that fed the blur readout goes.
- - `.pstat b` stays `var(--ui-accent)`.
- - Unused variables: `--dur`, `--ease` and `--max-blur` go.
- - Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| How blurry it gets | Choice buttons | Slight · Medium · Heavy | Medium | Heavy blur is costly for the browser to draw. | `maxBlur`: 8 / 20 / 35 (px) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long each half, blurring and sharpening, takes. | `dur`: 650 / 400 / 250 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Fades as it blurs | Switch | on / off | on | Fading as well hides the moment the pages swap. | `fadeTog.checked`: the pages fade as they blur / only blur |
-| Overlaps the two halves | Switch | on / off | off | The new page sharpens while the old one still blurs. | `overlapTog.checked`: the swap comes at half of Speed / at the end of the blur |
-| Feel | Choice buttons | Smooth · Gentle · Even | Gentle | Gentle feels like a camera pulling focus. | `ease`: `ease-out` / `ease-in-out` / `linear` (replaces `easeSel.value`) |
-
-- **Removed:**
- - The note.
- - The Page and Blur readouts, the frame loop that updated them, and the History log.
- - The Max blur slider. It becomes How blurry it gets, with the steps of Blur In.
- - The Stage duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel.
- - "Overlap stages (faster)" and "Blur + fade (vs blur only)". They become the two switches.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Photo sites · Film and editorial · Portfolios · **Avoid on:** Self-playing slideshows · Low-end phones
-- **Prompt:**
-
- > Add a blur transition to [the pages or views you want to switch between]. When the page changes, blur the old page until it is out of focus, bring in the new page just as blurred, then sharpen it into focus, like a camera pulling focus from one subject to another. Fading while blurring hides the moment of the swap. Blur is costly for the browser to draw, so use it only on changes the visitor starts, never on anything that repeats by itself, and remove the blur completely when it ends. If the visitor has reduced motion turned on, switch pages without blurring. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A blur transition takes the old page out of focus until it disappears, then brings the new page in from a blur to sharp. It looks like a camera pulling focus from one subject to another, so the change reads as a shift of attention rather than a hard cut.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | How blurry it gets | Medium | How much the pages blur at the midpoint: slight is 8px, medium 20px and heavy 35px; above about 30px it is heavy for the browser and can look muddy |
- | Speed | Normal | How long each half takes, blurring out and then sharpening in: slow is 650ms, normal 400ms and fast 250ms |
- | Fades as it blurs | on | Fades each page as it blurs, which hides the swap; off, the pages stay solid and only blur |
- | Overlaps the two halves | off | Starts sharpening the new page halfway through the blur, so the change takes a quarter less time |
- | Feel | Gentle | Gentle feels like a controlled focus pull; Smooth snaps into focus sooner; Even keeps one steady pace |
-
-- **README See also:** "Crossfade", "Flash / Light Leak" and "Dissolve" become the pages' real titles.
- - [Crossfade Transition](../crossfade/) — the plain fade underneath the blur
- - [Flash / Light Leak Transition](../flash-transition/) — a burst of light hides the change
- - [Dissolve Transition](../dissolve/) — tiles hide the change
- - [Zoom Transition](../zoom-transition/) — scale shifts attention instead of focus
-- **README How it works:**
- - "forced to commit over two animation frames, and only then animated to sharp" becomes "forced to commit with a reflow, and only then animated to sharp".
- - In the snippet, the `requestAnimationFrame(() => requestAnimationFrame(() => {` line and its closing `}));` go. A reflow line goes in their place, before the two lines they held:
-
- ```js
- void n.offsetWidth; // commit the blurred start
- ```
-
- - The sentence "An "overlap" option starts the incoming sharpen at 50% of the outgoing blur instead of waiting for it to finish, cutting the total time roughly in half while the two stages cross." becomes "The Overlaps the two halves setting starts the incoming sharpen at 50% of the outgoing blur instead of waiting for it to finish, cutting the total time by about a quarter while the two halves cross."
- - The snippet also follows the page's signature and settings:
- - The function is `doTransition(prev, next, dur, ease, maxBlur)`: the page passes the three values it read when the change started (`dur` three times as long in slow motion).
- - It reads the two switches with `const withFade = fadeTog.checked, overlap = overlapTog.checked;` (the snippet used both names without defining them), and builds one string for both pages' `transition`: ``const t = `filter ${dur}ms ${ease}` + (withFade ? `, opacity ${dur}ms ${ease}` : '');``. Opacity is in it only when the pages fade. `o.style.transition = t;` and `n.style.transition = t;` replace the two fixed strings, which always named opacity.
- - At the swap the old page also gets `o.style.opacity = '0'`, on the line with `o.classList.remove('active');`, as the page does.
-- **README Production notes:** the bullet "**The double `requestAnimationFrame`.** …" becomes "**Commit the start state.** Setting the pre-blur with `transition: none` and then turning the transition on needs a forced reflow in between (reading `offsetWidth`); without it the browser merges the two writes and the page pops in sharp." The rest is unchanged.
-- **Category line:** `03.08 · Page Transitions`
-- **Pager:** Previous: Flash / Light Leak Transition (`../flash-transition/`) · Next: Elastic Transition (`../elastic-transition/`)
-- **Final fix wave:** the name of the page on show carries `aria-current="page"` and the other two `"false"`, set by `updateNav()` (the same function as Dissolve's), so a screen reader hears which page is shown. In this sheet, a README bullet now records the snippet as the page has it.
-
----
-
-## elastic-transition — Elastic Transition
-
-- **Kind:** do it. The visitor clicks a page name; the new page springs into place.
-- **Description:** The new page slides in, goes too far and springs back. Best for playful apps.
-- **Step 1:** Click it · help line: "Click Work or About at the top of the box, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run goes from Home to Work and holds 1200ms after the transition ends (the `dur+50` timer on the planned path, or the moment the live spring settles), then goes back to Home.
- - This takes about 3.1s either way: the planned path's bounce lasts 900ms at Normal (its end timer waits 950ms), and at Normal and Medium the live spring settles in about 0.8s after its 100ms start delay.
- - `hb:input` cancels the way back.
- - The spring's frame id `rafId` and its 100ms start timer, now kept at page level and started through `later()`, let `settle()` stop a spring under way.
-- **Reset:** yes. Home at once.
-- **Slow motion:**
- - Planned path: the keyframe animations' `dur` and the timer that waits for them are multiplied by 3.
- - Live spring: the old page's 300ms slide-out and the 100ms start delay are multiplied by 3, and the time each frame adds to the spring is divided by 3 (after its 50ms limit), so the spring makes the same bounce three times slower.
-- **Reduced motion:** the demo's rule `.page{transition:none!important;animation:none!important}` and its `motionOk` branch stay: the pages swap at once. Show me swaps to Work and back.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav and the page area stay, and so does the `<style id="kf-style">` the planned path writes its keyframes into.
- - The spring graph canvas goes.
- - `.pstat b` stays `var(--ui-accent)`.
- - Unused variables: none.
- - Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| How it bounces | Choice buttons | Planned path · Live spring | Planned path | A planned path is cheap; a live spring feels more physical. | `mode`: `'css'` / `'spring'` |
-| Bounce size | Choice buttons | Small · Medium · Large | Medium | How far the page goes past its place before settling. | planned path: `overshoot` 30 / 60 / 100 (passed to `buildKF()`); live spring: `damping` from the table below |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How quickly the page springs into place. | planned path: `dur` 1400 / 900 / 550 (ms); live spring: `stiffness` 75 / 200 / 640 |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-Live-spring stiffness and damping, measured with the demo's own spring loop. The loop moves the spring in fixed steps of 1/120 s: each frame adds the time since the last one to a running total (at most 50ms, and a third of it in slow motion; the first frame adds none) and takes as many steps as that covers, at most 8, and the loop stops when position and speed are both under 0.5. Stepping the spring in whole steps calms it more than the textbook formula predicts, so each value was found by running the loop. The stiffness is 75, 200 and 640 for Slow, Normal and Fast (it was 70, 180 and 500), and the damping is in the table (one decimal now). The values were found so that the overshoot at 60 frames a second stays where the earlier one-step-per-frame loop had it (Small 2.6, 3.5 and 3.9%, Medium 8.1, 7.2 and 7.9%, Large 12.0, 12.3 and 11.2%, at Slow, Normal and Fast; each new value is within about 0.1 point of these), about as far past its place as the planned path goes for the same size (3.6%, 7.2% and 12% of the width); the overshoot it gives is in brackets. The spring settles within 1.3s. Normal and Medium are 200 and 17.4: they give the bounce that the owner-decided 180 and 16 gave the one-step-per-frame loop (today's 20 goes only 1.1% past its place, which barely shows). The bounce is now the same at any frame rate: at 30, 48, 72, 90, 120, 144, 165 and 240 frames a second, and in slow motion, each overshoot is within 0.4 point of the one in brackets. The damping lies inside the old sliders' range (5–50); the stiffness lies inside theirs (50–500) except for Fast, whose 640 is above it.
-
-| Bounce size | Slow (75) | Normal (200) | Fast (640) |
-|---|---|---|---|
-| Small | 12.8 (2.5%) | 19.7 (3.6%) | 33.6 (3.9%) |
-| Medium | 10.6 (8.0%) | 17.4 (7.3%) | 29.7 (7.9%) |
-| Large | 9.5 (12.0%) | 15.2 (12.3%) | 27.2 (11.2%) |
-
-- **Removed:**
- - The note.
- - The Page readout and the History log.
- - The Mode buttons. They become How it bounces.
- - The Overshoot intensity and Duration sliders, and the Stiffness and Damping sliders. Bounce size and Speed now set both ways of bouncing, so no setting has to hide when the other way is chosen.
- - The spring graph, a readout.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Playful apps · Panels and drawers · Games · **Avoid on:** Formal sites
-- **Prompt:**
-
- > Add an elastic transition to [the pages or panels you want to move between]. The new page should slide in from the side, go a little past its place and spring back before settling, as if pulled by a rubber band, while the old page slides away. The bounce can be planned ahead as a fixed path, which is cheap, or worked out live with a simple spring, which can react if the visitor interrupts it; with a live spring, advance it in small fixed time steps so it moves the same on every screen, and limit the time one frame adds so a slow frame cannot throw it off. If the visitor has reduced motion turned on, switch pages without movement. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > An elastic transition slides the new page in so that it goes a little past its place and springs back before settling, instead of easing to a stop. The overshoot gives the movement weight, as if the page were pulled into place by a rubber band. The bounce can be planned ahead as a fixed path, which is cheap, or worked out live by simulating a spring, which feels physical.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | How it bounces | Planned path | A planned path plays a bounce decided in advance, which is cheap; a live spring works out the movement in small fixed time steps, which feels physical and can react to interruptions |
- | Bounce size | Medium | How far the page goes past its place before settling; with a live spring, a bigger bounce means less damping, so it swings for longer |
- | Speed | Normal | How quickly it settles: on the planned path slow is 1400ms, normal 900ms and fast 550ms; with a live spring, a faster speed is a stiffer spring |
-
-- **README See also:**
- - [Slide Transition](../slide-transition/) — the plain slide this adds a spring to
- - [Zoom Transition](../zoom-transition/) — pages move in depth instead
- - [FLIP Technique](../flip-technique/) — elements glide to their new places
- - [Morph Transition](../morph-transition/) — a shape changes between pages
-- **README How it works:**
- - The first paragraph names the two ways as on the page: "This demo offers two modes. The CSS mode writes" becomes "This demo offers two ways to bounce. The planned path writes"; "with the overshoot amount scaled by a control" becomes "with the overshoot amount set by Bounce size"; and "The JS mode integrates" becomes "The live spring integrates an actual spring in fixed steps of 1/120 of a second: force equals `-stiffness × displacement − damping × velocity`, each frame takes as many steps as the time that has passed needs, and the loop runs until both position and velocity fall below a threshold."
- - In the snippet, `let pos = -100, vel = 0, target = 0; // start off-screen right` becomes `let pos = 100, vel = 0, target = 0; // start off-screen right`, as in the demo.
- - The snippet's `doSpring` line reads `function doSpring(o, n, stiffness, damping) {`, the names the page gives the old and the new page plus the two spring values it reads (so the snippet runs as written); a `const STEP = 1 / 120;` line comes before it. It read `function doSpring(prev, next) {`, so the `n` the loop moves was not defined.
- - In the last paragraph, the sentence "The `dt` is clamped to 50ms so a dropped frame or a backgrounded tab cannot inject a huge time step that would make the spring explode." is replaced by "A frame adds the time since the last one to `acc`, never more than 50ms, which keeps the spring from jumping ahead after a pause, a slow frame or a backgrounded tab, and then spends it in whole steps. The first frame adds nothing, because there is no earlier frame to measure from. The last step can end a little after the frame, so the page is drawn between the last two steps, at the frame's own time; a frame that fits no whole step still moves the page.", and the sentence "Recorded positions are plotted to a small canvas so the overshoot-and-settle curve is visible." is replaced by: "On the demo page, Speed and Bounce size set both ways of bouncing: the planned path's length (1400, 900 or 550ms) and overshoot (30, 60 or 100), or the live spring's stiffness (75, 200 or 640) and damping. These values were found by running this loop, so the spring goes about as far past its place as the planned path does (about 3.6%, 7.2% and 12% of the width). Stepping the spring in whole steps calms it more than the usual spring formula expects, so the values were measured rather than worked out."
-- **README Production notes:** the "**Clamp the time step.**" bullet becomes "**Clamp the time a frame adds.** One step of the raw frame delta is the classic spring bug: after one long frame `pos` shoots to infinity. Fixed steps avoid that, but the time a frame adds still needs a limit: added whole, a pause or a slow frame would make the spring jump ahead, and the bounce would be over in one frame. The 50ms clamp (`0.05` seconds in the snippet) keeps it moving on from where it was, and it also keeps a frame to a handful of steps.", and a bullet goes in after it: "**Frame rate.** The demo moves its spring in fixed steps of 1/120 of a second, as many as the time that has passed needs, so it bounces the same at any frame rate. A spring that takes one step per frame does not: at 30 frames a second a small bounce hardly shows, and at 120 it is a little larger. Draw the page between the last two steps, or a frame that fits no whole step shows the spring standing still." The rest is unchanged.
-- **Category line:** `03.09 · Page Transitions`
-- **Pager:** Previous: Blur Transition (`../blur-transition/`) · Next: Portal / Tunnel Zoom (`../portal-zoom/`)
-- **Final fix wave:** `rest()` sets `inert` on a page that is not on show, so a screen reader reads only the page on show and Tab cannot enter a hidden one; the planned path and the live spring both end in `rest()`. The name of the page on show carries `aria-current="page"` and the other two `"false"` (`updateNav`).
-- **Frame-rate fix (wrap-up):** the live spring moves in fixed steps of 1/120 s, so its bounce is the same at any frame rate. Each frame adds the time since the last one to `acc` (`Math.min(now - lastTime, 50) / 1000`, divided by 3 in slow motion; the first frame adds none) and `tick` takes as many steps as `acc` covers, at most 8, dropping the time left if that limit is reached; the last step can end a little after the frame, so the page is drawn between the last two steps (`shown = pos + (before - pos) * (-acc / STEP)`). The stiffness is now 75 / 200 / 640 and the damping table is measured again (above), so the overshoot at 60 Hz is within about 0.1 point of the one-step-per-frame table, and at any other rate within 0.4 point. Slow motion is now the normal bounce three times slower; before, its smaller steps made it bounce more (Small with Normal: 5.1% in slow motion, 3.6% now, the same as at normal speed). README: the snippet and its paragraph in How it works, the How it bounces row of Key parameters, and the Production notes on the time a frame adds and on the frame rate. The prompt says the spring advances "in small fixed time steps" and that the time one frame adds is limited.
-
----
-
-## portal-zoom — Portal / Tunnel Zoom
-
-- **Kind:** do it. The visitor clicks a portal or a page name; the next page opens out of it.
-- **Description:** The next page opens out of a circle you click. Best for big reveals.
-- **Step 1:** Click it · help line: "Click the round portal or a page name, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run clicks the portal of the page on show: the next page opens out of it. On arrival that is Home's portal, "Enter gallery", which opens the Gallery page.
- - 1200ms after the opening ends (the `dur+50` timer), it goes back to the page it started from the way a click on that page's name does, with the circle opening from the middle of the page area.
- - This takes about 3.7s.
- - `hb:input` cancels the way back.
- - A visitor who tabs into the box during a run takes over too. Shift+Tab from Show me lands on the portal of the page on show, and that sends no `hb:input`, so a trusted `focusin` on the stage does the same job: it clears `afterMove` and the way-back timer and the visitor's focus stays where they put it. The page's own focus move (see Stage) is wrapped in an `ownFocus` flag that this listener ignores, because a script's `focus()` sends a trusted `focusin` too; without the flag that move would stop the run after its first opening.
-- **Reset:** yes. Home at once; every page's `clipPath`, `transition` and `zIndex` are cleared.
-- **Slow motion:** multiplies `dur` by 3, along with that part of the timer.
-- **Reduced motion:** the demo's `motionOk` branch stays: the pages swap at once. Its CSS rule `#zoom-mask{transition:none!important}` goes with the mask. Show me swaps to Gallery and back.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav, the page area and each page's portal stay.
- - The unused `#zoom-mask` goes, with its CSS and its `--dur` and `--ease` variables. It never shows: the reveal is the incoming page's own `clip-path`.
- - **The portal moves to the top-right corner.** In the shorter shared stage its old bottom-right spot covers the Gallery grid (the grid reaches 226px of the laptop's 260px page area, and the portal starts at 148px). Its position and size move from the inline style into the `.portal` rule, and only the page's portal colour stays inline:
- - computers and tablets: `top:24px;right:24px;width:80px;height:80px`;
- - phones and short windows (`@media (max-width:600px),(max-height:640px)`): `top:16px;right:16px;width:64px;height:64px`;
- - short windows wider than a phone (`@media (max-height:640px) and (min-width:601px)`): `top:8px`, because the page area there is about 190 to 245px (193px at 1280×590, 243px at 1280×640). A phone up to 640px tall, upright or sideways, keeps its 16px; measured, the circle stays at least 24px from any text or tile at 320px wide, 48.8px at 360×640 and 51.5px at 568×320. Every short window (`@media (max-height:640px)`) also tightens the pages' spacing, `.pc{gap:8px}.gi{padding:12px}`.
- - The portal's label moves from its inline style (9px at `opacity:.6`) into the existing, unused `.portal-label` rule, which becomes `font-size:11px;opacity:.8;text-align:center;padding:4px;line-height:1.3;pointer-events:none`: 4.1:1 on the Gallery portal becomes 5.9:1.
- - The Home page keeps its line "Click the portal to travel to the gallery."
- - `--hb-stage-h-phone:360px`: at 320px wide, the About heading reaches under a top-right portal on the 300px stage; 360px clears it.
- - **Each portal is a real button:** `<button type="button" class="portal">` (it was a `div`), with `color:inherit;font:inherit` so its label looks as before. It is in the Tab order, Enter and Space open the next page, and the site's focus ring shows on it.
- - **Pages that are not on show are `visibility:hidden`** (with `opacity:0` and `pointer-events:none`), so the portal on such a page is not a Tab stop and not in the accessibility tree. A page is visible again the moment it gets `active`, which is when its opening starts.
- - **Focus follows the opening.** When an opening ends and the focus was on the portal of the page that is now hidden, `finish()` moves it to the portal of the page on show, so a keyboard visitor keeps their place. The move sits between `ownFocus=true` and `ownFocus=false` (see Show me).
- - **Reduced motion** also switches off the portal's hover grow (`transition:transform .2s ease`, on `@media (hover:hover)` only) with `@media (prefers-reduced-motion:reduce){.portal{transition:none}}`.
- - `.pstat b` stays `var(--ui-accent)`.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Portal shape | Choice buttons | Circle · Square | Circle | A circle feels like a tunnel; a square like a window. | `shape`: `'circle'` / `'square'` (read at each navigation in place of `shapeSel.value`) |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | Slower reads as travel; too fast looks like a wipe. | `dur`: 1900 / 1200 / 700 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Feel | Choice buttons | Speeds up · Smooth · Gentle · Even | Speeds up | Speeding up feels like diving in. | `ease`: `ease-in` / `ease-out` / `ease-in-out` / `linear` (replaces `easeSel.value`) |
-
-- **Removed:**
- - The note.
- - The Page and Portal readouts and the History log.
- - The Portal shape menu. It becomes choice buttons.
- - The Duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel.
- - The unused zoom mask.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Big reveals · Galleries · Story chapters · Calls to action · **Avoid on:** Everyday navigation
-- **Prompt:**
-
- > Add a portal transition to [the element that should open into the next page]. When the visitor clicks it, show the next page through an opening that starts as a point at the element's center and grows until the new page fills the view, as if diving through a window. Put the new page underneath first and only grow the visible opening, measuring the element's position at the moment of the click so the opening starts exactly there. Make the opening big enough at the end to reach the corners. If the visitor has reduced motion turned on, show the new page at once. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A portal zoom treats a small element on the page as a window into the next page. Clicking it opens a circle, or a square, from the element's center that grows until the new page fills the whole view, so it feels like diving through the portal rather than jumping to a new page. The new page is already there underneath; the growing opening only reveals it.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Portal shape | Circle | A circle feels like a tunnel; a square opens like a window |
- | Speed | Normal | How long the opening takes to fill the view: slow is 1900ms, normal 1200ms and fast 700ms; too fast and it becomes a plain wipe |
- | Feel | Speeds up | Speeds up feels like diving in; Smooth slows at the end, like pulling back; Gentle eases in and out; Even keeps one steady pace |
-
-- **README See also:** "Flash / Light Leak" becomes the page's real title.
- - [Zoom Transition](../zoom-transition/) — the whole page scales instead
- - [Shared Element Transition](../shared-element-transition/) — a picture grows into the next page
- - [Flash / Light Leak Transition](../flash-transition/) — a burst of light hides the change
- - [Morph Transition](../morph-transition/) — a shape changes between pages
-- **README How it works:** in the snippet, `easeSel.value` becomes `ease`. The rest is unchanged.
-- **README Production notes:** unchanged
-- **Category line:** `03.10 · Page Transitions`
-- **Pager:** Previous: Elastic Transition (`../elastic-transition/`) · Next: Dissolve Transition (`../dissolve/`)
-- **Final fix wave:** three changes to the page. The name of the page on show carries `aria-current="page"` and the other two `"false"`, set by `updateNav()` (the same function as Dissolve's). A trusted `focusin` on the stage stops a Show me run, with the `ownFocus` flag around the page's own `focus()`. The rule that lifts the portal to 8px from the top now applies only to short windows wider than 600px, so a phone up to 640px tall, upright or sideways, keeps the portal at 16px (it had 8px).
-
----
-
-## dissolve — Dissolve Transition
-
-- **Kind:** do it. The visitor clicks a page name; tiles dissolve the old page.
-- **Description:** The page breaks into tiles that give way to the next. Best for photo galleries.
-- **Step 1:** Click it · help line: "Click Work or About at the top of the box, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - The run goes from Home to Work, then back to Home 1200ms after the transition ends. It ends at the swap, or when the tiles have faded away if Dissolves both ways is on.
- - This takes about 2.2s, or 2.9s with Dissolves both ways.
- - `hb:input` cancels the way back.
-- **Reset:** yes. Home at once, with the tile overlay emptied.
-- **Slow motion:** multiplies `dur` by 3, which stretches the tiles' fades and delays, the swap point, and the clean-up timer.
-- **Phones:** the 256 tiles of Small make the frame that starts a dissolve take 50 to 120ms of the page's own work at 4× CPU on a 375px phone, a freeze of about nine frames, so CLAUDE.md's reduced-quality fallback applies. On a phone (the lane's rule: a viewport up to 600px wide or up to 500px tall, a sideways phone included) Small draws a 10 by 10 grid; Medium and Large stay as they are, and computers and tablets keep 16 by 16. `doDissolve()` reads it when the dissolve starts: `const n=matchMedia('(max-width:600px),(max-height:500px)').matches?Math.min(gran,10):gran;`, and passes `n` to `buildTiles()`.
-- **Reduced motion:** the demo's rule `.page{transition:opacity 300ms linear}.dtile{transition:none!important}` and its `motionOk` branch stay: the pages cross in a plain 300ms fade, with no tiles. Show me fades to Work and back.
-- **Stage font:** site font.
-- **Stage:**
- - The mini nav, the page area and the tile overlay stay.
- - No teaching outline on the tiles.
- - `.pstat b` stays `var(--ui-accent)`.
- - Unused variables: none.
- - Default height.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Pattern | Choice buttons | Random · Diagonal · From the middle | Random | The order in which the tiles appear. | `pattern`: `'random'` / `'diagonal'` / `'radial'` (read by `getDelays()` in place of `styleSel.value`) |
-| Tile size | Choice buttons | Small · Medium · Large | Medium | Small tiles look like grain; large ones like blocks. | `gran`: 16 / 8 / 4 (tiles on each side); on a phone Small draws 10 (see Phones), read as `n` when a dissolve starts |
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the tiles take to cover the page. | `dur`: 1300 / 800 / 500 (ms) |
-
-**More options**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Dissolves both ways | Switch | on / off | off | The tiles also fade away to reveal the new page. | `biTog.checked`: after the swap, the tiles fade out in the same pattern / vanish at once |
-
-- **Removed:**
- - The note.
- - The Page readout and the History log.
- - The Dissolve style menu. It becomes Pattern.
- - The Granularity slider. It becomes Tile size.
- - The Duration slider. It becomes Speed.
- - "Dissolve in + out (both stages)". It becomes Dissolves both ways.
- - "Show tile mask", a teaching overlay that outlined each tile in red.
- - "← Return to Home". Reset replaces it.
-- **Good for:** Photo galleries · Slideshows · Retro and game sites · **Avoid on:** Everyday navigation
-- **Prompt:**
-
- > Add a dissolve transition to [the pages or images you want to switch between]. Lay a grid of tiles over the old page and fade each tile in at a slightly different moment, following a pattern such as random, a diagonal sweep or rings from the middle, so the old page breaks up instead of fading evenly. Swap the page while the tiles cover it, then remove the tiles, or fade them away in the same pattern to reveal the new page. Give each tile its own delay and let the browser run the fades. If the visitor has reduced motion turned on, use a short, plain fade instead. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > A dissolve breaks a page change into a grid of tiles. Each tile fades in over the old page at a slightly different moment, so the old page seems to break up into grain or blocks rather than fading evenly. The order of the tiles — random, a diagonal sweep or rings from the middle — gives the dissolve its texture.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Pattern | Random | The order the tiles appear in: random looks like grain, diagonal sweeps from one corner, and from the middle spreads out in rings |
- | Tile size | Medium | How big the tiles are: small is a 16 by 16 grid (10 by 10 on phones), medium 8 by 8 and large 4 by 4; small tiles come close to a smooth fade |
- | Speed | Normal | How long the tiles take: slow is 1300ms, normal 800ms and fast 500ms; the page swaps at 60% of it, under the tiles |
- | Dissolves both ways | off | Also fades the tiles away in the same pattern to reveal the new page, instead of removing them at once |
-
-- **README See also:** "Crossfade" and "Flash / Light Leak" become the pages' real titles.
- - [Crossfade Transition](../crossfade/) — an even fade with no tiles
- - [Flash / Light Leak Transition](../flash-transition/) — a burst of light hides the change
- - [Blur Transition](../blur-transition/) — a blur hides the change
- - [Slide Transition](../slide-transition/) — pages move instead of dissolving
-- **README How it works:** the radial part of the snippet does not match the demo, which was corrected so the corners land at 1. Replace the radial part at the end of `getDelays()` (the comment `// radial: distance from the grid center` and the `return` under it) with:
-
- ```js
- // radial: tile-centre distance, normalised so the corners land at 1
- return Array.from({length: total}, (_, i) => {
- const r = Math.floor(i / n) - (n - 1) / 2, c = i % n - (n - 1) / 2;
- return Math.sqrt(r * r + c * c) / (Math.SQRT2 * (n - 1) / 2);
- });
- ```
-
- The rest is unchanged.
-- **README Production notes:** the bullet "**Tile count is a cost knob.**" is rewritten, because "still cheap" contradicted the phone cap (see Phones). It becomes "**Tile count is a cost knob.** A 16×16 grid is 256 animated elements. The fades themselves are cheap, because each tile only transitions `opacity`, but creating and styling that many elements makes the frame that starts the dissolve slow on phones, so the demo draws Small as 10×10 there. Much finer grids also cost layout and memory; beyond ~24×24 a canvas or a noise-texture mask is a better tool." The rest is unchanged.
-- **Category line:** `03.11 · Page Transitions`
-- **Pager:** Previous: Portal / Tunnel Zoom (`../portal-zoom/`) · Next: FLIP Technique (`../flip-technique/`)
-- **Final fix wave:** the page is unchanged; only the README's Production notes bullet on tile count was corrected, as recorded above.
-
----
-
-## flip-technique — FLIP Technique
-
-- **Kind:** do it. The visitor clicks a layout button; the cards glide to their new places.
-- **Description:** Cards glide to their new places when the layout changes. Best for sorting lists.
-- **Step 1:** Click it · help line: "Click a button above the cards, or press Show me."
-- **Player bar:** Show me · Reset · Slow motion (page)
-- **Show me:**
- - `settle()` here clears every card's inline `transform` and `transition`, so the cards sit in their real places, and sets `animating=false`.
- - The run then sorts the cards by size, as the Sort by size button does: every card moves from the starting order. If the cards are already in that order, it sorts them by color instead.
- - 1200ms after the glide ends (the `dur+50` timer), the cards glide back to the order they had before the run, through the same `doFlip()`.
- - The run keeps the current column layout. It takes about 2.3s. The stage, and with it the player bar, keeps one height through the run in every layout (see the grid minimum below).
- - `hb:input` cancels the way back.
-- **Reset:** yes. The starting order (Atlas, Orbit, Prism, Lumen, Frame, Echo) in three columns, at once: `renderCards()` with no glide, and "3 columns" marked as the active layout.
-- **Slow motion:** multiplies `dur` by 3, along with that part of the timer.
-- **Reduced motion:** the demo's rule `.flip-card{transition:none!important}` and its `motionOk` branch stay: the cards jump to their new places. Show me sorts and restores them with no gliding.
-- **Stage font:** site font.
-- **Stage:**
- - The toolbar and the card grid stay; the Invert badges go (`.invert-badge` and each card's badge element).
- - Toolbar buttons (`.tb-btn`): 13px text, `padding:0 10px`, `min-height:44px` and `min-width:44px` at every size, in `var(--ui-muted)`; the active layout stays in the accent colour. `min-width:44px` matters for List, which is 42.9px wide without it. On phones narrower than 360px a spacing rule, `@media(max-width:359px){.stage-toolbar{gap:4px;padding:10px 8px}}`, keeps the six buttons on two lines (at 320px they take three without it).
- - Toolbar labels become plain words: "Shuffle", "Sort by color", "Sort by size", "3 columns", "2 columns", "List" (were "⟳ Shuffle", "3 cols", "2 cols"). The six fit on one line on computers and tablets and on two lines at 375 and 320px with those rules (measured).
- - `.card-meta` goes from `opacity:.5` to `.8`: 3.0:1 becomes 5.1:1 on the cards. `.card-num`, the large faint number, is decoration and stays.
- - **The cards get shorter** so the default layout fits the laptop's first screen: in `renderCards()`, 110px for tall cards and 86px for short ones (were 140px and 110px); list rows stay 56px.
- - `#card-grid` gets `min-height:var(--rows-h)`, with `--rows-h:230px`, the height of the three-column grid, and `--rows-h:350px` in two columns (`data-columns="2"`, which `renderCards()` sets on the grid), the height of that grid in the starting order, so a new order never changes the stage height. Sorted by size the two-column grid is only 326px: without its own minimum the player bar jumped up 24px when the first glide of a Show me run ended, and back down when the way back began. It also gets `align-content:start`. Without it the grid spreads any extra height over its rows. In a scratch grid in headless Chrome, a 440px min-height moved the second row from 120px down to 225px. Then Sort by size would space the rows apart, and the hold below would glide the cards to stretched rows and make them jump when it is released.
- - **`hb-grow` on the stage**, which replaces the old phone rule `.stage{height:auto;min-height:var(--stage-h)}`. 2 columns (350px of cards) and List (386px) are taller than any shared stage, so the stage grows while they are shown; the default three columns need 329px on a laptop. At 1366×657 that puts the player bar's bottom at about 651px, inside the 657px screen (measured with the shared stage).
- - **The grid keeps its height until a glide ends.** Otherwise a layout that gets shorter shrinks the stage at once (by 120px measured), and `.page-area{overflow:hidden}` clips the cards that start from the old lower rows:
- - 2 columns to 3: cards 5 and 6 start with 80 of their 86px and 104 of their 110px below the edge;
- - List to 3 columns: two cards start fully hidden;
- - List to 2 columns: the last card starts 74px hidden, because each card is drawn at its new size (here 110px) from its old list row.
-
- The hold is set in two steps:
- - In `doFlip()`, before `renderCards()`, set `grid.style.minHeight` to the grid's current height (`grid.offsetHeight + 'px'`), so the page never gets shorter mid-change.
- - After the Last measurements, raise it to the larger of two heights, if that is more than the grid now has: the lowest point any card starts its glide from (the card's old top, from First, measured from the grid's top, plus its new height), and the new layout's own minimum (`--rows-h`, read from the grid's computed style). List to 3 or 2 columns needs 440px, 54px more than the list; with the current height alone the last card would lose 38px for a few frames. The minimum matters when 2 columns is entered from a shorter layout with an order that is only 326px high: without it the stage would grow by 24px when the hold is released.
-
- With `align-content:start`, neither step moves a card. Clear the hold (`grid.style.minHeight=''`, back to the layout's own minimum, 230px or 350px) in the `dur+50` timer, in `settle()`, in Reset, and straight after `renderCards()` in the reduced-motion branch, where the cards jump at once. A layout that gets taller grows the stage at once, as before. A shorter one keeps the stage's height, or grows it for the glide, until the cards have landed, then the stage shrinks. No card is cut off at the bottom by the stage shrinking.
- - Unused variables: none.
-
-**Main settings**
-
-| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
-|---|---|---|---|---|---|
-| Speed | Choice buttons | Slow · Normal · Fast | Normal | How long the cards take to glide into place. | `dur`: 800 / 500 / 300 (ms) |
-| Feel | Choice buttons | Smooth · Springy · Even | Smooth | Springy goes a little past each place, then settles. | `ease`: `cubic-bezier(.2,.7,.3,1)` / `cubic-bezier(.34,1.56,.64,1)` / `linear` (replaces `easeSel.value`) |
-
-**More options**
-
-None: leave out the `details.hb-options` block.
-
-- **Removed:**
- - The note.
- - The Layout and FLIP step readouts.
- - The Duration slider. It becomes Speed.
- - The Easing menu. It becomes Feel, and Ease out goes, because it looked almost the same as Smooth.
- - "Show Invert step", a teaching overlay that labelled the cards "INVERTED".
- - "Reset layout". Reset replaces it.
-- **Good for:** Sorting and filtering · Card grids · Dashboards · Lists · **Avoid on:** Very long lists
-- **Prompt:**
-
- > Animate layout changes in [the grid or list you want to rearrange] with the FLIP technique. Before the change, record where every item is. Apply the new order or layout so the items jump to their new places. Then shift each item back to where it was with a transform, and animate that shift away so the items glide to their real places. Only transforms animate, so it stays smooth even with many items. Match items across the change by a stable id. If the visitor has reduced motion turned on, let the items jump to their new places without gliding. Match the settings listed below.
-
-- **README What it is:** rewritten:
-
- > FLIP, short for First, Last, Invert, Play, animates layout changes that CSS cannot animate by itself, such as sorting a grid or switching from columns to a list. The browser moves every item to its new place at once; each item is then shifted back to where it was and slides from there to its new place. It looks as if the items glide into the new layout, but only their position on screen is animated.
-
-- **README Key parameters:**
-
- | Parameter | Default | Effect |
- |-----------|---------|--------|
- | Speed | Normal | How long the cards take to glide: slow is 800ms, normal 500ms and fast 300ms; 300 to 600ms reads as deliberate |
- | Feel | Smooth | Smooth slows to a stop; Springy goes a little past each place and settles; Even keeps one steady pace |
-
-- **README See also:**
- - [Shared Element Transition](../shared-element-transition/) — the same method for one element across pages
- - [Morph Transition](../morph-transition/) — a shape changes instead of moving
- - [Elastic Transition](../elastic-transition/) — a springy finish to the movement
- - [View Transitions API](../view-transitions-api/) — the browser can animate layout changes itself
-- **README How it works:**
- - "**Play:** on the next frames, transition that transform to zero so the card glides to where it really is." becomes "**Play:** transition that transform to zero so the card glides to where it really is."
- - In the snippet, the PLAY block becomes:
-
- ```js
- // PLAY — apply the inverted positions, then animate the transform to zero
- grid.offsetWidth; // force reflow
- newCards.forEach(c => {
- c.style.transition = `transform ${dur}ms ${ease}`;
- c.style.transform = '';
- });
- ```
-
- - "The double `requestAnimationFrame` guarantees the inverted (start) state is committed before the transition to zero begins." becomes "Reading `offsetWidth` between Invert and Play makes the browser apply the inverted (start) positions before the transition to zero begins."
- - In the snippet, the INVERT block reads every card's rect before it writes anything, as the page does and as the Production notes' "Read then write, once" says: `const last = newCards.map(c => c.getBoundingClientRect());` before the loop, then `newCards.forEach((c, i) => { const f = first[c.id]; const dx = f.left - last[i].left, dy = f.top - last[i].top; …` inside it.
-- **README Production notes:** the start of the "**Library equivalents.**" bullet changes, because `<AnimatePresence>` is Framer Motion's component for items that leave and is not FLIP itself. "React's `<AnimatePresence>` and Framer Motion's `layout` prop implement FLIP automatically for layout changes." becomes "Framer Motion's `layout` prop implements FLIP automatically for layout changes (its `AnimatePresence` handles items that leave)." The rest is unchanged.
-- **Category line:** `03.12 · Page Transitions`
-- **Pager:** Previous: Dissolve Transition (`../dissolve/`) · Next: none
-- **Final fix wave:** the page is unchanged. The README's library line was corrected, and the toolbar lines above now record the two rules the page has (`min-width:44px` and the spacing rule below 360px).
diff --git a/docs/superpowers/plans/2026-09-30-home-page-redesign.md b/docs/superpowers/plans/2026-09-30-home-page-redesign.md
deleted file mode 100644
index 6ca26259..00000000
--- a/docs/superpowers/plans/2026-09-30-home-page-redesign.md
+++ /dev/null
@@ -1,1459 +0,0 @@
-# Home Page Redesign ("Friendly guide") Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Replace the home page with the approved "Friendly guide" design: one plain question with a search box, nine place tiles, views that answer them, big cards with a visible Copy prompt button, phone and tablet layouts and both themes.
-
-**Architecture:** `index.html` stays one self-contained file. Its page styles, markup and home script are rewritten; the preview library (the `.pv-*` styles, `PV`, `pvMarkup`, the canvas engines) and `CATS` stay as they are. Cards are built once and moved between views. Copy prompt reuses one new helper in the shared `assets/js/demo-page.js`, so the home page and every demo page copy the same text. The page check gains a `home` target so each task can check the page in Chrome.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build step, no packages); Node's built-in test runner; `tools/check-pages.mjs` (Node 22+ and the local Chrome over the DevTools protocol); git worktrees.
-
-**Spec:** `docs/superpowers/specs/2026-09-30-home-page-redesign-design.md`. **Approved design:** (a private design canvas, not published), row "A · Friendly guide" (desktop, phone, phone after tapping Buttons). The canvas files are also on disk for a side-by-side look: `<scratchpad>\home-design-2\project\` (`Main.dc.html`, `APhone.dc.html`, `APhoneButtons.dc.html`); they are a reference, not code to copy.
-
-## Global Constraints
-
-- CLAUDE.md governs: plain HTML, CSS and vanilla JavaScript; no build step, packages or CDN files; motion with `transform` and `opacity`; text at least 4.5:1 against its background (3:1 at 24px and up); every control at least 44×44px on phones; `prefers-reduced-motion` respected; American spelling; plain words, no hype ("stunning", "amazing", "powerful").
-- Breakpoints: phone ≤ 600px, tablet 601–1024px, desktop ≥ 1025px; content at most 1280px wide, centered.
-- `index.html` stays one self-contained file. Each `CATS` entry keeps the exact shape `['slug','Name','Description']`: `tests/pages.test.js` matches every card to its page with that shape.
-- The preview library does not change: the styles from `/* ── preview library ── */` to the end of the `<style>` element (except the one reduced-motion block Task 4 replaces), `PV`, `pvMarkup` and the canvas engines (`starfield` … `const engines=…`).
-- Any change to `assets/js/demo-page.js` or `assets/css/demo-page.css` bumps `?v=N` on every demo page, and from Task 6 on on the home page too, in the same task (today `?v=5`; Task 1 makes it `?v=6`).
-- Copy is exactly as in the spec: pill "129 free animations · no coding needed"; heading "What do you want to animate?"; line "Pick a place, or describe it in your own words. Every animation plays live, and each one comes with a ready-made prompt for your AI assistant."; search label "Describe the animation you want", placeholder "For example: a button that bounces when clicked", button "Search"; "Popular:" fade in, typing text, loading spinner, parallax, confetti; views "Good places to start" / "Eight favorites from different places. Pick a place above to see more.", a place's name / "15 animations", "Results for “…”" / "12 animations match." ("1 animation matches."), "All animations" / "129 animations in 7 groups.", "Nothing matches “…” yet" / "Try a simpler word, or pick one of these:"; buttons "Browse all 129 animations", "Show all 15", "Clear"; card buttons "Copy prompt", "Copied", "Open to copy", "Try it"; message "Prompt copied. Paste it into your AI assistant."; How it works: "Watch it" / "Every animation plays right on its page, so you see exactly what you will get.", "Change it to fit" / "Try a few simple settings, like speed or direction, and watch the preview update.", "Copy the prompt" / "Paste it into your AI assistant. It describes the animation in plain words, with your settings.", then "Free and open source (MIT). No sign-up."
-- Every task ends green: `node --test "tests/*.test.js"`. From Task 4 on, `node tools/check-pages.mjs --base http://127.0.0.1:<port> home` prints six `ok` lines (Task 3 lands the home check while the old home page still fails it, as its steps say).
-- Serve each worktree with its own port: `python -m http.server <port> --bind 127.0.0.1` from the worktree root. Checks run in the agent's own headless Chrome (the page check tool), never in the shared in-app browser pane.
-- One commit per concern; never amend, never reset; no attribution lines in commit messages.
-
-## Files
-
-| File | Responsibility | Tasks |
-|---|---|---|
-| `assets/js/demo-page.js` | new `promptWithSettings()` and `pageCopyText()`; the page's own Copy prompt uses `pageCopyText()` | 1 |
-| `animations/*/*/index.html` (129) | `?v=5` → `?v=6` on both shared-file links | 1 |
-| `tests/demo-page.test.js` | tests for the two helpers | 1 |
-| `index.html` | `PLACES` and `PICKS` data (2); new page styles, markup and home script (4); views, search and address (5); Copy prompt and the shared script link (6) | 2, 4, 5, 6 |
-| `tests/pages.test.js` | `homeConst()` helper and place tests (2); home heading and count tests (4); the home page in the version test (6) | 2, 4, 6 |
-| `tools/check-pages.mjs` | `home` target with static checks (3); view checks (5); Copy prompt checks (6) | 3, 5, 6 |
-| `CLAUDE.md`, `CONTRIBUTING.md` | how to give a new animation its places; the home check | 7 |
-
-## Order
-
-- **Wave 1, in parallel** (each in its own worktree from `main`, each merged into `main` when its review passes): Task 1, Task 2, Task 3, Task 7. They touch different files.
-- **Wave 2, one after the other** in one worktree from `main` after wave 1: Task 4, Task 5, Task 6.
-- **Task 8** closes the plan: whole-site check, final review, publish.
-
----
-
-### Task 1: One shared helper builds the copied prompt
-
-**Files:**
-- Modify: `assets/js/demo-page.js` (the `settingsLine` helper near line 87, `readSettings` near line 168, `copyText()` inside `boot()` near line 202, the returned API at the end, the header comment)
-- Modify: every `animations/<category>/<slug>/index.html` (129 files): `?v=5` → `?v=6`
-- Test: `tests/demo-page.test.js`
-
-**Interfaces:**
-- Produces: `DemoPage.promptWithSettings(prompt: string, items: {label: string, value: string}[]): string` and `DemoPage.pageCopyText(doc, win): string` (`''` when the page has no `.hb-page .hb-prompt`). `win` needs only `getComputedStyle(node)`. The browser global is `window.DemoPage`; Node gets them from `require('../assets/js/demo-page.js')`.
-
-- [ ] **Step 1: Write the failing tests** — add to the end of `tests/demo-page.test.js`:
-
-```js
-test('promptWithSettings adds the settings line only when a setting is complete', () => {
- assert.equal(DP.promptWithSettings('Add it.', [{ label: 'Speed', value: 'Normal' }, { label: 'Size', value: 'Big' }]),
- 'Add it.\n\nSettings from the demo: Speed: Normal, Size: Big.');
- assert.equal(DP.promptWithSettings('Add it.', []), 'Add it.');
- assert.equal(DP.promptWithSettings('Add it.', [{ label: 'Speed', value: '' }]), 'Add it.');
-});
-
-test('pageCopyText reads the prompt and the Try it settings of a page', () => {
- // A stand-in page: a prompt and a Try it step holding one group of choice buttons, "Speed", with "Normal" pressed.
- const pressed = { getAttribute: () => null, textContent: ' Normal ' };
- const seg = { hidden: false, parentElement: null, hasAttribute: () => false, closest: () => null, matches: () => false,
- getAttribute: name => (name === 'aria-labelledby' ? 'speed-lbl' : null), querySelector: () => pressed };
- const tryStep = { querySelectorAll: () => [seg] };
- const prompt = { textContent: 'Add a fade to [the card].' };
- const page = { querySelector: s => ({ '.hb-prompt': prompt, '.hb-try': tryStep })[s] || null };
- const doc = { querySelector: s => (s === '.hb-page' ? page : null), getElementById: id => (id === 'speed-lbl' ? { textContent: 'Speed' } : null) };
- const win = { getComputedStyle: () => ({ display: '' }) };
- assert.equal(DP.pageCopyText(doc, win), 'Add a fade to [the card].\n\nSettings from the demo: Speed: Normal.');
- const noSettings = { querySelector: s => (s === '.hb-prompt' ? prompt : null) };
- assert.equal(DP.pageCopyText({ querySelector: s => (s === '.hb-page' ? noSettings : null) }, win), 'Add a fade to [the card].');
- assert.equal(DP.pageCopyText({ querySelector: () => null }, win), '');
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `node --test tests/demo-page.test.js`
-Expected: FAIL — `DP.promptWithSettings is not a function` and `DP.pageCopyText is not a function`.
-
-- [ ] **Step 3: Add the helpers**
-
-In `assets/js/demo-page.js`, right after the `settingsLine` function, add:
-
-```js
- // What Copy prompt copies: the prompt, then a blank line and "Settings from the demo: …" when the page has settings.
- function promptWithSettings(prompt, items) {
- var line = settingsLine(items);
- return prompt + (line ? '\n\nSettings from the demo: ' + line + '.' : '');
- }
-```
-
-Right after the `readSettings` function, add:
-
-```js
- // What Copy prompt copies on a page, with its settings as they are now. The home page runs it on a page it has
- // fetched and parsed, where every setting is at its default.
- function pageCopyText(doc, win) {
- var page = doc.querySelector('.hb-page');
- var promptEl = page && page.querySelector('.hb-prompt');
- if (!promptEl) return '';
- var tryStep = page.querySelector('.hb-try');
- var items = tryStep ? readSettings(doc, tryStep, win).filter(function (s) { return s.label && s.value; }) : [];
- return promptWithSettings(text(promptEl), items);
- }
-```
-
-Inside `boot()`, replace
-
-```js
- function copyText() {
- var line = settingsLine(settings());
- return promptText + (line ? '\n\nSettings from the demo: ' + line + '.' : '');
- }
-```
-
-with
-
-```js
- function copyText() { return pageCopyText(doc, win); }
-```
-
-(`setUpPrompt()` only wraps the parts to fill in with `<mark>` and puts its button after the prompt, so the prompt's text, and so the copied text, is unchanged.) In the object returned at the end of the file, add `promptWithSettings: promptWithSettings, pageCopyText: pageCopyText` after `settingsLine: settingsLine`. In the header comment, change "Fills in "Your settings", Copy prompt," to "Fills in "Your settings", Copy prompt (its text built by pageCopyText, which the home page uses too),".
-
-- [ ] **Step 4: Run the helper tests**
-
-Run: `node --test tests/demo-page.test.js`
-Expected: PASS, every test.
-
-- [ ] **Step 5: Bump the shared files to `?v=6` on every page**
-
-Run from the repo root:
-
-```bash
-node -e "const fs=require('fs'),path=require('path');let n=0;for(const c of fs.readdirSync('animations',{withFileTypes:true}).filter(d=>d.isDirectory()))for(const d of fs.readdirSync(path.join('animations',c.name),{withFileTypes:true}).filter(d=>d.isDirectory())){const f=path.join('animations',c.name,d.name,'index.html');if(!fs.existsSync(f))continue;const s=fs.readFileSync(f,'utf8'),t=s.replace(/demo-page\.(css|js)\?v=5/g,'demo-page.\$1?v=6');if(t!==s){fs.writeFileSync(f,t);n++;}}console.log(n+' pages')"
-```
-
-Expected: `129 pages`. Then `git grep -c "?v=5" -- animations` prints nothing.
-
-- [ ] **Step 6: Run all tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS (the version test sees one version, 6).
-
-- [ ] **Step 7: Check one page of each kind in Chrome**
-
-Serve the worktree (`python -m http.server <port> --bind 127.0.0.1`), then run:
-
-```bash
-node tools/check-pages.mjs --base http://127.0.0.1:<port> animations/02-entrance-and-exit/rotate-in animations/07-ambient-background/aurora animations/07-ambient-background/starfield animations/04-micro-interactions/checkmark-draw animations/01-scroll-based/snap-scrolling animations/03-page-transitions/crossfade animations/05-text-typography/wavy-text animations/06-3d-advanced/flip-card-3d
-```
-
-Expected: 48 `ok` lines, exit code 0.
-
-- [ ] **Step 8: Commit, in two commits**
-
-```bash
-git add assets/js/demo-page.js tests/demo-page.test.js
-git commit -m "feat: one shared helper (pageCopyText) builds the copied prompt, for the demo pages and the home page"
-git add animations
-git commit -m "chore: link the shared files as ?v=6 on every page"
-```
-
----
-
-### Task 2: Place data for every animation
-
-**Files:**
-- Modify: `index.html` — insert after the `};` that closes `const PV={` (just before `function pvMarkup(k){`)
-- Test: `tests/pages.test.js`
-
-**Interfaces:**
-- Produces: in `index.html`'s script, `const PLACES` (slug → array of place keys; the first key labels the card; keys `btn text imgcard bg menu load intro scroll page`) and `const PICKS` (the eight Start slugs, in order). In `tests/pages.test.js`, `homeConst(name)`: evaluates the literal after `const NAME=` in the home page's script and returns it (used again in Task 4).
-
-- [ ] **Step 1: Write the failing tests** — in `tests/pages.test.js`, add `const vm = require('node:vm');` under the other `require` lines, and add after the home page test (`the home page uses Schibsted Grotesk …`):
-
-```js
-// The value of `const NAME=` in the home page's script: an array or object literal of plain data, read with vm.
-function homeConst(name) {
- const start = HOME.indexOf(`const ${name}=`);
- assert.ok(start >= 0, `const ${name} in index.html`);
- const from = start + `const ${name}=`.length;
- const open = HOME[from], close = open === '[' ? ']' : '}';
- let depth = 0, i = from, quote = null;
- for (; i < HOME.length; i++) {
- const ch = HOME[i];
- if (quote) { if (ch === '\\') i++; else if (ch === quote) quote = null; continue; }
- if (ch === "'" || ch === '"' || ch === '`') quote = ch;
- else if (ch === open) depth++;
- else if (ch === close && --depth === 0) break;
- }
- // vm builds the value in its own realm; the JSON copy is made of ordinary arrays and objects that deepEqual accepts.
- return JSON.parse(JSON.stringify(vm.runInNewContext('(' + HOME.slice(from, i + 1) + ')')));
-}
-const PLACE_KEYS = ['btn', 'text', 'imgcard', 'bg', 'menu', 'load', 'intro', 'scroll', 'page'];
-
-test('every animation on the home page has one or more places, all of them known', () => {
- const places = homeConst('PLACES');
- const slugs = homeConst('CATS').flatMap(cat => cat.entries.map(e => e[0]));
- assert.deepEqual(Object.keys(places), slugs, 'PLACES lists every card once, in home order');
- for (const slug of slugs) {
- assert.ok(places[slug].length >= 1, `${slug} has a place`);
- for (const key of places[slug]) assert.ok(PLACE_KEYS.includes(key), `${slug}: unknown place ${key}`);
- assert.equal(new Set(places[slug]).size, places[slug].length, `${slug} lists a place twice`);
- }
-});
-
-test('every place holds at least one animation', () => {
- const used = new Set(Object.values(homeConst('PLACES')).flat());
- for (const key of PLACE_KEYS) assert.ok(used.has(key), `${key} holds no animation`);
-});
-
-test('the eight Start cards are on the home page', () => {
- const picks = homeConst('PICKS'), slugs = new Set(Object.keys(homeConst('PLACES')));
- assert.equal(picks.length, 8);
- for (const slug of picks) assert.ok(slugs.has(slug), slug);
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `node --test tests/pages.test.js`
-Expected: FAIL — "const PLACES in index.html".
-
-- [ ] **Step 3: Add the data** — in `index.html`, after the `};` closing `const PV={`, insert:
-
-```js
-// Where each animation can go: the place keys of the home page's tiles (the first one labels its card).
-const PLACES={
- // 01
- 'parallax-depth-of-field':['scroll','imgcard'],
- 'parallax-scrolling':['scroll','imgcard'],
- 'reverse-scrolling-columns':['scroll','imgcard'],
- 'cover-card-to-fixed-header':['scroll','menu'],
- 'fly-in-fly-out-contact-list':['scroll'],
- 'stacking-cards':['scroll','imgcard'],
- 'scroll-trigger':['scroll'],
- 'scrub-animation':['scroll'],
- 'pin-animation':['scroll'],
- 'snap-scrolling':['scroll','imgcard'],
- 'scrollytelling':['scroll'],
- 'reveal-on-scroll':['scroll','imgcard'],
- 'stagger-reveal':['scroll','imgcard'],
- 'horizontal-scroll':['scroll','imgcard'],
- 'sticky-section':['scroll'],
- 'counter-animation':['scroll','text'],
- 'progress-bar':['scroll','load'],
- 'section-wipe':['scroll'],
- 'zoom-into-image':['scroll','imgcard'],
- 'scroll-image-sequence':['scroll','imgcard'],
- 'smooth-scroll':['scroll'],
- 'text-fill-on-scroll':['scroll','text'],
- 'scroll-velocity-skew':['scroll','imgcard'],
- 'svg-line-draw':['scroll'],
- 'scrollspy-nav':['scroll','menu'],
- 'scroll-background-color':['scroll','bg'],
- // 02
- 'fade-in-out':['intro'],
- 'slide-in':['intro','menu','load'],
- 'slide-up-reveal':['intro','text'],
- 'scale-in':['intro','menu'],
- 'clip-path-reveal':['intro','imgcard'],
- 'curtain-reveal':['intro'],
- 'split-text-reveal':['intro','text'],
- 'letter-by-letter-stagger':['intro','text'],
- 'word-by-word-reveal':['intro','text'],
- 'blur-in':['intro','imgcard'],
- 'flip-in':['intro','imgcard'],
- 'bounce-in':['intro','load'],
- 'rotate-in':['intro'],
- // 03
- 'view-transitions-api':['page'],
- 'shared-element-transition':['page','imgcard'],
- 'morph-transition':['page'],
- 'crossfade':['page'],
- 'slide-transition':['page'],
- 'zoom-transition':['page'],
- 'flash-transition':['page'],
- 'blur-transition':['page','imgcard'],
- 'elastic-transition':['page'],
- 'portal-zoom':['page'],
- 'dissolve':['page','imgcard'],
- 'flip-technique':['page','imgcard'],
- // 04
- 'hover-state':['btn','imgcard'],
- 'click-ripple':['btn'],
- 'focus-ring':['menu'],
- 'button-press-scale':['btn'],
- 'magnetic-button':['btn'],
- 'toggle-switch':['btn','menu'],
- 'heart-burst':['btn','load'],
- 'success-confetti':['btn','load'],
- 'skeleton-loader':['load','imgcard'],
- 'shimmer-effect':['load'],
- 'loading-spinner':['load'],
- 'progress-animation':['load'],
- 'checkmark-draw':['load','menu'],
- 'form-field-morph':['menu'],
- 'badge-pulse':['load','btn'],
- 'tooltip-reveal':['btn'],
- 'drawer-slide':['menu'],
- 'modal-expand':['imgcard','btn'],
- 'accordion':['menu'],
- 'cursor-follower':['bg'],
- 'error-shake':['menu','load'],
- 'swipe-to-dismiss':['imgcard'],
- 'hamburger-menu-toggle':['menu','btn'],
- 'theme-toggle-morph':['btn'],
- 'copy-to-clipboard':['btn','load'],
- 'star-rating':['menu','btn'],
- 'toast-notification':['load'],
- 'segmented-control':['menu','btn'],
- 'pull-to-refresh':['load'],
- // 05
- 'kinetic-typography':['text','intro'],
- 'typewriter-effect':['text','intro'],
- 'scramble-text':['text'],
- 'variable-font-morph':['text'],
- 'text-clip-path-reveal':['text','intro'],
- 'marquee-ticker':['text'],
- 'text-morphing':['text'],
- 'text-gradient-animation':['text'],
- 'outline-to-fill':['text'],
- 'enter-exit-typography':['text','intro'],
- 'rotate-word-carousel':['text'],
- 'glitch-text':['text'],
- 'text-on-path':['text'],
- 'wavy-text':['text'],
- // 06
- '3d-model-orbit':['imgcard'],
- 'scroll-driven-3d-rotation':['scroll','imgcard'],
- 'parallax-3d-tilt':['imgcard'],
- 'canvas-particle-effect':['bg'],
- 'fluid-simulation':['bg'],
- 'glassmorphism-animated':['imgcard','bg'],
- 'webgl-shader-animation':['bg'],
- 'noise-based-motion':['bg'],
- 'svg-path-animation':['imgcard','intro'],
- 'chromatic-aberration':['text'],
- '2-5d-pseudo-3d':['imgcard'],
- 'ray-marching-sdf':['bg'],
- 'gpgpu-particle-system':['bg'],
- 'image-distortion-hover':['imgcard'],
- 'cloth-simulation':['imgcard'],
- 'volumetric-smoke':['bg'],
- 'morphing-blob':['bg'],
- 'flip-card-3d':['imgcard'],
- // 07
- 'animated-gradient-background':['bg'],
- 'mesh-gradient':['bg'],
- 'aurora':['bg'],
- 'grain-overlay':['bg','imgcard'],
- 'scanline':['bg'],
- 'light-leak':['bg','imgcard'],
- 'starfield':['bg'],
- 'breathing-glow':['bg','load'],
- 'ambient-ripple':['bg'],
- 'floating-elements':['bg'],
- 'grid-dot-pattern-parallax':['bg'],
- 'abstract-geometric-motion':['bg'],
- 'particle-constellation':['bg'],
- 'flow-field':['bg'],
- 'synthwave-grid':['bg'],
- 'matrix-rain':['bg'],
- 'plasma':['bg']
-};
-// The eight cards of "Good places to start", in this order.
-const PICKS=['click-ripple','typewriter-effect','flip-card-3d','aurora','hamburger-menu-toggle','loading-spinner','parallax-scrolling','slide-up-reveal'];
-```
-
-- [ ] **Step 4: Run the tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS. (Nothing on the page uses the new data yet, so the page looks and works as before.)
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add index.html tests/pages.test.js
-git commit -m "feat: the home page knows where each animation can go (PLACES) and its eight first picks (PICKS)"
-```
-
----
-
-### Task 3: The page check can check the home page
-
-**Files:**
-- Modify: `tools/check-pages.mjs` (the header comment, the `pages` list, a new `HOME_CHECK` after `CHECK`, the loop over pages)
-
-**Interfaces:**
-- Produces: `node tools/check-pages.mjs --base <url> home` checks the home page at the six setups. Inside the loop, `const home = page === 'home'`; home pages evaluate `HOME_CHECK` instead of `CHECK` and skip the demo-page checks. Later tasks add `homeViewProblems()` (Task 5), `homePhoneProblems()` (Task 5) and `homeCopyProblems()` (Task 6) inside the `if (home)` branch this task adds.
-
-- [ ] **Step 1: Let `home` through the argument list** — replace the `const pages = …` statement with:
-
-```js
-const pages = args.map(p => (p === 'home' ? p : p.replace(/\\/g, '/').replace(/^\.?\//, '').replace(/\/?(index\.html)?$/, '/')))
- .flatMap(p => {
- if (p === 'home' || isPage(p) || !existsSync(join(ROOT, p))) return [p];
- const inside = readdirSync(join(ROOT, p), { withFileTypes: true })
- .filter(d => d.isDirectory() && isPage(p + d.name)).map(d => `${p}${d.name}/`).sort();
- return inside.length ? inside : [p];
- });
-```
-
-and change the usage message to `Usage: node tools/check-pages.mjs [--base URL] [--out DIR] <page or category folder, or home>...`.
-
-- [ ] **Step 2: Add the home page's in-page check** — right after the `CHECK` constant, add:
-
-```js
-// Runs inside the home page. Returns the problems found: overflow, small targets on phones, the search box and the first
-// row of place tiles on the first screen (1280×800 and 375×812), the tile counts, and the eight Start cards.
-const HOME_CHECK = `(() => {
- const r = el => el.getBoundingClientRect();
- const phone = innerWidth <= 600;
- const problems = [];
- if (!document.getElementById('places')) problems.push('not the new home page');
- if (document.documentElement.scrollWidth > document.documentElement.clientWidth + 1) problems.push('horizontal overflow');
- if (phone) {
- const small = [...document.querySelectorAll('.top a, .top button, .search button, .pop button, .place, .card .copy, .pillbtn, .bigbtn, .pinbar button, .foot a')]
- .filter(el => el.getClientRects().length)
- .filter(el => { const b = r(el); return b.width < 44 || b.height < 44; })
- .map(el => el.tagName.toLowerCase() + (el.className ? '.' + String(el.className).split(' ')[0] : '') + ' ' + Math.round(r(el).width) + 'x' + Math.round(r(el).height));
- if (small.length) problems.push('small targets: ' + small.join(', '));
- }
- const firstScreen = (innerWidth === 1280 && innerHeight === 800) || (innerWidth === 375 && innerHeight === 812);
- const search = document.querySelector('.search'), tile = document.querySelector('.place');
- if (firstScreen && search && r(search).bottom > innerHeight) problems.push('search box below the first screen');
- if (firstScreen && tile && r(tile).bottom > innerHeight) problems.push('place tiles below the first screen');
- const counts = [...document.querySelectorAll('.pl-count')].map(el => el.textContent.trim());
- if (counts.length !== 9 || counts.some(t => !/^\\d+ animations?$/.test(t))) problems.push('tile counts: ' + counts.join(' | '));
- const cards = document.querySelectorAll('#cards .card').length;
- if (cards !== 8) problems.push('Start shows ' + cards + ' cards, not 8');
- return { problems };
-})()`;
-```
-
-- [ ] **Step 3: Use it in the loop** — in the `for (const page of pages)` loop:
- - replace the `const name = …` line with
- ```js
- const home = page === 'home';
- const name = home ? 'home' : parts.length > 1 ? `${parts[parts.length - 2].slice(0, 2)}-${parts[parts.length - 1]}` : parts[0];
- ```
- - replace `await send('Page.navigate', { url: `${BASE}/${page}` });` with `await send('Page.navigate', { url: home ? `${BASE}/` : `${BASE}/${page}` });`
- - replace `const result = await evaluate(CHECK);` with `const result = await evaluate(home ? HOME_CHECK : CHECK);`
- - wrap every check after `problems.push(...result.problems);` that reads `result.kind`, `result.loop` or `result.switches` in `if (!home) { … }` (the Loop-on-arrival check and the reduced-motion switches check before the screenshots; the four `movementProblems` / `loopProblems` / `demoProblems` / `scrollProblems` lines after them). The screenshots stay for both.
- - after the `if (!home) { … }` holding those four lines, add the branch later tasks fill:
- ```js
- if (home) {
- // Task 5 and Task 6 add the home page's interaction checks here.
- }
- ```
-
-- [ ] **Step 4: Describe the home target in the header comment** — after the line `// e.g. node tools/check-pages.mjs animations/02-entrance-and-exit`, add:
-
-```js
-// node tools/check-pages.mjs home checks the home page at the same six setups: overflow, small targets on phones,
-// the search box and the place tiles on the first screen, the tile counts and the eight Start cards.
-```
-
-- [ ] **Step 5: Run it on today's home page and see it fail**
-
-Serve the worktree, then run: `node tools/check-pages.mjs --base http://127.0.0.1:<port> home`
-Expected: six `FAIL home …` lines, each naming at least "not the new home page", "tile counts" and "Start shows 0 cards, not 8"; exit code 1. (The home page is rebuilt in Task 4.)
-
-- [ ] **Step 6: Check that demo pages are checked as before**
-
-Run: `node tools/check-pages.mjs --base http://127.0.0.1:<port> animations/02-entrance-and-exit/rotate-in animations/04-micro-interactions/checkmark-draw`
-Expected: 12 `ok` lines, exit code 0.
-
-- [ ] **Step 7: Commit**
-
-```bash
-git add tools/check-pages.mjs
-git commit -m "feat: the page check can check the home page (home): overflow, touch targets, first screen, tile counts, Start cards"
-```
-
----
-
-### Task 4: The new home page: layout, look and Start view
-
-**Files:**
-- Modify: `index.html` — the page styles, one reduced-motion block, the `<body>` markup and the home script (the preview library and `CATS` stay)
-- Test: `tests/pages.test.js`
-
-**Interfaces:**
-- Consumes: `PLACES`, `PICKS` (Task 2); the `home` check (Task 3); the preview library (`PV`, `pvMarkup(k)`, `engines`, `reduce`, `FRAME`).
-- Produces for Task 5 and Task 6 (top-level names in the home script): `PLACE_LIST` ({key,name,url}[]), `PLACE` (key → entry), `esc(s)`, `slugify(s)`, `wordsOf(s)`, `ALL` (entries in home order: `{slug,name,desc,cat,places,order,url,nameW,placeW,descW}`), `BY_SLUG`, `ICON_COPY`, `ICON_DONE`, `ICON_OPEN`, `ICON_ARROW`, `io`, `buildCard(e)`, `CARD` (slug → card element with `_play()`/`_pause()`), `$(id)`, `resultsEl`, `cardsBox`, `place(cards)`, `showCards(list)`. Element ids: `top`, `nav-all`, `theme-toggle`, `gh-star-count`, `search-form`, `q`, `q-clear`, `places`, `results`, `pinbar`, `pin-back`, `q2`, `results-title`, `results-sub`, `clear-view`, `cards`, `empty`, `empty-title`, `more`, `more-btn`, `more-label`, `how`, `toast`. Tiles and phone chips carry `data-place="<key>"`; suggestion buttons carry `data-q="<text>"`; tile counts `data-count="<key>"`.
-
-- [ ] **Step 1: Update the home page tests** — in `tests/pages.test.js`, replace the test `the home page uses Schibsted Grotesk and the new intro line` with:
-
-```js
-test('the home page uses Schibsted Grotesk and asks what to animate', () => {
- assert.ok(HOME.includes("url('assets/fonts/schibsted-latin.woff2')"), 'Latin font file');
- assert.ok(HOME.includes("url('assets/fonts/schibsted-latin-ext.woff2')"), 'Latin Extended font file');
- for (const old of ['Bricolage', 'PlexMono', 'var(--mono)', '--mono:']) assert.ok(!HOME.includes(old), `still uses ${old}`);
- assert.ok(HOME.includes('<h1 class="h1" id="hero-title">What do you want to animate?</h1>'), 'heading');
- assert.ok(HOME.includes('Pick a place, or describe it in your own words. Every animation plays live, and each one comes with a ready-made prompt for your AI assistant.'), 'intro line');
-});
-
-test('the counts written on the home page match its cards', () => {
- const cards = homeConst('CATS').reduce((n, cat) => n + cat.entries.length, 0);
- assert.ok(HOME.includes(`${cards} free animations · no coding needed`), 'hero pill');
- assert.ok(HOME.includes(`<span id="more-label">Browse all ${cards} animations</span>`), 'Browse all button');
-});
-```
-
-(Move `homeConst` and `PLACE_KEYS` above these tests if they sit below them.)
-
-- [ ] **Step 2: Run the tests and see them fail**
-
-Run: `node --test tests/pages.test.js`
-Expected: FAIL — "heading" and "hero pill".
-
-- [ ] **Step 3: Replace the page styles** — in `index.html`, replace everything from the `:root{` rule (the first rule after the two `@font-face` rules) up to, but not including, the comment `/* ── preview library ── */`, with:
-
-```css
-:root{
- --bg:#f8f7f4;--surface:#ffffff;--ink:#16161b;--ink-2:#45454f;--muted:#676771;
- --line:#e5e3dc;--line-2:#efede8;--brand:#2f5bea;--ok:#157a43;
- --shadow:0 1px 2px rgba(22,22,27,.04),0 8px 24px rgba(22,22,27,.06);
- --shadow-2:0 2px 4px rgba(22,22,27,.05),0 18px 40px rgba(22,22,27,.11);
- --c1:#6ea8ff;--c2:#5fd88a;--c3:#b98cff;--c4:#ff9d5c;--c5:#ff6f8b;--c6:#3fd6c4;--c7:#ffce5a;
- --disp:'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;--text:var(--disp);
- --ease:cubic-bezier(.22,1,.36,1);--gut:clamp(16px,4vw,40px);
- color-scheme:light;
-}
-:root[data-theme="dark"]{
- --bg:#0e0e11;--surface:#17171c;--ink:#f4f4f2;--ink-2:#c6c6cc;--muted:#9c9ca5;
- --line:rgba(255,255,255,.13);--line-2:rgba(255,255,255,.07);--brand:#86a8ff;
- --shadow:0 1px 2px rgba(0,0,0,.3),0 8px 24px rgba(0,0,0,.25);
- --shadow-2:0 2px 4px rgba(0,0,0,.35),0 18px 40px rgba(0,0,0,.45);
- color-scheme:dark;
-}
-.c1{--accent:var(--c1)}.c2{--accent:var(--c2)}.c3{--accent:var(--c3)}.c4{--accent:var(--c4)}.c5{--accent:var(--c5)}.c6{--accent:var(--c6)}.c7{--accent:var(--c7)}
-*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
-[hidden]{display:none!important}
-html,body{background:var(--bg);color:var(--ink)}
-body{font-family:var(--text);font-size:16px;line-height:1.5;-webkit-font-smoothing:antialiased;overflow-x:hidden}
-a{color:inherit}
-button,input{font:inherit;color:inherit}
-:focus-visible{outline:3px solid var(--brand);outline-offset:3px}
-.sr,.places-h{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
-.skip{position:absolute;left:16px;top:-80px;z-index:100;padding:10px 16px;border-radius:10px;background:var(--ink);color:var(--bg);font-weight:700;text-decoration:none}
-.skip:focus{top:12px}
-.i{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
-.wrap{width:min(1280px,calc(100% - 2 * var(--gut)));margin-inline:auto}
-
-/* top bar */
-.top{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:76px}
-.brand{display:inline-flex;align-items:center;gap:12px;min-height:44px;text-decoration:none;font-size:17px;font-weight:800;letter-spacing:-.015em;white-space:nowrap}
-.mark{width:30px;height:30px;flex:none}
-.mark .ring{fill:var(--bg);stroke:currentColor;stroke-width:1.8}
-.mark .ball{fill:currentColor}
-.nav{display:flex;align-items:center;gap:6px}
-.lnk{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 14px;border-radius:999px;text-decoration:none;font-size:15px;font-weight:600;color:var(--ink-2);white-space:nowrap}
-.icon-btn{display:inline-grid;place-items:center;width:44px;height:44px;border-radius:999px;border:0;background:none;color:var(--ink-2);cursor:pointer}
-.theme-btn .sun,:root[data-theme="dark"] .theme-btn .moon{display:none}
-:root[data-theme="dark"] .theme-btn .sun{display:block}
-.gh{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 16px;border-radius:999px;border:1px solid var(--line);background:var(--surface);text-decoration:none;font-size:15px;font-weight:600;white-space:nowrap}
-.gh-c{color:var(--muted);font-variant-numeric:tabular-nums}
-@media(hover:hover){.lnk:hover,.icon-btn:hover{color:var(--ink);background:var(--line-2)}.gh:hover{border-color:var(--ink)}}
-
-/* hero */
-.home-hero{position:relative;display:flex;flex-direction:column;align-items:center;text-align:center;padding-top:clamp(16px,4vw,56px)}
-.float{position:absolute;pointer-events:none;animation:fl 7s ease-in-out infinite}
-.fl1{left:6%;top:60px;width:26px;height:26px;border-radius:50%;background:var(--c7)}
-.fl2{left:14%;top:240px;width:22px;height:22px;border-radius:6px;background:var(--c1);animation-delay:-2s;animation-duration:8s}
-.fl3{left:2%;top:320px;width:30px;height:30px;border-radius:50%;border:5px solid var(--c5);animation-delay:-4s}
-.fl4{right:8%;top:80px;width:28px;height:28px;background:var(--c2);clip-path:polygon(50% 0,100% 100%,0 100%);animation-delay:-1s;animation-duration:9s}
-.fl5{right:16%;top:280px;width:16px;height:16px;border-radius:50%;background:var(--c3);animation-delay:-3s}
-.fl6{right:2%;top:350px;width:24px;height:24px;border-radius:7px;border:5px solid var(--c4);animation-delay:-5s;animation-duration:8s}
-@keyframes fl{0%,100%{transform:translateY(0) rotate(0)}50%{transform:translateY(-16px) rotate(14deg)}}
-.pill{display:inline-flex;align-items:center;gap:10px;padding:8px 16px;border-radius:999px;background:var(--surface);border:1px solid var(--line);font-size:14px;font-weight:600;color:var(--ink-2)}
-.pill-dot{position:relative;width:8px;height:8px;border-radius:50%;background:#1f9d57}
-.pill-dot::after{content:"";position:absolute;inset:0;border-radius:50%;background:#1f9d57;animation:pdot 2s ease-out infinite}
-@keyframes pdot{from{transform:scale(1);opacity:.6}to{transform:scale(2.8);opacity:0}}
-.h1{margin-top:22px;font-size:clamp(34px,5.2vw,64px);font-weight:800;line-height:1.04;letter-spacing:-.035em}
-.sub{margin-top:18px;max-width:640px;font-size:clamp(16px,1.4vw,19px);line-height:1.55;color:var(--ink-2)}
-.search{display:flex;align-items:center;width:min(720px,100%);margin-top:clamp(20px,3vw,34px);padding:8px 8px 8px 24px;border-radius:999px;background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow)}
-.search:focus-within{border-color:var(--brand);box-shadow:0 0 0 3px color-mix(in srgb,var(--brand) 22%,transparent),var(--shadow)}
-.search>.i{width:22px;height:22px;color:var(--muted)}
-#q{flex:1;min-width:0;min-height:48px;margin-left:12px;border:0;background:none;font-size:17px;outline:none;-webkit-appearance:none;appearance:none}
-#q::placeholder,#q2::placeholder{color:var(--muted)}
-#q::-webkit-search-cancel-button,#q2::-webkit-search-cancel-button{display:none}
-#q:focus-visible,#q2:focus-visible{outline:none}
-.clear{display:grid;place-items:center;width:44px;height:44px;flex:none;margin-right:4px;border-radius:999px;border:0;background:none;color:var(--muted);cursor:pointer}
-.go{display:inline-flex;align-items:center;justify-content:center;flex:none;min-height:48px;padding:0 26px;border-radius:999px;border:0;background:var(--ink);color:var(--bg);font-size:16px;font-weight:700;cursor:pointer}
-.go .i{display:none}
-.pop{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:2px;margin-top:12px;font-size:15px;color:var(--muted)}
-.pop button{min-height:44px;padding:0 9px;border:0;background:none;color:var(--ink-2);font-size:15px;font-weight:600;text-decoration:underline;text-decoration-color:var(--line);text-underline-offset:5px;cursor:pointer}
-@media(hover:hover){.pop button:hover{color:var(--brand);text-decoration-color:currentColor}}
-
-/* place tiles */
-.places{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:20px;margin-top:44px}
-.place{display:flex;flex-direction:column;align-items:center;padding:0;border:0;border-radius:24px;background:none;text-align:center;cursor:pointer}
-.p-btn{--pa:#2f5bea}.p-text{--pa:#d6336c}.p-img{--pa:#7048e8}.p-bg{--pa:#e8890c}.p-menu{--pa:#0c8f7f}.p-load{--pa:#e8590c}.p-intro{--pa:#2b9a4a}.p-scroll{--pa:#3b5b8c}.p-page{--pa:#9c36b5}
-.art{position:relative;display:grid;place-items:center;width:100%;height:108px;border-radius:22px;background:color-mix(in srgb,var(--pa) 12%,var(--surface));overflow:hidden;transition:transform .35s var(--ease),box-shadow .25s}
-@media(hover:hover){.place:hover .art{transform:translateY(-4px);box-shadow:var(--shadow-2)}}
-.place[aria-pressed="true"] .art{box-shadow:0 0 0 3px var(--ink)}
-.pl-name{margin-top:12px;font-size:15px;font-weight:700;line-height:1.2}
-.pl-count{min-height:1.2em;margin-top:3px;font-size:13px;color:var(--muted)}
-.ab-btn{position:relative;z-index:2;display:grid;place-items:center;width:62px;height:28px;border-radius:999px;background:var(--pa);color:#fff;font-size:12px;font-weight:700;animation:abpress 2.4s var(--ease) infinite}
-.ab-ring{position:absolute;left:50%;top:50%;width:62px;height:28px;margin:-14px 0 0 -31px;border-radius:999px;border:2px solid var(--pa);opacity:0;animation:abring 2.4s ease-out infinite}
-.ab-dot{position:absolute;z-index:3;left:50%;top:50%;width:14px;height:14px;margin:-7px 0 0 -7px;border-radius:50%;background:var(--ink);border:2px solid var(--surface);animation:abdot 2.4s var(--ease) infinite}
-@keyframes abpress{0%,34%{transform:scale(1)}42%{transform:scale(.88)}56%{transform:scale(1.06)}66%,100%{transform:scale(1)}}
-@keyframes abring{0%,38%{transform:scale(1);opacity:0}42%{opacity:.8}80%,100%{transform:scale(1.6,2.1);opacity:0}}
-@keyframes abdot{0%{transform:translate(36px,32px);opacity:0}14%{opacity:1}34%{transform:translate(14px,6px)}42%{transform:translate(14px,6px) scale(.8)}52%{transform:translate(14px,6px) scale(1)}80%{opacity:1}100%{transform:translate(36px,32px);opacity:0}}
-.at{display:flex;gap:1px;font-size:34px;font-weight:800;letter-spacing:-.02em;color:var(--pa)}
-.at span{display:inline-block;animation:atw 1.6s ease-in-out infinite}
-.at span:nth-child(1){animation-delay:-1.6s}.at span:nth-child(2){animation-delay:-1.4s}.at span:nth-child(3){animation-delay:-1.2s}
-@keyframes atw{0%,100%{transform:translateY(6px)}50%{transform:translateY(-6px)}}
-.ai{position:relative;width:72px;height:54px;border-radius:10px;overflow:hidden;background:linear-gradient(#bcd0ff,#e9efff);box-shadow:0 6px 14px rgba(22,22,27,.14);animation:aicard 3.6s var(--ease) infinite}
-.ai-sun{position:absolute;right:11px;top:9px;width:12px;height:12px;border-radius:50%;background:#ffb020}
-.ai-m1{position:absolute;left:-4px;bottom:-22px;width:44px;height:44px;border-radius:6px;background:var(--pa);transform:rotate(45deg)}
-.ai-m2{position:absolute;left:30px;bottom:-28px;width:48px;height:48px;border-radius:6px;background:color-mix(in srgb,var(--pa) 55%,#fff);transform:rotate(45deg)}
-@keyframes aicard{0%,100%{transform:rotate(-5deg) translateY(3px)}50%{transform:rotate(4deg) translateY(-4px)}}
-.abg{position:absolute;width:72px;height:72px;border-radius:50%;filter:blur(14px);opacity:.9;animation:abg 7s ease-in-out infinite}
-.abg.b1{left:6px;top:-12px;background:#ff9d5c}
-.abg.b2{right:0;bottom:-18px;background:#ff6f8b;animation-delay:-2.4s}
-.abg.b3{left:40px;top:26px;background:#ffce5a;animation-delay:-4.6s}
-@keyframes abg{0%,100%{transform:translate(0,0) scale(1)}33%{transform:translate(12px,-8px) scale(1.15)}66%{transform:translate(-10px,8px) scale(.9)}}
-.am{position:relative;width:34px;height:26px}
-.am span{position:absolute;left:0;width:34px;height:4px;border-radius:2px;background:var(--pa)}
-.am span:nth-child(1){top:0;animation:am1 3s var(--ease) infinite}
-.am span:nth-child(2){top:11px;animation:am2 3s var(--ease) infinite}
-.am span:nth-child(3){top:22px;animation:am3 3s var(--ease) infinite}
-@keyframes am1{0%,30%{transform:none}45%,80%{transform:translateY(11px) rotate(45deg)}95%,100%{transform:none}}
-@keyframes am2{0%,30%{opacity:1}40%,85%{opacity:0}95%,100%{opacity:1}}
-@keyframes am3{0%,30%{transform:none}45%,80%{transform:translateY(-11px) rotate(-45deg)}95%,100%{transform:none}}
-.al{display:flex;flex-direction:column;align-items:center;gap:12px}
-.al-spin{width:30px;height:30px;border-radius:50%;border:4px solid color-mix(in srgb,var(--pa) 25%,transparent);border-top-color:var(--pa);animation:alspin .9s linear infinite}
-.al-bar{position:relative;width:64px;height:6px;border-radius:3px;overflow:hidden;background:color-mix(in srgb,var(--pa) 22%,transparent)}
-.al-bar span{position:absolute;inset:0;background:var(--pa);transform-origin:left;animation:albar 2.6s var(--ease) infinite}
-@keyframes alspin{to{transform:rotate(360deg)}}
-@keyframes albar{0%{transform:scaleX(0)}70%,100%{transform:scaleX(1)}}
-.ap{display:flex;flex-direction:column;gap:6px;width:72px;padding:10px;border-radius:10px;background:var(--surface);box-shadow:0 6px 14px rgba(22,22,27,.12)}
-.ap span{display:block;height:8px;border-radius:3px;animation:aprise 3s var(--ease) infinite}
-.ap .h{width:70%;height:10px;background:var(--pa);animation-delay:-1.2s}
-.ap .l1{width:100%;background:color-mix(in srgb,var(--pa) 30%,transparent);animation-delay:-1.05s}
-.ap .l2{width:80%;background:color-mix(in srgb,var(--pa) 30%,transparent);animation-delay:-.9s}
-@keyframes aprise{0%,8%{opacity:0;transform:translateY(8px)}30%,80%{opacity:1;transform:none}100%{opacity:0;transform:none}}
-.as{position:relative;width:48px;height:76px;border-radius:10px;border:3px solid var(--ink);background:var(--surface);overflow:hidden}
-.as-in{position:absolute;left:5px;right:8px;top:0;height:200%;background:repeating-linear-gradient(180deg,color-mix(in srgb,var(--pa) 55%,transparent) 0 9%,transparent 9% 14%,color-mix(in srgb,var(--pa) 25%,transparent) 14% 21%,transparent 21% 25%);animation:asy 4s linear infinite}
-.as-bar{position:absolute;right:2px;top:4px;width:3px;height:18px;border-radius:2px;background:var(--pa);animation:asbar 4s linear infinite}
-@keyframes asy{to{transform:translateY(-50%)}}
-@keyframes asbar{from{transform:translateY(0)}to{transform:translateY(42px)}}
-.ax{position:relative;width:64px;height:76px;border-radius:10px;overflow:hidden;box-shadow:0 6px 14px rgba(22,22,27,.14)}
-.ax span{position:absolute;inset:0;background:linear-gradient(var(--pa),var(--pa)) 8px 10px/60% 8px no-repeat,linear-gradient(color-mix(in srgb,var(--pa) 30%,transparent),color-mix(in srgb,var(--pa) 30%,transparent)) 8px 26px/80% 6px no-repeat,linear-gradient(color-mix(in srgb,var(--pa) 30%,transparent),color-mix(in srgb,var(--pa) 30%,transparent)) 8px 38px/64% 6px no-repeat,var(--surface)}
-.ax .pa{animation:axa 4s var(--ease) infinite}
-.ax .pb{background-color:color-mix(in srgb,var(--pa) 18%,var(--surface));animation:axb 4s var(--ease) infinite}
-@keyframes axa{0%,32%{transform:translateX(0)}46%,82%{transform:translateX(-100%)}96%,100%{transform:translateX(0)}}
-@keyframes axb{0%,32%{transform:translateX(100%)}46%,82%{transform:translateX(0)}96%,100%{transform:translateX(100%)}}
-
-/* results */
-.results{margin-top:clamp(40px,6vw,72px);scroll-margin-top:12px}
-.pinbar{display:none}
-.rhead{display:flex;align-items:flex-end;justify-content:space-between;flex-wrap:wrap;gap:16px 24px;margin-bottom:24px}
-.rtitle{font-size:clamp(24px,2.6vw,32px);font-weight:800;letter-spacing:-.02em;line-height:1.1}
-.rsub{margin-top:6px;font-size:16px;color:var(--muted)}
-.pillbtn{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 18px;border-radius:999px;border:1px solid var(--line);background:var(--surface);font-size:15px;font-weight:600;cursor:pointer}
-.grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:24px}
-.group{scroll-margin-top:12px}
-.group+.group{margin-top:56px}
-.ghead{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 12px;margin-bottom:20px;font-weight:800}
-.gnum{font-size:26px;color:var(--muted);font-variant-numeric:tabular-nums}
-.gname{font-size:22px;letter-spacing:-.015em}
-.gcount{font-size:15px;font-weight:400;color:var(--muted)}
-
-/* cards */
-.card{position:relative;display:flex;flex-direction:column;padding:10px;border-radius:20px;background:var(--surface);box-shadow:var(--shadow);transition:transform .35s var(--ease),box-shadow .35s var(--ease)}
-.card:has(.title a:focus-visible){outline:3px solid var(--brand);outline-offset:3px}
-.stage{position:relative;aspect-ratio:16/10;border-radius:12px;overflow:hidden;background:#08080a}
-.pv{position:absolute;inset:0;width:100%;height:100%;transition:transform .6s var(--ease);--ink:#f4f4f2;--ink-dim:#adadb2;--muted:#77777e;--line:rgba(255,255,255,.085)}
-.tag{position:absolute;z-index:1;left:10px;top:10px;padding:5px 11px;border-radius:999px;background:rgba(255,255,255,.94);color:#16161b;font-size:12px;font-weight:700;line-height:1.2}
-.results.no-tags .tag{display:none}
-.meta{display:flex;flex-direction:column;flex:1;padding:14px 8px 6px}
-.title{font-size:18px;font-weight:700;letter-spacing:-.01em;line-height:1.25}
-.title a{text-decoration:none;outline:none}
-.title a::after{content:"";position:absolute;inset:0;z-index:2;border-radius:20px}
-.desc{flex:1;margin-top:6px;font-size:15px;line-height:1.5;color:var(--ink-2)}
-.acts{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:14px}
-.copy{position:relative;z-index:3;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 16px;border-radius:999px;border:1px solid var(--line);background:var(--surface);font-size:14px;font-weight:600;cursor:pointer;transition:background .2s,border-color .2s,color .2s}
-.copy.done{background:var(--ok);border-color:var(--ok);color:#fff}
-.try{display:inline-flex;align-items:center;gap:6px;padding-right:6px;font-size:15px;font-weight:700;color:var(--brand)}
-.try .i{transition:transform .25s var(--ease)}
-@media(hover:hover){
- .card:hover{transform:translateY(-4px);box-shadow:var(--shadow-2)}
- .card:hover .pv{transform:scale(1.04)}
- .card:hover .try .i{transform:translateX(3px)}
- .copy:hover,.pillbtn:hover{border-color:var(--ink)}
- .copy.done:hover{border-color:var(--ok)}
-}
-
-/* below the cards */
-.more{display:flex;justify-content:center;margin-top:36px}
-.bigbtn{display:inline-flex;align-items:center;gap:10px;min-height:52px;padding:0 26px;border-radius:999px;border:1.5px solid var(--ink);background:none;font-size:16px;font-weight:700;cursor:pointer;transition:background .2s,color .2s}
-@media(hover:hover){.bigbtn:hover{background:var(--ink);color:var(--bg)}}
-.empty{display:flex;flex-direction:column;align-items:center;gap:12px;padding:56px 24px;border-radius:20px;background:var(--surface);box-shadow:var(--shadow);text-align:center}
-.empty-t{font-size:22px;font-weight:800}
-.empty-s{font-size:16px;color:var(--muted)}
-.empty .pop{margin-top:0}
-.noscript{max-width:60ch;margin-top:16px;line-height:1.7;color:var(--ink-2)}
-
-/* how it works, footer, message */
-.how{margin-top:clamp(56px,8vw,96px);padding:clamp(36px,6vw,80px) 0;background:var(--surface);border-block:1px solid var(--line-2)}
-.how-head{display:flex;flex-direction:column;align-items:center;gap:6px;margin-bottom:40px;text-align:center}
-.steps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;list-style:none}
-.step{display:flex;flex-direction:column;gap:10px;padding:28px;border-radius:20px;background:var(--bg)}
-.step-n{display:grid;place-items:center;width:44px;height:44px;flex:none;border-radius:50%;background:var(--ink);color:var(--bg);font-size:18px;font-weight:800}
-.step-t{margin-top:6px;font-size:20px;font-weight:700}
-.step-p{margin-top:4px;font-size:16px;line-height:1.55;color:var(--ink-2)}
-.fine{margin-top:32px;text-align:center;font-size:15px;color:var(--muted)}
-.foot{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px 24px;padding:36px 0 44px}
-.foot-t{font-size:15px;color:var(--muted)}
-.toast{position:fixed;z-index:60;left:50%;bottom:24px;display:flex;align-items:center;gap:10px;min-height:52px;max-width:calc(100% - 32px);padding:0 18px;border-radius:16px;background:var(--ink);color:var(--bg);font-size:15px;font-weight:600;box-shadow:0 12px 32px rgba(22,22,27,.28);opacity:0;transform:translate(-50%,16px);pointer-events:none;transition:opacity .25s,transform .25s var(--ease)}
-.toast.show{opacity:1;transform:translate(-50%,0)}
-.toast .ok{display:inline-grid;place-items:center;width:28px;height:28px;flex:none;border-radius:50%;background:#1f9d57;color:#fff}
-.toast .ok .i{width:16px;height:16px}
-
-/* tablet */
-@media(max-width:1024px){
- .float{display:none}
- .places{display:flex;flex-wrap:wrap;justify-content:center;gap:20px 16px}
- .place{width:calc((100% - 64px) / 5)}
- .grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}
-}
-/* phone */
-@media(max-width:600px){
- .top{min-height:60px}
- .nav .lnk,.gh{display:none}
- .brand{gap:10px;font-size:15px}
- .mark{width:28px;height:28px}
- .pill{gap:8px;padding:7px 13px;font-size:13px}
- .search{padding:5px 5px 5px 18px}
- #q{min-height:44px;margin-left:10px;font-size:16px}
- .go{width:44px;min-height:44px;padding:0}
- .go-l{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
- .go .i{display:block}
- .home-hero .pop{flex-wrap:nowrap;justify-content:flex-start;gap:8px;width:calc(100% + 2 * var(--gut));margin-inline:calc(-1 * var(--gut));padding-inline:var(--gut);overflow-x:auto;scrollbar-width:none}
- .home-hero .pop>span{display:none}
- .home-hero .pop button{flex:none;padding:0 14px;border:1px solid var(--line);border-radius:999px;background:var(--surface);font-size:14px;text-decoration:none;white-space:nowrap}
- .places-h{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal;margin-top:28px;font-size:18px;font-weight:800;letter-spacing:-.01em}
- .places{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px 10px;margin-top:14px}
- .place{width:auto}
- .art{height:92px;border-radius:20px}
- .pl-name{margin-top:8px;font-size:14px}
- .pl-count{margin-top:2px;font-size:12px}
- .results{scroll-margin-top:0}
- .results.filtered .pinbar{position:sticky;top:0;z-index:20;display:flex;flex-direction:column;gap:10px;margin:0 calc(-1 * var(--gut)) 16px;padding:10px var(--gut) 12px;background:var(--surface);border-bottom:1px solid var(--line);box-shadow:0 4px 16px rgba(22,22,27,.06)}
- .pinrow{display:flex;align-items:center;gap:8px}
- .pin-back{display:grid;place-items:center;width:44px;height:44px;flex:none;border-radius:999px;border:1px solid var(--line);background:var(--surface);cursor:pointer}
- .pin-search{display:flex;align-items:center;flex:1;min-width:0;padding:0 14px;border-radius:999px;border:1px solid var(--line);background:var(--bg)}
- .pin-search:focus-within{border-color:var(--brand)}
- .pin-search .i{color:var(--muted)}
- #q2{flex:1;min-width:0;min-height:44px;margin-left:8px;border:0;background:none;font-size:16px;outline:none;-webkit-appearance:none;appearance:none}
- .pchips{display:flex;gap:8px;margin-inline:calc(-1 * var(--gut));padding-inline:var(--gut);overflow-x:auto;scrollbar-width:none}
- .pchip{flex:none;min-height:44px;padding:0 14px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--ink-2);font-size:14px;font-weight:600;white-space:nowrap;cursor:pointer}
- .pchip[aria-pressed="true"]{background:var(--ink);border-color:var(--ink);color:var(--surface)}
- .group{scroll-margin-top:136px}
- .rhead{margin-bottom:16px}
- .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
- .card{padding:6px;border-radius:16px}
- .title a::after{border-radius:16px}
- .stage{border-radius:10px}
- .tag{left:6px;top:6px;padding:3px 8px;font-size:11px}
- .meta{padding:10px 6px 4px}
- .title{font-size:15px}
- .desc{margin-top:4px;font-size:13px;line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
- .acts{margin-top:10px}
- .copy{width:100%;justify-content:center;padding:0 8px;font-size:13px}
- .try{display:none}
- .how-head{margin-bottom:20px}
- .steps{grid-template-columns:1fr;gap:12px}
- .step{flex-direction:row;align-items:flex-start;gap:14px;padding:16px}
- .step-n{width:40px;height:40px;font-size:16px}
- .step-t{margin-top:0;font-size:17px}
- .step-p{font-size:15px}
- .foot{flex-direction:column;align-items:flex-start}
-}
-
-```
-
-- [ ] **Step 4: Replace the preview library's reduced-motion block** — replace the block
-
-```css
-@media(prefers-reduced-motion:reduce){
- .pv .anim{animation-play-state:paused!important}
- .card{transition:border-color .2s}
- .card:hover .pv{transform:none}
- .card.playing .live{animation:none;opacity:.6}
-}
-```
-
-with
-
-```css
-@media(prefers-reduced-motion:reduce){
- .pv .anim{animation-play-state:paused!important}
- .art *,.art *::before,.art *::after,.pill-dot::after{animation-play-state:paused!important}
- .float{display:none}
- .card,.card:hover,.card:hover .pv,.place:hover .art{transform:none;transition:none}
-}
-```
-
-(The tile pictures hold a clear frame: their delays and first keyframes show the button, the word, the card, the blobs, the menu icon, the spinner, the page lines, the phone and the first page.)
-
-- [ ] **Step 5: Replace the markup** — replace everything from `<div class="grid-bg"></div><div class="toplight"></div><div class="grain"></div>` through `</main>` with:
-
-```html
-<a class="skip" href="#results">Skip to the animations</a>
-<header class="wrap top" id="top">
- <a class="brand" href="./"><svg class="mark" viewBox="0 0 32 32" aria-hidden="true"><circle class="ring" cx="11.16" cy="20.84" r="6.1"/><circle class="ring" cx="15.12" cy="16.88" r="6.1"/><circle class="ring" cx="18.51" cy="13.49" r="6.1"/><circle class="ball" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <nav class="nav" aria-label="Site">
- <a class="lnk" id="nav-all" href="?view=all">Browse all</a>
- <a class="lnk" href="#how">How it works</a>
- <button type="button" class="icon-btn theme-btn" id="theme-toggle" aria-label="Switch between light and dark">
- <svg class="i moon" viewBox="0 0 24 24" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
- <svg class="i sun" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
- </button>
- <a class="gh" id="gh-stars" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener noreferrer"><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>GitHub <span class="gh-c" id="gh-star-count"></span></a>
- </nav>
-</header>
-
-<main>
- <section class="wrap home-hero" aria-labelledby="hero-title">
- <span class="float fl1" aria-hidden="true"></span><span class="float fl2" aria-hidden="true"></span><span class="float fl3" aria-hidden="true"></span>
- <span class="float fl4" aria-hidden="true"></span><span class="float fl5" aria-hidden="true"></span><span class="float fl6" aria-hidden="true"></span>
- <p class="pill"><span class="pill-dot" aria-hidden="true"></span>129 free animations · no coding needed</p>
- <h1 class="h1" id="hero-title">What do you want to animate?</h1>
- <p class="sub">Pick a place, or describe it in your own words. Every animation plays live, and each one comes with a ready-made prompt for your AI assistant.</p>
- <form class="search" id="search-form" role="search" action="./" method="get">
- <label class="sr" for="q">Describe the animation you want</label>
- <svg class="i" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/></svg>
- <input id="q" name="q" type="search" autocomplete="off" spellcheck="false" placeholder="For example: a button that bounces when clicked">
- <button type="button" class="clear" id="q-clear" aria-label="Clear the search" hidden><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
- <button type="submit" class="go"><span class="go-l">Search</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button>
- </form>
- <p class="pop"><span>Popular:</span><button type="button" data-q="fade in">fade in</button><button type="button" data-q="typing text">typing text</button><button type="button" data-q="loading spinner">loading spinner</button><button type="button" data-q="parallax">parallax</button><button type="button" data-q="confetti">confetti</button></p>
- </section>
-
- <section class="wrap" aria-labelledby="places-title">
- <h2 class="places-h" id="places-title">Or pick a place</h2>
- <div class="places" id="places">
- <button type="button" class="place p-btn" data-place="btn" aria-pressed="false"><span class="art" aria-hidden="true"><span class="ab-btn">Like</span><span class="ab-ring"></span><span class="ab-dot"></span></span><span class="pl-name">Buttons</span><span class="pl-count" data-count="btn"></span></button>
- <button type="button" class="place p-text" data-place="text" aria-pressed="false"><span class="art" aria-hidden="true"><span class="at"><span>W</span><span>o</span><span>w</span></span></span><span class="pl-name">Text</span><span class="pl-count" data-count="text"></span></button>
- <button type="button" class="place p-img" data-place="imgcard" aria-pressed="false"><span class="art" aria-hidden="true"><span class="ai"><span class="ai-sun"></span><span class="ai-m1"></span><span class="ai-m2"></span></span></span><span class="pl-name">Images &amp; cards</span><span class="pl-count" data-count="imgcard"></span></button>
- <button type="button" class="place p-bg" data-place="bg" aria-pressed="false"><span class="art" aria-hidden="true"><span class="abg b1"></span><span class="abg b2"></span><span class="abg b3"></span></span><span class="pl-name">Backgrounds</span><span class="pl-count" data-count="bg"></span></button>
- <button type="button" class="place p-menu" data-place="menu" aria-pressed="false"><span class="art" aria-hidden="true"><span class="am"><span></span><span></span><span></span></span></span><span class="pl-name">Menus &amp; forms</span><span class="pl-count" data-count="menu"></span></button>
- <button type="button" class="place p-load" data-place="load" aria-pressed="false"><span class="art" aria-hidden="true"><span class="al"><span class="al-spin"></span><span class="al-bar"><span></span></span></span></span><span class="pl-name">Loading &amp; messages</span><span class="pl-count" data-count="load"></span></button>
- <button type="button" class="place p-intro" data-place="intro" aria-pressed="false"><span class="art" aria-hidden="true"><span class="ap"><span class="h"></span><span class="l1"></span><span class="l2"></span></span></span><span class="pl-name">Page intros</span><span class="pl-count" data-count="intro"></span></button>
- <button type="button" class="place p-scroll" data-place="scroll" aria-pressed="false"><span class="art" aria-hidden="true"><span class="as"><span class="as-in"></span><span class="as-bar"></span></span></span><span class="pl-name">Scrolling</span><span class="pl-count" data-count="scroll"></span></button>
- <button type="button" class="place p-page" data-place="page" aria-pressed="false"><span class="art" aria-hidden="true"><span class="ax"><span class="pa"></span><span class="pb"></span></span></span><span class="pl-name">Page changes</span><span class="pl-count" data-count="page"></span></button>
- </div>
- </section>
-
- <section class="wrap results" id="results" aria-labelledby="results-title">
- <div class="pinbar" id="pinbar">
- <div class="pinrow">
- <button type="button" class="pin-back" id="pin-back" aria-label="Back to the start"><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg></button>
- <div class="pin-search"><label class="sr" for="q2">Describe the animation you want</label><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/></svg><input id="q2" type="search" autocomplete="off" spellcheck="false" placeholder="Search animations"></div>
- </div>
- <div class="pchips" role="group" aria-label="Places">
- <button type="button" class="pchip" data-place="btn" aria-pressed="false">Buttons</button>
- <button type="button" class="pchip" data-place="text" aria-pressed="false">Text</button>
- <button type="button" class="pchip" data-place="imgcard" aria-pressed="false">Images &amp; cards</button>
- <button type="button" class="pchip" data-place="bg" aria-pressed="false">Backgrounds</button>
- <button type="button" class="pchip" data-place="menu" aria-pressed="false">Menus &amp; forms</button>
- <button type="button" class="pchip" data-place="load" aria-pressed="false">Loading &amp; messages</button>
- <button type="button" class="pchip" data-place="intro" aria-pressed="false">Page intros</button>
- <button type="button" class="pchip" data-place="scroll" aria-pressed="false">Scrolling</button>
- <button type="button" class="pchip" data-place="page" aria-pressed="false">Page changes</button>
- </div>
- </div>
- <div class="rhead">
- <div><h2 class="rtitle" id="results-title">Good places to start</h2><p class="rsub" id="results-sub" aria-live="polite">Eight favorites from different places. Pick a place above to see more.</p></div>
- <button type="button" class="pillbtn" id="clear-view" hidden><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>Clear</button>
- </div>
- <div id="cards"></div>
- <div class="empty" id="empty" hidden>
- <p class="empty-t" id="empty-title">Nothing matches that yet</p>
- <p class="empty-s">Try a simpler word, or pick one of these:</p>
- <p class="pop"><button type="button" data-q="fade in">fade in</button><button type="button" data-q="typing text">typing text</button><button type="button" data-q="loading spinner">loading spinner</button><button type="button" data-q="parallax">parallax</button><button type="button" data-q="confetti">confetti</button></p>
- </div>
- <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 129 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>
- <noscript><p class="noscript">This page shows its animations with JavaScript. All 129 are still easy to reach: see the <a href="https://github.com/matinmonshizadeh/animation-handbook#categories">category list on GitHub</a> or the <a href="sitemap.xml">full sitemap</a>. Each demo is a page of its own under <code>/animations/&lt;category&gt;/&lt;name&gt;/</code>.</p></noscript>
- </section>
-
- <section class="how" id="how" aria-labelledby="how-title">
- <div class="wrap">
- <div class="how-head"><h2 class="rtitle" id="how-title">How it works</h2><p class="rsub">Three steps, and no code to read.</p></div>
- <ol class="steps">
- <li class="step"><span class="step-n" aria-hidden="true">1</span><div><h3 class="step-t">Watch it</h3><p class="step-p">Every animation plays right on its page, so you see exactly what you will get.</p></div></li>
- <li class="step"><span class="step-n" aria-hidden="true">2</span><div><h3 class="step-t">Change it to fit</h3><p class="step-p">Try a few simple settings, like speed or direction, and watch the preview update.</p></div></li>
- <li class="step"><span class="step-n" aria-hidden="true">3</span><div><h3 class="step-t">Copy the prompt</h3><p class="step-p">Paste it into your AI assistant. It describes the animation in plain words, with your settings.</p></div></li>
- </ol>
- <p class="fine">Free and open source (MIT). No sign-up.</p>
- </div>
- </section>
-</main>
-
-<footer class="wrap foot">
- <a class="brand" href="./"><svg class="mark" viewBox="0 0 32 32" aria-hidden="true"><circle class="ring" cx="11.16" cy="20.84" r="6.1"/><circle class="ring" cx="15.12" cy="16.88" r="6.1"/><circle class="ring" cx="18.51" cy="13.49" r="6.1"/><circle class="ball" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <p class="foot-t">129 web animations with live demos and copyable prompts.</p>
- <nav class="nav" aria-label="Footer"><a class="lnk" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener noreferrer">GitHub</a><a class="lnk" href="#top">Back to top</a></nav>
-</footer>
-<div class="toast" id="toast" role="status" aria-live="polite"><span class="ok" aria-hidden="true"><svg class="i" viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="toast-t"></span></div>
-```
-
-- [ ] **Step 6: Remove the old grid builder** — delete the statement block that starts with `const root=document.getElementById('root');` and ends with the `});` closing its `CATS.forEach(cat=>{` loop (just before `const reduce=`).
-
-- [ ] **Step 7: Replace the old card, filter, chip and key code** — replace everything from `document.querySelectorAll('.card').forEach(card=>{` (right after the `const engines=…;` line) to the end of the script (the last `addEventListener('keydown',…);` statement, before `</script>`) with:
-
-```js
-// ---------- Home page: places and cards ----------
-const PLACE_LIST=[
- {key:'btn',name:'Buttons',url:'buttons'},
- {key:'text',name:'Text',url:'text'},
- {key:'imgcard',name:'Images & cards',url:'images-and-cards'},
- {key:'bg',name:'Backgrounds',url:'backgrounds'},
- {key:'menu',name:'Menus & forms',url:'menus-and-forms'},
- {key:'load',name:'Loading & messages',url:'loading-and-messages'},
- {key:'intro',name:'Page intros',url:'page-intros'},
- {key:'scroll',name:'Scrolling',url:'scrolling'},
- {key:'page',name:'Page changes',url:'page-changes'}
-];
-const PLACE=Object.fromEntries(PLACE_LIST.map(p=>[p.key,p]));
-const esc=s=>String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
-const slugify=x=>x.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'');
-const wordsOf=s=>s.toLowerCase().replace(/[^a-z0-9]+/g,' ').trim().split(' ').filter(Boolean);
-// Every animation in home order, with the words search looks at.
-const ALL=[];
-CATS.forEach(cat=>cat.entries.forEach(([slug,name,desc])=>{
- const places=PLACES[slug]||[];
- ALL.push({slug,name,desc,cat,places,order:ALL.length,url:`${cat.folder}/${slug}/`,
- nameW:wordsOf(name),placeW:wordsOf(places.map(k=>PLACE[k].name).join(' ')),descW:wordsOf(desc+' '+cat.name)});
-}));
-const BY_SLUG=Object.fromEntries(ALL.map(e=>[e.slug,e]));
-const ICON_COPY='<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>';
-const ICON_DONE='<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
-const ICON_OPEN='<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M7 17L17 7M8 7h9v9"/></svg>';
-const ICON_ARROW='<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>';
-
-// A preview plays while its card is on screen (on phones, while the card is in the middle of the screen).
-const hoverCap=matchMedia('(hover:hover)').matches;
-const io='IntersectionObserver'in window?new IntersectionObserver(es=>es.forEach(en=>en.target[en.isIntersecting?'_play':'_pause']()),
- hoverCap?{threshold:.2}:{rootMargin:'-34% 0px -34% 0px'}):null;
-function buildCard(e){
- const pv=PV[e.slug]||'sig'+parseInt(e.cat.n,10);
- const card=document.createElement('article');
- card.className='card '+e.cat.cat.replace('-cat','');
- card.dataset.slug=e.slug;card.dataset.pv=pv;
- card.innerHTML=`<div class="stage"><div class="pv pv-${pv}" aria-hidden="true">${pvMarkup(pv)}</div>`+
- `<span class="tag">${esc(e.places.length?PLACE[e.places[0]].name:e.cat.name)}</span></div>`+
- `<div class="meta"><h3 class="title"><a href="${esc(e.url)}">${esc(e.name)}</a></h3><p class="desc">${esc(e.desc)}</p>`+
- `<div class="acts"><button type="button" class="copy" aria-label="${esc('Copy prompt for '+e.name)}">${ICON_COPY}<span class="copy-l">Copy prompt</span></button>`+
- `<span class="try" aria-hidden="true">Try it${ICON_ARROW}</span></div></div>`;
- if(reduce)card.querySelectorAll('animate').forEach(a=>a.remove());
- const eng=engines[pv]?engines[pv](card.querySelector('.pv')):null;
- card._play=()=>{card.classList.add('playing');eng&&eng.play();};
- card._pause=()=>{card.classList.remove('playing');eng&&eng.pause();};
- card.addEventListener('focusin',card._play);
- if(io)io.observe(card);
- return card;
-}
-const CARD=Object.fromEntries(ALL.map(e=>[e.slug,buildCard(e)]));
-const $=id=>document.getElementById(id);
-const resultsEl=$('results'),cardsBox=$('cards');
-let shown=[];
-// Cards that left the page stop. The canvas previews size themselves on resize, so one resize lets them measure their new place.
-function place(cards){
- shown.forEach(c=>{if(!cards.includes(c))c._pause();});
- shown=cards;
- if(!io)cards.forEach(c=>c._play());
- dispatchEvent(new Event('resize'));
-}
-function showCards(list){
- const grid=document.createElement('div');grid.className='grid';
- const cards=list.map(e=>CARD[e.slug]);
- cards.forEach(c=>grid.appendChild(c));
- cardsBox.replaceChildren(grid);
- place(cards);
-}
-document.querySelectorAll('[data-count]').forEach(el=>{
- const n=ALL.filter(e=>e.places.includes(el.dataset.count)).length;
- el.textContent=n+(n===1?' animation':' animations');
-});
-showCards(PICKS.map(s=>BY_SLUG[s]));
-
-(function(){const btn=$('theme-toggle');if(!btn)return;
- btn.addEventListener('click',()=>{const next=document.documentElement.dataset.theme==='light'?'dark':'light';
- document.documentElement.dataset.theme=next;try{localStorage.setItem('ah-theme',next);}catch(e){}});})();
-addEventListener('keydown',e=>{const t=document.activeElement&&document.activeElement.tagName;
- if(e.key==='/'&&t!=='INPUT'&&t!=='TEXTAREA'){e.preventDefault();$('q').focus();}});
-```
-
-(The `loadStars` block at the top of the script stays: it still fills `#gh-star-count`.)
-
-- [ ] **Step 8: Run the tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS.
-
-- [ ] **Step 9: Check the page in Chrome and look at it**
-
-Serve the worktree, then run: `node tools/check-pages.mjs --base http://127.0.0.1:<port> home`
-Expected: six `ok` lines. Then open the screenshots it names (`home-desktop.png`, `home-desktop-full.png`, `home-tablet.png`, `home-phone.png`, `home-phone-reduced.png`, `home-phone-small.png`) with the Read tool and compare them with the canvas row "A · Friendly guide": the pill, heading, line, search box and Popular row centered; nine tiles in one row on desktop, five plus four on the tablet, three by three on phones; eight Start cards (four across on desktop, two on phones) with a place label, name, description, Copy prompt and (desktop) Try it; How it works; the footer. Fix anything that differs, then rerun the check.
-
-- [ ] **Step 10: Commit**
-
-```bash
-git add index.html tests/pages.test.js
-git commit -m "feat: the new home page: a plain question, search, nine place tiles, Start cards with Copy prompt, How it works"
-```
-
----
-
-### Task 5: Views, search and the address
-
-**Files:**
-- Modify: `index.html` (the home script)
-- Modify: `tools/check-pages.mjs` (two new check functions, called in the `if (home)` branch)
-
-**Interfaces:**
-- Consumes: everything Task 4 produces (`ALL`, `BY_SLUG`, `PLACE`, `PLACE_LIST`, `CARD`, `esc`, `slugify`, `wordsOf`, `place()`, `showCards()`, `$`, `resultsEl`, `cardsBox`, the element ids, `data-place`, `data-q`).
-- Produces: `state` ({q, place, view, all}), `render()`, `go(next, push)`, `readURL()`, `writeURL(push)`, `search(text)`, `queryWords(text)`, `score(e, words)`, `showGroups()`, `toResults()`. Addresses: `?place=<url name>`, `?q=<text>`, `?view=all`, `&all=1` when Show all is pressed, and old `?cat=<category name>` links.
-
-- [ ] **Step 1: Write the failing checks** — in `tools/check-pages.mjs`, add before the `cleanUp()` function:
-
-```js
-// Home page, desktop run: a tile press shows that place and changes the address, Show all shows the rest, Back returns to
-// the start, a plain sentence finds the right animations, a word with no match says so, All animations lists every card
-// under its seven headings, and the old ?q= and ?cat= links still work. Leaves the home page on ?cat=micro-interactions.
-async function homeViewProblems() {
- const problems = [];
- const view = () => evaluate(`({ title: document.getElementById('results-title').textContent, cards: document.querySelectorAll('#cards .card').length,
- more: document.getElementById('more').hidden ? '' : document.getElementById('more-label').textContent, search: location.search })`);
- const type = text => evaluate(`(() => { const q = document.getElementById('q'); q.value = ${JSON.stringify(text)}; q.dispatchEvent(new Event('input', { bubbles: true })); })()`);
- await evaluate(`document.querySelector('.place[data-place="btn"]').click()`);
- await sleep(300);
- let v = await view();
- if (v.title !== 'Buttons' || v.cards !== 8 || v.more !== 'Show all 15' || v.search !== '?place=buttons') problems.push(`Buttons tile: ${JSON.stringify(v)}`);
- await evaluate(`document.getElementById('more-btn').click()`);
- await sleep(300);
- v = await view();
- if (v.cards !== 15 || v.more !== '' || v.search !== '?place=buttons&all=1') problems.push(`Show all: ${JSON.stringify(v)}`);
- await evaluate(`history.back()`);
- await sleep(500);
- v = await view();
- if (v.title !== 'Good places to start' || v.cards !== 8 || v.search !== '') problems.push(`Back: ${JSON.stringify(v)}`);
- await type('a button that bounces when clicked');
- await sleep(300);
- const found = await evaluate(`[...document.querySelectorAll('#cards .card .title a')].map(a => a.textContent)`);
- if (found[0] !== 'Click / Tap Ripple' || !found.slice(0, 4).includes('Bounce In')) problems.push(`search order: ${found.slice(0, 5).join(', ')}`);
- await type('zebra');
- await sleep(300);
- const empty = await evaluate(`!document.getElementById('empty').hidden && document.getElementById('empty-title').textContent`);
- if (empty !== 'Nothing matches “zebra” yet') problems.push(`nothing found: ${empty}`);
- await evaluate(`document.getElementById('nav-all').click()`);
- await sleep(500);
- const all = await evaluate(`({ groups: document.querySelectorAll('#cards .group').length, cards: document.querySelectorAll('#cards .card').length, search: location.search })`);
- if (all.groups !== 7 || all.cards !== 129 || all.search !== '?view=all') problems.push(`All animations: ${JSON.stringify(all)}`);
- // Old links keep working: ?q= opens the search, ?cat= opens All animations at that category's heading.
- for (const [query, want] of [['?q=fade', 'Results for “fade”'], ['?cat=micro-interactions', 'All animations']]) {
- let onLoad;
- const loaded = new Promise(resolve => { onLoad = msg => { if (msg.method === 'Page.loadEventFired') resolve(); }; listeners.add(onLoad); });
- await send('Page.navigate', { url: `${BASE}/${query}` });
- try { await withTimeout(loaded, LOAD_TIMEOUT); } catch { problems.push(`${query} did not load`); }
- listeners.delete(onLoad);
- await sleep(300);
- const got = await evaluate(`({ title: document.getElementById('results-title').textContent,
- top: (() => { const g = document.getElementById('cat-micro-interactions'); return g ? Math.round(g.getBoundingClientRect().top) : null; })() })`);
- if (got.title !== want) problems.push(`${query}: heading "${got.title}"`);
- if (query.startsWith('?cat=') && (got.top === null || Math.abs(got.top - 12) > 24)) problems.push(`${query}: the category heading is at ${got.top}px, not at the top`);
- }
- return problems;
-}
-
-// Home page, phone run: a tile press scrolls to the results, and the slim bar sticks to the top with that place pressed.
-async function homePhoneProblems() {
- await evaluate(`document.querySelector('.place[data-place="text"]').click()`);
- await sleep(900);
- const v = await evaluate(`(() => { const bar = document.getElementById('pinbar');
- return { title: document.getElementById('results-title').textContent, shown: getComputedStyle(bar).display !== 'none',
- top: Math.round(bar.getBoundingClientRect().top), pressed: [...bar.querySelectorAll('[aria-pressed="true"]')].map(b => b.textContent) }; })()`);
- return v.title === 'Text' && v.shown && Math.abs(v.top) <= 1 && v.pressed.join() === 'Text' ? [] : [`phone, Text tile: ${JSON.stringify(v)}`];
-}
-```
-
-and fill the `if (home)` branch of the loop:
-
-```js
- if (home) {
- if (setup.moves) problems.push(...await homeViewProblems());
- if (setup.name === 'phone') problems.push(...await homePhoneProblems());
- }
-```
-
-- [ ] **Step 2: Run the check and see it fail**
-
-Serve the worktree, then run: `node tools/check-pages.mjs --base http://127.0.0.1:<port> home`
-Expected: `FAIL home desktop — Buttons tile: …` (the tiles do nothing yet) and `FAIL home phone — phone, Text tile: …`; the other four lines `ok`.
-
-- [ ] **Step 3: Add the views** — in `index.html`, replace the two statements `showCards(PICKS.map(s=>BY_SLUG[s]));` and the final `addEventListener('keydown',…);` of the home script with the code below (the theme button block between them stays where it is):
-
-```js
-// ---------- Views, search and the address ----------
-const PAGE=8;
-const STOP=new Set(['a','an','and','the','that','this','to','for','with','when','on','in','of','my','it','i','want','make','some']);
-const stem=w=>w.length>3?w.replace(/(ing|ed|es|s)$/,''):w;
-function queryWords(text){return [...new Set(wordsOf(text).filter(w=>!STOP.has(w)).map(stem).filter(w=>w.length>=2))];}
-// A word counts 3 in the name, 2 in a place name, 1 in the description or category; each is matched by the start of a word.
-function score(e,words){
- let s=0;
- for(const w of words){
- if(e.nameW.some(x=>x.startsWith(w)))s+=3;
- if(e.placeW.some(x=>x.startsWith(w)))s+=2;
- if(e.descW.some(x=>x.startsWith(w)))s+=1;
- }
- return s;
-}
-function search(text){
- const words=queryWords(text);
- if(!words.length)return [];
- return ALL.map(e=>({e,s:score(e,words)})).filter(x=>x.s>0).sort((a,b)=>b.s-a.s||a.e.order-b.e.order).map(x=>x.e);
-}
-function showGroups(){
- const boxes=[],cards=[];
- CATS.forEach(cat=>{
- const list=ALL.filter(e=>e.cat===cat),box=document.createElement('section');
- box.className='group';box.id='cat-'+slugify(cat.name);box.setAttribute('aria-labelledby',box.id+'-h');
- box.innerHTML=`<h3 class="ghead" id="${box.id}-h"><span class="gnum">${cat.n}</span><span class="gname">${esc(cat.name)}</span><span class="gcount">${list.length} animations</span></h3>`;
- const grid=document.createElement('div');grid.className='grid';
- list.forEach(e=>{grid.appendChild(CARD[e.slug]);cards.push(CARD[e.slug]);});
- box.appendChild(grid);boxes.push(box);
- });
- cardsBox.replaceChildren(...boxes);
- place(cards);
-}
-const state={q:'',place:'',view:'',all:false};
-const q=$('q'),q2=$('q2'),qClear=$('q-clear'),titleEl=$('results-title'),subEl=$('results-sub'),clearBtn=$('clear-view'),
- emptyEl=$('empty'),emptyTitle=$('empty-title'),moreBox=$('more'),moreLabel=$('more-label');
-const phone=matchMedia('(max-width:600px)');
-let moreAction='all';
-function render(){
- const filtered=!!(state.q||state.place||state.view);
- let list=null,title,sub,tags=true;
- if(state.q){
- list=search(state.q);title='Results for “'+state.q+'”';
- sub=list.length===1?'1 animation matches.':list.length+' animations match.';
- }else if(state.place){
- list=ALL.filter(e=>e.places.includes(state.place));title=PLACE[state.place].name;sub=list.length+' animations';tags=false;
- }else if(state.view==='all'){
- title='All animations';sub=ALL.length+' animations in '+CATS.length+' groups.';
- }else{
- list=PICKS.map(s=>BY_SLUG[s]);title='Good places to start';sub='Eight favorites from different places. Pick a place above to see more.';
- }
- titleEl.textContent=title;subEl.textContent=sub;
- resultsEl.classList.toggle('filtered',filtered);
- resultsEl.classList.toggle('no-tags',!tags);
- clearBtn.hidden=!filtered;
- if(list)showCards(state.all||!filtered?list:list.slice(0,PAGE));else showGroups();
- const empty=!!list&&!list.length;
- emptyEl.hidden=!empty;
- if(empty)emptyTitle.textContent='Nothing matches “'+state.q+'” yet';
- if(!filtered||empty){moreAction='all';moreLabel.textContent='Browse all '+ALL.length+' animations';moreBox.hidden=false;}
- else if(list&&!state.all&&list.length>PAGE){moreAction='expand';moreLabel.textContent='Show all '+list.length;moreBox.hidden=false;}
- else moreBox.hidden=true;
- document.querySelectorAll('[data-place]').forEach(b=>b.setAttribute('aria-pressed',String(!state.q&&b.dataset.place===state.place)));
- [q,q2].forEach(input=>{if(input!==document.activeElement&&input.value!==state.q)input.value=state.q;});
- qClear.hidden=!q.value;
-}
-function writeURL(push){
- const p=new URLSearchParams();
- if(state.q)p.set('q',state.q);
- else if(state.place)p.set('place',PLACE[state.place].url);
- else if(state.view)p.set('view','all');
- if(state.all&&(state.q||state.place))p.set('all','1');
- const url=p.toString()?'?'+p:location.pathname;
- history[push?'pushState':'replaceState'](null,'',url);
-}
-// Reads the view from the address. Returns the category of an old ?cat= link, to scroll to.
-function readURL(){
- const p=new URLSearchParams(location.search),found=PLACE_LIST.find(x=>x.url===p.get('place')),cat=p.get('cat')||'';
- Object.assign(state,{q:(p.get('q')||'').trim(),place:'',view:'',all:p.get('all')==='1'});
- if(!state.q&&found)state.place=found.key;
- else if(!state.q&&(p.get('view')==='all'||cat))state.view='all';
- q.value=q2.value=state.q;
- return cat;
-}
-function go(next,push){Object.assign(state,{q:'',place:'',view:'',all:false},next);writeURL(push);render();}
-const toResults=()=>resultsEl.scrollIntoView({behavior:reduce?'auto':'smooth',block:'start'});
-document.addEventListener('click',e=>{
- const tile=e.target.closest('[data-place]');
- if(tile){
- const key=tile.dataset.place;
- go(!state.q&&state.place===key?{}:{place:key},true);
- if(phone.matches&&state.place)toResults();
- return;
- }
- const pick=e.target.closest('[data-q]');
- if(pick){go({q:pick.dataset.q},true);if(phone.matches)toResults();}
-});
-function typed(input){
- (input===q?q2:q).value=input.value;
- Object.assign(state,{q:input.value.trim(),place:'',view:'',all:false});
- writeURL(false);render();
-}
-q.addEventListener('input',()=>typed(q));
-q2.addEventListener('input',()=>typed(q2));
-$('search-form').addEventListener('submit',e=>{e.preventDefault();toResults();});
-qClear.addEventListener('click',()=>{q.value='';typed(q);q.focus();});
-clearBtn.addEventListener('click',()=>go({},true));
-$('pin-back').addEventListener('click',()=>{go({},true);scrollTo({top:0,behavior:reduce?'auto':'smooth'});});
-$('more-btn').addEventListener('click',()=>{
- if(moreAction==='all'){go({view:'all'},true);toResults();}
- else{state.all=true;writeURL(false);render();}
-});
-$('nav-all').addEventListener('click',e=>{e.preventDefault();go({view:'all'},true);toResults();});
-addEventListener('popstate',()=>{readURL();render();});
-addEventListener('keydown',e=>{
- const el=document.activeElement,t=el&&el.tagName;
- if(e.key==='/'&&t!=='INPUT'&&t!=='TEXTAREA'){e.preventDefault();q.focus();}
- else if(e.key==='Escape'&&(el===q||el===q2)){el.value='';typed(el);el.blur();}
-});
-const startCat=readURL();
-render();
-if(startCat){const g=$('cat-'+startCat);if(g)g.scrollIntoView();}
-```
-
-- [ ] **Step 4: Run the check**
-
-Run: `node tools/check-pages.mjs --base http://127.0.0.1:<port> home`
-Expected: six `ok` lines.
-
-- [ ] **Step 5: Run the tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: PASS.
-
-- [ ] **Step 6: Commit**
-
-```bash
-git add index.html tools/check-pages.mjs
-git commit -m "feat: the home page's tiles, search, Show all, All animations and address; the check tries them"
-```
-
----
-
-### Task 6: Copy prompt on the cards
-
-**Files:**
-- Modify: `index.html` (the `<head>`: one `<script>` line; the end of the home script)
-- Modify: `tests/pages.test.js` (the version test)
-- Modify: `tools/check-pages.mjs` (a new check function, called in the `if (home)` branch)
-
-**Interfaces:**
-- Consumes: `DemoPage.pageCopyText(doc, win)` (Task 1, in `assets/js/demo-page.js?v=6`); `cardsBox`, `$`, `ICON_COPY`, `ICON_DONE`, `ICON_OPEN`, `ALL` (Task 4).
-- Produces: `promptFor(url): Promise<string>` (top-level in the home script, cached per page; the check calls it), `writeClipboard(textPromise)`, `toast(message)`, `copyState(button, '' | 'done' | 'fail')`.
-
-- [ ] **Step 1: Put the home page in the version test** — in `tests/pages.test.js`, replace the test `every guided-steps page links the same version of the shared files` with:
-
-```js
-test('every guided-steps page and the home page link the same version of the shared files', () => {
- const versions = new Set([...steps.map(pageOf), HOME].flatMap(html => [...html.matchAll(/demo-page\.(?:css|js)\?v=(\d+)/g)].map(m => m[1])));
- assert.equal(versions.size, 1, `versions in use: ${[...versions].join(', ')}`);
- assert.match(HOME, /<script src="assets\/js\/demo-page\.js\?v=\d+" defer><\/script>/, 'the home page links the page script, for Copy prompt');
-});
-```
-
-- [ ] **Step 2: Add the Copy prompt check** — in `tools/check-pages.mjs`, add before `cleanUp()`:
-
-```js
-// Home page, desktop run: the Copy prompt button puts a page's text on the clipboard and says so (the clipboard is stubbed:
-// a headless run cannot grant it), then, for every page, the home page's text equals what the page's own Copy prompt gives
-// before any change. Leaves the home page.
-async function homeCopyProblems() {
- const problems = [];
- const wiring = await evaluate(`(async () => {
- let got = null;
- navigator.clipboard.write = async items => { got = await (await items[0].getType('text/plain')).text(); };
- navigator.clipboard.writeText = async text => { got = text; };
- const btn = document.querySelector('#cards .card .copy');
- btn.click();
- for (let i = 0; i < 60 && got === null; i++) await new Promise(r => setTimeout(r, 50));
- await new Promise(r => setTimeout(r, 50));
- const url = btn.closest('.card').querySelector('.title a').getAttribute('href');
- return { same: got === await promptFor(url), label: btn.textContent.trim(), toast: document.getElementById('toast').classList.contains('show') };
- })()`);
- if (!wiring.same || wiring.label !== 'Copied' || !wiring.toast) problems.push(`Copy prompt button: ${JSON.stringify(wiring)}`);
- const items = await evaluate(`Promise.all(ALL.map(e => promptFor(e.url).then(text => ({ url: e.url, text }), err => ({ url: e.url, text: 'ERROR ' + err.message }))))`);
- for (const { url, text } of items) {
- let onLoad;
- const loaded = new Promise(resolve => { onLoad = msg => { if (msg.method === 'Page.loadEventFired') resolve(); }; listeners.add(onLoad); });
- await send('Page.navigate', { url: `${BASE}/${url}` });
- try { await withTimeout(loaded, LOAD_TIMEOUT); } catch { problems.push(`${url} did not load`); }
- listeners.delete(onLoad);
- const own = await evaluate(`DemoPage.pageCopyText(document, window)`);
- if (own !== text) problems.push(`Copy prompt text differs for ${url}`);
- }
- return problems;
-}
-```
-
-and in the `if (home)` branch, after the `homeViewProblems()` line, add `if (setup.moves) problems.push(...await homeCopyProblems());` (it must stay the last check of the desktop run: it leaves the home page).
-
-- [ ] **Step 3: Run the test and the check, and see them fail**
-
-Run: `node --test tests/pages.test.js` → FAIL ("the home page links the page script").
-Run: `node tools/check-pages.mjs --base http://127.0.0.1:<port> home` → `FAIL home desktop — … promptFor is not defined`.
-
-- [ ] **Step 4: Link the shared page script** — in `index.html`'s `<head>`, right after the theme script line (`<script>document.documentElement.classList.add('js');…</script>`), add:
-
-```html
-<script src="assets/js/demo-page.js?v=6" defer></script>
-```
-
-(On the home page the script sets nothing up: it only lends `DemoPage.pageCopyText`.)
-
-- [ ] **Step 5: Add Copy prompt** — at the end of the home script (after the Task 5 code), add:
-
-```js
-// ---------- Copy prompt on the cards ----------
-// The text is the page's own: the home page reads the page's HTML and builds the text with the shared page script
-// (DemoPage), every setting at its default. Nothing on a fetched page is laid out, so no control counts as hidden by style.
-const pageTexts=new Map(),NO_STYLE={getComputedStyle:()=>({display:''})};
-function promptFor(url){
- let text=pageTexts.get(url);
- if(!text){
- text=fetch(url).then(r=>{if(!r.ok)throw new Error('HTTP '+r.status);return r.text();}).then(html=>{
- if(!window.DemoPage)throw new Error('the page script has not loaded');
- const t=DemoPage.pageCopyText(new DOMParser().parseFromString(html,'text/html'),NO_STYLE);
- if(!t)throw new Error('no prompt on the page');
- return t;
- });
- text.catch(()=>pageTexts.delete(url));
- pageTexts.set(url,text);
- }
- return text;
-}
-// Safari only writes the clipboard while the press is fresh, so the text goes in as a promise where the browser allows it.
-async function writeClipboard(text){
- const clip=navigator.clipboard;
- if(!clip)throw new Error('no clipboard');
- if(window.ClipboardItem&&clip.write){
- try{await clip.write([new ClipboardItem({'text/plain':text.then(t=>new Blob([t],{type:'text/plain'}))})]);return;}
- catch(err){if(err&&err.name==='NotAllowedError')throw err;}
- }
- await clip.writeText(await text);
-}
-const toastEl=$('toast');let toastTimer=0;
-function toast(message){
- toastEl.querySelector('.toast-t').textContent=message;
- toastEl.classList.add('show');
- clearTimeout(toastTimer);toastTimer=setTimeout(()=>toastEl.classList.remove('show'),2400);
-}
-function copyState(btn,kind){
- const name=btn.closest('.card').querySelector('.title a').textContent;
- clearTimeout(btn._timer);
- btn.classList.toggle('done',kind==='done');btn.classList.toggle('fail',kind==='fail');
- if(kind==='done'){
- btn.innerHTML=ICON_DONE+'<span class="copy-l">Copied</span>';btn.setAttribute('aria-label','Prompt copied for '+name);
- btn._timer=setTimeout(()=>copyState(btn,''),1800);
- }else if(kind==='fail'){
- btn.innerHTML=ICON_OPEN+'<span class="copy-l">Open to copy</span>';btn.setAttribute('aria-label','Open the page to copy the prompt for '+name);
- }else{
- btn.innerHTML=ICON_COPY+'<span class="copy-l">Copy prompt</span>';btn.setAttribute('aria-label','Copy prompt for '+name);
- }
-}
-const urlOf=card=>card.querySelector('.title a').getAttribute('href');
-cardsBox.addEventListener('click',e=>{
- const btn=e.target.closest('.copy');
- if(!btn)return;
- const url=urlOf(btn.closest('.card'));
- if(btn.classList.contains('fail')){location.href=url+'#hb-prompt-title';return;}
- writeClipboard(promptFor(url)).then(()=>{copyState(btn,'done');toast('Prompt copied. Paste it into your AI assistant.');},()=>copyState(btn,'fail'));
-});
-// Reading the page starts when the pointer rests on a card or a card gets focus, so the copy is quick.
-const warm=e=>{const card=e.target.closest&&e.target.closest('.card');if(card)promptFor(urlOf(card)).catch(()=>{});};
-cardsBox.addEventListener('pointerover',warm);
-cardsBox.addEventListener('focusin',warm);
-```
-
-- [ ] **Step 6: Run the tests and the check**
-
-Run: `node --test "tests/*.test.js"` → PASS.
-Run: `node tools/check-pages.mjs --base http://127.0.0.1:<port> home` → six `ok` lines (the desktop run takes a few minutes: it visits all 129 pages). A "Copy prompt text differs for …" line means that page's controls read differently in its HTML than on the live page (for example a control hidden by a style rule, or a default set by the page's script at load): make that page's default visible in its HTML (the `hidden` attribute or `data-hb-skip` for a control that must not count, the pressed or checked state written in the markup), keeping the page's look and behavior exactly, and rerun.
-
-- [ ] **Step 7: Commit**
-
-```bash
-git add index.html tests/pages.test.js tools/check-pages.mjs
-git commit -m "feat: Copy prompt on every home card copies the page's own prompt and settings; the check compares all 129"
-```
-
-(Commit any page fix from Step 6 separately: `fix: <page>: its default settings are written in its HTML, so Copy prompt on the home page matches the page`.)
-
----
-
-### Task 7: Docs — places and the home check
-
-**Files:**
-- Modify: `CLAUDE.md`, `CONTRIBUTING.md`
-
-**Interfaces:**
-- Consumes: the names `PLACES`, `PICKS`, the place keys, the `home` check target.
-
-- [ ] **Step 1: CLAUDE.md** — make these four edits:
- 1. In "The page", item 2, replace `the category line \`NN.MM · Category\` (its place on the home page)` with `the category line \`NN.MM · Category\` (its place in the home page's All animations list)`.
- 2. After the paragraph under **Shared files** that ends "`demo-page.js` runs it.", add the sentence: `The home page links \`demo-page.js\` too (its cards' Copy prompt builds the text with \`DemoPage.pageCopyText\`), with the same \`N\`.`
- 3. In "When asked to add a new animation", step 6, append: ` Give it one or more places in \`PLACES\` (right after \`PV\` in the same script): \`btn\` Buttons, \`text\` Text, \`imgcard\` Images & cards, \`bg\` Backgrounds, \`menu\` Menus & forms, \`load\` Loading & messages, \`intro\` Page intros, \`scroll\` Scrolling, \`page\` Page changes; the first one labels its card.`
- 4. Under "Tests and the page check", after the **Page check** bullet, add a bullet: `- **Home page:** \`node tools/check-pages.mjs --base http://127.0.0.1:<port> home\` checks the home page at the same six setups (six \`ok\` lines). Its desktop run also tries the tiles, the search and Show all, and compares Copy prompt on the home page with every page's own; run it after changing any page's settings or prompt.`
-
-- [ ] **Step 2: CONTRIBUTING.md** — make these three edits:
- 1. In step 5 of adding an animation, after "Register the entry in the root `index.html` `CATS` array (slug, name, one-line description)", insert ", give it one or more places in `PLACES` (the home page's tiles: `btn`, `text`, `imgcard`, `bg`, `menu`, `load`, `intro`, `scroll`, `page`; the first labels its card)".
- 2. In the paragraph that says the one-line description is "its card on the home page", keep it as is (still true).
- 3. After the code block with `node tools/check-pages.mjs --base http://127.0.0.1:<port> animations/02-entrance-and-exit/rotate-in`, add the paragraph: `The home page has a check of its own: \`node tools/check-pages.mjs --base http://127.0.0.1:<port> home\`. It checks the layout at the six setups, tries the tiles, the search and Show all, and compares Copy prompt on the home page with every page's own prompt and default settings.`
-
-- [ ] **Step 3: Run the tests**
-
-Run: `node --test "tests/*.test.js"` → PASS (nothing in the docs is tested; this guards against a stray edit elsewhere).
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add CLAUDE.md CONTRIBUTING.md
-git commit -m "docs: a new animation gets its places on the home page; the home page check"
-```
-
----
-
-### Task 8: Final check, review and publish
-
-**Files:** none new.
-
-- [ ] **Step 1: Everything merged into one tree** — all task branches merged into `main` locally (wave 1, then wave 2), no conflicts left.
-
-- [ ] **Step 2: All tests**
-
-Run: `node --test "tests/*.test.js"` → PASS.
-
-- [ ] **Step 3: Whole-site check**
-
-Serve the repo, then run:
-
-```bash
-node tools/check-pages.mjs --base http://127.0.0.1:<port> home animations/01-scroll-based animations/02-entrance-and-exit animations/03-page-transitions animations/04-micro-interactions animations/05-text-typography animations/06-3d-advanced animations/07-ambient-background
-```
-
-Expected: 780 `ok` lines (129 pages × 6 + the home page × 6), exit code 0.
-
-- [ ] **Step 4: Final review** — a fresh reviewer (the most capable model) reviews everything the plan changed against the spec: the look at the six setups (screenshots), both themes, reduced motion, keyboard use (Tab to the tiles, Enter, "/", Escape), the address and Back, Copy prompt and its fallback, text contrast. One fix wave, one scoped re-review.
-
-- [ ] **Step 5: Publish** — with the owner's go-ahead, push `main` (`git push origin main`); GitHub Pages serves it at https://matinmonshizadeh.github.io/animation-handbook/. Clean up worktrees, branches, stray servers and `%TEMP%\hb-chrome-*` profiles.
diff --git a/docs/superpowers/plans/2026-09-30-rollout-wrap-up.md b/docs/superpowers/plans/2026-09-30-rollout-wrap-up.md
deleted file mode 100644
index 8b0c81d8..00000000
--- a/docs/superpowers/plans/2026-09-30-rollout-wrap-up.md
+++ /dev/null
@@ -1,71 +0,0 @@
-# Guided-Steps Rollout: Wrap-up — Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Finish the guided-steps rollout now that all seven categories are live: retire the old page system, bring the docs in line with the new pages, apply the shared-file fixes the category reviews collected, and make every per-frame loop run at the same speed on every screen.
-
-**Architecture:** Independent tasks run side by side, each in its own worktree from `main` and its own branch, each with a builder, a separate reviewer and fix rounds; each lands on `main` and is pushed when checked (standing permission). Tasks that touch the same files (`assets/`, `tests/`) run one after the other in one worktree. A last whole-site check and review closes the plan.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build step); Node's built-in test runner; `tools/check-pages.mjs` (Node and the local Chrome); git worktrees.
-
-**Specs and references:** `docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md` (step 8, Wrap-up), `docs/superpowers/specs/2026-09-27-demo-page-guided-steps-design.md`, the coordinator notes `.superpowers/sdd/2026-09-29-demo-page-rollout-parallel/coordinator-notes.md` (git-ignored), the frame-rate survey `.superpowers/sdd/2026-09-29-demo-page-rollout-parallel/wrapup/frame-rate-survey.md` (git-ignored), and the category final reviews saved under `.superpowers/sdd/2026-09-29-demo-page-rollout-parallel/lanes/<category>/`.
-
-## Global Constraints
-
-- CLAUDE.md governs: plain HTML/CSS/vanilla JS, no dependencies, transform and opacity for motion, 60 fps on a mid-range phone (phone fallbacks at `(max-width:600px),(max-height:500px)`), text at least 4.5:1, 44px touch targets, `prefers-reduced-motion` respected, pages near ~300 lines.
-- Owner rulings stay: reduced motion greys out Loop and Slow motion with a short note, loops start paused, Replay/Play/Show me still work; stage text uses the site font; Pause stops at once; the visitor must see the effect; after a jump a scroll page shows the right state at once.
-- A behaviour change must leave every page looking and behaving exactly as today at 60 Hz on a laptop and a phone, unless the task says what changes.
-- Shared files are linked with `?v=N`; any change to `assets/css/demo-page.css` or `assets/js/demo-page.js` bumps N on every page that links them (today `?v=4`), in the same task.
-- Every task ends green: `node --test "tests/*.test.js"` and `node tools/check-pages.mjs --base http://127.0.0.1:<port> <folders the task touched>` (6 `ok` lines per page).
-- One commit per page or per concern; never amend, never reset. Checks run in the agent's own headless Chrome over the DevTools protocol, never in the shared in-app Browser pane.
-
----
-
-### Task 1: Frame-rate independence (in flight)
-
-Per-page fixes from the frame-rate survey (sections 3, 6, 7, 10): steps scale with `dt / FRAME` (`FRAME = 1000/60`, `dt` clamped to 50 ms), smoothing uses `1 - Math.pow(1 - k, dt / FRAME)`, loops start and re-arm with a null sentinel or one 60 Hz frame, gates stay as draw caps, trail fades scale with `dt`, stills keep a step of 1, README and prompt words follow the code. Branches: `feat/fr-ambient` (6 pages), `feat/fr-3d` (7), `feat/fr-micro` (3, live), `feat/fr-scroll` (4), and `feat/fr-transitions` for Elastic Transition's live spring (fixed 1/120 s sub-steps from an accumulator; re-measure the Bounciness table so the overshoot at 60 Hz stays today's). The home page's three card previews (starfield, particles, flow in `index.html`) get the same treatment in Task 5.
-
-### Task 2: Docs — one-liners, CLAUDE.md, CONTRIBUTING.md
-
-**Files:** `README.md`, `animations/*/README.md` (the one-line list only, plus any general paragraph that is wrong about the pages), `CLAUDE.md`, `CONTRIBUTING.md`.
-
-- [ ] Every page's one-liner in the root README and in its category README matches that page's current description (the page's `<meta name="description">`, which the home card and lede share), in the same order as the home page.
-- [ ] CLAUDE.md and CONTRIBUTING.md describe the current page: the guided-steps layout (Watch it, Try it, Copy the prompt, What it is, Good for / Avoid on, Similar animations), the shared files `assets/css/demo-page.css` and `assets/js/demo-page.js` with the `?v=N` rule, the four page kinds (`data-hb-kind="once|loop|do|scroll"`) and their controls, the copyable prompt (plain words, no code, at most 130 words), the site font, the tests (`node --test "tests/*.test.js"`) and the page check (`node tools/check-pages.mjs`). Every mention of `handbook.css`, `handbook.js`, the old side panel or the migration tool goes. The existing hard rules (one folder per animation, README sections, taxonomy, responsiveness, writing style) stay.
-
-### Task 3: Retire the old page system
-
-**Files:** delete `assets/css/handbook.css`, `assets/js/handbook.js`, `tests/handbook.test.js`, `tools/migrate-demo.js`, `tests/migrate.test.js`, `tests/fixtures/legacy-demo.html`, `assets/fonts/brico-*.woff2`, `assets/fonts/plex-*.woff2`, `samples/demo-page-design.html`; create `tests/helpers/markdown.js`; modify `tests/pages.test.js`, the comment in `assets/js/demo-page.js` that names `handbook.js`.
-
-- [ ] Move `sections(md)` and `table(text)` (and the helpers they call, such as `escapeHtml`) from `assets/js/handbook.js` into `tests/helpers/markdown.js` unchanged in behaviour; `tests/pages.test.js` requires them from there.
-- [ ] Delete the files above after confirming nothing else references them (`samples/home-redesign.html` keeps `samples/fonts/`).
-- [ ] Tests green; the site check on one page per category still green.
-
-### Task 4: Shared-file fixes (after Task 3, same worktree)
-
-**Files:** `assets/js/demo-page.js`, `assets/css/demo-page.css`, every page's `?v=` links, `tests/`, and page files only where a fix needs them (FLIP Technique).
-
-- [ ] **Scroll range before the arrival Play:** Play reads the scroller's range again on every frame (or waits for `document.fonts.ready` before the arrival run), so a late web font cannot stop Play short of the end (Cover Card, Scrollytelling, Progress Bar at 320px on a slow link stopped at 91%).
-- [ ] **Arrival guard:** the arrival press of Show me is skipped when the visitor has already acted in the stage (a trusted `hb:input`, or a trusted `focusin` inside the stage) before it fires. The per-page guards (Checkmark Draw, Focus Ring, Error Shake) may stay.
-- [ ] **Reduced motion on scroll pages:** a short note in the player bar says the effects follow the scroll without animating, in the style of the existing reduced-motion note.
-- [ ] **Short laptop windows:** `.hb-page .stage.hb-grow` follows the same 260px short-window minimum as other stages; FLIP Technique's cards get short-window sizes (its inline heights move into classes) so its player bar is on the first screen at 1280×590 and 1024×600.
-- [ ] Bump `?v=4` to `?v=5` on every page; tests updated.
-- [ ] Check every category (all 129 pages: 774 `ok` lines).
-
-### Task 5: Home page card previews
-
-**Files:** `index.html` (the card preview scripts only).
-
-- [ ] The starfield, particles and flow previews step with `dt / FRAME` (clamped, null sentinel), matching today's look at 60 Hz.
-
-### Task 6: Check tool hardening
-
-**Files:** `tools/check-pages.mjs` and its tests if any.
-
-- [ ] The reduced-motion "Show me visibly moves the stage" check captures straight after the click (or checks page state), so it no longer misses under heavy CPU load.
-- [ ] The temporary Chrome profile is removed with retries (Windows file locks), and any profile the run leaves is named in its output.
-
-### Task 7: Sheet sync, final check and review
-
-- [ ] One docs pass syncs the content sheets under `docs/superpowers/plans/` with the wording the Task 1 branches changed (each builder's report lists the lines).
-- [ ] Whole-site check (774 `ok` lines), tests, a final whole-site review (Opus) of everything the wrap-up changed, one fix wave, one scoped re-review, publish.
-- [ ] Clean up: leftover worktrees and branches, stray local servers, stale headless Chrome processes and `%TEMP%\hb-chrome-*` profiles.
diff --git a/docs/superpowers/plans/2026-10-02-readme-hero.md b/docs/superpowers/plans/2026-10-02-readme-hero.md
deleted file mode 100644
index 8471bc88..00000000
--- a/docs/superpowers/plans/2026-10-02-readme-hero.md
+++ /dev/null
@@ -1,265 +0,0 @@
-# README Hero (Wall of Animations) Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Put a 960×414 looping GIF of six demo stages, each tile named, at the top of `README.md`, with a still PNG for reduced motion.
-
-**Architecture:**
-- **Record:** a scratch Node script drives headless Chrome over the DevTools protocol and records each page's stage with the screencast.
-- **Compose:** a scratch Python script turns the recordings into seamless 6 s tile loops and composes 86 wall frames under a Chrome-drawn overlay of name pills and corner masks.
-- **Encode:** ffmpeg makes the GIF.
-- **Commit:** only the two pictures, the README edit and the test edit.
-
-**Tech Stack:**
-- Node 24 (built-in WebSocket)
-- Chrome 154 headless
-- Python 3.11 with Pillow 9.4, numpy and imageio_ffmpeg (bundled ffmpeg 7.1)
-
-## Global Constraints
-
-- **GIF:** `docs/hero.gif`, 960×414 px, about 6 s loop (86 frames × 70 ms), loops forever, **5 MB at most**.
-- **Still:** `docs/hero.png`, the same wall, shown when `(prefers-reduced-motion: reduce)`.
-- **Tiles, in reading order:** Text Particles, Synthwave Grid, Liquid Glass, Shatter Effect, Holographic Card, Dynamic Island.
-- **Tile layout:** 306×191 tiles, 10 px corners, 10 px gaps, 11 px margin, #0b0b10 background.
-- **Names:** on pills in Schibsted Grotesk (`assets/fonts/schibsted-latin.woff2`).
-- **Recording setup:** 768×1024 viewport, DPR 1, dark color scheme, normal motion, served by the launch config `static-site` (http://127.0.0.1:8731).
-- **Scratch scripts:** they live in the session scratchpad (`$S` below) and are never committed.
-- **README:** only the top picture changes. `docs/demo.gif` and `og-image.png` stay where they are.
-- **Pushing:** pushing to GitHub needs the owner's OK.
-
-`$S` = `<scratchpad>/hero`
-
----
-
-### Task 1: Record the six stages
-
-**Files:**
-- Create: `$S/record.mjs`. It is `$S/capture-stills.mjs` with the per-page loop replaced; the DevTools plumbing stays the same.
-
-**Interfaces:**
-- Produces: `$S/rec/<name>/NNNN.jpg`, the full 768×1024 screencast frames, and `$S/rec/<name>/frames.json`, which holds `{ kind, stage: {x,y,w,h}, times: [seconds from the first frame], clickAt }`.
-
-- [ ] **Step 1: Write the per-page loop**
-
-```js
- for (const slug of slugs) {
- const name = slug.split('/')[1];
- const dir = join(outDir, name);
- mkdirSync(dir, { recursive: true });
- let onLoad;
- const loaded = new Promise(ok => { onLoad = m => { if (m.method === 'Page.loadEventFired') ok(); }; listeners.add(onLoad); });
- await send('Page.navigate', { url: `${BASE}/animations/${slug}/` });
- await Promise.race([loaded, sleep(15000)]);
- listeners.delete(onLoad);
- const info = await evaluate(`(async () => { await document.fonts.ready; scrollTo(0, 0); const r = document.querySelector('.stage').getBoundingClientRect(); return { kind: document.body.dataset.hbKind, x: r.x, y: r.y, w: r.width, h: r.height }; })()`);
- const frames = [];
- let t0 = null, clickAt = null;
- const onFrame = m => {
- if (m.method !== 'Page.screencastFrame') return;
- const t = m.params.metadata.timestamp;
- if (t0 === null) t0 = t;
- frames.push({ t: t - t0, data: m.params.data });
- send('Page.screencastFrameAck', { sessionId: m.params.sessionId }).catch(() => {});
- };
- listeners.add(onFrame);
- await send('Page.startScreencast', { format: 'jpeg', quality: 92, everyNthFrame: 1 });
- const start = Date.now();
- if (info.kind === 'do') {
- await sleep(5000 - (Date.now() - start));
- await evaluate(`document.querySelector('[data-hb-demo]').click()`);
- clickAt = Date.now() / 1000 - t0;
- }
- await sleep(11000 - (Date.now() - start));
- await send('Page.stopScreencast');
- listeners.delete(onFrame);
- frames.forEach((f, i) => writeFileSync(join(dir, `${String(i).padStart(4, '0')}.jpg`), Buffer.from(f.data, 'base64')));
- writeFileSync(join(dir, 'frames.json'), JSON.stringify({ kind: info.kind, stage: info, times: frames.map(f => f.t), clickAt }));
- console.log(`${name}: ${info.kind}, ${frames.length} frames, stage ${Math.round(info.w)}x${Math.round(info.h)}, click at ${clickAt && clickAt.toFixed(2)} s`);
- }
-```
-
-- [ ] **Step 2: Run it**
-
-Run: `cd $S && VW=768 VH=1024 node record.mjs rec 05-text-typography/text-particles 07-ambient-background/synthwave-grid 06-3d-advanced/liquid-glass 02-entrance-and-exit/shatter-effect 06-3d-advanced/holographic-card 04-micro-interactions/dynamic-island`
-Expected: six lines.
-- Each line has 250+ frames and stage 707x440.
-- The four `do` pages report a click at about 5 s.
-
-- [ ] **Step 3: Check each page has settled before the 4.5 s cut**
-
-Build a strip of the stage at 4.0, 4.5, 5.0, 7.0 and 10.5 s per page, then look at it.
-Expected:
-- At 4.5 s every `do` page is at rest.
-- At 7 s it is mid-demo.
-- At 10.5 s it is at rest again.
-- If a page is not at rest at 4.5 s, raise the click to 6 s and the record time to 12 s for that page, and run it again.
-
-### Task 2: Seamless tile loops and the wall frames
-
-**Files:**
-- Create: `$S/overlay.html`, rendered to `$S/overlay.png` (960×414, transparent, with the name pills and corner masks).
-- Create: `$S/wall.py`, which writes `$S/wall/000.png`–`085.png` and `$S/still.png`.
-
-**Interfaces:**
-- Consumes: `$S/rec/<name>/` from Task 1.
-- Produces: `$S/wall/NNN.png`, 86 frames at 960×414, and `$S/still.png`.
-
-- [ ] **Step 1: Write and render the overlay**
-
-```html
-<!doctype html><meta charset="utf-8"><style>
-@font-face{font-family:S;src:url(data:font/woff2;base64,FONT) format('woff2');font-weight:400 900}
-html,body{margin:0;background:transparent;width:960px;height:414px;overflow:hidden}
-.t{position:absolute;width:306px;height:191px;border-radius:10px;box-shadow:0 0 0 12px #0b0b10}
-.t span{position:absolute;left:10px;bottom:10px;background:rgba(10,10,16,.74);color:#fff;font:600 14px/1 S,sans-serif;padding:6px 11px;border-radius:999px}
-</style>
-<div class="t" style="left:11px;top:11px"><span>Text Particles</span></div>
-<div class="t" style="left:327px;top:11px"><span>Synthwave Grid</span></div>
-<div class="t" style="left:643px;top:11px"><span>Liquid Glass</span></div>
-<div class="t" style="left:11px;top:212px"><span>Shatter Effect</span></div>
-<div class="t" style="left:327px;top:212px"><span>Holographic Card</span></div>
-<div class="t" style="left:643px;top:212px"><span>Dynamic Island</span></div>
-```
-
-Python replaces `FONT` with the base64 of `assets/fonts/schibsted-latin.woff2`. Render it with:
-`chrome --headless=new --hide-scrollbars --force-color-profile=srgb --default-background-color=00000000 --window-size=960,414 --screenshot=<S>\overlay.png file:///<S>/overlay.html`
-Expected: a 960×414 RGBA PNG. The pixels are transparent inside the tiles except for the pills, and #0b0b10 outside the rounded corners.
-
-- [ ] **Step 2: Write `wall.py`**
-
-```python
-import bisect, json, os
-import numpy as np
-from PIL import Image
-S = os.path.dirname(os.path.abspath(__file__))
-NAMES = ['text-particles', 'synthwave-grid', 'liquid-glass', 'shatter-effect', 'holographic-card', 'dynamic-island']
-N, DT, K = 86, 0.07, 7 # frames, seconds per frame, crossfade frames
-TW, TH, GAP, MX, MY = 306, 191, 10, 11, 11
-POS = [(MX + c * (TW + GAP), MY + r * (TH + GAP)) for r in range(2) for c in range(3)]
-OFFSETS = [0, 43, 14, 57, 29, 72] # each tile's loop is rotated, so their demos take turns
-
-def tile_loop(name):
- meta = json.load(open(f'{S}/rec/{name}/frames.json'))
- times, st = meta['times'], meta['stage']
- box = (round(st['x']), round(st['y']), round(st['x'] + st['w']), round(st['y'] + st['h']))
- cache = {}
- def img(i):
- if i not in cache:
- cache[i] = Image.open(f'{S}/rec/{name}/{i:04d}.jpg').convert('RGB').crop(box).resize((TW, TH), Image.LANCZOS)
- return cache[i]
- at = lambda t: max(bisect.bisect_right(times, t) - 1, 0) # the latest frame at or before t
- thumb = lambda i: np.asarray(img(i).resize((96, 60)).convert('L'), dtype=np.float32)
- if meta['kind'] == 'do':
- s, L = 4.5, N * DT
- else: # find the start and length whose ends match best
- best = None
- for s in np.arange(3.8, 4.8, 0.02):
- a = thumb(at(s))
- for L in np.arange(5.6, 6.5, 0.02):
- d = float(np.abs(a - thumb(at(s + L))).mean())
- if best is None or d < best[0]: best = (d, s, L)
- _, s, L = best
- step = L / N
- seg = [img(at(s + i * step)) for i in range(N)]
- seam = float(np.abs(np.asarray(seg[-1], np.float32) - np.asarray(seg[0], np.float32)).mean())
- if seam > 3.0: # fade the last K frames into the frames just before the start
- for j in range(K):
- a = (j + 1) / (K + 1)
- seg[N - K + j] = Image.blend(seg[N - K + j], img(at(s - (K - j) * step)), a)
- print(f'{name}: start {s:.2f} s, length {L:.2f} s, seam {seam:.1f}{" (crossfaded)" if seam > 3.0 else ""}')
- return seg
-
-tiles = [tile_loop(n) for n in NAMES]
-overlay = Image.open(f'{S}/overlay.png').convert('RGBA')
-def wall(frames):
- canvas = Image.new('RGB', (960, 414), (11, 11, 16))
- for k, f in enumerate(frames): canvas.paste(f, POS[k])
- return Image.alpha_composite(canvas.convert('RGBA'), overlay).convert('RGB')
-os.makedirs(f'{S}/wall', exist_ok=True)
-for i in range(N):
- wall([t[(i + OFFSETS[k]) % N] for k, t in enumerate(tiles)]).save(f'{S}/wall/{i:03d}.png')
-STILL = json.load(open(f'{S}/still.json')) if os.path.exists(f'{S}/still.json') else [N // 2] * 6
-wall([t[STILL[k]] for k, t in enumerate(tiles)]).save(f'{S}/still.png', optimize=True)
-```
-
-- [ ] **Step 3: Run it and look**
-
-Run: `cd $S && python wall.py`
-Expected: six lines with a start, a length and a seam per tile, and 86 frames in `wall/`.
-- Make a contact sheet of every 6th frame and look at it.
-- For each tile, compare its last and first loop frame side by side.
-- If a tile jumps, adjust its start or length, or raise K.
-
-- [ ] **Step 4: Pick the still**
-
-For each tile, choose the clearest loop frame from the contact sheet: particles mid-flight, shards in the air, the card tilted and the island showing a call. Write them to `$S/still.json`, for example `[20, 0, 30, 15, 25, 30]`, then run `python wall.py` again.
-Expected: `still.png` shows all six tiles at a good moment.
-
-### Task 3: Encode the GIF
-
-**Files:**
-- Create: `docs/hero.gif` and `docs/hero.png`, the latter copied from `$S/still.png`.
-
-- [ ] **Step 1: Encode**
-
-```bash
-FF=$(python -c "import imageio_ffmpeg; print(imageio_ffmpeg.get_ffmpeg_exe())")
-"$FF" -y -v error -framerate 100/7 -i "$S/wall/%03d.png" -vf "split[a][b];[a]palettegen=max_colors=256:stats_mode=diff[p];[b][p]paletteuse=dither=bayer:bayer_scale=4:diff_mode=rectangle" -loop 0 docs/hero.gif
-cp "$S/still.png" docs/hero.png
-ls -l docs/hero.gif docs/hero.png
-```
-
-Expected:
-- `hero.gif` is 5 MB or smaller.
-- If it is bigger, in this order: try `bayer_scale=5`; then `max_colors=192`; then 80 ms frames (75 frames, with `N = 75` and `DT = 0.08`).
-
-- [ ] **Step 2: Check the GIF**
-
-Run: `python -c "from PIL import Image; im = Image.open('docs/hero.gif'); print(im.size, im.n_frames, im.info.get('loop'), im.info.get('duration'))"`
-Expected: `(960, 414) 86 0 70`.
-Then look at frames 0, 20, 43 and 70 of the GIF.
-
-### Task 4: README and test
-
-**Files:**
-- Modify: `tests/pages.test.js:458`
-- Modify: `README.md:3`
-
-- [ ] **Step 1: Change the test so it expects the new picture**
-
-```js
- assert.equal(numberIn(readme, /<img src="docs\/hero\.gif" alt="[^"]*?(\d+) web animation techniques/), cards, "README: the picture's alt text");
-```
-
-- [ ] **Step 2: Run it to see it fail**
-
-Run: `node --test "tests/*.test.js"`
-Expected: FAIL in "the counts written in the root README match the cards" (README: the picture's alt text).
-
-- [ ] **Step 3: Change the README's top picture**
-
-Replace line 3:
-```html
-<a href="https://matinmonshizadeh.github.io/animation-handbook/"><img src="og-image.png" alt="Animation Handbook — 166 web animation techniques with live demos" width="820"></a>
-```
-with:
-```html
-<a href="https://matinmonshizadeh.github.io/animation-handbook/"><picture><source media="(prefers-reduced-motion: reduce)" srcset="docs/hero.png"><img src="docs/hero.gif" alt="Six animations from the handbook playing at once: Text Particles, Synthwave Grid, Liquid Glass, Shatter Effect, Holographic Card and Dynamic Island. Animation Handbook — 166 web animation techniques with live demos" width="820"></picture></a>
-```
-
-- [ ] **Step 4: Run the tests to see them pass**
-
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes (1381 or more), with 0 failing.
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add docs/hero.gif docs/hero.png README.md tests/pages.test.js
-git commit -m "docs: the README opens with a moving wall of six animations, and a still one under reduced motion"
-```
-
-### Task 5: Show the owner, then publish on their OK
-
-- [ ] **Step 1:** Send the owner `docs/hero.gif` and ask whether to publish it.
-- [ ] **Step 2:** On their OK, run `git checkout main`, `git merge --ff-only feat/readme-hero` and `git push origin main`. Then open the repo page and check that the GIF shows at the top.
diff --git a/docs/superpowers/plans/2026-10-12-star-button.md b/docs/superpowers/plans/2026-10-12-star-button.md
deleted file mode 100644
index 41f39741..00000000
--- a/docs/superpowers/plans/2026-10-12-star-button.md
+++ /dev/null
@@ -1,404 +0,0 @@
-# Star Button Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Every visitor gets an easy way to star the repository: a Star link at the end of every animation page's top bar,
-a star row under every prompt card, and a round star on the home page for phones.
-
-**Architecture:** Static markup, the same on every page (like the footer), styled by the shared `assets/css/demo-page.css`;
-a one-off Node script adds the markup to the 166 pages and bumps the shared files' version. The home page changes only its
-own inline CSS and one span. Tests pin the markup character by character; the browser page check proves layout, overflow
-and touch targets at six screen setups.
-
-**Tech Stack:** Plain HTML, CSS, vanilla JS. Node 22 for the tests (`node --test`) and tools. Chrome for the page check.
-
-Spec: `docs/superpowers/specs/2026-10-12-star-button-design.md`.
-
-## Global Constraints
-
-- No build step, no frameworks, no npm packages. Do not edit anything under `.claude/worktrees/` (old copies of the site).
-- Work on the branch `feat/star-button` in the main checkout. Never push.
-- Commits: plain sentence messages in the repo's style (`feat: …`, `docs: …`), no Co-Authored-By or other trailers.
-- Files in this checkout have CRLF line endings (`core.autocrlf=true`). Scripts keep each file's own line endings.
-- `demo-page.css` changes, so `demo-page.css?v=7` and `demo-page.js?v=7` become `?v=8` on all 166 pages, and the home
- page's `demo-page.js?v=7` becomes `?v=8`, in the same commit (a test fails when versions differ).
-- The star icon, everywhere: `<svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>`
-- The repository link, everywhere: `href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"`
-- Top-bar Star link (exact): `<a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>`
-- Star row (exact): `<div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>`
-- Phones (600px and less): every control at least 44×44px, no horizontal overflow down to 320px.
-- A static server for the repo is running at `http://127.0.0.1:8731` (it serves this checkout). Check with
- `curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8731/` (expect `200`). If it is down, ask the controller to
- restart it; do not start servers from a shell.
-- Tests: `node --test "tests/*.test.js"` from the repo root. Page check: `node tools/check-pages.mjs --base http://127.0.0.1:8731 <folder>`;
- a passing page prints six `ok` lines, a failure prints `FAIL` and exits 1. Home check: the same with `home`.
-
----
-
-### Task 1: Star link and star row on every animation page
-
-> Changed after the task review (owner's choice, 2026-10-12): below 1061px the Star link is a round star with no words, and its `hb-star-more` span is gone; after the final review, below 820px it is left out of the top bar (the `max-width:819px` block, not the phone block, hides it). The steps below are as they were first run; the spec holds the change.
-
-**Files:**
-- Modify: `assets/css/demo-page.css` (top bar rules near line 39, prompt step rules near line 156, the hover block at
- line 180, the `max-width:1024px` block at line 197, the `max-width:600px` block at line 219)
-- Modify: all 166 `animations/*/*/index.html` (markup + version) and `index.html` (version only), via a one-off script
-- Create (not committed, the folder is git-ignored): `.superpowers/scratch/add-star.mjs`
-- Modify: `tools/check-pages.mjs:90` (phone touch-target list)
-- Modify: `CLAUDE.md` (the page template)
-- Test: `tests/pages.test.js` (two new tests after the footer test, which ends near line 456)
-
-**Interfaces:**
-- Consumes: the helpers already in `tests/pages.test.js`: `read`, `count`, `between`, `cssRules`, `steps`, `pageOf`, `ROOT`, `path`.
-- Produces: CSS classes `hb-star`, `hb-star-more`, `hb-star-row`, `hb-star-btn` in `demo-page.css`; shared-file version `v=8`
- (Task 2 relies on the home page already linking `demo-page.js?v=8`).
-
-- [ ] **Step 1: Write the failing tests**
-
-In `tests/pages.test.js`, right after the test `'every guided-steps page has the same footer, with a link to the source on GitHub'`
-(it ends with `'pages without exactly this footer');` and `});`), add:
-
-```js
-// The Star link at the end of every page's top bar and the star row under its prompt card, the same on every page
-// (docs/superpowers/specs/2026-10-12-star-button-design.md).
-const STAR_ICON = '<svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>';
-const STAR_HREF = 'href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"';
-const BAR_STAR = `<a class="hb-star" ${STAR_HREF} aria-label="Star on GitHub">${STAR_ICON}<span>Star<span class="hb-star-more"> on GitHub</span></span></a>`;
-const STAR_ROW = `<div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" ${STAR_HREF}>${STAR_ICON}Star on GitHub</a></div>`;
-test('every guided-steps page asks for a star at the end of its top bar and under its prompt card', () => {
- const lastAfter = (part, piece, before) => part.trimEnd().endsWith(piece) &&
- part.slice(0, part.lastIndexOf(piece)).trimEnd().endsWith(before);
- const wrong = steps.filter(d => {
- const html = pageOf(d);
- const bar = between(html, '<nav class="hb-bar"', '</nav>');
- const promptStep = between(html, '<section class="hb-step hb-prompt-step"', '</section>');
- return count(html, BAR_STAR) !== 1 || !lastAfter(bar, BAR_STAR, '</span>') ||
- count(html, STAR_ROW) !== 1 || !lastAfter(promptStep, STAR_ROW, '</div>');
- }).map(d => `${d.cat}/${d.slug}`);
- assert.deepEqual(wrong, [], 'pages without the Star link right after the pager, or without the star row right after the prompt card');
-});
-
-test('the shared stylesheet shortens the Star link to "Star" on tablets and leaves it to the star row on phones', () => {
- const css = read(path.join(ROOT, 'assets/css/demo-page.css')).replace(/\/\*[\s\S]*?\*\//g, '');
- const hides = (media, selector) => cssRules(between(css, `@media(${media}){`, '\n}'))
- .some(rule => rule.selector.split(',').some(part => part.trim() === selector) && /(^|;)\s*display:\s*none\s*(;|$)/.test(rule.body));
- assert.ok(hides('max-width:1024px', '.hb-bar .hb-star-more'), 'tablets read "Star"');
- assert.ok(hides('max-width:600px', '.hb-bar .hb-star'), 'phones leave the Star link out of the top bar');
-});
-```
-
-- [ ] **Step 2: Run the tests to see them fail**
-
-Run: `node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"`
-Expected: `ℹ pass 1560` and `ℹ fail 2`; every `✖` line names one of the two new tests (166 pages listed as wrong;
-`tablets read "Star"`). The reporter may list each failure twice (in place and in its summary).
-
-- [ ] **Step 3: Add the styles to `assets/css/demo-page.css`**
-
-3a. Right after the line `.hb-bar .hb-ic{width:16px;height:16px}` add:
-
-```css
-/* The Star link: the last item of the top bar, beside the pager. Computers read "Star on GitHub", tablets "Star" (the words
- go with "Previous: " and "Next: "), and phones leave it out: the star row under the prompt card is theirs. */
-.hb-bar .hb-pager{margin-left:auto}
-.hb-bar .hb-star{flex:none;padding:0 14px;border:1px solid var(--hb-edge);border-radius:999px;color:var(--hb-soft)}
-```
-
-3b. Right after the line `.hb-copy.is-done .hb-i-done{display:inline}` add:
-
-```css
-/* Under the prompt card: a sentence and an outline Star on GitHub button (full width on phones) */
-.hb-star-row{display:flex;flex-wrap:wrap;align-items:center;gap:12px 20px}
-.hb-star-row p{flex:1 1 260px;margin:0;font:400 15px/1.5 var(--hb-font);color:var(--hb-dim)}
-.hb-star-btn{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;
- border:1px solid var(--hb-edge);border-radius:999px;color:var(--hb-ink);text-decoration:none;font:600 15px/1 var(--hb-font)}
-.hb-star-btn .hb-ic{width:16px;height:16px}
-```
-
-3c. In the `@media(hover:hover){` block, right after its line ` .hb-bar a:hover{color:var(--hb-ink)}` add:
-
-```css
- .hb-bar .hb-star:hover,.hb-star-btn:hover{border-color:var(--hb-edge-2);color:var(--hb-ink)}
-```
-
-3d. Replace the tablet block
-
-```css
-/* Tablets and phones: the "Previous: " / "Next: " words go, so two page names fit beside the home link */
-@media(max-width:1024px){
- .hb-bar .hb-dir{display:none}
-}
-```
-
-with
-
-```css
-/* Tablets and phones: the "Previous: " / "Next: " words and the Star link's " on GitHub" go, so two page names fit
- beside the home link */
-@media(max-width:1024px){
- .hb-bar .hb-dir,.hb-bar .hb-star-more{display:none}
-}
-```
-
-3e. In the `@media(max-width:600px){` block, right after its line ` .hb-copy{width:100%}` add:
-
-```css
- .hb-bar .hb-star{display:none}
- .hb-star-btn{width:100%}
-```
-
-- [ ] **Step 4: Write and run the one-off page script**
-
-Create `.superpowers/scratch/add-star.mjs` (the folder exists and is git-ignored):
-
-```js
-// One-off: adds the Star link and the star row to every guided-steps page and moves the shared files from v=7 to v=8.
-// Run from the repo root: node .superpowers/scratch/add-star.mjs
-import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
-import { join } from 'node:path';
-
-const ROOT = process.cwd();
-const ICON = '<svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>';
-const GH = 'href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"';
-const BAR_STAR = `<a class="hb-star" ${GH} aria-label="Star on GitHub">${ICON}<span>Star<span class="hb-star-more"> on GitHub</span></span></a>`;
-const ROW = `<div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" ${GH}>${ICON}Star on GitHub</a></div>`;
-const dirs = d => readdirSync(d, { withFileTypes: true }).filter(e => e.isDirectory()).map(e => join(d, e.name));
-
-let pages = 0;
-for (const cat of dirs(join(ROOT, 'animations'))) {
- for (const dir of dirs(cat)) {
- const file = join(dir, 'index.html');
- if (!existsSync(file)) continue;
- let html = readFileSync(file, 'utf8');
- if (!html.includes('<main class="hb-page">')) continue;
- if (html.includes('class="hb-star"') || html.includes('hb-star-row')) throw new Error(`${file}: already has a Star link or row`);
- const NL = html.includes('\r\n') ? '\r\n' : '\n';
- // A: the last item of the top bar, after the pager
- const barEnd = `</span>${NL}</nav>`;
- if (html.split(barEnd).length !== 2) throw new Error(`${file}: the top bar does not end with the pager`);
- html = html.replace(barEnd, `</span>${NL} ${BAR_STAR}${NL}</nav>`);
- // B: the last part of the prompt step, after the card
- const start = html.indexOf('<section class="hb-step hb-prompt-step"');
- const close = start < 0 ? -1 : html.indexOf(`${NL} </section>`, start);
- if (close < 0) throw new Error(`${file}: no prompt step`);
- html = html.slice(0, close) + `${NL} ${ROW}` + html.slice(close);
- // The shared files' version
- if (!html.includes('demo-page.css?v=7') || !html.includes('demo-page.js?v=7')) throw new Error(`${file}: not on v=7`);
- html = html.replace('demo-page.css?v=7', 'demo-page.css?v=8').replace('demo-page.js?v=7', 'demo-page.js?v=8');
- writeFileSync(file, html);
- pages++;
- }
-}
-const homeFile = join(ROOT, 'index.html');
-const home = readFileSync(homeFile, 'utf8');
-if (home.split('demo-page.js?v=7').length !== 2) throw new Error('index.html: not on v=7');
-writeFileSync(homeFile, home.replace('demo-page.js?v=7', 'demo-page.js?v=8'));
-console.log(`${pages} pages and the home page updated`);
-```
-
-Run: `node .superpowers/scratch/add-star.mjs`
-Expected: `166 pages and the home page updated`
-Then: `git diff --stat | tail -1` → `169 files changed` (166 pages, `index.html`, `assets/css/demo-page.css` and
-`tests/pages.test.js`). Any other number: find out why before going on.
-Spot-check one page: `git diff animations/04-micro-interactions/checkmark-draw/index.html` shows exactly three changes:
-the two version lines, the Star link line before `</nav>`, and the star row line after the card's closing `</div>`.
-
-- [ ] **Step 5: Add the star row's button to the page check's phone touch targets**
-
-In `tools/check-pages.mjs` (line 90), in the selector list that starts `'.hb-bar a, .hb-page button, .hb-page summary,`,
-add `.hb-star-row a` after `.hb-foot a`, so the list reads `... label.hb-switch-row, .hb-foot a, .hb-star-row a, .hb-rel')]`.
-
-- [ ] **Step 6: Run the tests to see them pass**
-
-Run: `node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"`
-Expected: `ℹ pass 1562`, `ℹ fail 0`, no `✖` lines.
-
-- [ ] **Step 7: Run the page check on every category**
-
-Confirm the server answers (see Global Constraints), then run the seven categories, up to four at a time
-(each in its own process; each prints its own temp folder of screenshots):
-
-```bash
-for c in 01-scroll-based 02-entrance-and-exit 03-page-transitions 04-micro-interactions; do node tools/check-pages.mjs --base http://127.0.0.1:8731 animations/$c > .superpowers/scratch/check-$c.txt 2>&1 & done; wait
-for c in 05-text-typography 06-3d-advanced 07-ambient-background; do node tools/check-pages.mjs --base http://127.0.0.1:8731 animations/$c > .superpowers/scratch/check-$c.txt 2>&1 & done; wait
-grep -c "\bok\b" .superpowers/scratch/check-*.txt; grep -l "FAIL" .superpowers/scratch/check-*.txt
-```
-
-Expected: 996 `ok` lines in all (166 pages × 6), and no file with `FAIL`. If a page fails, first re-run it alone once
-(`node tools/check-pages.mjs --base http://127.0.0.1:8731 animations/<cat>/<slug>`): a busy machine can make a timing
-check flaky. If it still fails, read its problem text and screenshots. Fix it when this change caused it (an overflow,
-a small target, the star row or the Star link drawn wrong); otherwise stop and report the output to the controller
-without changing unrelated code.
-
-- [ ] **Step 8: Update the page template in `CLAUDE.md`**
-
-Replace
-
-```
-1. **Top bar** (`nav.hb-bar`): the home link and Previous / Next links to the neighbors in the category
- (`rel="prev"`, `rel="next"`; the first and last page have one).
-```
-
-with
-
-```
-1. **Top bar** (`nav.hb-bar`): the home link, Previous / Next links to the neighbors in the category
- (`rel="prev"`, `rel="next"`; the first and last page have one) and, last, the **Star on GitHub** link (`a.hb-star`).
-```
-
-Replace
-
-```
-5. **3 · Copy the prompt** (`section.hb-prompt-step`): prompt (`p.hb-prompt`), "Your settings" chips, **Copy prompt**.
-```
-
-with
-
-```
-5. **3 · Copy the prompt** (`section.hb-prompt-step`): prompt (`p.hb-prompt`), "Your settings" chips, **Copy prompt**;
- under the card, the star row (`div.hb-star-row`: a sentence and a **Star on GitHub** button).
-```
-
-And right before the paragraph that starts `The page owns the stage's width, border, corners and height`, add this
-paragraph (followed by a blank line):
-
-```
-The Star link and the star row are the same on every page too: copy them from a neighbor (a test compares them).
-```
-
-- [ ] **Step 9: Commit**
-
-```bash
-git add assets/css/demo-page.css animations index.html tests/pages.test.js tools/check-pages.mjs CLAUDE.md
-git status --short | grep -v "^M " ; git commit -q -m "feat: a Star on GitHub link at the end of every animation page's top bar and a star row under its prompt card (shared files v=8)"
-```
-
-Expected: `git status --short | grep -v "^M "` prints nothing before the commit (only modified files, nothing new or
-deleted); the commit succeeds.
-
----
-
-### Task 2: Round star on the home page for phones
-
-> Run in a worktree of its own (branch `feat/star-home`, merged into `feat/star-button`): its test went at the end of `tests/pages.test.js`, not after Task 1's tests, whose titles changed in Task 1's fix round. After the final review the test also pins how the round star fits (44px wide, the word hidden from sight, the count gone).
-
-**Files:**
-- Modify: `index.html` (the GitHub button's markup near line 1449; the phone rule near line 273; the rule near line 324)
-- Modify: `CHANGELOG.md` (a new "Unreleased" heading at the top)
-- Test: `tests/pages.test.js` (one new test after the two from Task 1)
-
-**Interfaces:**
-- Consumes: `HOME`, `cssRules`, `count` from `tests/pages.test.js`; the home page already links `demo-page.js?v=8` (Task 1).
-- Produces: class `gh-t` on the home page (the word "GitHub" inside `#gh-stars`).
-
-- [ ] **Step 1: Write the failing test**
-
-In `tests/pages.test.js`, right after the test `'the shared stylesheet shortens the Star link to "Star" on tablets and leaves it to the star row on phones'`, add:
-
-```js
-test('the home page keeps its GitHub button on phones as a round star, and leaves it out only below 360px', () => {
- assert.equal(count(HOME, '</svg><span class="gh-t">GitHub</span> <span class="gh-c" id="gh-star-count"></span></a>'), 1,
- 'the word GitHub has a span of its own, so small screens can hide it from sight and still read it out');
- const css = [...HOME.matchAll(/<style>([\s\S]*?)<\/style>/g)].map(m => m[1]).join('\n');
- const hiding = cssRules(css).filter(rule => rule.selector.split(',').some(part => part.trim() === '.gh') &&
- /(^|;)\s*display:\s*none/.test(rule.body));
- assert.equal(hiding.length, 1, 'one rule hides the GitHub button');
- assert.equal(count(HOME, '@media(max-width:359px){.gh{display:none}}'), 1, 'and it is for screens under 360px');
-});
-```
-
-- [ ] **Step 2: Run the tests to see it fail**
-
-Run: `node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"`
-Expected: `ℹ pass 1562`, `ℹ fail 1`; the `✖` lines name only the new test (the `gh-t` span is missing).
-
-- [ ] **Step 3: Change the home page**
-
-3a. The GitHub button: replace
-
-```html
-</svg>GitHub <span class="gh-c" id="gh-star-count"></span></a>
-```
-
-with
-
-```html
-</svg><span class="gh-t">GitHub</span> <span class="gh-c" id="gh-star-count"></span></a>
-```
-
-3b. In the phone block (`@media(max-width:600px){`, near line 273) replace the line
-
-```css
- .top .nav .lnk,.gh{display:none}
-```
-
-with
-
-```css
- .top .nav .lnk{display:none}
-```
-
-3c. Replace the line (near line 324)
-
-```css
-@media(max-width:760px){.gh{display:none}} /* the top bar fits from 601px up */
-```
-
-with these three lines:
-
-```css
-@media(max-width:760px){.gh{position:relative;width:44px;padding:0;justify-content:center;gap:0}.gh-t{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.gh-c{display:none}} /* from 760px down the GitHub button is a round star beside the dark-mode button: the word is still read out, the count goes */
-@media(min-width:601px) and (max-width:620px){.top .nav .lnk{padding:0 11px}} /* at 601px "Browse all" and "How it works" are there too: a little less padding makes room for the star */
-@media(max-width:359px){.gh{display:none}} /* below 360px there is no room for it beside the dark-mode button */
-```
-
-- [ ] **Step 4: Run the tests to see them pass**
-
-Run: `node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"`
-Expected: `ℹ pass 1563`, `ℹ fail 0`, no `✖` lines.
-
-- [ ] **Step 5: Measure the top bar at its tight widths**
-
-With the browser tools: open a tab (`mcp__Claude_Browser__tabs_create`), then for each width 601, 620, 700, 760, 360 and
-375 set the size (`mcp__Claude_Browser__resize_window` with that `width`, `height` 800 and the tab's id), load
-`http://127.0.0.1:8731/` (`mcp__Claude_Browser__navigate`) and run this with `mcp__Claude_Browser__javascript_tool`:
-`(() => { const top = document.querySelector('header.top').getBoundingClientRect(), gh = document.getElementById('gh-stars').getBoundingClientRect(); return { right: Math.round(top.right), ghRight: Math.round(gh.right), w: Math.round(gh.width), h: Math.round(gh.height), overflow: document.documentElement.scrollWidth > document.documentElement.clientWidth }; })()`
-Expected at every width: `ghRight <= right`, `w` and `h` both 44, `overflow` false. At 359 the button is not shown
-(`getComputedStyle(document.getElementById('gh-stars')).display === 'none'`). At 1280 the button still reads
-"GitHub ★ …" as before. If 601 does not fit, lower the 11px in the 601–620px rule one pixel at a time until it fits,
-and note the measured numbers in the commit message. When done, set the tab back (`resize_window` with preset
-`desktop`) and close it (`mcp__Claude_Browser__tabs_close`). If the browser tools are not available to you, stop and
-ask the controller to take these measurements.
-
-- [ ] **Step 6: Run the home check**
-
-Run: `node tools/check-pages.mjs --base http://127.0.0.1:8731 home`
-Expected: six `ok` lines, exit code 0.
-
-- [ ] **Step 7: Add the changelog line**
-
-In `CHANGELOG.md`, between the intro line (`The main steps of Animation Handbook, newest first, with the number of animations at each one.`)
-and `## 1.0.0 — 2026-10-10`, add:
-
-```markdown
-## Unreleased
-
-- A Star on GitHub button at the end of every animation page's top bar and under its Copy prompt, and a round star on the
- home page for phones.
-
-```
-
-- [ ] **Step 8: Commit**
-
-```bash
-git add index.html tests/pages.test.js CHANGELOG.md
-git commit -q -m "feat: the home page keeps its GitHub button on phones as a round star beside the dark-mode button"
-```
-
----
-
-### Finish (controller)
-
-- [ ] Run `node --test "tests/*.test.js"` once more on the branch (expect `ℹ pass 1563`, `ℹ fail 0`).
-- [ ] Take screenshots of the result (a page's top bar at 1280px, its star row at 375px, the home page at 375px) and show them to the owner.
-- [ ] Ask the owner before merging into `main` and pushing: pushing publishes the site.
diff --git a/docs/superpowers/plans/2026-10-13-animation-finder.md b/docs/superpowers/plans/2026-10-13-animation-finder.md
deleted file mode 100644
index e7b16baf..00000000
--- a/docs/superpowers/plans/2026-10-13-animation-finder.md
+++ /dev/null
@@ -1,2758 +0,0 @@
-# Animation Finder Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Add the Animation finder to the home page (three picture-button questions: what moved, when, how; the matching animations below, best first; a Not here? link to a short GitHub form), and give all 166 animations the answers a visitor would pick, checked against the spec's frozen set of 28 described effects.
-
-**Architecture:** The finder is a view of the home page, `?view=find`, like All animations. `index.html` gains the questions (`FIND_Q`), every card's answers (`FIND`, right after `PLACES`), pure functions (`findMatches(answers)` → `{best, close}` and its helpers) that the tests run with `node:vm` as they run the search, the finder section with its CSS and 17 small moving pictures, the Find button and the Finder link; the results reuse the cards. Seven tagging lanes write the answers into ledgers in the run folder while the page is built on draft answers; integration writes the reviewed answers into `FIND` and adds the test set. Around it: a GitHub issue form, two 404 routes, new page-check steps and the docs.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript in `index.html` (no build, no dependencies); the Node 22+ test runner (`node --test`) reading the page's code with `node:vm`; the repo's Chrome-driven page check (`tools/check-pages.mjs`); a GitHub issue form (YAML); small Node helper scripts that live in the run folder, outside git.
-
-**Spec:** `docs/superpowers/specs/2026-10-13-animation-finder-design.md` (the finder) and `docs/superpowers/specs/2026-10-13-next-projects-coordination.md` (branches, the file map, generated files, releases; it wins where the two differ). Both are committed on `feat/see-inside-compare` (03a00d0): read them in the main checkout, never in a finder worktree (cut from `main`, it has neither). Owner rulings of 2026-10-13: Not here? opens a short GitHub issue form with the visitor's answers filled in; the finder goes live as soon as it is ready and the owner approves it, reached from the home page (the Finder tab on every animation page comes later, in a separate pass).
-
-## Global Constraints
-
-- Branch `feat/animation-finder`, cut from `main` (d3e1786 on 2026-10-13, or `main`'s head when Task 0 runs, which must equal `origin/main`); never from `feat/see-inside-compare`.
-- Lanes are branches `af/<lane>` cut from `feat/animation-finder`, each in its own worktree `.claude/worktrees/af-<lane>`; the coordinator merges them into `feat/animation-finder` with `git merge --no-ff` in `.claude/worktrees/af-int`; never rebase, squash or amend a pushed commit.
-- The main checkout stays on `feat/see-inside-compare` for the whole run; never switch it and never commit finder work there.
-- Run folder: `.superpowers/sdd/<date Task 0 runs>-animation-finder/` in the main checkout (`$RUN` below); ledgers, briefs, helper scripts, stills and reviews live there, outside git.
-- Ports 8901 to 8909 only (table below); one server per worktree, `python -m http.server <port> --bind 127.0.0.1` from the worktree root as a background command, stopped when its lane ends.
-- Every page check and every other headless Chrome run takes a slot from the shared pool of eight (`slots/slot-1…8` in the rollout's run folder) and frees it afterwards; never the browser pane (it is the owner's).
-- Files the finder changes: `index.html`, `tests/finder.test.js` (new), `tests/pages.test.js` (one new 404 test block), `tools/check-pages.mjs` (new functions and one new block in the home branch of the main loop), `tools/make-social-image.mjs`, `404.html`, `.github/ISSUE_TEMPLATE/animation_not_here.yml` (new), `.github/ISSUE_TEMPLATE/config.yml`; at integration only `CLAUDE.md`, `CONTRIBUTING.md`, `.github/pull_request_template.md`, `README.md` (How to use it, step 1), `CHANGELOG.md` (one Unreleased line) and the generated `sitemap.xml` (the home page's date).
-- Never changed: the 166 animation pages, `assets/css/demo-page.css`, `assets/js/demo-page.js`, `tests/demo-page.test.js`, `tools/update-sitemap.mjs`, `tools/make-skill.mjs`, `tests/skill.test.js`; no `?v=N` bump anywhere.
-- Generated files (`sitemap.xml`, `llms.txt`, `skills/animation-handbook/`, `og-image.png`) are written only by their tools, never edited or merged by hand.
-- No dependencies: plain HTML, CSS and vanilla JavaScript; nothing from a CDN; the home page loads only files from this repository and still works opened from disk.
-- No code on the site and plain words: the finder's texts are exactly those of "The contract" below; American spelling; no hype.
-- Accessibility: native radios in fieldsets with legends, each answer named by its words, pictures `aria-hidden`; the site's 3px focus ring; every finder control at least 44×44px on phones (≤600px wide); text at least 4.5:1 in both themes; no sideways scroll at 320px; keyboard focus moves only as the contract says.
-- Motion: the finder animates only `transform` and `opacity`; its `@keyframes` names start `fd-`; no `@keyframes` name appears twice in `index.html`; under reduced motion nothing in the finder moves and every How picture shows a still with a small arrow.
-- Do not use `git stash` (every worktree shares it); compare versions with `git show <rev>:<path> > <scratch file>`.
-- Type `·`, `—`, `“` and `”` as the characters themselves in `index.html` and the tests (both compare them literally); never type a backslash-u escape through Write or Edit (it stores the raw character).
-- Tests: `node --test "tests/*.test.js"` from the worktree root passes at every commit; a step that writes a new test first says which test fails until the next step.
-- Home check: `node tools/check-pages.mjs --base http://127.0.0.1:<port> home` prints six `ok` lines from Task 5 on (Tasks 3 and 4 name the finder problems still expected before it).
-- Test target: of the spec's 28 described effects, a right animation is among the first 6 results for at least 24 and among the first 12 for at least 27; of the held-out set, at least 7 of 10 among the first 6.
-- Taggers and tag checkers never open the spec, this plan or `tests/finder.test.js` (they hold the test set); their brief is all they get.
-- Commit messages: `feat:`, `fix:`, `test:`, `docs:` or `chore:` and one plain-words sentence, in the repo's style; no Co-Authored-By line.
-- Nothing is pushed and nothing is created on GitHub before Task 17, and then only on the owner's word; nothing merges into `main` from 2026-10-23 to 2026-10-26 without the owner's word for that day.
-
-## Paths, ports and slots
-
-Shell variables do not last between commands, so begin each Git Bash command with the assignments it uses:
-
-- `MAIN=C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook`
-- `WT=$MAIN/.claude/worktrees`
-- `RUN=$MAIN/.superpowers/sdd/2026-10-14-animation-finder` (the date Task 0 runs: 2026-10-14 if it starts beside the rollout's Phase 0 as planned, otherwise that day's date; Task 0 writes the real path into `$RUN/env.md`)
-- `SLOTS=$MAIN/.superpowers/sdd/2026-10-14-see-inside-compare/slots` (the rollout's pool; Task 0 writes the real path into `$RUN/env.md`)
-
-| Port | Worktree | Branch | Used by |
-|---|---|---|---|
-| 8901 | `af-logic` | `af/logic` | Task 1 |
-| 8902 | `af-pics` | `af/pics` | Task 2 |
-| 8903 | `af-view` | `af/view` | Tasks 3, 4, 5 |
-| 8904 | `af-check` | `af/check` | Task 7 |
-| 8905 | `af-tags` | detached at the branch's start | Tasks 8, 9 (one server for the seven lanes) |
-| 8906 | `af-int` | `feat/animation-finder` | Tasks 10, 11, 13, 15, 16 |
-| 8907 | `af-final` | detached at the reviewed commit | Task 14 |
-| 8908, 8909 | spare | | |
-| 8990 | `release` | `main` | Task 17 (the coordination file's release port) |
-
-`af-404` (Task 6) needs no server.
-
-**Taking a slot** (before every page check and every `shoot.mjs` run):
-
-```bash
-for n in 1 2 3 4 5 6 7 8; do mkdir "$SLOTS/slot-$n" 2>/dev/null && { echo "took $SLOTS/slot-$n"; break; }; done
-```
-
-No line printed means all eight are busy: wait a few minutes (Monitor) and run it again. When the run ends, also when it fails, free the slot with `rmdir "$SLOTS/slot-<n>"`.
-
-## The contract
-
-Tasks 3, 4 and 5 build exactly this; Task 7 checks it; the tests pin the words.
-
-**Address and history.** `?view=find` opens the finder; then `&what=<key>`, `&when=<key>`, `&how=<key>` for each question answered, in that order; then `&all=1` after Show all. A value that is not one of the question's keys counts as Not sure. `?q=` still wins over any view. The Find button and the Finder link add one history step; an answer, Start over and Show all only replace the address; Describe it in words adds one step (to the start page).
-
-**Markup in `index.html`.**
-- Top bar: `<a class="lnk" id="nav-find" href="?view=find">Finder</a>` right before `<a class="lnk" id="nav-all" href="?view=all">Browse all</a>`; it carries `aria-current="page"` in the finder and nowhere else.
-- Hero: `<a class="find-cta" href="?view=find">Don't know the name? Find it</a>` right after the `<p class="pop">…</p>` line.
-- `<section class="wrap finder" id="finder" aria-labelledby="find-title" hidden>` between the place tiles' section and `<section class="wrap results" id="results" …>`. In the finder `.home-hero` and the place tiles' section are hidden and `#finder` shows; everywhere else the reverse.
-- Inside it: `<h1 class="h1 fd-h" id="find-title" tabindex="-1">Find an animation you saw</h1>`, `<p class="sub">Saw an animation on a website and don't know its name? Answer three short questions. The animations that match play below, with their names.</p>`, `<div class="fd-qs" id="find-qs"></div>` (the script builds the questions into it) and `<div class="fd-go"><button type="button" class="fd-btn" id="find-see" hidden>See 0 matches</button><button type="button" class="pillbtn" id="find-reset">Start over</button></div>`.
-- The built questions: `fieldset.fd-q.fd-what` (then `.fd-when`, `.fd-how`) > `legend` (`span.fd-n` with the number, then the title) [+ `p.fd-hint` for How] > `div.fd-as` > one `label.fd-a` per answer around `input.fd-r[type=radio][name=fd-<question>][value=<key>][autocomplete=off]`, then `svg.i.fd-icon` (What, When) or `span.fd-pic.fd-<key>` holding four `<i>` (How), then `span.fd-w` with the words; last `label.fd-a.fd-unsure` with the value `unsure` and the words `Not sure`.
-- Not here?, right after `<div class="more" id="more">…</div>`: `<div class="fd-not" id="find-not" hidden>` holding `<h3 class="fd-not-t">Not here?</h3>`, `<p class="fd-not-s" id="find-not-s">…</p>`, `<p class="fd-not-acts"><a class="fd-btn" id="find-gh" href="…" target="_blank" rel="noopener">Tell us on GitHub</a><button type="button" class="pillbtn" id="find-words">Describe it in words</button></p>` and `<p class="fd-fine">The form is on GitHub and needs a free account.</p>`.
-
-**Words.**
-- The tab's title in the finder: `Find an animation you saw — Animation Handbook`.
-- `#results-title`: `Your matches`. `#results-sub`, written 400 ms after an answer and at once on any other change: no answer (or only Not sure) → `Answer a question above, and the animations that match show here.`; Best and Close → `5 best matches and 9 close matches.` (`1 best match`, `1 close match`); Best only → `5 best matches.`; Close only → `No animation fits all your answers. These come close.`; neither → `No animation fits these answers yet.`
-- Groups: `section.group.fd-group` > `h3.ghead` with `span.gname` (`Best matches`, `Close matches`) and `span.gcount` (`N animations`, `1 animation`); Close adds `p.fd-gline` `They fit all but one of your answers.`; card titles carry `aria-level="4"`; the first 12 cards show, then `#more-label` reads `Show all N matches`.
-- `#find-see`: `See N matches` (`See 1 match`), hidden while nothing matches.
-- `#find-not-s`: `Tell us what you saw. We use it to add the animation or to fix the finder.`; when nothing matches: `Nothing fits these answers yet. Try Not sure on one question, or tell us what you saw.` The panel shows whenever a question has a real answer.
-- `#find-gh`'s address is `findIssueURL(state)`.
-
-**Keyboard focus.** See N matches → the results heading, brought into view. Start over → `#find-title`, page at the top. Show all → the 13th card's link. The Find button and the Finder link → `#find-title`, page at the top. Describe it in words → the search box `#q`. Back or Forward that hides the focused control → `#find-title` in the finder, `#results-title` elsewhere. An answer never moves focus and never scrolls the page.
-
-**Phones and motion.** `#pinbar` never shows in the finder. Every `.fd-a`, button and link of the finder and of its results is at least 44×44px on phones. Under reduced motion no animation runs in the finder and each `.fd-pic` holds a still with a small arrow.
-
-**Script names** (globals of the home page's script, read by the tests with vm and called by the page check): `FIND_Q`, `FIND`, `findQuery(answers)`, `findWords(answers)`, `findScore(slug, answers)`, `findMatches(answers)`, `findIssueURL(answers)`, `fromURL()`, `writeURL(push)`.
-
-## Phases
-
-- **Phase 0, coordinator:** Task 0.
-- **Phase A, at once:** Task 1 (`af-logic`), Task 6 (`af-404`), Task 7 (`af-check`), and the seven tagging lanes: Task 8 in each lane, then that lane's Task 9 as soon as its Task 8 is done.
-- **Phase B:** once Task 1 is merged, Task 2 (`af-pics`); once Tasks 1 and 7 are merged, the view lane `af-view` runs Task 3, then Task 4, then Task 5, each reviewed and merged before the next starts. The tagging lanes keep running beside it.
-- **Phase C, integration:** once every code task is merged and every lane's Task 9 is approved: Task 10, Task 11, then Task 12 and Task 13 at once, then Task 14, Task 15, Task 16 (only if the owner asks for it at Task 15) and Task 17 (only on the owner's word).
-- **Review and merge:** every builder or tagger is followed by a fresh reviewer (never the builder), at most three fix rounds by the same builder, then the coordinator decides (a design question goes to the owner). When a code task's review is clean the coordinator merges it, `git -C "$WT/af-int" merge --no-ff af/<lane> -m "Merge af/<lane>: <what it adds, in plain words>"`, runs the tests in `af-int` and logs it in `$RUN/progress.md`.
-- **Agents:** the strongest model for every builder, tagger, checker and reviewer (the owner: quality first, cost no concern).
-- **Time:** about one day of agent work (tags and page side by side, 4 to 5 hours each; integration and review 2 to 3 hours), plus the owner's look. On a usage-limit hit the finder pauses before the rollout does.
-
----
-
-### Task 0: Branch, worktrees, run folder and the run's helper scripts (coordinator)
-
-**Files:**
-- No file in git changes.
-- Create (run folder): `$RUN/env.md`, `$RUN/progress.md`, `$RUN/home-data.mjs`, `$RUN/lint-tags.mjs`, `$RUN/card-facts.mjs`, `$RUN/shoot.mjs`, `$RUN/lanes/01…07/brief.md`, `$RUN/lanes/01…07/check-brief.md`
-
-**Interfaces:**
-- Produces: branch `feat/animation-finder` checked out in `$WT/af-int`; worktrees `af-logic` (`af/logic`), `af-404` (`af/404`), `af-check` (`af/check`), `af-tags` (detached); a server on 8905 serving `af-tags`.
-- Produces in `$RUN/home-data.mjs`: `readHome(file = 'index.html')` → `{ text, eol, blockEnd(from), valueOf(name), functionSource(name) }`; `KEYS` (`{ what: string[], when: string[], how: string[] }`); `MAX` (`{ what: 3, when: 3, how: 4 }`); `tagRows(markdown)` → `string[][]` (the cells of each row of a tags table, header and divider left out).
-- Produces: `node $RUN/lint-tags.mjs <tags.md>` (prints problems or `ok: …`, exit 1 on problems); `node $RUN/card-facts.mjs <NN> $RUN`; `node $RUN/shoot.mjs --url … [--size WxH] [--mobile] [--theme light|dark] [--reduce] [--wait ms] [--eval js] [--shot file] [--full]`.
-
-- [ ] **Step 1: Check that `main` is the live site and nothing is in the way**
-
-```bash
-MAIN=C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-git -C "$MAIN" fetch origin
-git -C "$MAIN" rev-parse main origin/main
-git -C "$MAIN" branch --list feat/animation-finder 'af/*'
-git -C "$MAIN" worktree list | grep '/af-' || echo "no af worktrees"
-```
-
-Expected: the two hashes are the same; no branch is listed; `no af worktrees`. If the hashes differ, stop and bring `main` up to date in the release worktree first.
-
-- [ ] **Step 2: Cut the branch and make the Phase A worktrees**
-
-```bash
-MAIN=C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook; WT=$MAIN/.claude/worktrees
-git -C "$MAIN" branch feat/animation-finder main
-git -C "$MAIN" worktree add "$WT/af-int" feat/animation-finder
-git -C "$MAIN" worktree add -b af/logic "$WT/af-logic" feat/animation-finder
-git -C "$MAIN" worktree add -b af/404 "$WT/af-404" feat/animation-finder
-git -C "$MAIN" worktree add -b af/check "$WT/af-check" feat/animation-finder
-git -C "$MAIN" worktree add --detach "$WT/af-tags" feat/animation-finder
-git -C "$MAIN" worktree list | grep '/af-'
-```
-
-Expected: five lines, for `af-int`, `af-logic`, `af-404`, `af-check` and `af-tags`.
-
-- [ ] **Step 3: The run folder, the slot pool, `env.md` and the ledger**
-
-```bash
-MAIN=C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-RUN=$MAIN/.superpowers/sdd/$(date +%F)-animation-finder
-mkdir -p "$RUN"/lanes/{01,02,03,04,05,06,07} "$RUN/pics" "$RUN/owner" "$RUN/final"
-ls -d "$MAIN"/.superpowers/sdd/*-see-inside-compare/slots 2>/dev/null || echo "no slot pool yet"
-```
-
-If it prints `no slot pool yet`, make the pool where the coordination file puts it, in the rollout's run folder: `mkdir -p "$MAIN/.superpowers/sdd/<rollout start date, 2026-10-14 as planned>-see-inside-compare/slots"`.
-
-Write `$RUN/env.md` with the real values:
-
-```markdown
-# Animation finder run: where things are
-- Plan: docs/superpowers/plans/2026-10-13-animation-finder.md (main checkout)
-- MAIN=C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook (stays on feat/see-inside-compare)
-- WT=$MAIN/.claude/worktrees
-- RUN=<this folder's full path>
-- SLOTS=<the slot pool's full path>
-- feat/animation-finder cut from main <hash> on <date>, checked out in $WT/af-int
-- Servers: af-logic 8901, af-pics 8902, af-view 8903, af-check 8904, af-tags 8905, af-int 8906, af-final 8907
-```
-
-Write `$RUN/progress.md`:
-
-```markdown
-# SDD ledger — plan: docs/superpowers/plans/2026-10-13-animation-finder.md
-
-Branch feat/animation-finder from main <hash>, <date>. Lanes run in parallel in worktrees (owner: parallel agents, quality first).
-```
-
-- [ ] **Step 4: `$RUN/home-data.mjs`, shared by every helper script**
-
-```js
-// Reads the home page of the checkout a command runs in (index.html in the current folder) as the tests read it: its text, its
-// line ending, the value of any `const NAME=` of plain data in its script (run with vm) and the source of any function. Also the
-// finder's answer keys and the rows of a lane's tags table. Shared by the scripts of the Animation finder's run folder.
-import { readFileSync } from 'node:fs';
-import vm from 'node:vm';
-
-export function readHome(file = 'index.html') {
- const text = readFileSync(file, 'utf8');
- const eol = text.includes('\r\n') ? '\r\n' : '\n';
- // Where the bracket that opens at text[from] ('[' or '{') is closed, stepping over strings and // comments.
- const blockEnd = from => {
- const open = text[from], close = open === '[' ? ']' : '}';
- let depth = 0, i = from, quote = null;
- for (; i < text.length; i++) {
- const ch = text[i];
- if (quote) { if (ch === '\\') i++; else if (ch === quote) quote = null; continue; }
- if (ch === '/' && text[i + 1] === '/') { while (i < text.length && text[i] !== '\n') i++; continue; }
- if (ch === "'" || ch === '"' || ch === '`') quote = ch;
- else if (ch === open) depth++;
- else if (ch === close && --depth === 0) break;
- }
- return i;
- };
- const valueOf = name => {
- const at = text.indexOf(`const ${name}=`);
- if (at < 0) throw new Error(`index.html has no const ${name}=`);
- const from = at + `const ${name}=`.length;
- return vm.runInNewContext('(' + text.slice(from, blockEnd(from) + 1) + ')');
- };
- const functionSource = name => {
- const at = text.indexOf(`function ${name}(`);
- if (at < 0) throw new Error(`index.html has no function ${name}`);
- return text.slice(at, blockEnd(text.indexOf('{', at)) + 1);
- };
- return { text, eol, blockEnd, valueOf, functionSource };
-}
-
-// The finder's answer keys (spec, section 2), for checking ledgers made before FIND_Q exists on the checkout they read.
-export const KEYS = {
- what: ['text', 'card', 'button', 'menu', 'loader', 'shape', 'particles', 'background', 'page'],
- when: ['scroll', 'hover', 'click', 'drag', 'load', 'newpage', 'loop'],
- how: ['fade', 'slide', 'grow', 'turn', 'bounce', 'stagger', 'pieces', 'follow', 'color', 'morph', 'draw', 'reveal', 'layers', 'pin', 'drift', 'wave', 'glitch']
-};
-export const MAX = { what: 3, when: 3, how: 4 };
-
-// The cells of each row of a lane's tags table (| slug | what | when | how | reason |), the header and divider rows left out.
-export const tagRows = markdown => markdown.split(/\r?\n/)
- .filter(line => /^\|\s*[a-z0-9]/.test(line) && !/^\|\s*slug\s*\|/.test(line))
- .map(line => line.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map(cell => cell.trim()));
-```
-
-- [ ] **Step 5: `$RUN/lint-tags.mjs`, then check that it catches mistakes**
-
-```js
-#!/usr/bin/env node
-// Checks one lane's finder answers ($RUN/lanes/<NN>/tags.md) by the rules a script can check: every card of the category once, in
-// home order; known answer keys only; 1–3 What, 1–3 When and 1–4 How, none twice; a reason on every row; every page transition
-// answers newpage, every loop page loop, every Scroll-Based or scroll page scroll. Prints every problem, or "ok". Run it from the
-// root of a checkout of feat/animation-finder (it reads index.html and the pages there):
-// node <run folder>/lint-tags.mjs <run folder>/lanes/<NN>/tags.md
-import { existsSync, readFileSync } from 'node:fs';
-import { basename, dirname, join } from 'node:path';
-import { readHome, KEYS, MAX, tagRows } from './home-data.mjs';
-
-const file = process.argv[2];
-if (!file || !existsSync(file)) { console.error('Usage: node lint-tags.mjs <run folder>/lanes/<NN>/tags.md'); process.exit(2); }
-const lane = basename(dirname(file));
-const cat = readHome().valueOf('CATS').find(c => c.n === lane);
-if (!cat) { console.error(`index.html has no category ${lane}`); process.exit(2); }
-const problems = [], seen = [];
-for (const cells of tagRows(readFileSync(file, 'utf8'))) {
- if (cells.length !== 5) { problems.push(`not five cells: | ${cells.join(' | ')} |`); continue; }
- const [slug, what, when, how, reason] = cells;
- seen.push(slug);
- if (!cat.entries.some(e => e[0] === slug)) { problems.push(`${slug}: not a card of ${cat.n} ${cat.name}`); continue; }
- for (const [question, value] of [['what', what], ['when', when], ['how', how]]) {
- const keys = value.split(' ');
- if (keys.length > MAX[question]) problems.push(`${slug}: ${keys.length} ${question} answers, at most ${MAX[question]}`);
- for (const key of keys) if (!KEYS[question].includes(key)) problems.push(`${slug}: "${key}" is not a ${question} answer`);
- if (new Set(keys).size !== keys.length) problems.push(`${slug}: a ${question} answer twice`);
- }
- if (reason.split(/\s+/).length < 5) problems.push(`${slug}: the reason is missing or too short`);
- const page = join(cat.folder, slug, 'index.html');
- const kind = existsSync(page) ? (readFileSync(page, 'utf8').match(/data-hb-kind="(\w+)"/) || [])[1] : '';
- const whens = when.split(' ');
- if (cat.n === '03' && !whens.includes('newpage')) problems.push(`${slug}: every page transition answers newpage`);
- if (kind === 'loop' && !whens.includes('loop')) problems.push(`${slug}: every loop page answers loop`);
- if ((cat.n === '01' || kind === 'scroll') && !whens.includes('scroll')) problems.push(`${slug}: every Scroll-Based or scroll page answers scroll`);
-}
-const want = cat.entries.map(e => e[0]);
-for (const slug of want) if (!seen.includes(slug)) problems.push(`${slug}: no row`);
-for (const slug of new Set(seen)) if (seen.indexOf(slug) !== seen.lastIndexOf(slug)) problems.push(`${slug}: more than one row`);
-if (!problems.length && seen.join() !== want.join()) problems.push('the rows are not in home order (the order card-facts.mjs prints)');
-console.log(problems.length ? problems.join('\n') : `ok: ${seen.length} cards of ${cat.n} ${cat.name}`);
-process.exit(problems.length ? 1 : 0);
-```
-
-Check it on a made-up ledger with two mistakes:
-
-```bash
-MAIN=C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook; WT=$MAIN/.claude/worktrees; RUN=<from env.md>
-mkdir -p "$RUN/selftest/01"
-printf '| slug | what | when | how | reason |\n|---|---|---|---|---|\n| parallax-depth-of-field | background card | scroll | layers | Layers of a scene slide at their own speeds as you scroll. |\n| parallax-scrolling | columns | load | layers | short |\n' > "$RUN/selftest/01/tags.md"
-cd "$WT/af-tags" && node "$RUN/lint-tags.mjs" "$RUN/selftest/01/tags.md"; echo "exit $?"
-```
-
-Expected: `parallax-scrolling: "columns" is not a what answer`, `parallax-scrolling: the reason is missing or too short`, `parallax-scrolling: every Scroll-Based or scroll page answers scroll`, then `… : no row` for the other 25 cards of 01, and `exit 1`. Then `rm -r "$RUN/selftest"`.
-
-- [ ] **Step 6: `$RUN/card-facts.mjs`, then run it on 02**
-
-```js
-#!/usr/bin/env node
-// Prints what a tagger reads for each card of one category, in home order: the home card (name, line, places), the page (kind,
-// title, lede, prompt, Good for, Avoid on), the README (What it is, When to use it) and where its desktop still is.
-// Usage, from the root of the af-tags worktree: node <run folder>/card-facts.mjs <NN> <run folder>
-import { readFileSync } from 'node:fs';
-import { join } from 'node:path';
-import { readHome } from './home-data.mjs';
-
-const [lane, RUN] = process.argv.slice(2);
-const home = readHome(), PLACES = home.valueOf('PLACES');
-const cat = home.valueOf('CATS').find(c => c.n === lane);
-if (!cat || !RUN) { console.error('Usage: node card-facts.mjs <NN> <run folder>'); process.exit(2); }
-const plain = s => String(s || '').replace(/<[^>]+>/g, '').replace(/&amp;/g, '&').replace(/&#39;/g, "'").replace(/&quot;/g, '"').replace(/\s+/g, ' ').trim();
-const section = (md, name) => (md.split(/\r?\n## /).find(s => s.startsWith(name)) || '').split(/\r?\n/).slice(1).join(' ').replace(/\s+/g, ' ').trim();
-for (const [slug, name, line] of cat.entries) {
- const dir = join(cat.folder, slug), html = readFileSync(join(dir, 'index.html'), 'utf8'), md = readFileSync(join(dir, 'README.md'), 'utf8');
- const pick = re => plain((html.match(re) || [])[1]);
- const list = cls => [...((html.match(new RegExp(`<ul class="hb-tags ${cls}">([\\s\\S]*?)</ul>`)) || [])[1] || '').matchAll(/<li>([^<]*)<\/li>/g)].map(m => m[1]).join(', ');
- console.log([`## ${slug} (${name})`,
- `Card: ${line} Places: ${PLACES[slug].join(', ')}. Kind: ${(html.match(/data-hb-kind="(\w+)"/) || [])[1]}.`,
- `Title: ${pick(/<h1>([\s\S]*?)<\/h1>/)}. Lede: ${pick(/<p class="hb-lede">([\s\S]*?)<\/p>/)}`,
- `Prompt: ${pick(/<p class="hb-prompt"[^>]*>([\s\S]*?)<\/p>/)}`,
- `Good for: ${list('hb-good')}. Avoid on: ${list('hb-avoid')}.`,
- `What it is: ${section(md, 'What it is')}`,
- `When to use it: ${section(md, 'When to use it')}`,
- `Desktop still: ${join(RUN, 'lanes', lane, 'stills', `${lane}-${slug}-desktop.png`)}`, ''].join('\n'));
-}
-```
-
-Run `cd "$WT/af-tags" && node "$RUN/card-facts.mjs" 02 "$RUN" | head -20`. Expected: `## fade-in-out (Fade In / Fade Out)`, then its card line, places `intro`, kind `once`, its title, lede, prompt, Good for, Avoid on, What it is, When to use it and still path; then `## slide-in (Slide In)`.
-
-- [ ] **Step 7: `$RUN/shoot.mjs`, then a smoke test**
-
-```js
-#!/usr/bin/env node
-// Opens one address in headless Chrome at one size and, as asked, prints the value of an expression run in the page and saves a
-// screenshot of the window or of the whole page. A helper of the finder's run, not part of the site. It starts a Chrome, so take a
-// slot from the shared pool before running it and free it after.
-// Usage: node shoot.mjs --url <address> [--size 1280x800] [--mobile] [--theme light|dark] [--reduce] [--wait 800]
-// [--eval "<expression>"] [--shot <file.png>] [--full]
-import { execFileSync, spawn } from 'node:child_process';
-import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { join } from 'node:path';
-
-const args = process.argv.slice(2);
-const opt = (name, fallback) => { const i = args.indexOf(name); return i < 0 ? fallback : args[i + 1]; };
-const flag = name => args.includes(name);
-const url = opt('--url', ''), [width, height] = opt('--size', '1280x800').split('x').map(Number);
-const theme = opt('--theme', 'light'), wait = Number(opt('--wait', '800')), expression = opt('--eval', ''), shotFile = opt('--shot', '');
-if (!url) { console.error('Usage: node shoot.mjs --url <address> [--size WxH] [--mobile] [--theme light|dark] [--reduce] [--wait ms] [--eval js] [--shot file.png] [--full]'); process.exit(2); }
-const CHROME = process.env.CHROME || 'C:/Program Files/Google/Chrome/Application/chrome.exe';
-const profile = mkdtempSync(join(tmpdir(), 'hb-chrome-'));
-const chrome = spawn(CHROME, ['--headless=new', '--disable-gpu', '--hide-scrollbars', '--disable-lcd-text', '--remote-debugging-port=0',
- `--user-data-dir=${profile}`, 'about:blank'], { stdio: 'ignore' });
-const sleep = ms => new Promise(done => setTimeout(done, ms));
-const pending = new Map(), events = [];
-let ws = null, id = 0;
-const send = (method, params = {}) => new Promise((done, fail) => {
- const n = ++id;
- pending.set(n, m => (m.error ? fail(new Error(`${method}: ${m.error.message}`)) : done(m.result)));
- ws.send(JSON.stringify({ id: n, method, params }));
-});
-try {
- let socket = null;
- for (let i = 0; i < 100 && !socket; i++) {
- const portFile = join(profile, 'DevToolsActivePort');
- if (existsSync(portFile)) {
- try {
- const port = readFileSync(portFile, 'utf8').split('\n')[0].trim();
- socket = ((await (await fetch(`http://127.0.0.1:${port}/json/list`)).json()).find(t => t.type === 'page') || {}).webSocketDebuggerUrl || null;
- } catch {}
- }
- if (!socket) await sleep(100);
- }
- if (!socket) throw new Error('Chrome started but did not answer');
- ws = new WebSocket(socket);
- await new Promise((done, fail) => { ws.onopen = done; ws.onerror = () => fail(new Error('could not connect to Chrome')); });
- ws.onmessage = e => { const m = JSON.parse(e.data); if (m.id && pending.has(m.id)) { pending.get(m.id)(m); pending.delete(m.id); } else events.push(m); };
- await send('Page.enable');
- // The visitor's theme and a GitHub star count stored as the home page stores them, so it never asks api.github.com.
- await send('Page.addScriptToEvaluateOnNewDocument', { source: `try { localStorage.setItem('ah-theme', '${theme === 'dark' ? 'dark' : 'light'}');
- localStorage.setItem('gh-star-count', JSON.stringify({ count: 1234, ts: Date.now() })); } catch (e) {}` });
- await send('Emulation.setDeviceMetricsOverride', { width, height, deviceScaleFactor: flag('--mobile') ? 2 : 1, mobile: flag('--mobile') });
- await send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-reduced-motion', value: flag('--reduce') ? 'reduce' : 'no-preference' },
- { name: 'prefers-color-scheme', value: theme === 'dark' ? 'dark' : 'light' }] });
- await send('Page.navigate', { url });
- for (let i = 0; i < 200 && !events.some(m => m.method === 'Page.loadEventFired'); i++) await sleep(100);
- await sleep(wait);
- if (expression) {
- const r = await send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true });
- console.log(r.exceptionDetails ? `error: ${r.exceptionDetails.exception?.description || r.exceptionDetails.text}` : JSON.stringify(r.result.value));
- }
- if (shotFile) {
- let params = { format: 'png' };
- if (flag('--full')) {
- const { cssContentSize } = await send('Page.getLayoutMetrics');
- params = { format: 'png', captureBeyondViewport: true, clip: { x: 0, y: 0, width, height: Math.ceil(cssContentSize.height), scale: 1 } };
- }
- writeFileSync(shotFile, Buffer.from((await send('Page.captureScreenshot', params)).data, 'base64'));
- console.log(`saved ${shotFile}`);
- }
-} catch (err) {
- console.error(err.message);
- process.exitCode = 1;
-} finally {
- if (ws) ws.close();
- chrome.kill();
- if (process.platform === 'win32') {
- try {
- execFileSync('powershell', ['-NoProfile', '-NonInteractive', '-Command',
- `Get-CimInstance Win32_Process -Filter "Name='chrome.exe'" | Where-Object { $_.CommandLine -and $env:HB_PROFILE -and $_.CommandLine.Contains($env:HB_PROFILE) } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }`],
- { stdio: 'ignore', timeout: 20000, windowsHide: true, env: { ...process.env, HB_PROFILE: profile } });
- } catch {}
- }
- for (let i = 0; i < 50; i++) { try { rmSync(profile, { recursive: true, force: true }); break; } catch { await sleep(200); } }
-}
-```
-
-Smoke test: start the `af-tags` server (`cd "$WT/af-tags" && python -m http.server 8905 --bind 127.0.0.1`, background; it serves the seven tagging lanes until every Task 9 is approved), take a slot, then
-
-```bash
-node "$RUN/shoot.mjs" --url http://127.0.0.1:8905/ --size 1280x800 --eval "document.title" --shot "$RUN/smoke.png"
-```
-
-Expected: `"Animation Handbook — 166 Web Animation Techniques with Live Demos"` and `saved …/smoke.png`. Open the picture with the Read tool: the home page's top in the light theme. Free the slot; delete `smoke.png`.
-
-- [ ] **Step 8: The seven lanes' briefs**
-
-For each lane of the table in Task 8, write `$RUN/lanes/<NN>/brief.md` from Task 8's tagger brief and `$RUN/lanes/<NN>/check-brief.md` from Task 9's checker brief, replacing `<NN>`, `<Category>`, `<folder>`, `<count>` and `$RUN` with the lane's values and the real run folder path. Nothing else of this plan goes into the briefs.
-
-- [ ] **Step 9: Baseline**
-
-Run: `cd "$WT/af-int" && node --test "tests/*.test.js"`
-Expected: every test passes. Log the count, the branch's base hash and the worktrees in `$RUN/progress.md`.
-
----
-
-### Task 1: The questions, the draft answers and the matching
-
-**Files:**
-- Modify: `index.html` — after the end of `PLACES` (`};` on line 1993 on main), before `// The eight cards of "Good places to start", in this order.` (line 1994): the draft `FIND` block, then `FIND_Q`; after `function search(text){…}` (lines 2411–2415): the finder's functions
-- Create: `tests/finder.test.js`
-- Create (run folder): `$RUN/draft-find.mjs`
-
-**Interfaces:**
-- Consumes: `readHome` from `$RUN/home-data.mjs` (Task 0); the page's `ALL` (cards in home order with `slug`, `name`, `order`).
-- Produces: `FIND_Q` (array of `{ key: 'what'|'when'|'how', title, weight, hint?, answers: [{ key, words, icon? , pic? }] }`), `FIND` (`{ [slug]: [what: string, when: string, how: string] }`, keys space-separated, main first), `findQuery(answers) → string`, `findWords(answers) → string`, `findScore(slug, answers) → { points, misses, size }`, `findMatches(answers) → { best: Card[], close: Card[] }`, `findIssueURL(answers) → string`; `answers` is any object with `what`, `when`, `how` (`''`, `'unsure'` or a key).
-- Produces in `tests/finder.test.js`: the helpers `read`, `count`, `between`, `plain`, `blockEnd`, `homeConst`, `at`, `source`, `finder(data)`, `cards(rows)`, `slugs(list)`, and four section headers that Tasks 2, 3–5 and 11 fill.
-
-- [ ] **Step 1: Write the failing tests** — create `tests/finder.test.js`:
-
-```js
-// Static checks for the Animation finder on the home page (index.html): its questions (FIND_Q), each card's answers (FIND), the
-// matching (findMatches), the finder's markup and pictures, the Not here? link and its GitHub form, and the finder's test set.
-// The page's own code is read with vm, as tests/pages.test.js reads the search. Run from the repo root: node --test "tests/*.test.js"
-const test = require('node:test');
-const assert = require('node:assert/strict');
-const fs = require('node:fs');
-const path = require('node:path');
-const vm = require('node:vm');
-
-const ROOT = path.resolve(__dirname, '..');
-const read = f => fs.readFileSync(f, 'utf8');
-const count = (s, sub) => s.split(sub).length - 1;
-// The part of s from the first `from` up to the next `to` after it ('' when `from` is missing), as in tests/pages.test.js.
-const between = (s, from, to) => {
- const start = s.indexOf(from);
- if (start < 0) return '';
- const end = s.indexOf(to, start + from.length);
- return s.slice(start, end < 0 ? undefined : end);
-};
-// A value made in a vm context, copied into plain arrays and objects that deepEqual accepts.
-const plain = v => JSON.parse(JSON.stringify(v));
-const HOME = read(path.join(ROOT, 'index.html'));
-
-// As in tests/pages.test.js: where the bracket that opens at HOME[from] ('[' or '{') is closed, stepping over strings and //
-// comments, and the value of `const NAME=` in the home page's script, read with vm.
-function blockEnd(from) {
- const open = HOME[from], close = open === '[' ? ']' : '}';
- let depth = 0, i = from, quote = null;
- for (; i < HOME.length; i++) {
- const ch = HOME[i];
- if (quote) { if (ch === '\\') i++; else if (ch === quote) quote = null; continue; }
- if (ch === '/' && HOME[i + 1] === '/') { while (i < HOME.length && HOME[i] !== '\n') i++; continue; }
- if (ch === "'" || ch === '"' || ch === '`') quote = ch;
- else if (ch === open) depth++;
- else if (ch === close && --depth === 0) break;
- }
- return i;
-}
-function homeConst(name) {
- const start = HOME.indexOf(`const ${name}=`);
- assert.ok(start >= 0, `const ${name} in index.html`);
- const from = start + `const ${name}=`.length;
- return plain(vm.runInNewContext('(' + HOME.slice(from, blockEnd(from) + 1) + ')'));
-}
-const at = marker => { const i = HOME.indexOf(marker); assert.ok(i >= 0, `${marker} in index.html`); return i; };
-const source = name => { const start = at(`function ${name}(`); return HOME.slice(start, blockEnd(HOME.indexOf('{', start)) + 1); };
-// The finder as the page runs it: the cards in home order, built by the page's own code from PLACE_LIST up to BY_SLUG (as the
-// search tests build them), with FIND_Q, FIND and the finder's functions in one context. `data` adds to the context or replaces
-// CATS, PLACES or FIND with test data.
-function finder(data = {}) {
- const context = vm.createContext({ CATS: homeConst('CATS'), PLACES: homeConst('PLACES'), FIND_Q: homeConst('FIND_Q'), FIND: homeConst('FIND'), ...data });
- vm.runInContext(HOME.slice(at('const PLACE_LIST=['), at('const BY_SLUG=')), context);
- for (const name of ['findQuery', 'findWords', 'findScore', 'findMatches', 'findIssueURL']) vm.runInContext(source(name), context);
- return context;
-}
-// The finder over test cards, one group in this order: each [slug, what, when, how], the answers written as FIND writes them.
-function cards(rows) {
- const CATS = [{ name: 'Test', cat: 'c1-cat', dot: '#000000', n: '01', desc: 'Test cards.', folder: 'animations/01-test',
- entries: rows.map(([slug]) => [slug, slug, 'A test card. Best for tests.']) }];
- return finder({ CATS, PLACES: Object.fromEntries(rows.map(([slug]) => [slug, ['btn']])), FIND: Object.fromEntries(rows.map(([slug, ...answers]) => [slug, answers])) });
-}
-const slugs = list => Array.from(list, e => e.slug);
-
-// ── The questions, the answers and the matching ──
-
-const QUESTIONS = [
- ['what', 'What moved?', 2, [['text', 'Text or numbers'], ['card', 'A picture or card'], ['button', 'A button or icon'], ['menu', 'A menu or form'],
- ['loader', 'A loading sign or message'], ['shape', 'A line or shape'], ['particles', 'Dots or particles'], ['background', 'The background'],
- ['page', 'The whole page']]],
- ['when', 'When did it move?', 1, [['scroll', 'When I scrolled'], ['hover', 'When I pointed at it'], ['click', 'When I clicked or tapped'],
- ['drag', 'When I dragged or swiped'], ['load', 'When the page opened'], ['newpage', 'When I went to another page'], ['loop', 'By itself, again and again']]],
- ['how', 'How did it move?', 3, [['fade', 'Faded or blurred'], ['slide', 'Slid'], ['grow', 'Grew or shrank'], ['turn', 'Turned or flipped'],
- ['bounce', 'Bounced or shook'], ['stagger', 'One after another'], ['pieces', 'Broke into pieces'], ['follow', 'Followed my pointer'],
- ['color', 'Changed color or glowed'], ['morph', 'Changed into something else'], ['draw', 'Drew or typed itself'], ['reveal', 'Got uncovered'],
- ['layers', 'Moved in layers'], ['pin', 'Stayed in place while I scrolled'], ['drift', 'Drifted or floated'], ['wave', 'Rippled or waved'],
- ['glitch', 'Glitched or flickered']]]
-];
-
-test('FIND_Q holds the three questions in order, with the answers of the spec in their exact words', () => {
- const questions = homeConst('FIND_Q');
- assert.deepEqual(questions.map(q => [q.key, q.title, q.weight, q.answers.map(a => [a.key, a.words])]), QUESTIONS);
- assert.equal(questions[2].hint, 'Pick the picture closest to what you saw.');
- for (const q of questions.slice(0, 2)) {
- for (const a of q.answers) assert.match(a.icon || '', /^(<(path|rect|circle) [^<>]*\/>)+$/, `${a.key}: a still icon in the site's line style`);
- }
- for (const a of questions[2].answers) assert.equal(a.pic, `fd-${a.key}`, `${a.key}: the class of its moving picture`);
-});
-
-test('FIND lists every card once, in home order, with 1–3 What, 1–3 When and 1–4 How answers, all known, none twice', () => {
- const find = homeConst('FIND'), questions = homeConst('FIND_Q');
- const all = homeConst('CATS').flatMap(cat => cat.entries.map(e => e[0]));
- assert.deepEqual(Object.keys(find), all, 'FIND lists every card once, in home order');
- const problems = [];
- for (const slug of all) {
- const row = find[slug];
- if (!Array.isArray(row) || row.length !== 3) { problems.push(`${slug}: not three lists`); continue; }
- questions.forEach((q, i) => {
- const keys = String(row[i]).split(' '), most = q.key === 'how' ? 4 : 3;
- if (keys.length > most) problems.push(`${slug}: ${keys.length} ${q.key} answers, at most ${most}`);
- for (const key of keys) if (!q.answers.some(a => a.key === key)) problems.push(`${slug}: "${key}" is not a ${q.key} answer`);
- if (new Set(keys).size !== keys.length) problems.push(`${slug}: a ${q.key} answer twice`);
- });
- }
- assert.deepEqual(problems, []);
-});
-
-test('FIND sits right after PLACES', () => {
- const end = blockEnd(HOME.indexOf('{', at('const PLACES='))) + 1;
- assert.match(HOME.slice(end, at('const FIND=')), /^;\s*(\/\/[^\n]*\n\s*)*$/, 'only a comment line between PLACES and FIND');
-});
-
-test("a card's points: its main answer earns twice the question's weight, another answer once (the spec's example)", () => {
- const page = cards([['letters', 'text', 'load scroll', 'stagger fade'], ['typewriter', 'text', 'load loop', 'draw stagger'], ['fade', 'card text', 'load scroll click', 'fade']]);
- const answers = { what: 'text', when: 'load', how: 'stagger' };
- assert.deepEqual(plain(page.findScore('letters', answers)), { points: 12, misses: 0, size: 5 });
- assert.deepEqual(plain(page.findScore('typewriter', answers)), { points: 9, misses: 0, size: 5 });
- assert.deepEqual(plain(page.findScore('fade', answers)), { points: 4, misses: 1, size: 6 });
- const found = page.findMatches(answers);
- assert.deepEqual([slugs(found.best), slugs(found.close)], [['letters', 'typewriter'], ['fade']]);
-});
-
-test('no answer, or only Not sure, gives no cards, and an unknown key counts as Not sure', () => {
- const page = cards([['a', 'text', 'load', 'fade'], ['b', 'card', 'load', 'fade']]);
- for (const answers of [{}, { what: '', when: '', how: '' }, { what: 'unsure', when: 'unsure', how: 'unsure' }, { what: 'zebra' }]) {
- assert.deepEqual(plain(page.findMatches(answers)), { best: [], close: [] }, JSON.stringify(answers));
- }
- assert.deepEqual(plain(page.findMatches({ what: 'zebra', when: 'unsure', how: 'fade' })), plain(page.findMatches({ how: 'fade' })));
-});
-
-test('Best has no miss; Close has exactly one, and only when two or more questions are answered', () => {
- const page = cards([['a', 'text', 'load', 'fade'], ['b', 'card', 'load', 'fade'], ['c', 'card', 'scroll', 'slide']]);
- let found = page.findMatches({ what: 'text' });
- assert.deepEqual([slugs(found.best), slugs(found.close)], [['a'], []], 'one question answered: no Close matches');
- found = page.findMatches({ what: 'text', how: 'fade' });
- assert.deepEqual([slugs(found.best), slugs(found.close)], [['a'], ['b']], 'b misses What only, c misses both');
- found = page.findMatches({ what: 'text', when: 'load', how: 'fade' });
- assert.deepEqual([slugs(found.best), slugs(found.close)], [['a'], ['b']], 'c misses all three');
-});
-
-test('a main answer counts double', () => {
- const page = cards([['side', 'card text', 'load', 'fade'], ['main', 'text card', 'load', 'fade']]);
- assert.deepEqual(slugs(page.findMatches({ what: 'text' }).best), ['main', 'side']);
-});
-
-test('weights How 3, What 2, When 1: with the rest equal, a card missing When ranks above one missing What, above one missing How', () => {
- const page = cards([['no-how', 'text', 'load', 'slide'], ['no-what', 'card', 'load', 'fade'], ['no-when', 'text', 'scroll', 'fade']]);
- const found = page.findMatches({ what: 'text', when: 'load', how: 'fade' });
- assert.deepEqual([slugs(found.best), slugs(found.close)], [[], ['no-when', 'no-what', 'no-how']]);
-});
-
-test('ties go to fewer answers in all, then home order', () => {
- const page = cards([['many', 'text', 'load scroll', 'fade'], ['first', 'text', 'load', 'fade'], ['second', 'text', 'load', 'fade']]);
- assert.deepEqual(slugs(page.findMatches({ what: 'text', when: 'load', how: 'fade' }).best), ['first', 'second', 'many']);
-});
-
-test('the finder part of an address and the answers in words', () => {
- const page = finder();
- assert.equal(page.findQuery({ what: 'text', when: 'scroll', how: 'draw' }), '?view=find&what=text&when=scroll&how=draw');
- assert.equal(page.findQuery({ what: 'unsure', when: 'zebra', how: 'draw' }), '?view=find&how=draw');
- assert.equal(page.findQuery({}), '?view=find');
- assert.equal(page.findWords({ what: 'text', when: 'unsure', how: 'draw' }), 'Text or numbers · Not sure · Drew or typed itself');
-});
-
-test('the Not here? address opens the form animation_not_here.yml with its title and its answers field filled in', () => {
- const url = new URL(finder().findIssueURL({ what: 'text', when: 'scroll', how: 'draw' }));
- assert.equal(url.origin + url.pathname, 'https://github.com/matinmonshizadeh/animation-handbook/issues/new');
- assert.deepEqual([...url.searchParams.keys()], ['template', 'title', 'answers']);
- assert.equal(url.searchParams.get('template'), 'animation_not_here.yml');
- assert.equal(url.searchParams.get('title'), '[not here] Text or numbers · When I scrolled · Drew or typed itself');
- assert.equal(url.searchParams.get('answers'),
- 'Text or numbers · When I scrolled · Drew or typed itself — https://matinmonshizadeh.github.io/animation-handbook/?view=find&what=text&when=scroll&how=draw');
-});
-
-// ── The pictures of the How answers ──
-// Each How answer moves in a small picture of its own, and reduced motion holds every picture still.
-
-// ── The finder view, its ways in and Not here? ──
-// The finder's markup and address, the Find button and the Finder link, and the Not here? panel with its GitHub form.
-
-// ── Every card's answers and the test set ──
-// The reviewed answers: every answer given to some card, the rules every page of a kind shares, and the spec's 28 described effects.
-```
-
-- [ ] **Step 2: Run the new tests and see them fail**
-
-Run: `cd "$WT/af-logic" && node --test tests/finder.test.js`
-Expected: every test FAILS with an assertion that names what is missing: `const FIND_Q in index.html`, `const FIND in index.html` or `const FIND= in index.html`.
-
-- [ ] **Step 3: Write the draft answers** — create `$RUN/draft-find.mjs`:
-
-```js
-#!/usr/bin/env node
-// Writes the finder's draft answers into index.html, right after PLACES: What from each card's first place, When and How from its
-// category. They only let the finder run while the seven lanes tag the cards; Task 11 replaces them with the reviewed answers.
-// Run once, from the root of the af-logic worktree: node <run folder>/draft-find.mjs
-import { writeFileSync } from 'node:fs';
-import { readHome } from './home-data.mjs';
-
-const home = readHome();
-if (home.text.includes('const FIND={')) { console.error('index.html already has const FIND={'); process.exit(1); }
-const CATS = home.valueOf('CATS'), PLACES = home.valueOf('PLACES');
-const WHAT = { btn: 'button', text: 'text', imgcard: 'card', bg: 'background', menu: 'menu', load: 'loader', intro: 'card', scroll: 'card', page: 'page' };
-const WHEN = { '01': 'scroll', '02': 'load', '03': 'newpage', '04': 'click', '05': 'load', '06': 'loop', '07': 'loop' };
-const HOW = { '01': 'slide', '02': 'fade', '03': 'slide', '04': 'grow', '05': 'stagger', '06': 'turn', '07': 'drift' };
-const lines = ["// Draft answers for the finder, from each card's first place and its category: the reviewed answers replace them.", 'const FIND={'];
-CATS.forEach((cat, c) => {
- lines.push(` // ${cat.n}`);
- cat.entries.forEach(([slug], i) => {
- const last = c === CATS.length - 1 && i === cat.entries.length - 1;
- lines.push(` '${slug}':['${WHAT[PLACES[slug][0]]}','${WHEN[cat.n]}','${HOW[cat.n]}']${last ? '' : ','}`);
- });
-});
-lines.push('};');
-const end = home.blockEnd(home.text.indexOf('{', home.text.indexOf('const PLACES='))) + 2; // just after the "};" that ends PLACES
-writeFileSync('index.html', home.text.slice(0, end) + home.eol + lines.join(home.eol) + home.text.slice(end));
-console.log(`Wrote the draft FIND: ${CATS.reduce((n, cat) => n + cat.entries.length, 0)} cards`);
-```
-
-Run: `cd "$WT/af-logic" && node "$RUN/draft-find.mjs"`
-Expected: `Wrote the draft FIND: 166 cards`; `git diff --stat` shows `index.html` with 176 lines added.
-
-- [ ] **Step 4: Add `FIND_Q`** — in `index.html`, right after the `};` that ends the draft `FIND` and before `// The eight cards of "Good places to start", in this order.`, insert:
-
-```js
-// The finder's three questions in order (spec, section 2): each answer's key (in the address and in FIND), its words (which name
-// it) and its picture: a still icon in the site's 24px line style for What and When, the class of a small moving picture for How
-// (drawn at the end of the stylesheet). weight is what a question counts for in findScore. Not sure, at the end of each
-// question, is no answer.
-const FIND_Q=[
- {key:'what',title:'What moved?',weight:2,answers:[
- {key:'text',words:'Text or numbers',icon:'<path d="M5 7V4h14v3M12 4v16M9 20h6"/>'},
- {key:'card',words:'A picture or card',icon:'<rect x="3" y="5" width="18" height="14" rx="2"/><circle cx="15.5" cy="9.5" r="1.5"/><path d="m3 16 5-5 4 4 3-3 6 6"/>'},
- {key:'button',words:'A button or icon',icon:'<rect x="3" y="7" width="18" height="10" rx="5"/><path d="M9 12h6"/>'},
- {key:'menu',words:'A menu or form',icon:'<path d="M4 6h16M4 12h16M4 18h10"/>'},
- {key:'loader',words:'A loading sign or message',icon:'<path d="M12 3a9 9 0 1 0 9 9"/>'},
- {key:'shape',words:'A line or shape',icon:'<circle cx="7.5" cy="7.5" r="3.5"/><path d="m13 20 4-7 4 7z"/><path d="M3 20 9 14"/>'},
- {key:'particles',words:'Dots or particles',icon:'<circle cx="6" cy="7" r="1.5" fill="currentColor"/><circle cx="17" cy="5" r="1.5" fill="currentColor"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/><circle cx="5" cy="18" r="1.5" fill="currentColor"/><circle cx="18" cy="17" r="1.5" fill="currentColor"/>'},
- {key:'background',words:'The background',icon:'<rect x="3" y="4" width="18" height="16" rx="2"/><path d="m3 12 8-8M3 20 19 4M11 20l10-10"/>'},
- {key:'page',words:'The whole page',icon:'<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 9h18M6.5 6.5h.01M9.5 6.5h.01"/>'}
- ]},
- {key:'when',title:'When did it move?',weight:1,answers:[
- {key:'scroll',words:'When I scrolled',icon:'<rect x="7" y="3" width="10" height="18" rx="5"/><path d="M12 7v4"/>'},
- {key:'hover',words:'When I pointed at it',icon:'<path d="m5 3 14 7-6 2-2 6z"/>'},
- {key:'click',words:'When I clicked or tapped',icon:'<path d="m9 9 11 4.5-4.5 1.5-1.5 4.5z"/><path d="m4 4 2 2M9 3v2M3 9h2"/>'},
- {key:'drag',words:'When I dragged or swiped',icon:'<path d="M3 12h18M7 8l-4 4 4 4M17 8l4 4-4 4"/>'},
- {key:'load',words:'When the page opened',icon:'<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 9h18M12 12v5M9.5 14.5h5"/>'},
- {key:'newpage',words:'When I went to another page',icon:'<rect x="3" y="5" width="10" height="14" rx="1.5"/><path d="M15 12h6M18 9l3 3-3 3"/>'},
- {key:'loop',words:'By itself, again and again',icon:'<path d="M20 12a8 8 0 1 1-2.3-5.7"/><path d="M20 4v5h-5"/>'}
- ]},
- {key:'how',title:'How did it move?',hint:'Pick the picture closest to what you saw.',weight:3,answers:[
- {key:'fade',words:'Faded or blurred',pic:'fd-fade'},
- {key:'slide',words:'Slid',pic:'fd-slide'},
- {key:'grow',words:'Grew or shrank',pic:'fd-grow'},
- {key:'turn',words:'Turned or flipped',pic:'fd-turn'},
- {key:'bounce',words:'Bounced or shook',pic:'fd-bounce'},
- {key:'stagger',words:'One after another',pic:'fd-stagger'},
- {key:'pieces',words:'Broke into pieces',pic:'fd-pieces'},
- {key:'follow',words:'Followed my pointer',pic:'fd-follow'},
- {key:'color',words:'Changed color or glowed',pic:'fd-color'},
- {key:'morph',words:'Changed into something else',pic:'fd-morph'},
- {key:'draw',words:'Drew or typed itself',pic:'fd-draw'},
- {key:'reveal',words:'Got uncovered',pic:'fd-reveal'},
- {key:'layers',words:'Moved in layers',pic:'fd-layers'},
- {key:'pin',words:'Stayed in place while I scrolled',pic:'fd-pin'},
- {key:'drift',words:'Drifted or floated',pic:'fd-drift'},
- {key:'wave',words:'Rippled or waved',pic:'fd-wave'},
- {key:'glitch',words:'Glitched or flickered',pic:'fd-glitch'}
- ]}
-];
-```
-
-- [ ] **Step 5: Add the finder's functions** — in `index.html`, right after the closing `}` of `function search(text){…}`, insert:
-
-```js
-// ---------- The finder's matching ----------
-// The finder's part of an address: ?view=find, then what, when and how for each question answered (nothing, Not sure or an
-// unknown key leaves the question out).
-function findQuery(answers){
- return '?view=find'+FIND_Q.map(q=>q.answers.some(a=>a.key===answers[q.key])?'&'+q.key+'='+answers[q.key]:'').join('');
-}
-// The answers in words, Not sure for a question left out: "Text or numbers · When I scrolled · Drew or typed itself".
-function findWords(answers){
- return FIND_Q.map(q=>{const a=q.answers.find(x=>x.key===answers[q.key]);return a?a.words:'Not sure';}).join(' · ');
-}
-// How one card fits the answers: for each question answered, the card's main (first) answer earns twice the question's weight
-// (How 3, What 2, When 1), another of its answers once, and no answer of it is a miss. size counts all the card's answers.
-function findScore(slug,answers){
- const lists=(FIND[slug]||['','','']).map(s=>s.split(' ').filter(Boolean));
- let points=0,misses=0;
- FIND_Q.forEach((q,i)=>{
- if(!q.answers.some(a=>a.key===answers[q.key]))return;
- const at=lists[i].indexOf(answers[q.key]);
- if(at<0)misses++;else points+=(at?1:2)*q.weight;
- });
- return {points,misses,size:lists.reduce((n,l)=>n+l.length,0)};
-}
-// The finder's matches as {best, close}; it never touches the page. Best fits every answer; Close misses exactly one, and only
-// when two or more questions are answered. Each is ordered by points, then fewer answers in all (a card made for just this comes
-// first), then home order. Nothing answered, or only Not sure: no cards.
-function findMatches(answers){
- const asked=FIND_Q.filter(q=>q.answers.some(a=>a.key===answers[q.key])).length,best=[],close=[];
- if(!asked)return {best,close};
- for(const e of ALL){
- const s=findScore(e.slug,answers);
- if(!s.misses)best.push({e,...s});else if(s.misses===1&&asked>1)close.push({e,...s});
- }
- const order=(a,b)=>b.points-a.points||a.size-b.size||a.e.order-b.e.order;
- return {best:best.sort(order).map(x=>x.e),close:close.sort(order).map(x=>x.e)};
-}
-// The Not here? link: GitHub's form animation_not_here.yml with its title and its answers field filled in (GitHub fills an issue
-// form's field from the address by its id): the answers in words, then the finder's live address with them. Nothing personal.
-function findIssueURL(answers){
- const words=findWords(answers);
- return 'https://github.com/matinmonshizadeh/animation-handbook/issues/new?template=animation_not_here.yml&title='+encodeURIComponent('[not here] '+words)+
- '&answers='+encodeURIComponent(words+' — https://matinmonshizadeh.github.io/animation-handbook/'+findQuery(answers));
-}
-```
-
-- [ ] **Step 6: Run all tests**
-
-Run: `cd "$WT/af-logic" && node --test "tests/*.test.js"`
-Expected: every test passes, the new ones included.
-
-- [ ] **Step 7: The home page still works.** Serve `af-logic` on 8901, take a slot, run `node tools/check-pages.mjs --base http://127.0.0.1:8901 home`, free the slot, stop the server.
-Expected: six `ok` lines (nothing visible changed; a script error would show as a console problem).
-
-- [ ] **Step 8: Commit**
-
-```bash
-cd "$WT/af-logic"
-git add index.html tests/finder.test.js
-git commit -m "feat: the finder's questions, draft answers for every card and the matching that ranks them, with tests that run the page's own code"
-```
-
----
-
-### Task 2: The How pictures
-
-Runs once Task 1 is merged. The coordinator first makes the lane: `git -C "$MAIN" worktree add -b af/pics "$WT/af-pics" feat/animation-finder`.
-
-**Files:**
-- Modify: `index.html` — the end of the `<style>` block, right before `</style>` (line 1438 on main)
-- Modify: `tests/finder.test.js` — under the header `// ── The pictures of the How answers ──`
-- Create (run folder): `$RUN/fd-preview.mjs`
-
-**Interfaces:**
-- Consumes: `FIND_Q` How answers and their `pic` classes `fd-<key>` (Task 1); the markup Task 3 builds: `<span class="fd-pic fd-<key>" aria-hidden="true"><i></i><i></i><i></i><i></i></span>`.
-- Produces: the classes `.fd-pic` and `.fd-<key>` for the 17 How answers, keyframes named `fd-<key>…`, and the reduced-motion block that starts with `.fd-pic *,.fd-pic *::before,.fd-pic *::after{animation:none!important}`.
-
-- [ ] **Step 1: Write the failing test** — in `tests/finder.test.js`, under `// ── The pictures of the How answers ──` and its comment line, add:
-
-```js
-const STYLE = [...HOME.matchAll(/<style>([\s\S]*?)<\/style>/g)].map(m => m[1]).join('\n');
-
-test('every How answer has a moving picture, its keyframes are named fd- and move only transform and opacity, and no keyframes name is used twice', () => {
- const names = [...STYLE.matchAll(/@keyframes\s+([\w-]+)/g)].map(m => m[1]);
- assert.deepEqual(names.filter((name, i) => names.indexOf(name) !== i), [], 'no @keyframes name twice in index.html');
- for (const a of homeConst('FIND_Q')[2].answers) {
- assert.match(STYLE, new RegExp(`\\.${a.pic}[\\s.:{,]`), `a rule draws ${a.pic}`);
- assert.ok(names.some(name => name === a.pic || name.startsWith(a.pic + '-')), `${a.pic} moves: @keyframes ${a.pic}`);
- }
- for (const [, name, body] of STYLE.matchAll(/@keyframes\s+(fd-[\w-]+)\s*\{((?:[^{}]*\{[^{}]*\})*)\s*\}/g)) {
- for (const [, property] of body.matchAll(/([a-z-]+)\s*:/g)) {
- assert.ok(['transform', 'opacity', 'animation-timing-function'].includes(property), `${name} animates ${property}`);
- }
- }
-});
-
-test('with reduced motion the How pictures hold still', () => {
- assert.match(STYLE, /@media\(prefers-reduced-motion:reduce\)\{\s*\.fd-pic \*,\.fd-pic \*::before,\.fd-pic \*::after\{animation:none!important\}/);
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `cd "$WT/af-pics" && node --test tests/finder.test.js`
-Expected: the two new tests FAIL (`a rule draws fd-fade`; the reduced-motion pattern does not match); every other test passes.
-
-- [ ] **Step 3: Draw the pictures** — in `index.html`, right before `</style>`, add:
-
-```css
-
-/* ── finder pictures ── */
-/* "How did it move?": each answer's small dark square (64px) plays its movement on a loop, drawn by up to four <i>; its keyframes
- are named fd-<answer>. With reduced motion every picture holds its resting frame (the styles below, which show the movement at
- a glance) with a small arrow for the way it goes. Shapes use the category colors; only transform and opacity move. */
-.fd-pic{position:relative;display:block;width:64px;height:64px;flex:none;border-radius:12px;background:#0b0b0f;box-shadow:inset 0 0 0 1px rgba(255,255,255,.06);overflow:hidden}
-.fd-pic i{position:absolute;display:none}
-/* Faded or blurred: a square comes out of a blur, holds, and fades away */
-.fd-fade i:nth-child(-n+2){display:block;left:18px;top:18px;width:28px;height:28px;border-radius:6px;background:var(--c1)}
-.fd-fade i:nth-child(1){filter:blur(5px);opacity:0;animation:fd-fade-blur 3s ease-in-out infinite}
-.fd-fade i:nth-child(2){animation:fd-fade 3s ease-in-out infinite}
-@keyframes fd-fade{0%,25%{opacity:0}55%,85%{opacity:1}100%{opacity:0}}
-@keyframes fd-fade-blur{0%{opacity:0}25%{opacity:.9}55%,100%{opacity:0}}
-/* Slid: a square slides in from the left, holds, and slides out to the right */
-.fd-slide i:nth-child(1){display:block;left:18px;top:18px;width:28px;height:28px;border-radius:6px;background:var(--c6);animation:fd-slide 2.8s cubic-bezier(.22,1,.36,1) infinite}
-@keyframes fd-slide{0%{transform:translateX(-48px)}35%,75%{transform:none}100%{transform:translateX(48px)}}
-/* Grew or shrank: a square grows from small, holds, and shrinks away */
-.fd-grow i:nth-child(1){display:block;left:16px;top:16px;width:32px;height:32px;border-radius:7px;background:var(--c2);animation:fd-grow 2.8s cubic-bezier(.22,1,.36,1) infinite}
-@keyframes fd-grow{0%{transform:scale(.15);opacity:0}12%{opacity:1}45%,80%{transform:none;opacity:1}100%{transform:scale(.15);opacity:0}}
-/* Turned or flipped: a card turns over, purple front then light back */
-.fd-turn{perspective:160px}
-.fd-turn i:nth-child(-n+2){display:block;left:20px;top:14px;width:24px;height:36px;border-radius:5px;backface-visibility:hidden}
-.fd-turn i:nth-child(1){background:var(--c3);transform:rotateY(-35deg);animation:fd-turn 3s cubic-bezier(.65,0,.35,1) infinite}
-.fd-turn i:nth-child(2){background:#f4f4f2;transform:rotateY(-215deg);animation:fd-turn-back 3s cubic-bezier(.65,0,.35,1) infinite}
-@keyframes fd-turn{0%,20%{transform:rotateY(0)}50%,70%{transform:rotateY(180deg)}100%{transform:rotateY(360deg)}}
-@keyframes fd-turn-back{0%,20%{transform:rotateY(-180deg)}50%,70%{transform:rotateY(0)}100%{transform:rotateY(180deg)}}
-/* Bounced or shook: a ball drops onto a floor and bounces back up */
-.fd-bounce i:nth-child(1){display:block;left:26px;top:10px;width:12px;height:12px;border-radius:50%;background:var(--c4);transform:translateY(14px);animation:fd-bounce 1.2s infinite}
-.fd-bounce i:nth-child(2){display:block;left:14px;right:14px;bottom:9px;height:2px;border-radius:1px;background:rgba(255,255,255,.35)}
-@keyframes fd-bounce{0%,100%{transform:translateY(0);animation-timing-function:cubic-bezier(.5,0,1,.5)}50%{transform:translateY(31px);animation-timing-function:cubic-bezier(0,.5,.5,1)}}
-/* One after another: three lines appear in turn */
-.fd-stagger i:nth-child(-n+3){display:block;left:14px;height:7px;border-radius:3px;background:#f4f4f2;animation:fd-stagger 2.8s cubic-bezier(.22,1,.36,1) infinite both}
-.fd-stagger i:nth-child(1){top:17px;width:30px}
-.fd-stagger i:nth-child(2){top:28px;width:24px;opacity:.6;animation-delay:.3s}
-.fd-stagger i:nth-child(3){top:39px;width:28px;opacity:.3;animation-delay:.6s}
-@keyframes fd-stagger{0%{opacity:0;transform:translateY(7px)}20%,70%{opacity:1;transform:none}85%,100%{opacity:0;transform:none}}
-/* Broke into pieces: a square splits into four that fly apart and fade, then it is whole again */
-.fd-pieces i{display:block;width:14px;height:14px;background:var(--c5);transform:translate(calc(var(--x) * .35),calc(var(--y) * .35)) rotate(calc(var(--r) * .3));animation:fd-pieces 2.8s cubic-bezier(.22,1,.36,1) infinite}
-.fd-pieces i:nth-child(1){left:18px;top:18px;--x:-16px;--y:-16px;--r:-40deg;border-radius:4px 0 0 0}
-.fd-pieces i:nth-child(2){left:32px;top:18px;--x:16px;--y:-16px;--r:35deg;border-radius:0 4px 0 0}
-.fd-pieces i:nth-child(3){left:18px;top:32px;--x:-16px;--y:16px;--r:30deg;border-radius:0 0 0 4px}
-.fd-pieces i:nth-child(4){left:32px;top:32px;--x:16px;--y:16px;--r:-35deg;border-radius:0 0 4px 0}
-@keyframes fd-pieces{0%,30%{transform:none;opacity:1}75%{transform:translate(var(--x),var(--y)) rotate(var(--r));opacity:0}76%{transform:none;opacity:0}100%{transform:none;opacity:1}}
-/* Followed my pointer: a pointer moves around and a dot trails behind it */
-.fd-follow i:nth-child(-n+2){display:block;left:0;top:0;animation:fd-follow 3.2s ease-in-out infinite}
-.fd-follow i:nth-child(1){width:12px;height:12px;margin:-6px 0 0 -6px;border-radius:50%;background:var(--c6);opacity:.85;transform:translate(24px,38px)}
-.fd-follow i:nth-child(2){width:13px;height:18px;background:#f4f4f2;clip-path:polygon(0 0,100% 64%,58% 64%,76% 100%,56% 100%,40% 68%,0 88%);transform:translate(36px,26px);animation-delay:-.4s}
-@keyframes fd-follow{0%,100%{transform:translate(16px,18px)}33%{transform:translate(46px,24px)}66%{transform:translate(28px,46px)}}
-/* Changed color or glowed: a band of colors runs through a rounded bar */
-.fd-color i:nth-child(1){display:block;left:10px;top:20px;width:44px;height:24px;border-radius:12px;overflow:hidden;box-shadow:0 0 14px rgba(185,140,255,.45)}
-.fd-color i:nth-child(1)::before{content:"";position:absolute;left:0;top:0;width:192px;height:100%;background:linear-gradient(90deg,var(--c1),var(--c3),var(--c5),var(--c7),var(--c1)) 0 0/96px 100% repeat-x;animation:fd-color 3s linear infinite}
-@keyframes fd-color{to{transform:translateX(-96px)}}
-/* Changed into something else: a circle turns into a square and back */
-.fd-morph i:nth-child(-n+2){display:block;left:18px;top:18px;width:28px;height:28px;background:var(--c7)}
-.fd-morph i:nth-child(1){border-radius:50%;animation:fd-morph 3s ease-in-out infinite}
-.fd-morph i:nth-child(2){border-radius:5px;opacity:0;animation:fd-morph-square 3s ease-in-out infinite}
-@keyframes fd-morph{0%,25%{opacity:1;transform:none}50%,75%{opacity:0;transform:rotate(45deg) scale(.85)}100%{opacity:1;transform:none}}
-@keyframes fd-morph-square{0%,25%{opacity:0;transform:rotate(-45deg) scale(.85)}50%,75%{opacity:1;transform:none}100%{opacity:0;transform:rotate(-45deg) scale(.85)}}
-/* Drew or typed itself: a line draws itself from left to right behind a pen tip */
-.fd-draw i:nth-child(1){display:block;left:10px;top:30px;width:44px;height:4px;border-radius:2px;background:var(--c1);transform-origin:left;transform:scaleX(.65);animation:fd-draw 2.6s ease-in-out infinite}
-.fd-draw i:nth-child(2){display:block;left:7px;top:27px;width:10px;height:10px;border-radius:50%;background:#f4f4f2;transform:translateX(29px);animation:fd-draw-pen 2.6s ease-in-out infinite}
-@keyframes fd-draw{0%{transform:scaleX(0)}60%,85%{transform:none;opacity:1}100%{transform:none;opacity:0}}
-@keyframes fd-draw-pen{0%{transform:translateX(0)}60%,85%{transform:translateX(44px);opacity:1}100%{transform:translateX(44px);opacity:0}}
-/* Got uncovered: a colored panel slides off a little landscape, then covers it again */
-.fd-reveal i:nth-child(1){display:block;inset:0;background:linear-gradient(#9fb8ff,#dfe7ff)}
-.fd-reveal i:nth-child(2){display:block;right:12px;top:12px;width:10px;height:10px;border-radius:50%;background:#ffb020}
-.fd-reveal i:nth-child(3){display:block;left:-12px;right:-12px;bottom:-30px;height:52px;border-radius:50%;background:#2b9a4a}
-.fd-reveal i:nth-child(4){display:block;inset:0;background:var(--c5);transform:translateX(55%);animation:fd-reveal 2.8s cubic-bezier(.65,0,.35,1) infinite}
-@keyframes fd-reveal{0%,20%{transform:none}55%,85%{transform:translateX(100%)}100%{transform:none}}
-/* Moved in layers: three bands of dashes slide sideways, the near ones faster (each moves one dash pattern per loop) */
-.fd-layers i:nth-child(-n+3){display:block;left:0;width:128px;border-radius:2px;animation:fd-layers 2.4s linear infinite}
-.fd-layers i:nth-child(1){top:14px;height:6px;background:repeating-linear-gradient(90deg,rgba(110,168,255,.55) 0 8px,transparent 8px 16px);--d:-16px}
-.fd-layers i:nth-child(2){top:28px;height:8px;background:repeating-linear-gradient(90deg,rgba(185,140,255,.8) 0 16px,transparent 16px 32px);--d:-32px}
-.fd-layers i:nth-child(3){top:44px;height:10px;background:repeating-linear-gradient(90deg,var(--c6) 0 32px,transparent 32px 64px);--d:-64px}
-@keyframes fd-layers{to{transform:translateX(var(--d))}}
-/* Stayed in place while I scrolled: lines pass upward behind a box that holds still */
-.fd-pin i:nth-child(1){display:block;left:10px;right:10px;top:0;height:128px;background:repeating-linear-gradient(180deg,rgba(255,255,255,.3) 0 3px,transparent 3px 14px);animation:fd-pin 1.4s linear infinite}
-.fd-pin i:nth-child(2){display:block;left:18px;top:22px;width:28px;height:20px;border-radius:4px;background:var(--c7);box-shadow:0 0 0 4px #0b0b0f}
-@keyframes fd-pin{to{transform:translateY(-14px)}}
-/* Drifted or floated: four dots drift slowly, each on its own path */
-.fd-drift i{display:block;width:8px;height:8px;border-radius:50%;background:#f4f4f2;animation:fd-drift 6s ease-in-out infinite alternate}
-.fd-drift i:nth-child(1){left:12px;top:14px;--dx:10px;--dy:6px}
-.fd-drift i:nth-child(2){left:40px;top:10px;width:6px;height:6px;opacity:.7;--dx:-8px;--dy:10px;animation-duration:7s}
-.fd-drift i:nth-child(3){left:22px;top:40px;width:6px;height:6px;opacity:.6;--dx:8px;--dy:-8px;animation-duration:8s}
-.fd-drift i:nth-child(4){left:46px;top:42px;--dx:-10px;--dy:-6px;animation-duration:6.5s}
-@keyframes fd-drift{to{transform:translate(var(--dx),var(--dy))}}
-/* Rippled or waved: rings spread from the middle, one after another */
-.fd-wave i:nth-child(-n+3){display:block;left:12px;top:12px;width:40px;height:40px;border-radius:50%;border:2px solid var(--c6);animation:fd-wave 2.4s ease-out infinite}
-.fd-wave i:nth-child(1){transform:scale(.35)}
-.fd-wave i:nth-child(2){transform:scale(.7);opacity:.6;animation-delay:-.8s}
-.fd-wave i:nth-child(3){transform:scale(1.05);opacity:.3;animation-delay:-1.6s}
-@keyframes fd-wave{0%{transform:scale(.2);opacity:1}100%{transform:scale(1.4);opacity:0}}
-/* Glitched or flickered: a bar jumps while red and blue copies of it jitter beside it */
-.fd-glitch i:nth-child(-n+3){display:block;left:14px;top:26px;width:36px;height:12px;border-radius:2px}
-.fd-glitch i:nth-child(1){background:#ff3b5c;opacity:.85;transform:translateX(-2px);animation:fd-glitch-red 1.6s steps(1) infinite}
-.fd-glitch i:nth-child(2){background:#2fd8ff;opacity:.85;transform:translateX(2px);animation:fd-glitch-blue 1.6s steps(1) infinite}
-.fd-glitch i:nth-child(3){background:#f4f4f2;animation:fd-glitch 1.6s steps(1) infinite}
-@keyframes fd-glitch{0%,100%{transform:none}20%{transform:translateX(3px)}24%{transform:translateX(-2px) scaleY(.7)}28%,60%{transform:none}64%{transform:translateX(-3px)}68%{transform:none}}
-@keyframes fd-glitch-red{0%,100%{transform:translateX(-2px)}20%{transform:translateX(-6px)}28%{transform:translateX(-2px)}64%{transform:translateX(4px)}68%{transform:translateX(-2px)}}
-@keyframes fd-glitch-blue{0%,100%{transform:translateX(2px)}20%{transform:translateX(6px)}28%{transform:translateX(2px)}64%{transform:translateX(-4px)}68%{transform:translateX(2px)}}
-@media(prefers-reduced-motion:reduce){
- .fd-pic *,.fd-pic *::before,.fd-pic *::after{animation:none!important}
- /* still frames where the resting styles above do not show the movement: the blur beside the sharp square, the circle beside
- the square, the square still growing */
- .fd-fade i:nth-child(1){opacity:.8;transform:translateX(-14px) scale(.6)}
- .fd-fade i:nth-child(2){transform:translateX(14px) scale(.6)}
- .fd-morph i:nth-child(1){transform:translateX(-14px) scale(.6)}
- .fd-morph i:nth-child(2){opacity:1;transform:translateX(14px) scale(.6)}
- .fd-grow i:nth-child(1){transform:scale(.7)}
- /* the small arrow: which way it moves (a curved one for turning, a double one for glitching) */
- .fd-pic::after{content:"";position:absolute;left:var(--ax,44px);top:var(--ay,4px);width:var(--as,16px);height:var(--as,16px);transform:rotate(var(--ar,0deg));background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4f4f2' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h15M13 6l6 6-6 6'/%3E%3C/svg%3E") center/contain no-repeat}
- .fd-fade,.fd-morph{--ax:25px;--ay:25px;--as:14px}
- .fd-slide,.fd-reveal{--ax:3px;--ay:24px}
- .fd-grow,.fd-pieces,.fd-wave{--ax:44px;--ay:4px;--ar:-45deg}
- .fd-bounce,.fd-stagger{--ax:46px;--ay:24px;--ar:90deg}
- .fd-follow{--ax:4px;--ay:44px;--ar:-40deg}
- .fd-color,.fd-draw,.fd-layers,.fd-glitch{--ax:24px;--ay:46px}
- .fd-pin{--ax:46px;--ay:44px;--ar:-90deg}
- .fd-drift{--ax:24px;--ay:24px;--ar:-30deg}
- .fd-turn::after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4f4f2' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5'/%3E%3C/svg%3E")}
- .fd-glitch::after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4f4f2' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h18M7 8l-4 4 4 4M17 8l4 4-4 4'/%3E%3C/svg%3E")}
-}
-```
-
-- [ ] **Step 4: Run all tests**
-
-Run: `cd "$WT/af-pics" && node --test "tests/*.test.js"`
-Expected: every test passes.
-
-- [ ] **Step 5: A sheet of the pictures** — create `$RUN/fd-preview.mjs`:
-
-```js
-#!/usr/bin/env node
-// Writes the finder's How pictures, drawn by index.html's own styles, into .superpowers/fd-preview-dark.html and
-// .superpowers/fd-preview-light.html of the current checkout (git ignores that folder), for screenshots with shoot.mjs.
-// Usage, from the worktree root: node <run folder>/fd-preview.mjs
-import { mkdirSync, writeFileSync } from 'node:fs';
-import { readHome } from './home-data.mjs';
-
-const home = readHome();
-const how = home.valueOf('FIND_Q').find(q => q.key === 'how').answers;
-const css = [...home.text.matchAll(/<style>([\s\S]*?)<\/style>/g)].map(m => m[1]).join('\n');
-const sheet = how.map(a => `<figure><span class="fd-pic ${a.pic}" aria-hidden="true"><i></i><i></i><i></i><i></i></span><figcaption>${a.words}</figcaption></figure>`).join('');
-mkdirSync('.superpowers', { recursive: true });
-for (const theme of ['dark', 'light']) {
- writeFileSync(`.superpowers/fd-preview-${theme}.html`, `<!DOCTYPE html><html lang="en" data-theme="${theme}"><head><meta charset="UTF-8"><base href="/">
-<title>Finder pictures</title><style>${css}
-.fd-sheet{display:grid;grid-template-columns:repeat(6,104px);gap:14px;padding:20px}
-.fd-sheet figure{display:flex;flex-direction:column;align-items:center;gap:8px;font-size:13px;font-weight:600;line-height:1.25;text-align:center}
-</style></head><body><div class="fd-sheet">${sheet}</div></body></html>`);
-}
-console.log(`Wrote .superpowers/fd-preview-dark.html and .superpowers/fd-preview-light.html (${how.length} pictures)`);
-```
-
-Run: `cd "$WT/af-pics" && node "$RUN/fd-preview.mjs"`. Expected: `… (17 pictures)`.
-
-- [ ] **Step 6: Photograph them and tune.** Serve `af-pics` on 8902 (background), take a slot, then:
-
-```bash
-for t in 0 700 1400 2100; do node "$RUN/shoot.mjs" --url "http://127.0.0.1:8902/.superpowers/fd-preview-dark.html" --size 760x420 --eval "document.getAnimations().forEach(a => { a.pause(); a.currentTime = $t; })" --shot "$RUN/pics/dark-$t.png"; done
-node "$RUN/shoot.mjs" --url "http://127.0.0.1:8902/.superpowers/fd-preview-light.html" --size 760x420 --eval "document.getAnimations().forEach(a => { a.pause(); a.currentTime = 1400; })" --shot "$RUN/pics/light-1400.png"
-node "$RUN/shoot.mjs" --url "http://127.0.0.1:8902/.superpowers/fd-preview-dark.html" --size 760x420 --reduce --shot "$RUN/pics/reduced.png"
-```
-
-Free the slot. Open every picture with the Read tool. Each square must read as its words at 64px, the four frames must show the movement's stages, the light sheet must look like the dark one (the squares are dark in both themes), and in `reduced.png` each square must show a clear frame and an arrow that does not cover its shape. Tune only numbers (positions, sizes, colors, timings, the `--ax`/`--ay`/`--as`/`--ar` of the arrows) until they do; re-run Steps 4–6 after each change.
-
-- [ ] **Step 7: Commit**
-
-```bash
-cd "$WT/af-pics"
-git add index.html tests/finder.test.js
-git commit -m "feat: the finder's seventeen How pictures, each a small dark square that plays its movement and holds a still with an arrow under reduced motion"
-```
-
----
-
-### Task 3: The finder view
-
-Runs once Tasks 1 and 7 are merged. The coordinator first makes the lane: `git -C "$MAIN" worktree add -b af/view "$WT/af-view" feat/animation-finder`. Tasks 4 and 5 continue in the same worktree.
-
-**Files:**
-- Modify: `index.html` — CSS after line 336 (the `}` that closes `@media(max-width:360px){…}`), before `/* ── preview library ── */`; markup between line 1485 (`</section>` of the place tiles) and line 1487 (`<section class="wrap results" …>`); script: line 2377 (`const PAGE=8;`), 2431 (`state`), 2437–2438 (`syncBar`), 2442–2476 (`render`), 2477–2489 (`writeURL`), 2490–2497 (`fromURL`), 2500–2501 (`go`), 2522–2526 (`typed`), 2540–2543 (Show all), 2546–2552 (`popstate`), and a new block right before `const startCat=readURL();` (line 2558)
-- Modify: `tests/finder.test.js` — under `// ── The finder view, its ways in and Not here? ──`
-
-**Interfaces:**
-- Consumes: `FIND_Q`, `findQuery`, `findMatches` (Task 1); `$`, `esc`, `CARD`, `cardsBox`, `place`, `titleEl`, `subEl`, `toTitle`, `toResults`, `reduce`, `PAGE` and the view functions of the home page; the `.fd-pic` classes (Task 2, drawn once merged).
-- Produces: the contract's finder markup, words, address, history and focus, apart from the Find button and Finder link (Task 4) and Not here? (Task 5); `state` gains `what`, `when`, `how` (`''`, `'unsure'` or a key); `render(answered)`, `say(text, later)`, `answeredAny()`, `findLine(found)`, `showFinder(finding, found)`, `showFound(found)`, `FIND_PAGE` (12), `HOME_TITLE`, `FIND_TITLE`, and the DOM constants `finderEl`, `findTitle`, `findSee`, `heroEl`, `placesSec`.
-
-- [ ] **Step 1: Write the failing tests** — under `// ── The finder view, its ways in and Not here? ──` and its comment line, add:
-
-```js
-test('the finder takes the place of the hero and the tiles: its section, heading, line, questions box and buttons', () => {
- const section = between(HOME, '<section class="wrap finder" id="finder"', '</section>');
- assert.ok(section.startsWith('<section class="wrap finder" id="finder" aria-labelledby="find-title" hidden>'), 'section.finder, hidden until its view opens');
- for (const part of ['<h1 class="h1 fd-h" id="find-title" tabindex="-1">Find an animation you saw</h1>',
- "<p class=\"sub\">Saw an animation on a website and don't know its name? Answer three short questions. The animations that match play below, with their names.</p>",
- '<div class="fd-qs" id="find-qs"></div>',
- '<button type="button" class="fd-btn" id="find-see" hidden>See 0 matches</button>',
- '<button type="button" class="pillbtn" id="find-reset">Start over</button>']) assert.ok(section.includes(part), part);
- const order = ['id="places"', 'id="finder"', 'id="results"'].map(at);
- assert.deepEqual([...order].sort((a, b) => a - b), order, 'the finder comes after the place tiles and before the results');
- assert.ok(HOME.includes("FIND_TITLE='Find an animation you saw — Animation Handbook'"), "the finder's tab title");
-});
-
-test('the address keeps the finder and its answers: ?view=find, then what, when and how; an unknown value is Not sure; ?q= still wins', () => {
- const calls = [];
- const page = finder({ URLSearchParams, location: { search: '', pathname: '/animation-handbook/' },
- history: { pushState: (s, t, url) => calls.push(['push', url]), replaceState: (s, t, url) => calls.push(['replace', url]) } });
- for (const name of ['fromURL', 'writeURL']) vm.runInContext(source(name), page);
- const open = search => { page.location.search = search; return plain(page.fromURL().next); };
- const none = { q: '', place: '', view: '', all: false, what: '', when: '', how: '' };
- assert.deepEqual(open('?view=find&what=text&when=scroll&how=draw'), { ...none, view: 'find', what: 'text', when: 'scroll', how: 'draw' });
- assert.deepEqual(open('?view=find&what=zebra&how=fade&all=1'), { ...none, view: 'find', all: true, how: 'fade' });
- assert.deepEqual(open('?q=fade&view=find&what=text'), { ...none, q: 'fade' });
- assert.deepEqual(open('?view=all&what=text'), { ...none, view: 'all' });
- page.location.search = '';
- page.state = { ...none, view: 'find', what: 'text', when: 'unsure', how: 'draw' };
- page.writeURL(true);
- assert.deepEqual(calls.pop(), ['push', '?view=find&what=text&how=draw'], 'entering adds a history step, Not sure stays out');
- page.location.search = '?view=find&what=text&how=draw';
- page.state = { ...none, view: 'find', what: 'text', when: 'scroll', how: 'draw', all: true };
- page.writeURL(false);
- assert.deepEqual(calls.pop(), ['replace', '?view=find&what=text&when=scroll&how=draw&all=1'], 'answers and Show all only replace the address');
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `cd "$WT/af-view" && node --test tests/finder.test.js`
-Expected: the two new tests FAIL (`section.finder, hidden until its view opens`; the address test at its first comparison, because the old `fromURL` knows no `view=find` and no answers); the others pass.
-
-- [ ] **Step 3: The markup** — between `</section>` of the place tiles (line 1485) and the blank line before `<section class="wrap results" …>`, insert:
-
-```html
-
- <section class="wrap finder" id="finder" aria-labelledby="find-title" hidden>
- <h1 class="h1 fd-h" id="find-title" tabindex="-1">Find an animation you saw</h1>
- <p class="sub">Saw an animation on a website and don't know its name? Answer three short questions. The animations that match play below, with their names.</p>
- <div class="fd-qs" id="find-qs"></div>
- <div class="fd-go"><button type="button" class="fd-btn" id="find-see" hidden>See 0 matches</button><button type="button" class="pillbtn" id="find-reset">Start over</button></div>
- </section>
-```
-
-- [ ] **Step 4: The styles** — after line 336 (the `}` closing `@media(max-width:360px){…}`) and before the blank line and `/* ── preview library ── */`, insert:
-
-```css
-
-/* ── finder ── */
-/* The finder (?view=find) takes the place of the hero and the place tiles: its heading and line, three questions of answers and,
- under them, See N matches and Start over; its matches show in the results below, as Best matches and Close matches. Each answer
- is a label around a radio hidden from sight but keeping keyboard focus: the label shows the site's focus ring, and a chosen
- answer a dark ring and a tick. What and When answers have a still icon beside their words, How answers a small moving picture
- above them (drawn at the end of this stylesheet). */
-.finder{display:flex;flex-direction:column;align-items:center;padding-top:clamp(16px,4vw,56px);text-align:center}
-.fd-h{margin-top:0}
-.fd-qs{display:flex;flex-direction:column;gap:clamp(28px,4vw,44px);width:min(1080px,100%);margin-top:clamp(24px,4vw,44px);text-align:left}
-.fd-q{min-width:0;border:0}
-.fd-q legend{display:flex;align-items:center;gap:12px;padding:0;font-size:clamp(20px,2.2vw,26px);font-weight:800;letter-spacing:-.015em;line-height:1.2}
-.fd-n{display:grid;place-items:center;width:36px;height:36px;flex:none;border-radius:50%;background:var(--ink);color:var(--bg);font-size:17px;font-weight:800}
-.fd-hint{margin-top:6px;font-size:16px;color:var(--ink-2)}
-.fd-as{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin-top:16px}
-.fd-how .fd-as{grid-template-columns:repeat(6,minmax(0,1fr))}
-.fd-a{position:relative;display:flex;align-items:center;gap:10px;min-height:56px;padding:8px 14px;border-radius:14px;border:1px solid var(--line);background:var(--surface);font-size:15px;font-weight:600;line-height:1.25;cursor:pointer}
-.fd-how .fd-a{flex-direction:column;justify-content:flex-start;gap:8px;padding:10px 8px 12px;text-align:center}
-.fd-icon{width:24px;height:24px;color:var(--ink-2)}
-.fd-r{position:absolute;left:0;top:0;width:1px;height:1px;margin:0;opacity:0;pointer-events:none}
-.fd-a:has(.fd-r:focus-visible){outline:3px solid var(--brand);outline-offset:3px}
-.fd-a:has(.fd-r:checked){border-color:var(--ink);box-shadow:0 0 0 2px var(--ink)}
-.fd-a:has(.fd-r:checked)::before{content:"";position:absolute;top:-9px;right:-9px;width:22px;height:22px;border-radius:50%;background:var(--ink)}
-.fd-a:has(.fd-r:checked)::after{content:"";position:absolute;top:-5px;right:-1px;width:6px;height:11px;border:solid var(--bg);border-width:0 2.5px 2.5px 0;transform:rotate(45deg)}
-.fd-unsure,.fd-how .fd-unsure{justify-content:center;border-style:dashed;background:none;color:var(--ink-2);font-weight:500}
-.fd-go{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;margin-top:clamp(24px,4vw,40px)}
-.fd-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:52px;padding:0 26px;border-radius:999px;border:0;background:var(--ink);color:var(--bg);font-size:16px;font-weight:700;text-decoration:none;cursor:pointer}
-.finder .pillbtn{min-height:52px;padding:0 24px;font-size:16px}
-.fd-gline{margin:-12px 0 18px;font-size:15px;color:var(--muted)}
-@media(hover:hover){.fd-a:hover{border-color:var(--ink)}}
-@media(max-width:1024px){.fd-as{grid-template-columns:repeat(4,minmax(0,1fr))}}
-@media(max-width:760px){.fd-as{grid-template-columns:repeat(3,minmax(0,1fr))}.fd-how .fd-as{grid-template-columns:repeat(4,minmax(0,1fr))}}
-@media(max-width:600px){
- .fd-as{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
- .fd-how .fd-as{grid-template-columns:repeat(3,minmax(0,1fr))}
- .fd-a{min-height:52px;padding:8px 10px;font-size:14px}
- .fd-how .fd-a{padding:8px 4px 10px;font-size:13px}
- .fd-go{flex-direction:column;align-self:stretch}
-}
-```
-
-- [ ] **Step 5: The view's state, address and rendering** — make these replacements in the script:
-
-`const PAGE=8;` (line 2377) becomes:
-
-```js
-const PAGE=8;
-const FIND_PAGE=12; // the finder shows twelve cards before Show all
-```
-
-`const state={q:'',place:'',view:'',all:false};` (line 2431) becomes:
-
-```js
-const state={q:'',place:'',view:'',all:false,what:'',when:'',how:''};
-```
-
-Lines 2437–2438 become:
-
-```js
-// The phone bar is there while a view other than Start or the finder is open and while its own search box has focus, so emptying the box does not take the box away.
-const syncBar=()=>resultsEl.classList.toggle('filtered',(isFiltered()&&state.view!=='find')||document.activeElement===q2);
-```
-
-`function render(){…}` (lines 2442–2476) becomes:
-
-```js
-// answered: the render follows an answer in the finder, so the results line waits (say).
-function render(answered){
- const filtered=isFiltered(),finding=state.view==='find';
- let list=null,title,sub,tags=true,found=null;
- if(state.q){
- list=search(state.q);title='Results for “'+state.q+'”';
- sub=list.length===1?'1 animation matches.':list.length+' animations match.';
- }else if(state.place){
- list=ALL.filter(e=>e.places.includes(state.place));title=PLACE[state.place].name;sub=list.length+' animations';tags=false;
- }else if(finding){
- found=findMatches(state);title='Your matches';sub=findLine(found);
- }else if(state.view==='all'){
- title='All animations';sub=ALL.length+' animations in '+CATS.length+' groups.';
- }else{
- list=PICKS.map(s=>BY_SLUG[s]);title='Good places to start';sub='Eight favorites from different places. Pick a place above to see more.';
- }
- titleEl.textContent=title;say(sub,finding&&answered);
- showFinder(finding,found);
- syncBar();
- resultsEl.classList.toggle('no-tags',!tags);
- clearBtn.hidden=!filtered||finding;
- if(found)showFound(found);else if(list)showCards(state.all||!filtered?list:list.slice(0,PAGE));else showGroups();
- const empty=!!list&&!list.length,matched=found?found.best.length+found.close.length:0;
- emptyEl.hidden=!empty;
- if(empty)emptyTitle.textContent='Nothing matches “'+state.q+'” yet';
- if(finding){moreAction='expand';moreLabel.textContent='Show all '+matched+' matches';moreBox.hidden=state.all||matched<=FIND_PAGE;}
- else if(!filtered||empty){moreAction='all';moreLabel.textContent='Browse all '+ALL.length+' animations';moreBox.hidden=false;}
- else if(list&&!state.all&&list.length>PAGE){moreAction='expand';moreLabel.textContent='Show all '+list.length;moreBox.hidden=false;}
- else moreBox.hidden=true;
- document.querySelectorAll('[data-place]').forEach(b=>b.setAttribute('aria-pressed',String(!state.q&&b.dataset.place===state.place)));
- // The picked chip is scrolled fully into the phone bar's row, clear of the row's edge margin; only the row moves, never the page.
- const chip=pinbar.querySelector('.pchip[aria-pressed="true"]');
- if(chip&&chip.getClientRects().length){
- const row=chip.parentElement,r=row.getBoundingClientRect(),b=chip.getBoundingClientRect(),edge=parseFloat(getComputedStyle(row).paddingLeft)||0;
- if(b.left<r.left+edge)row.scrollLeft-=r.left+edge-b.left;
- else if(b.right>r.right-edge)row.scrollLeft+=b.right-(r.right-edge);
- }
- [q,q2].forEach(input=>{if(input!==document.activeElement&&input.value!==state.q)input.value=state.q;});
- qClear.hidden=!q.value;
-}
-```
-
-`function writeURL(push){…}` (lines 2480–2489, keep its comment above) becomes:
-
-```js
-function writeURL(push){
- const p=[];
- if(state.q)p.push('q='+encodeURIComponent(state.q));
- else if(state.place)p.push('place='+PLACE[state.place].url);
- else if(state.view==='find')p.push(findQuery(state).slice(1));
- else if(state.view)p.push('view=all');
- if(state.all&&(state.q||state.place||state.view==='find'))p.push('all=1');
- const query=p.length?'?'+p.join('&'):'';
- const moved=String(new URLSearchParams(query))!==String(new URLSearchParams(location.search));
- try{history[push&&moved?'pushState':'replaceState'](null,'',query||location.pathname);}catch(e){}
-}
-```
-
-`function fromURL(){…}` (lines 2491–2497, keep its comment above) becomes:
-
-```js
-function fromURL(){
- const p=new URLSearchParams(location.search),found=PLACE_LIST.find(x=>x.url===p.get('place')),cat=p.get('cat')||'';
- const next={q:(p.get('q')||'').trim(),place:'',view:'',all:p.get('all')==='1',what:'',when:'',how:''};
- if(!next.q&&found)next.place=found.key;
- else if(!next.q&&p.get('view')==='find'){next.view='find';FIND_Q.forEach(qu=>{if(qu.answers.some(a=>a.key===p.get(qu.key)))next[qu.key]=p.get(qu.key);});}
- else if(!next.q&&(p.get('view')==='all'||cat))next.view='all';
- return {next,cat};
-}
-```
-
-`function go(next,push){…}` (line 2501) becomes:
-
-```js
-function go(next,push){Object.assign(state,{q:'',place:'',view:'',all:false,what:'',when:'',how:''},next);q.value=q2.value=state.q;render();writeURL(push);}
-```
-
-In `function typed(input){…}` (lines 2522–2526) the `Object.assign` line becomes:
-
-```js
- Object.assign(state,{q:input.value.trim(),place:'',view:'',all:false,what:'',when:'',how:''});
-```
-
-In the Show all handler (line 2542) the `else` line becomes:
-
-```js
- else{state.all=true;render();writeURL(false);(cardsBox.querySelectorAll('.card .title a')[state.view==='find'?FIND_PAGE:PAGE]||titleEl).focus();} // the first new card
-```
-
-The `popstate` handler (lines 2546–2552) becomes:
-
-```js
-// Back and Forward over a fragment only (the skip link, How it works, Back to top) leave the view and keyboard focus as they
-// are. A view they change can take away the control that had keyboard focus (the ninth card after Show all): the heading gets
-// it, the finder's heading in the finder.
-addEventListener('popstate',()=>{
- const {next}=fromURL();
- if(Object.keys(next).every(k=>next[k]===state[k]))return;
- readURL();render();const a=document.activeElement;
- if(!a||a===document.body||gone(a)){if(state.view==='find')findTitle.focus({preventScroll:true});else toTitle();}
-});
-```
-
-- [ ] **Step 6: The finder block** — right before `const startCat=readURL();` (line 2558), insert:
-
-```js
-// ---------- The finder (?view=find) ----------
-// The three questions, built from FIND_Q: a fieldset each, its answers as radios (one Tab stop per question; the arrow keys
-// choose), each in a label with its picture (hidden from screen readers) and its words, which name it. Not sure ends each one.
-const finderEl=$('finder'),findTitle=$('find-title'),findSee=$('find-see'),heroEl=document.querySelector('.home-hero'),
- placesSec=$('places').closest('section');
-$('find-qs').innerHTML=FIND_Q.map((qu,n)=>`<fieldset class="fd-q fd-${qu.key}"><legend><span class="fd-n" aria-hidden="true">${n+1}</span><span>${esc(qu.title)}</span></legend>`+
- (qu.hint?`<p class="fd-hint">${esc(qu.hint)}</p>`:'')+'<div class="fd-as">'+
- [...qu.answers,{key:'unsure',words:'Not sure'}].map(a=>`<label class="fd-a${a.key==='unsure'?' fd-unsure':''}"><input class="fd-r" type="radio" name="fd-${qu.key}" value="${a.key}" autocomplete="off">`+
- (a.pic?`<span class="fd-pic ${a.pic}" aria-hidden="true"><i></i><i></i><i></i><i></i></span>`:a.icon?`<svg class="i fd-icon" viewBox="0 0 24 24" aria-hidden="true">${a.icon}</svg>`:'')+
- `<span class="fd-w">${esc(a.words)}</span></label>`).join('')+'</div></fieldset>').join('');
-// The results line is a polite live region. In the finder an answer writes it 400 ms after the last change, so arrowing through
-// the answers announces only the final count; every other change writes it at once.
-let sayTimer=0;
-function say(text,later){clearTimeout(sayTimer);if(later)sayTimer=setTimeout(()=>{subEl.textContent=text;},400);else subEl.textContent=text;}
-const answeredAny=()=>FIND_Q.some(qu=>qu.answers.some(a=>a.key===state[qu.key]));
-// The finder's results line: how many fit, or why none do.
-function findLine(found){
- const b=found.best.length,c=found.close.length,n=(k,one)=>k+' '+one+(k===1?'':'es');
- if(!answeredAny())return 'Answer a question above, and the animations that match show here.';
- if(b)return n(b,'best match')+(c?' and '+n(c,'close match'):'')+'.';
- return c?'No animation fits all your answers. These come close.':'No animation fits these answers yet.';
-}
-// The finder in place of the hero and the place tiles, with the tab's own title, the radios as the state says (after an address,
-// Back, Forward or Start over) and See N matches (hidden while nothing matches).
-const HOME_TITLE=document.title,FIND_TITLE='Find an animation you saw — Animation Handbook';
-function showFinder(finding,found){
- heroEl.hidden=placesSec.hidden=finding;finderEl.hidden=!finding;
- document.title=finding?FIND_TITLE:HOME_TITLE;
- FIND_Q.forEach(qu=>finderEl.querySelectorAll('.fd-r[name="fd-'+qu.key+'"]').forEach(r=>{r.checked=r.value===state[qu.key];}));
- const matched=found?found.best.length+found.close.length:0;
- findSee.hidden=!matched;findSee.textContent='See '+matched+(matched===1?' match':' matches');
-}
-// The finder's matches: Best matches, then Close matches, each a group headed like those of All animations (an h3 with its count,
-// the card titles a level below), the first twelve cards until Show all.
-function showFound(found){
- const boxes=[],cards=[];let left=state.all?Infinity:FIND_PAGE;
- [['Best matches',found.best,''],['Close matches',found.close,'They fit all but one of your answers.']].forEach(([name,list,line])=>{
- if(!list.length||left<=0)return;
- const box=document.createElement('section');box.className='group fd-group';
- box.innerHTML=`<h3 class="ghead"><span class="gname">${name}</span><span class="gcount">${list.length===1?'1 animation':list.length+' animations'}</span></h3>`+(line?`<p class="fd-gline">${line}</p>`:'');
- const grid=document.createElement('div');grid.className='grid';
- list.slice(0,left).forEach(e=>{const c=CARD[e.slug];c.querySelector('.title').setAttribute('aria-level','4');grid.appendChild(c);cards.push(c);});
- left-=list.length;box.appendChild(grid);boxes.push(box);
- });
- cardsBox.replaceChildren(...boxes);
- place(cards);
-}
-// An answer changes the cards at once and only replaces the address; nothing scrolls. See N matches brings the results heading
-// into view with keyboard focus, as Search does. Start over clears the answers and the cards (the address goes back to
-// ?view=find) and puts keyboard focus on the finder's heading, at the top of the page.
-finderEl.addEventListener('change',e=>{
- const r=e.target;if(!r.classList.contains('fd-r'))return;
- state[r.name.slice(3)]=r.value;state.all=false;
- render(true);writeURL(false);
-});
-findSee.addEventListener('click',()=>{toResults();toTitle();});
-$('find-reset').addEventListener('click',()=>{go({view:'find'},false);scrollTo({top:0,behavior:reduce?'auto':'smooth'});findTitle.focus({preventScroll:true});});
-```
-
-- [ ] **Step 7: Run all tests**
-
-Run: `cd "$WT/af-view" && node --test "tests/*.test.js"`
-Expected: every test passes.
-
-- [ ] **Step 8: The page check.** Merge the branch first (it holds Task 7, and Task 2 once merged): `cd "$WT/af-view" && git merge --no-ff feat/animation-finder -m "Merge feat/animation-finder into af/view"`. Serve `af-view` on 8903, take a slot, run
-`node tools/check-pages.mjs --base http://127.0.0.1:8903 --out "$RUN/view-3" home`, free the slot.
-Expected: six lines; every problem left on them names the Find button, the Finder link, Not here?, Describe it in words (Tasks 4 and 5) or, while Task 2 is not merged, the How pictures. Nothing about the questions, the cards, the address, See N matches, Start over, Show all, the loaded address, overflow, the phone bar or small targets. Open `home-desktop-finder-full.png` and `home-phone-finder-full.png` with the Read tool: three numbered questions, five What and When answers a row on the laptop and two on the phone, six How pictures a row on the laptop and three on the phone, the chosen answers with a dark ring and a tick, Best matches and Close matches below.
-
-- [ ] **Step 9: Commit**
-
-```bash
-cd "$WT/af-view"
-git add index.html tests/finder.test.js
-git commit -m "feat: the finder view at ?view=find: three questions of picture answers in place of the hero and tiles, the matching cards as Best and Close matches, See N matches, Start over, and answers kept in the address"
-```
-
----
-
-### Task 4: The ways in — the Find button, the Finder link and the social picture
-
-Runs in `af-view` after Task 3 is merged.
-
-**Files:**
-- Modify: `index.html` — the top bar (line 1445 on main, before `<a class="lnk" id="nav-all" …>`), the hero (after the `<p class="pop">…</p>` line, 1469 on main), the end of the `/* ── finder ── */` CSS block, `showFinder` and the end of the finder block (Task 3)
-- Modify: `tools/make-social-image.mjs` — the comment lines 8–12 and `PICTURE_CSS` line 47
-- Modify: `tests/finder.test.js` — under `// ── The finder view, its ways in and Not here? ──`, after Task 3's tests
-
-**Interfaces:**
-- Consumes: `go`, `findTitle`, `reduce`, `state`, `showFinder` (Task 3); `shoot.mjs` (Task 0).
-- Produces: `a.find-cta`, `a#nav-find` and its `aria-current="page"` in the finder, `enterFind(e)`, `navFind`; the How it works link hidden below the measured width; `.find-cta` and `#nav-find` hidden in the social picture.
-
-- [ ] **Step 1: Write the failing test** — after Task 3's tests:
-
-```js
-test('the ways into the finder: the Find button under the Popular line, Finder right before Browse all, both left out of the social picture', () => {
- assert.equal(count(HOME, `<a class="find-cta" href="?view=find">Don't know the name? Find it</a>`), 1, 'one Find button');
- assert.match(between(HOME, '<section class="wrap home-hero"', '</section>'),
- /<p class="pop"><span>Popular:<\/span>.*<\/p>\s*<a class="find-cta" href="\?view=find">Don't know the name\? Find it<\/a>\s*$/, 'the Find button ends the hero, right under the Popular line');
- assert.match(between(HOME, '<nav class="nav" aria-label="Site">', '</nav>'),
- /<a class="lnk" id="nav-find" href="\?view=find">Finder<\/a>\s*<a class="lnk" id="nav-all" href="\?view=all">Browse all<\/a>/, 'Finder right before Browse all');
- const css = [...HOME.matchAll(/<style>([\s\S]*?)<\/style>/g)].map(m => m[1]).join('\n');
- assert.ok(css.includes('@media(max-width:849px){.top .nav .lnk[href="#how"]{display:none}}'), 'How it works leaves the bar where the three links no longer fit');
- assert.ok(read(path.join(ROOT, 'tools', 'make-social-image.mjs')).includes('.find-cta, #nav-find { display: none }'), 'the social picture leaves both out');
-});
-```
-
-- [ ] **Step 2: Run it and see it fail**
-
-Run: `cd "$WT/af-view" && node --test tests/finder.test.js`
-Expected: the new test FAILS with `one Find button`; the others pass.
-
-- [ ] **Step 3: The baseline social picture** — serve `af-view` on 8903, take a slot, run `node tools/make-social-image.mjs --base http://127.0.0.1:8903 --out "$RUN/og-before.png"`, free the slot. Expected: `Wrote …og-before.png: 1200×630 …`.
-
-- [ ] **Step 4: The markup.** In the top bar, right before `<a class="lnk" id="nav-all" href="?view=all">Browse all</a>`, add the line:
-
-```html
- <a class="lnk" id="nav-find" href="?view=find">Finder</a>
-```
-
-In the hero, right after the `<p class="pop"><span>Popular:</span>…</p>` line, add the line:
-
-```html
- <a class="find-cta" href="?view=find">Don't know the name? Find it</a>
-```
-
-- [ ] **Step 5: Measure where the bar is full.** With the server still on 8903 and a slot taken, run before adding any width rule:
-
-```bash
-for w in 1024 900 880 870 860 850 840 830 820 800 780 761; do
- node "$RUN/shoot.mjs" --url "http://127.0.0.1:8903/" --size ${w}x400 --eval "(() => { const links = [...document.querySelectorAll('.top .nav > *')].filter(el => el.getClientRects().length); return { width: innerWidth, room: Math.round(links[0].getBoundingClientRect().left - document.querySelector('.top .brand span').getBoundingClientRect().right) }; })()"
-done
-```
-
-Free the slot. `room` is the space between the brand's words and the first link. Take the smallest width whose `room` is at least 32 (12px of gap plus 20px for a longer star count) and call it W; the rule below uses `max-width: W−1`. If W is not 850, use your number in the CSS of Step 6 and in the test of Step 1.
-
-- [ ] **Step 6: The styles** — at the end of the `/* ── finder ── */` block, add:
-
-```css
-/* The ways into the finder: a pill under the Popular line (as wide as the column on phones) and Finder in the top bar, marked as
- the current page in the finder. Below 850px (measured) Finder, Browse all and How it works no longer all fit beside the brand,
- so How it works leaves the bar; its band stays on the page. Phones show no top-bar links: there the pill is the way in. */
-.find-cta{display:inline-flex;align-items:center;justify-content:center;min-height:44px;margin-top:10px;padding:0 20px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--ink);font-size:15px;font-weight:700;text-decoration:none}
-.lnk[aria-current="page"]{color:var(--ink);background:var(--line-2)}
-@media(hover:hover){.find-cta:hover{border-color:var(--ink)}}
-@media(max-width:849px){.top .nav .lnk[href="#how"]{display:none}}
-@media(max-width:600px){.find-cta{display:flex;align-self:stretch;margin-top:8px}}
-```
-
-- [ ] **Step 7: The script.** In `showFinder`, after the `document.title=…` line, add:
-
-```js
- if(finding)navFind.setAttribute('aria-current','page');else navFind.removeAttribute('aria-current');
-```
-
-At the end of the finder block (after the Start over listener), add:
-
-```js
-// The ways in: the Find button under the search and Finder in the top bar open the finder with one history step, at the top of
-// the page with keyboard focus on its heading (the Find button goes away with the hero). A click with Ctrl, Cmd, Shift or Alt,
-// or with another button, is left to the browser, as for Browse all.
-const navFind=$('nav-find');
-function enterFind(e){
- if(e.button||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;
- e.preventDefault();
- if(state.view!=='find')go({view:'find'},true);
- scrollTo({top:0,behavior:reduce?'auto':'smooth'});findTitle.focus({preventScroll:true});
-}
-document.querySelectorAll('.find-cta,#nav-find').forEach(a=>a.addEventListener('click',enterFind));
-```
-
-- [ ] **Step 8: The social picture keeps its look.** In `tools/make-social-image.mjs` replace lines 8–12 (from `// The page is laid out 1080 pixels wide` to `// animation is stopped at the same moment of its loop, so every run draws the same picture.`) with:
-
-```js
-// The page is laid out 1080 pixels wide and drawn at 1200/1080 of its size, so its words stay readable when a social site
-// shows the picture small. For the picture only, the line under the question, the Popular suggestions, the finder's Find button
-// and Finder link and the counts under the tiles are left out (so the tiles fit with room under them, as before the finder), the
-// question is drawn at its full size and the GitHub button shows no star count (the request for it is blocked: a number in the
-// picture would soon be out of date). Every animation is stopped at the same moment of its loop, so every run draws the same
-// picture.
-```
-
-and the first line of `PICTURE_CSS` (line 47) with:
-
-```js
-.home-hero .sub, .home-hero .pop, .pl-count, .gh-c:empty, .find-cta, #nav-find { display: none }
-```
-
-Take a slot, run `node tools/make-social-image.mjs --base http://127.0.0.1:8903 --out "$RUN/og-after.png"`, free it, then `cmp "$RUN/og-before.png" "$RUN/og-after.png" && echo same`.
-Expected: `same`. If not, open both with the Read tool and find what leaked into the picture.
-
-- [ ] **Step 9: Tests and the page check**
-
-Run: `cd "$WT/af-view" && node --test "tests/*.test.js"` — expected: every test passes.
-Take a slot, run `node tools/check-pages.mjs --base http://127.0.0.1:8903 --out "$RUN/view-4" home`, free it.
-Expected: six lines; the only problems left name Not here? or Describe it in words (Task 5), or the How pictures while Task 2 is not merged; no `place tiles below the first screen` and no `search box below the first screen` (the Find button must not push the first row of tiles off the first screen at 1280×800 and 375×812). If a first-screen problem shows, take the room from the gap above the tiles: add `@media(min-width:601px){.places{margin-top:32px}}` (desktop) or `@media(max-width:600px){.places-h{margin-top:18px}}` (phone) at the end of the finder block, never shrinking the tiles or the search box, and run the check again.
-
-- [ ] **Step 10: Commit**
-
-```bash
-cd "$WT/af-view"
-git add index.html tools/make-social-image.mjs tests/finder.test.js
-git commit -m "feat: two ways into the finder, a Don't know the name? button under the search and a Finder link in the top bar, both left out of the social picture"
-```
-
----
-
-### Task 5: Not here? and the GitHub form
-
-Runs in `af-view` after Task 4 is merged. Before Step 6 the branch must hold Task 2.
-
-**Files:**
-- Modify: `index.html` — after `<div class="more" id="more">…</div>` (line 1516 on main); the end of the `/* ── finder ── */` CSS block; `render` (one line after `showFinder(finding,found);`); the end of the finder block
-- Create: `.github/ISSUE_TEMPLATE/animation_not_here.yml`
-- Modify: `.github/ISSUE_TEMPLATE/config.yml` — lines 2–3 (`contact_links:` and the first item)
-- Modify: `tests/finder.test.js` — after Task 4's test
-
-**Interfaces:**
-- Consumes: `findIssueURL` (Task 1); `answeredAny`, `render`, `go`, `q`, `reduce` (Task 3).
-- Produces: `#find-not`, `#find-not-s`, `#find-gh`, `#find-words`; `showNotHere(finding, found)`; the form `animation_not_here.yml` with the fields `answers`, `site`, `what`, `recording`; a first contact link to the finder in the issue chooser.
-
-- [ ] **Step 1: Write the failing tests** — after Task 4's test:
-
-```js
-// The fields of a GitHub issue form, in order: each item of its body that has an id, with its type, label and whether it is required.
-const formFields = yml => yml.split(/\n - type: /).slice(1).map(item => ({
- type: item.split(/\r?\n/)[0].trim(),
- id: (item.match(/\n id: (\S+)/) || [])[1],
- label: ((item.match(/\n label: (.+)/) || [])[1] || '').trim().replace(/^"(.*)"$/, '$1'),
- required: /\n required: true/.test(item)
-})).filter(field => field.id);
-const FORM = path.join(ROOT, '.github', 'ISSUE_TEMPLATE', 'animation_not_here.yml');
-
-test('Not here? sits under the cards with its words, its GitHub link in a new tab and Describe it in words', () => {
- const panel = between(HOME, '<div class="fd-not" id="find-not" hidden>', '</div>');
- assert.ok(panel, 'the Not here? panel, hidden until an answer is picked');
- for (const part of ['<h3 class="fd-not-t">Not here?</h3>',
- '<p class="fd-not-s" id="find-not-s">Tell us what you saw. We use it to add the animation or to fix the finder.</p>',
- '<a class="fd-btn" id="find-gh" href="https://github.com/matinmonshizadeh/animation-handbook/issues/new?template=animation_not_here.yml" target="_blank" rel="noopener">Tell us on GitHub</a>',
- '<button type="button" class="pillbtn" id="find-words">Describe it in words</button>',
- '<p class="fd-fine">The form is on GitHub and needs a free account.</p>']) assert.ok(panel.includes(part), part);
- assert.ok(at('id="find-not"') > at('id="more"') && at('id="find-not"') < at('id="how"'), 'under the cards, before How it works');
-});
-
-test('the GitHub form for Not here? has its name, title, label and four fields', () => {
- const form = read(FORM);
- assert.match(form, /^name: "Can't find an animation"\r?$/m);
- assert.match(form, /^description: "You saw an animation on a website, and the finder did not show it\."\r?$/m);
- assert.match(form, /^title: "\[not here\] "\r?$/m);
- assert.match(form, /^labels: \["finder"\]\r?$/m);
- assert.deepEqual(formFields(form).map(f => [f.type, f.id, f.label, f.required]), [
- ['input', 'answers', 'Your answers in the finder', false],
- ['input', 'site', 'Where did you see it? A link, and where on the page', true],
- ['textarea', 'what', 'What happened, in your own words', true],
- ['textarea', 'recording', 'A screen recording or picture: drag it into this box', false]
- ]);
-});
-
-test('the Not here? link names animation_not_here.yml and fills only fields the form has', () => {
- const fields = formFields(read(FORM)).map(f => f.id);
- const url = new URL(finder().findIssueURL({ what: 'card', when: 'scroll', how: 'pieces' }));
- assert.equal(url.searchParams.get('template'), path.basename(FORM));
- for (const name of url.searchParams.keys()) assert.ok(['template', 'title'].includes(name) || fields.includes(name), `${name} is a field of the form`);
-});
-
-test('the issue chooser offers the finder first', () => {
- const config = read(path.join(ROOT, '.github', 'ISSUE_TEMPLATE', 'config.yml'));
- assert.match(config.split(/\r?\n - name: /)[1] || '', /^Find an animation by what you saw\r?\n url: https:\/\/matinmonshizadeh\.github\.io\/animation-handbook\/\?view=find\r?\n/);
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `cd "$WT/af-view" && node --test tests/finder.test.js`
-Expected: the four new tests FAIL (no panel; `ENOENT … animation_not_here.yml`; the chooser's first link is Browse the live handbook); the others pass.
-
-- [ ] **Step 3: The form** — create `.github/ISSUE_TEMPLATE/animation_not_here.yml`:
-
-```yaml
-name: "Can't find an animation"
-description: "You saw an animation on a website, and the finder did not show it."
-title: "[not here] "
-labels: ["finder"]
-body:
- - type: input
- id: answers
- attributes:
- label: "Your answers in the finder"
- description: "Filled in when you come from the finder's Not here? link."
- - type: input
- id: site
- attributes:
- label: "Where did you see it? A link, and where on the page"
- placeholder: "For example: https://example.com, the big picture at the top"
- validations:
- required: true
- - type: textarea
- id: what
- attributes:
- label: "What happened, in your own words"
- placeholder: "For example: as I scrolled, the picture broke into small pieces that floated away."
- validations:
- required: true
- - type: textarea
- id: recording
- attributes:
- label: "A screen recording or picture: drag it into this box"
- description: "Optional, but it helps us see exactly what you saw."
-```
-
-In `.github/ISSUE_TEMPLATE/config.yml`, right after `contact_links:`, add the finder as the first item:
-
-```yaml
- - name: Find an animation by what you saw
- url: https://matinmonshizadeh.github.io/animation-handbook/?view=find
- about: "Saw an animation on a website and don't know its name? Answer three short questions and see the ones that match."
-```
-
-- [ ] **Step 4: The panel, its styles and its script.** Right after `<div class="more" id="more">…</div>`, add:
-
-```html
- <div class="fd-not" id="find-not" hidden>
- <h3 class="fd-not-t">Not here?</h3>
- <p class="fd-not-s" id="find-not-s">Tell us what you saw. We use it to add the animation or to fix the finder.</p>
- <p class="fd-not-acts"><a class="fd-btn" id="find-gh" href="https://github.com/matinmonshizadeh/animation-handbook/issues/new?template=animation_not_here.yml" target="_blank" rel="noopener">Tell us on GitHub</a><button type="button" class="pillbtn" id="find-words">Describe it in words</button></p>
- <p class="fd-fine">The form is on GitHub and needs a free account.</p>
- </div>
-```
-
-At the end of the `/* ── finder ── */` CSS block, add:
-
-```css
-/* Not here?, under the finder's cards whenever an answer is picked */
-.fd-not{display:flex;flex-direction:column;align-items:center;gap:12px;margin-top:40px;padding:clamp(28px,4vw,44px) 24px;border-radius:20px;background:var(--surface);box-shadow:var(--shadow);text-align:center}
-.fd-not-t{font-size:22px;font-weight:800}
-.fd-not-s{max-width:560px;font-size:16px;color:var(--ink-2)}
-.fd-not-acts{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;margin-top:4px}
-.fd-fine{font-size:14px;color:var(--muted)}
-@media(max-width:600px){.fd-not-acts{flex-direction:column;align-self:stretch}}
-```
-
-In `render`, right after `showFinder(finding,found);`, add the line:
-
-```js
- showNotHere(finding,found);
-```
-
-At the end of the finder block, add:
-
-```js
-// Not here?, under the cards whenever an answer is picked: its link opens the GitHub form with the answers filled in; when nothing
-// fits, its line says so and suggests Not sure on one question. Describe it in words goes back to the start, search box focused.
-const findNot=$('find-not'),findNotLine=$('find-not-s'),findGh=$('find-gh');
-function showNotHere(finding,found){
- const answered=finding&&answeredAny();
- findNot.hidden=!answered;
- if(!answered)return;
- findNotLine.textContent=found.best.length+found.close.length?'Tell us what you saw. We use it to add the animation or to fix the finder.':'Nothing fits these answers yet. Try Not sure on one question, or tell us what you saw.';
- findGh.href=findIssueURL(state);
-}
-$('find-words').addEventListener('click',()=>{go({},true);scrollTo({top:0,behavior:reduce?'auto':'smooth'});q.focus({preventScroll:true});});
-```
-
-- [ ] **Step 5: Run all tests**
-
-Run: `cd "$WT/af-view" && node --test "tests/*.test.js"`
-Expected: every test passes, the four new ones included.
-
-- [ ] **Step 6: Six `ok` lines.** Merge the branch (it must hold Task 2 by now; if Task 2 is still in review, wait for its merge): `cd "$WT/af-view" && git merge --no-ff feat/animation-finder -m "Merge feat/animation-finder into af/view"`. Serve on 8903, take a slot, run `node tools/check-pages.mjs --base http://127.0.0.1:8903 --out "$RUN/view-5" home`, free it.
-Expected: six `ok` lines. Open the six `home-*-finder-full.png` with the Read tool: the Not here? panel under the cards, its two buttons side by side on the laptop and one under the other on the phone.
-
-- [ ] **Step 7: Commit**
-
-```bash
-cd "$WT/af-view"
-git add index.html tests/finder.test.js .github/ISSUE_TEMPLATE/animation_not_here.yml .github/ISSUE_TEMPLATE/config.yml
-git commit -m "feat: Not here? under the finder's cards opens a short GitHub form with the visitor's answers filled in, and the issue chooser offers the finder first"
-```
-
----
-
-### Task 6: The 404 page sends /finder and /find to the finder
-
-**Files:**
-- Modify: `404.html` — the comment and `whereTo` (lines 18–36), the ways back (lines 123–126)
-- Modify: `tests/pages.test.js` — a new test right after the test ending on line 685 ("the 404 page sends a mistyped address where it belongs and never off the site")
-
-**Interfaces:**
-- Consumes: nothing new.
-- Produces: `whereTo('/animation-handbook/finder', rest)` → `{ go: '/animation-handbook/?view=find' + kept answers }`; the third way back `<a class="way" href="/animation-handbook/?view=find">Find an animation by what you saw</a>`.
-
-- [ ] **Step 1: Write the failing test** — after the test that ends on line 685 of `tests/pages.test.js`:
-
-```js
-test('the 404 page sends /finder and /find to the finder, keeping only its answers, and offers it as a way back', () => {
- const html = read(path.join(ROOT, '404.html'));
- const start = html.indexOf('function whereTo(');
- assert.ok(start >= 0, 'whereTo in 404.html');
- let depth = 0, end = html.indexOf('{', start);
- for (; end < html.length; end++) { if (html[end] === '{') depth++; else if (html[end] === '}' && --depth === 0) break; }
- const whereTo = vm.runInNewContext('(' + html.slice(start, end + 1) + ')');
- const cases = [
- ['/animation-handbook/finder', '', { go: '/animation-handbook/?view=find' }],
- ['/animation-handbook/find/', '', { go: '/animation-handbook/?view=find' }],
- ['/animation-handbook/Finder/', '?what=text&when=scroll&how=draw#top', { go: '/animation-handbook/?view=find&what=text&when=scroll&how=draw' }],
- ['/animation-handbook/FIND', '?q=fade&how=fade&utm_source=x', { go: '/animation-handbook/?view=find&how=fade' }],
- ['/animation-handbook/finder', '?what=%3Cb%3E', { go: '/animation-handbook/?view=find' }],
- ['/animation-handbook/finders', '', { words: 'finders' }],
- ['/animation-handbook/animations/finder/', '', { words: 'finder' }]
- ];
- for (const [where, rest, want] of cases) assert.deepEqual({ ...whereTo(where, rest) }, want, where + rest);
- assert.ok(html.includes('<a class="way" href="/animation-handbook/?view=find">Find an animation by what you saw</a>'), 'the third way back');
-});
-```
-
-- [ ] **Step 2: Run it and see it fail**
-
-Run: `cd "$WT/af-404" && node --test tests/pages.test.js`
-Expected: the new test FAILS on `/animation-handbook/finder` (it gets `{ words: 'finder' }`); every other test passes.
-
-- [ ] **Step 3: Implement.** In `404.html` replace the comment and the first three lines of `whereTo` (from `// Where a missing address leads:` to the line `if(lower!==path&&lower.indexOf('/animation-handbook/')===0)return {go:lower+(rest||'')};`) with:
-
-```js
-// Where a missing address leads: {go} to move on at once, else {words} for the search box. rest is the address's query
-// and fragment. GitHub Pages tells capital letters from small ones, so an address with capitals moves to its lowercase
-// path (percent escapes keep their case, so a lowercase path never moves again), and only within the handbook, so it
-// never leaves the site. /animations/ and a category folder have no page of their own: they open Browse all; /finder and
-// /find open the finder, a view of the home page, keeping only its answers (what, when and how). Any other address offers
-// the words of its last part ("rotate-inn" gives "rotate inn"), skipping an index or readme file; a part made only of
-// digits offers none.
-function whereTo(path,rest){
- var lower=path.replace(/%[0-9A-Fa-f]{2}|[A-Z]+/g,function(s){return s.charAt(0)==='%'?s:s.toLowerCase();});
- if(/^\/animation-handbook\/animations(\/\d\d-[a-z0-9-]+)?(\/(index\.html?)?)?$/.test(lower))return {go:'/animation-handbook/?view=all#results'};
- if(/^\/animation-handbook\/find(er)?\/?$/.test(lower)){
- var keep=(rest||'').replace(/#.*$/,'').replace(/^\?/,'').split('&').filter(function(p){return /^(what|when|how)=[a-z]+$/.test(p);});
- return {go:'/animation-handbook/?view=find'+(keep.length?'&'+keep.join('&'):'')};
- }
- if(lower!==path&&lower.indexOf('/animation-handbook/')===0)return {go:lower+(rest||'')};
-```
-
-(the rest of `whereTo` stays as it is). In the ways back, after `<a class="way" href="/animation-handbook/?view=all#results">Browse all 166 animations</a>`, add:
-
-```html
- <a class="way" href="/animation-handbook/?view=find">Find an animation by what you saw</a>
-```
-
-- [ ] **Step 4: Run all tests**
-
-Run: `cd "$WT/af-404" && node --test "tests/*.test.js"`
-Expected: every test passes, including "every address in it works at any depth" (the new link points at the home page).
-
-- [ ] **Step 5: Commit**
-
-```bash
-cd "$WT/af-404"
-git add 404.html tests/pages.test.js
-git commit -m "feat: the 404 page sends /finder and /find to the finder with its answers, and offers it as a third way back"
-```
-
----
-
-### Task 7: The page check works the finder
-
-**Files:**
-- Modify: `tools/check-pages.mjs` — new functions right after `homeMotionProblems()` (ends on line 908 on main), before `// The end of the run, done once:`; a new block inside `if (home) {…}` of the main loop, after line 1010 (`if (setup.moves) problems.push(...await homeCopyProblems());`)
-
-**Interfaces:**
-- Consumes: the contract (written in parallel with Tasks 3–5, checked against them once they are merged); the page's `FIND_Q` and `findIssueURL`.
-- Produces: `openHome(query, problems)`, `clickAt(selector)` → `{ covered, scrolled }`, `finderLayoutProblems(name, setup)`, `finderViewProblems()`, `pictureChange(drawn, bare)` → `{ share, wide, tall }`, `finderMotionProblems()`; screenshots `home-<setup>-finder.png` and `home-<setup>-finder-full.png` at every setup.
-
-- [ ] **Step 1: Add the functions** — after `homeMotionProblems()`:
-
-```js
-// ── The finder (?view=find) ──
-// Every home setup also opens the finder (finderLayoutProblems). The desktop run works it (finderViewProblems) and the
-// reduced-motion run holds it still (finderMotionProblems). These are the finder's own steps; the home checks above are unchanged.
-
-// Opens an address of the site as a new visit does; a load that does not finish is a problem of its own.
-async function openHome(query, problems) {
- let onLoad;
- const loaded = new Promise(resolve => { onLoad = msg => { if (msg.method === 'Page.loadEventFired') resolve(); }; listeners.add(onLoad); });
- await send('Page.navigate', { url: `${BASE}/${query}` });
- try { await withTimeout(loaded, LOAD_TIMEOUT); } catch { problems.push(`finder: ${query || 'the home page'} did not load`); }
- listeners.delete(onLoad);
- await sleep(300);
-}
-
-// A real mouse click at the middle of the element the selector finds, once it is scrolled to the middle of the window. Returns
-// what covers that point when it is not the element or something inside it (covered), and where the page was scrolled to just
-// before the click (scrolled), so the caller can tell whether the click scrolled the page.
-async function clickAt(selector) {
- const spot = await evaluate(`(() => {
- const el = document.querySelector(${JSON.stringify(selector)});
- if (!el) return { covered: 'nothing: the page has no such element' };
- el.scrollIntoView({ block: 'center' });
- const b = el.getBoundingClientRect(), x = b.left + b.width / 2, y = b.top + b.height / 2, hit = document.elementFromPoint(x, y);
- return { x, y, scrolled: Math.round(scrollY),
- covered: el.contains(hit) ? '' : hit ? hit.tagName.toLowerCase() + (hit.getAttribute('class') ? '.' + hit.getAttribute('class').split(' ')[0] : '') : 'nothing' };
- })()`);
- if (spot.covered) return { covered: spot.covered, scrolled: 0 };
- 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 { covered: '', scrolled: spot.scrolled };
-}
-
-// The finder at every setup. On the start page the Find button sits under the Popular line (on a phone 44px tall or more and as
-// wide as the column). The finder, opened with three answers in the address: the hero and the place tiles give way to it, its
-// cards and the Not here? panel show, nothing overflows sideways, Finder is in the top bar above 600px and the bar's links fit
-// beside the brand, the phone bar stays away and, on phones, every answer, button and link of the finder and its results is at
-// least 44×44. Screenshots of the finder (the window and the whole page) are saved beside the others.
-async function finderLayoutProblems(name, setup) {
- const problems = [];
- await openHome('', problems);
- const cta = await evaluate(`(() => {
- const a = document.querySelector('.find-cta'), pop = document.querySelector('.home-hero .pop'), hero = document.querySelector('.home-hero');
- if (!a || !a.getClientRects().length) return null;
- const b = a.getBoundingClientRect();
- return { width: Math.round(b.width), height: Math.round(b.height), under: !!pop && b.top >= pop.getBoundingClientRect().bottom - 1,
- full: Math.abs(b.width - hero.getBoundingClientRect().width) <= 1 };
- })()`);
- if (!cta) problems.push('finder: no Find button on the start page');
- else {
- if (!cta.under) problems.push('finder: the Find button is not under the Popular line');
- if (setup.width <= 600 && (cta.height < 44 || !cta.full)) problems.push(`finder: on a phone the Find button is ${cta.width}x${cta.height}${cta.full ? '' : ', not as wide as the column'}`);
- }
- await openHome('?view=find&what=text&when=load&how=stagger', problems);
- await sleep(500);
- const found = await evaluate(`(() => {
- const r = el => el.getBoundingClientRect(), shown = el => !!el && !!el.getClientRects().length, out = [];
- if (shown(document.querySelector('.home-hero')) || shown(document.getElementById('places'))) out.push('the hero or the place tiles show in the finder');
- if (!shown(document.getElementById('finder'))) out.push('the finder does not show');
- if (!document.querySelectorAll('#cards .card').length) out.push('no cards for Text or numbers · When the page opened · One after another');
- if (!shown(document.getElementById('find-not'))) out.push('no Not here? panel');
- if (document.documentElement.scrollWidth > document.documentElement.clientWidth + 1) out.push('horizontal overflow');
- if (innerWidth > 600 && !shown(document.getElementById('nav-find'))) out.push('no Finder link in the top bar');
- const brand = document.querySelector('.top .brand span'), first = [...document.querySelectorAll('.top .nav > *')].find(shown);
- if (brand && first && r(brand).right > r(first).left - 8) out.push('the top bar links do not fit beside the brand');
- if (getComputedStyle(document.getElementById('pinbar')).display !== 'none') out.push('the phone bar shows');
- if (innerWidth <= 600) {
- const small = [...document.querySelectorAll('#finder .fd-a, #finder button, #find-not a, #find-not button, #cards .card .copy, #more button')]
- .filter(shown).filter(el => { const b = r(el); return b.width < 44 || b.height < 44; })
- .map(el => (el.id || el.tagName.toLowerCase() + '.' + (el.getAttribute('class') || '').split(' ')[0]) + ' ' + Math.round(r(el).width) + 'x' + Math.round(r(el).height));
- if (small.length) out.push('small targets: ' + small.slice(0, 6).join(', ') + (small.length > 6 ? ' and ' + (small.length - 6) + ' more' : ''));
- }
- return out;
- })()`);
- problems.push(...found.map(p => `finder: ${p}`));
- const shot = await send('Page.captureScreenshot', { format: 'png' });
- writeFileSync(join(OUT, `${name}-${setup.name}-finder.png`), Buffer.from(shot.data, 'base64'));
- const { cssContentSize } = await send('Page.getLayoutMetrics');
- const full = await send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true,
- clip: { x: 0, y: 0, width: setup.width, height: Math.ceil(cssContentSize.height), scale: 1 } });
- writeFileSync(join(OUT, `${name}-${setup.name}-finder-full.png`), Buffer.from(full.data, 'base64'));
- return problems;
-}
-
-// The finder, desktop run. ?view=find opens with three questions, nothing chosen, the heading "Your matches", the line asking for
-// an answer and no cards, the tab's title and the Finder link marked as the current page. Real clicks on answers change the cards,
-// replace the address (no history step) and never scroll the page; with A menu or form · When I scrolled · Slid, Hide-on-Scroll
-// Header is among the first six (case 22 of the finder's test set). The Not here? link is the form's address for those answers, in
-// a new tab. See N matches brings the results heading into view with keyboard focus; Start over clears the answers and the cards,
-// goes back to ?view=find and puts keyboard focus on the finder's heading. With more than twelve matches Show all shows the rest
-// and puts keyboard focus on the thirteenth card. An address opened directly shows the same answers and cards as the clicks. The
-// Find button and the Finder link each enter the finder with one history step and keyboard focus on its heading; after an answer,
-// Back returns to the start in one press. Describe it in words goes back to the start with keyboard focus in the search box.
-async function finderViewProblems() {
- const problems = [];
- const FIND_TITLE = 'Find an animation you saw — Animation Handbook', ASK = 'Answer a question above, and the animations that match show here.';
- const look = () => evaluate(`(() => {
- const $ = id => document.getElementById(id), shown = el => !!el && !!el.getClientRects().length;
- const links = [...document.querySelectorAll('#cards .card .title a')], a = document.activeElement;
- return { hero: shown(document.querySelector('.home-hero')), tiles: shown($('places')), finder: shown($('finder')),
- questions: document.querySelectorAll('#finder fieldset').length,
- checked: [...document.querySelectorAll('#finder .fd-r:checked')].map(r => r.name.slice(3) + '=' + r.value).join('&'),
- title: $('results-title').textContent, sub: $('results-sub').textContent, names: links.map(l => l.textContent),
- more: $('more').hidden ? '' : $('more-label').textContent, search: location.search, steps: history.length, tab: document.title,
- current: $('nav-find') ? $('nav-find').getAttribute('aria-current') : 'no Finder link',
- see: shown($('find-see')) ? $('find-see').textContent : '', notHere: shown($('find-not')),
- focus: a.id || (links.includes(a) ? 'card link ' + (links.indexOf(a) + 1) : a.tagName.toLowerCase()) };
- })()`);
- const press = selector => evaluate(`(() => { const el = document.querySelector(${JSON.stringify(selector)}); if (el) { el.focus(); el.click(); } return !!el; })()`);
- const answer = (question, key) => `#finder .fd-a:has(.fd-r[name="fd-${question}"][value="${key}"])`;
- const still = () => evaluate(`new Promise(done => { let last = scrollY, same = 0;
- const tick = () => { same = scrollY === last ? same + 1 : 0; last = scrollY; if (same >= 3) done(); else setTimeout(tick, 100); };
- setTimeout(tick, 100); })`);
- // A real click on an answer: then the line has been written (400 ms) and the page must not have scrolled.
- const pick = async (question, key) => {
- const spot = await clickAt(answer(question, key));
- if (spot.covered) { problems.push(`finder: the answer ${question}=${key} is covered by ${spot.covered}`); return; }
- await sleep(700);
- const y = await evaluate('Math.round(scrollY)');
- if (Math.abs(y - spot.scrolled) > 1) problems.push(`finder: picking ${question}=${key} scrolled the page from ${spot.scrolled}px to ${y}px`);
- };
-
- await openHome('?view=find', problems);
- let s = await look();
- if (s.hero || s.tiles || !s.finder || s.questions !== 3 || s.checked || s.names.length || s.title !== 'Your matches' || s.sub !== ASK ||
- s.tab !== FIND_TITLE || s.current !== 'page' || s.see || s.notHere) problems.push(`finder, ?view=find: ${JSON.stringify(s)}`);
- const steps = s.steps;
- for (const [question, key] of [['what', 'menu'], ['when', 'scroll'], ['how', 'slide']]) await pick(question, key);
- s = await look();
- if (s.checked !== 'what=menu&when=scroll&how=slide' || s.search !== '?view=find&what=menu&when=scroll&how=slide' || s.steps !== steps) {
- problems.push(`finder, three answers: chosen ${s.checked}, the address ${s.search}, ${s.steps - steps} history steps added`);
- }
- if (!s.names.slice(0, 6).includes('Hide-on-Scroll Header')) problems.push(`finder: A menu or form · When I scrolled · Slid shows ${s.names.slice(0, 6).join(', ') || 'no cards'} first, not Hide-on-Scroll Header`);
- if (!/^See \d+ match(es)?$/.test(s.see) || !s.notHere) problems.push(`finder: See N matches reads "${s.see}", Not here? is ${s.notHere ? 'shown' : 'hidden'}`);
- if (!/^\d+ best match(es)?( and \d+ close match(es)?)?\.$|^No animation fits all your answers\. These come close\.$/.test(s.sub)) problems.push(`finder: the results line "${s.sub}"`);
- const link = await evaluate(`(() => { const a = document.getElementById('find-gh');
- return a ? { href: new URL(a.href).href, want: new URL(findIssueURL({ what: 'menu', when: 'scroll', how: 'slide' })).href, target: a.target, rel: a.rel } : null; })()`);
- if (!link || link.href !== link.want || !link.href.startsWith('https://github.com/matinmonshizadeh/animation-handbook/issues/new?template=animation_not_here.yml&') ||
- link.target !== '_blank' || link.rel !== 'noopener') problems.push(`finder: the Not here? link ${JSON.stringify(link)}`);
- const picked = s.names;
- await press('#find-see');
- await still();
- const seen = await evaluate(`(() => { const t = document.getElementById('results-title'), top = Math.round(t.getBoundingClientRect().top);
- return { top, shown: top >= 0 && top <= innerHeight * .6, focus: document.activeElement === t }; })()`);
- if (!seen.shown || !seen.focus) problems.push(`finder: after See N matches the results heading is at ${seen.top}px${seen.focus ? '' : ', without keyboard focus'}`);
- await press('#find-reset');
- await still();
- await sleep(500);
- s = await look();
- if (s.checked || s.names.length || s.search !== '?view=find' || s.sub !== ASK || s.focus !== 'find-title' || s.see || s.notHere || s.steps !== steps) {
- problems.push(`finder, Start over: ${JSON.stringify(s)}`);
- }
- // More than twelve matches: twelve cards, then Show all shows every one and puts keyboard focus on the thirteenth.
- await openHome('?view=find&what=background', problems);
- s = await look();
- const total = Number((s.more.match(/^Show all (\d+) matches$/) || [])[1]);
- if (!(total > 12) || s.names.length !== 12) problems.push(`finder, The background: ${s.names.length} cards and the button "${s.more}" (twelve cards, then Show all for the rest)`);
- else {
- await press('#more-btn');
- await sleep(400);
- s = await look();
- if (s.names.length !== total || s.search !== '?view=find&what=background&all=1' || s.focus !== 'card link 13' || s.more) {
- problems.push(`finder, Show all: ${s.names.length} of ${total} cards, the address ${s.search}, keyboard focus on ${s.focus}`);
- }
- }
- // An address opened directly shows the same answers and cards as the clicks did.
- await openHome('?view=find&what=menu&when=scroll&how=slide', problems);
- s = await look();
- if (s.checked !== 'what=menu&when=scroll&how=slide' || s.names.join() !== picked.join()) problems.push(`finder, the address opened directly: chosen ${s.checked}, cards ${s.names.join(', ')}; after the clicks: ${picked.join(', ')}`);
- // The ways in: one history step, keyboard focus on the finder's heading; after an answer, Back returns to the start in one press.
- for (const [what, selector] of [['Find button', '.find-cta'], ['Finder link', '#nav-find']]) {
- await openHome('', problems);
- const before = await evaluate('history.length');
- if (!(await press(selector))) { problems.push(`finder: no ${what}`); continue; }
- await still();
- s = await look();
- if (s.search !== '?view=find' || s.steps !== before + 1 || s.focus !== 'find-title' || s.hero || !s.finder) problems.push(`finder, the ${what}: ${JSON.stringify(s)}`);
- await pick('what', 'text');
- await evaluate('history.back()');
- await sleep(700);
- s = await look();
- if (s.search !== '' || !s.hero || s.finder || s.title !== 'Good places to start' || s.tab === FIND_TITLE || s.current !== null) {
- problems.push(`finder, Back after the ${what} and an answer: ${JSON.stringify(s)}`);
- }
- }
- // Describe it in words: back to the start, one history step, keyboard focus in the search box.
- await openHome('?view=find&what=text', problems);
- const before = await evaluate('history.length');
- if (!(await press('#find-words'))) problems.push('finder: no Describe it in words');
- else {
- await still();
- s = await look();
- if (s.search !== '' || !s.hero || s.focus !== 'q' || s.steps !== before + 1) problems.push(`finder, Describe it in words: ${JSON.stringify(s)}`);
- }
- return problems;
-}
-
-// How much two captures of the same box differ: the share of pixels that differ by more than 48 (red, green and blue summed), and
-// the shares of the box's width and height that the rectangle around them takes, as in the home page's reduced-motion check.
-async function pictureChange(drawn, bare) {
- return evaluate(`new Promise(done => {
- const load = src => new Promise(resolve => { const img = new Image(); img.onload = () => resolve(img); img.src = 'data:image/png;base64,' + src; });
- Promise.all([load(${JSON.stringify(drawn)}), load(${JSON.stringify(bare)})]).then(([x, y]) => {
- const read = img => { const c = document.createElement('canvas'); c.width = img.width; c.height = img.height; const g = c.getContext('2d'); g.drawImage(img, 0, 0); return g.getImageData(0, 0, c.width, c.height).data; };
- const p = read(x), q = read(y), w = x.width, h = x.height;
- let changed = 0, left = w, right = -1, top = h, bottom = -1;
- for (let i = 0; i < p.length; i += 4) {
- if (Math.abs(p[i] - q[i]) + Math.abs(p[i + 1] - q[i + 1]) + Math.abs(p[i + 2] - q[i + 2]) <= 48) continue;
- const px = (i / 4) % w, py = Math.floor(i / 4 / w);
- changed++; left = Math.min(left, px); right = Math.max(right, px); top = Math.min(top, py); bottom = Math.max(bottom, py);
- }
- done({ share: changed / (w * h), wide: changed ? (right - left + 1) / w : 0, tall: changed ? (bottom - top + 1) / h : 0 });
- });
- })`);
-}
-
-// The finder under reduced motion: nothing runs in it, with or without cards (no animation in the page is running, on
-// pseudo-elements too), and every How picture holds a still that shows something: captured with its parts and again with them
-// hidden (its dark square stays), the pixels that change are at least 0.3% of the picture and the box around them at least 1%.
-async function finderMotionProblems() {
- const problems = [];
- for (const query of ['?view=find', '?view=find&what=background']) {
- await openHome(query, problems);
- await sleep(500);
- const running = await evaluate(`document.getAnimations().filter(a => a.playState === 'running').map(a => {
- const t = a.effect && a.effect.target, cls = t && t.getAttribute && t.getAttribute('class');
- return (a.animationName || a.transitionProperty || 'an animation') + ' on ' + (t ? t.tagName.toLowerCase() + (cls ? '.' + cls.split(' ').join('.') : '') : 'the page') + ((a.effect && a.effect.pseudoElement) || '');
- })`);
- if (running.length) problems.push(`finder, reduced motion, ${query}: ${running.length} animations run (${[...new Set(running)].slice(0, 6).join(', ')})`);
- }
- const pics = await evaluate(`typeof FIND_Q === 'undefined' ? [] : FIND_Q.find(q => q.key === 'how').answers.map(a => a.pic)`);
- if (!pics.length) problems.push('finder, reduced motion: the page has no How answers');
- const frames = 'new Promise(done => requestAnimationFrame(() => requestAnimationFrame(done)))';
- const empty = [];
- for (const pic of pics) {
- const box = await evaluate(`(async () => { const p = document.querySelector('#finder .${pic}'); if (!p || !p.getClientRects().length) return null;
- p.scrollIntoView({ block: 'center' }); await ${frames};
- const b = p.getBoundingClientRect(); return { x: b.left + scrollX, y: b.top + scrollY, width: b.width, height: b.height }; })()`);
- if (!box || !box.width || !box.height) { empty.push(`${pic} (no picture)`); continue; }
- const drawn = (await send('Page.captureScreenshot', { format: 'png', clip: { ...box, scale: 1 } })).data;
- await evaluate(`(async () => { for (const el of document.querySelector('#finder .${pic}').children) el.style.visibility = 'hidden'; await ${frames}; })()`);
- const bare = (await send('Page.captureScreenshot', { format: 'png', clip: { ...box, scale: 1 } })).data;
- await evaluate(`{ for (const el of document.querySelector('#finder .${pic}').children) el.style.visibility = ''; }`);
- const seen = await pictureChange(drawn, bare);
- if (seen.share < .003 || seen.wide * seen.tall < .01) empty.push(`${pic} (${(seen.share * 100).toFixed(2)}% of the picture)`);
- }
- if (empty.length) problems.push(`finder, reduced motion: ${empty.length} How pictures show nothing: ${empty.join(', ')}`);
- return problems;
-}
-```
-
-- [ ] **Step 2: Call them** — in the main loop, inside `if (home) {…}`, right after `if (setup.moves) problems.push(...await homeCopyProblems());`, add:
-
-```js
- // The finder (?view=find): opened at every setup; the desktop run works it and the reduced-motion run holds it still.
- problems.push(...await finderLayoutProblems(name, setup));
- if (setup.moves) problems.push(...await finderViewProblems());
- if (setup.reduce) problems.push(...await finderMotionProblems());
-```
-
-- [ ] **Step 3: Syntax and the tests**
-
-Run: `cd "$WT/af-check" && node --check tools/check-pages.mjs && node --test "tests/*.test.js"`
-Expected: no syntax error; every test passes.
-
-- [ ] **Step 4: See the new steps fail before the finder exists.** Serve `af-check` on 8904, take a slot, run `node tools/check-pages.mjs --base http://127.0.0.1:8904 --out "$RUN/check-red" home`, free it, stop the server.
-Expected: six `FAIL` lines; every problem on them starts with `finder` (no Find button, the finder does not show, no Finder link, no How answers, and so on) and none is about the home page's own steps. This is the failing test for Tasks 3–5; they turn it into six `ok` lines.
-
-- [ ] **Step 5: Commit**
-
-```bash
-cd "$WT/af-check"
-git add tools/check-pages.mjs
-git commit -m "feat: the page check opens the finder at every home setup, works its answers, address, focus, Show all, Not here? and ways in on desktop, and holds it still under reduced motion"
-```
-
----
-
-### Task 8: Tag one category (seven lanes at once)
-
-Each lane runs this task for its own category, all seven at once, in the shared worktree `af-tags` (no lane changes any file of the repository). The coordinator gives each tagger only its `brief.md` (never this plan, the spec or `tests/finder.test.js`: they hold the test set).
-
-| Lane | Category | Folder | Cards |
-|---|---|---|---|
-| 01 | Scroll-Based | `animations/01-scroll-based` | 27 |
-| 02 | Entrance & Exit | `animations/02-entrance-and-exit` | 14 |
-| 03 | Page Transitions | `animations/03-page-transitions` | 16 |
-| 04 | Micro-Interactions | `animations/04-micro-interactions` | 41 |
-| 05 | Text & Typography | `animations/05-text-typography` | 19 |
-| 06 | 3D & Advanced | `animations/06-3d-advanced` | 26 |
-| 07 | Ambient & Background | `animations/07-ambient-background` | 23 |
-
-**Files:**
-- Create (run folder): `$RUN/lanes/<NN>/tags.md`, `$RUN/lanes/<NN>/stills/`
-- No file in git changes.
-
-**Interfaces:**
-- Consumes: `card-facts.mjs`, `lint-tags.mjs`, the slot pool and the server on 8905 (Task 0).
-- Produces: `$RUN/lanes/<NN>/tags.md`: a title line, then one table `| slug | what | when | how | reason |` with one row per card of the category in home order, keys from the brief separated by single spaces, main first, read by Task 9, Task 11 (`assemble-find.mjs`) and Task 14.
-
-The tagger's brief (`$RUN/lanes/<NN>/brief.md`, written by Task 0 with the lane's values):
-
-````markdown
-# Finder answers for <NN> · <Category> (<count> cards)
-
-The handbook is getting an Animation finder for people who saw an animation on a website and do not know its name. They answer
-three questions with picture buttons, and the animations whose answers match come first, with their names. You give each animation
-of one category the answers a visitor who saw it would pick. Your answers decide whether they find it.
-
-Read only this brief, the pages and the files it names. Do not open `docs/superpowers/specs/2026-10-13-animation-finder-design.md`,
-`docs/superpowers/plans/2026-10-13-animation-finder.md` or `tests/finder.test.js`: they hold the described effects your answers are
-scored against, and seeing them would spoil the score. Change no file of the repository; you write only `$RUN/lanes/<NN>/tags.md`.
-
-## The three questions
-
-**1 · What moved?** `text` Text or numbers · `card` A picture or card · `button` A button or icon · `menu` A menu or form ·
-`loader` A loading sign or message · `shape` A line or shape · `particles` Dots or particles · `background` The background ·
-`page` The whole page.
-
-**2 · When did it move?** `scroll` When I scrolled · `hover` When I pointed at it · `click` When I clicked or tapped ·
-`drag` When I dragged or swiped · `load` When the page opened · `newpage` When I went to another page · `loop` By itself, again
-and again.
-
-**3 · How did it move?** The visitor picks the picture closest to what they saw.
-
-| Key | Answer | Its picture | For example |
-|---|---|---|---|
-| `fade` | Faded or blurred | a square fades and sharpens | Fade In / Fade Out, Blur In |
-| `slide` | Slid | a square slides in from the side | Slide In, Hide-on-Scroll Header |
-| `grow` | Grew or shrank | a square grows from small | Scale In / Zoom In, Zoom Into Image |
-| `turn` | Turned or flipped | a card turns over | 3D Flip Card, Loading Spinner |
-| `bounce` | Bounced or shook | a ball bounces | Bounce In, Error Shake |
-| `stagger` | One after another | three bars appear in turn | Stagger Reveal, Word-by-Word Reveal |
-| `pieces` | Broke into pieces | a square splits and flies apart | Shatter Effect, Success Confetti |
-| `follow` | Followed my pointer | a dot trails an arrow | Cursor Follower, Magnetic Button |
-| `color` | Changed color or glowed | a band of color shifts | Animated Gradient Background, Text Fill on Scroll |
-| `morph` | Changed into something else | a circle becomes a square | Hamburger Menu Toggle, Text Morphing |
-| `draw` | Drew or typed itself | a line draws itself | SVG Path Animation, Typewriter Effect |
-| `reveal` | Got uncovered | a panel wipes off a picture | Clip-Path Reveal, Curtain Reveal |
-| `layers` | Moved in layers | three bands slide at different speeds | Parallax Scrolling, 2.5D / Pseudo-3D |
-| `pin` | Stayed in place while I scrolled | a box holds while lines pass it | Pin Animation, Stacking Cards |
-| `drift` | Drifted or floated | dots drift | Floating Elements, Starfield / Space Particles |
-| `wave` | Rippled or waved | rings spread | Ambient Ripple Effect, Wavy Text |
-| `glitch` | Glitched or flickered | a bar jitters in red and blue | Glitch Text, Neon Flicker |
-
-Each question also has Not sure, which leaves it out.
-
-## How your answers are used
-
-For each question the visitor answers, an animation's first (main) answer counts double, its other answers count once, and having
-none of the visitor's answer is a miss. Animations that miss nothing come first, those that miss one come after. So put first the
-answer most people would pick, add the ones people might pick instead, and add nothing the effect does not show.
-
-## Rules
-
-- Tag what a visitor sees and would say, not how it is built.
-- What: 1 to 3 keys; the first is what the demo moves.
-- When: 1 to 3 keys: every trigger the effect is commonly used with on real sites, not only the demo's (a fade plays when the page
- opens, on scroll and on click), the most common first.
-- How: 1 to 4 keys: the most visible movement first, then the ones a visitor might name instead.
-- A technique that drives many effects (Scroll-Triggered Animation, View Transitions API, FLIP Technique, Scrub Animation) takes
- only the movements its own demo shows.
-- Not sure is never an answer.
-- Every page transition (category 03) answers `newpage`; every loop page (kind `loop`) answers `loop`; every Scroll-Based page
- (category 01) and every scroll page (kind `scroll`) answers `scroll`. The lint checks these three.
-
-## What to read for each card
-
-From the root of the `af-tags` worktree, `node $RUN/card-facts.mjs <NN> $RUN` prints, for every card in home order, its home card
-line and places, its page's kind, title, lede, prompt (what the viewer sees, in plain words), Good for and Avoid on, and its
-README's What it is and When to use it. Look at each card's desktop still with the Read tool (the path card-facts prints); when the
-still caught a quiet moment, read the stage's markup and script in the page itself.
-
-## Format
-
-`$RUN/lanes/<NN>/tags.md`: the title line `# Finder answers · <NN> <Category>`, a blank line, then one table with one row per card,
-in the order card-facts prints:
-
-| slug | what | when | how | reason |
-|---|---|---|---|---|
-
-The keys in a cell are separated by single spaces, main first. The reason is one line, at most about 25 words, saying what a
-visitor sees and why these answers.
-
-## Worked rows
-
-The first two are the spec's own examples; the third follows the same rules. They show the format; judge every card yourself.
-
-| slug | what | when | how | reason |
-|---|---|---|---|---|
-| parallax-scrolling | background card | scroll | layers | Far and near layers of a landscape slide at different speeds as you scroll; visitors name the layered background, sometimes the picture. |
-| slide-in | card menu loader | load click | slide fade | A panel travels in from an edge, as a card, a menu or a notification, when the page opens or after a click; some remember only a fade. |
-| loading-spinner | loader | load loop | turn | Small shapes spin round while something loads, again and again: a loading sign that turns. |
-
-## Done when
-
-`node $RUN/lint-tags.mjs $RUN/lanes/<NN>/tags.md`, run from the `af-tags` root, prints `ok`. Then report: the number of cards, the
-rows you were least sure of, and why.
-````
-
-- [ ] **Step 1: The failing check**
-
-Run: `cd "$WT/af-tags" && node "$RUN/lint-tags.mjs" "$RUN/lanes/<NN>/tags.md"`
-Expected: `Usage: node lint-tags.mjs …` (exit 2): there is no ledger yet.
-
-- [ ] **Step 2: Start the stills** (background). Take a slot, then
-`cd "$WT/af-tags" && node tools/check-pages.mjs --base http://127.0.0.1:8905 --out "$RUN/lanes/<NN>/stills" <folder>`
-(10 to 45 minutes; a `FAIL` line does not matter here, the run is for its pictures). Free the slot when it ends.
-
-- [ ] **Step 3: Read the cards**
-
-Run: `cd "$WT/af-tags" && node "$RUN/card-facts.mjs" <NN> "$RUN"`
-Read every card's facts; once the stills exist, look at every `<NN>-<slug>-desktop.png`.
-
-- [ ] **Step 4: Write the ledger** — `$RUN/lanes/<NN>/tags.md` in the brief's format, one row per card, by the brief's rules.
-
-- [ ] **Step 5: Lint until clean**
-
-Run: `cd "$WT/af-tags" && node "$RUN/lint-tags.mjs" "$RUN/lanes/<NN>/tags.md"`
-Expected: `ok: <count> cards of <NN> <Category>`. Fix every problem it prints and run it again.
-
-- [ ] **Step 6: Record** (the run folder is outside git, so nothing is committed): add to `$RUN/progress.md` the line `Lane <NN>: tags written, lint ok, <count> cards; least sure: <slugs>`.
-
----
-
-### Task 9: Check one category's tags (seven checkers)
-
-Runs for a lane as soon as its Task 8 is done, by a fresh agent (never the tagger), given only `$RUN/lanes/<NN>/check-brief.md`.
-
-**Files:**
-- Create (run folder): `$RUN/lanes/<NN>/check.md`
-- Modify (run folder, by the tagger): `$RUN/lanes/<NN>/tags.md`
-
-**Interfaces:**
-- Consumes: the lane's `tags.md`, `stills/`, `card-facts.mjs`, `lint-tags.mjs`; the other lanes' `tags.md` that exist.
-- Produces: `$RUN/lanes/<NN>/check.md` with `Verdict: approved` (Task 11 reads only approved lanes) or `Verdict: changes` and a table `| slug | now | change to | why |`.
-
-The checker's brief (`$RUN/lanes/<NN>/check-brief.md`, written by Task 0 with the lane's values):
-
-````markdown
-# Check: finder answers for <NN> · <Category>
-
-Another agent gave each animation of this category the answers a visitor would pick in the handbook's Animation finder
-(`$RUN/lanes/<NN>/tags.md`, made by the rules of `$RUN/lanes/<NN>/brief.md`; read that brief first). You check them. Do not open
-`docs/superpowers/specs/2026-10-13-animation-finder-design.md`, `docs/superpowers/plans/2026-10-13-animation-finder.md` or
-`tests/finder.test.js`. Change no file of the repository and do not edit `tags.md`: you write `$RUN/lanes/<NN>/check.md`.
-
-For each row, beside the card's facts (`node $RUN/card-facts.mjs <NN> $RUN`, from the root of the `af-tags` worktree) and its
-desktop still:
-1. Is the first What the thing the demo moves?
-2. Does When hold every trigger the effect is commonly used with on real sites, the most common first, and nothing it is never
- used with?
-3. Is the first How the most visible movement, and is every other How one a visitor might name instead? Nothing the effect does
- not show?
-4. Are the answers what a visitor sees and would say, not how it is built? Does a technique page (Scroll-Triggered Animation,
- View Transitions API, FLIP Technique, Scrub Animation) take only the movements its own demo shows?
-5. Across categories: read the other lanes' `tags.md` that exist. The same kind of effect should get the same answers wherever it
- sits (a fade in 02 and a crossfade in 03 both answer `fade`; every page that holds still while you scroll answers `pin`).
-6. `node $RUN/lint-tags.mjs $RUN/lanes/<NN>/tags.md` prints `ok`.
-
-Write `$RUN/lanes/<NN>/check.md`: the line `Verdict: approved` or `Verdict: changes`, then for changes one table
-`| slug | now | change to | why |`, one row per row to change (the whole what · when · how before and after, and one line why).
-The tagger applies the changes or answers in the same file why not; you check those rows again. After two rounds the
-coordinator decides what stays open.
-````
-
-- [ ] **Step 1: The failing check:** the lane has no `check.md`; `grep -s '^Verdict: approved' "$RUN/lanes/<NN>/check.md" || echo "not approved"` prints `not approved`.
-- [ ] **Step 2: Check every row** by the brief's six questions; write `check.md`.
-- [ ] **Step 3: The tagger applies the changes** (the same agent as the lane's Task 8, resumed), runs the lint (`ok`), and notes each change it did not make, with why, under the table in `check.md`.
-- [ ] **Step 4: Re-check the changed rows;** set `Verdict: approved` when none is left open, or, after the second round, list what is still open for the coordinator.
-- [ ] **Step 5: Record:** `grep '^Verdict: approved' "$RUN/lanes/<NN>/check.md"` prints the line; add `Lane <NN>: checked, approved, <n> rows changed` to `$RUN/progress.md`. When all seven lanes are approved, stop the server on 8905.
-
----
-
-### Task 10: Merge the lanes (coordinator)
-
-**Files:**
-- Modify: nothing new; the merges of `af/logic`, `af/404`, `af/check`, `af/pics` and `af/view` into `feat/animation-finder`
-
-**Interfaces:**
-- Consumes: Tasks 1–7, each reviewed and approved.
-- Produces: `feat/animation-finder` with the whole finder on draft answers: every test passes, the home check gives six `ok` lines.
-
-- [ ] **Step 1: Every code lane is merged**
-
-```bash
-for b in af/logic af/404 af/check af/pics af/view; do git -C "$WT/af-int" merge-base --is-ancestor "$b" feat/animation-finder && echo "$b merged" || echo "$b NOT merged"; done
-```
-
-Expected: five `merged` lines. Merge any that is not (`git -C "$WT/af-int" merge --no-ff <branch> -m "Merge <branch>: <what it adds>"`); a conflict is resolved by the file map (each task keeps its own lines).
-
-- [ ] **Step 2: Only the finder's files changed**
-
-Run: `git -C "$WT/af-int" diff --stat main...feat/animation-finder`
-Expected: only `index.html`, `tests/finder.test.js`, `tests/pages.test.js`, `tools/check-pages.mjs`, `tools/make-social-image.mjs`, `404.html`, `.github/ISSUE_TEMPLATE/animation_not_here.yml` and `.github/ISSUE_TEMPLATE/config.yml`.
-
-- [ ] **Step 3: Tests and the home check**
-
-Run: `cd "$WT/af-int" && node --test "tests/*.test.js"` — expected: every test passes.
-Serve `af-int` on 8906 (it serves Tasks 11–16 too), take a slot, run `node tools/check-pages.mjs --base http://127.0.0.1:8906 --out "$RUN/int-draft" home`, free it.
-Expected: six `ok` lines.
-
-- [ ] **Step 4: Record** in `$RUN/progress.md`: `Integration: all code lanes merged at <hash>; <n> tests pass; home six ok on draft answers`.
-
----
-
-### Task 11: The reviewed answers and the test set
-
-**Files:**
-- Modify: `index.html` — the `FIND` block right after `PLACES` (the draft is replaced)
-- Modify: `tests/finder.test.js` — under `// ── Every card's answers and the test set ──`
-- Create (run folder): `$RUN/assemble-find.mjs`, `$RUN/tag-fixes.md`
-
-**Interfaces:**
-- Consumes: the seven approved `$RUN/lanes/<NN>/tags.md` (Task 9); `readHome`, `tagRows` (Task 0); `finder()`, `homeConst`, `read`, `HOME` in the tests (Task 1).
-- Produces: the reviewed `FIND` with the comment line `// What moved, when and how: the finder's answers for each card, the main one first.`; `CASES` (the spec's 28 described effects) in `tests/finder.test.js`, which the ten new animations' integration extends (Ink Spread Reveal joins case 9).
-
-- [ ] **Step 1: Write the failing tests** — under `// ── Every card's answers and the test set ──` and its comment line:
-
-```js
-test('FIND holds the reviewed answers, not the draft', () => {
- assert.match(HOME, /\/\/ What moved, when and how: the finder's answers for each card, the main one first\.\r?\nconst FIND=\{/);
-});
-
-test('every answer of every question is given to at least one card', () => {
- const find = Object.values(homeConst('FIND'));
- homeConst('FIND_Q').forEach((q, i) => {
- for (const a of q.answers) assert.ok(find.some(row => row[i].split(' ').includes(a.key)), `no card answers ${q.key} ${a.key}`);
- });
-});
-
-test('the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll', () => {
- const find = homeConst('FIND'), problems = [];
- for (const cat of homeConst('CATS')) {
- for (const [slug] of cat.entries) {
- const kind = (read(path.join(ROOT, cat.folder, slug, 'index.html')).match(/data-hb-kind="(\w+)"/) || [])[1];
- const when = find[slug][1].split(' ');
- if (cat.n === '03' && !when.includes('newpage')) problems.push(`${slug}: a page transition without newpage`);
- if (kind === 'loop' && !when.includes('loop')) problems.push(`${slug}: a loop page without loop`);
- if ((cat.n === '01' || kind === 'scroll') && !when.includes('scroll')) problems.push(`${slug}: a scroll page without scroll`);
- }
- }
- assert.deepEqual(problems, []);
-});
-
-// The finder spec's 28 described effects (section 9), frozen before any answers existed: the answers a visitor would pick ('' for
-// Not sure) and the animations that count as right. The right lists only grow; a miss is fixed by changing FIND, never a case.
-const CASES = [
- [1, 'card', 'scroll', 'pieces', ['Shatter Effect', 'Dissolve Transition']],
- [2, 'background', 'loop', 'color', ['Mesh Gradient Animation', 'Animated Gradient Background']],
- [3, 'text', 'load', 'stagger', ['Letter-by-Letter Stagger', 'Split Text Reveal', 'Word-by-Word Reveal']],
- [4, 'card', 'load', 'grow', ['Scale In / Zoom In']],
- [5, 'card', 'hover', 'grow', ['Hover State Animation']],
- [6, '', 'scroll', 'pin', ['Pin Animation', 'Sticky Section', 'Scrollytelling']],
- [7, 'card', 'scroll', 'grow', ['Zoom Into Image']],
- [8, '', 'scroll', 'layers', ['Parallax Scrolling', 'Parallax Depth-of-Field']],
- [9, 'page', 'click', '', ['Circle Reveal', 'Overlay Wipe', 'Portal / Tunnel Zoom']],
- [10, 'text', 'load', 'reveal', ['Curtain Reveal', 'Text Clip-Path Reveal']],
- [11, 'page', 'scroll', 'slide', ['Smooth (Inertia) Scroll']],
- [12, 'card', 'scroll', 'turn', ['Scroll Image Sequence', 'Scrub Animation', 'Scroll-Driven 3D Rotation']],
- [13, 'text', 'scroll', 'color', ['Text Fill on Scroll']],
- [14, 'card', 'hover', 'follow', ['Spotlight Hover Glow']],
- [15, 'shape', 'loop', 'turn', ['3D Model Orbit']],
- [16, 'button', 'click', 'morph', ['Hamburger Menu Toggle']],
- [17, 'button', 'hover', 'follow', ['Magnetic Button']],
- [18, 'card', 'hover', 'turn', ['Parallax 3D Tilt', 'Holographic Card']],
- [19, 'loader', 'load', 'color', ['Skeleton Loader', 'Shimmer Effect']],
- [20, 'text', 'scroll', '', ['Counter Animation', 'Rolling Numbers']],
- [21, 'page', 'scroll', 'slide', ['Horizontal Scroll']],
- [22, 'menu', 'scroll', 'slide', ['Hide-on-Scroll Header']],
- [23, 'card', 'hover', 'follow', ['Image Trail']],
- [24, 'particles', 'loop', 'drift', ['Particle Constellation', 'Canvas Particle Effect']],
- [25, 'text', 'loop', 'glitch', ['Glitch Text', 'Chromatic Aberration']],
- [26, 'particles', 'loop', 'drift', ['Snow / Rain']],
- [27, 'page', 'newpage', 'slide', ['Overlay Wipe', 'Slide Transition']],
- [28, 'particles', 'click', 'pieces', ['Success Confetti']]
-];
-
-test('the test set: a right animation among the first 6 for at least 24 of the 28 described effects, and among the first 12 for at least 27', t => {
- const page = finder(), names = new Set(homeConst('CATS').flatMap(cat => cat.entries.map(e => e[1])));
- let in6 = 0, in12 = 0;
- for (const [n, what, when, how, right] of CASES) {
- for (const name of right) assert.ok(names.has(name), `case ${n}: no card is named ${name}`);
- const found = page.findMatches({ what, when, how }), list = [...found.best, ...found.close].map(e => e.name);
- const position = list.findIndex(name => right.includes(name)) + 1; // 0: not found
- if (position && position <= 6) in6++;
- if (position && position <= 12) in12++;
- t.diagnostic(`case ${n} (${[what, when, how].map(a => a || 'Not sure').join(' · ')}): ${position ? `${list[position - 1]} at ${position}` : 'not found'}` +
- (!position || position > 6 ? `; first six: ${list.slice(0, 6).join(', ')}` : ''));
- }
- assert.ok(in6 >= 24, `${in6} of 28 cases have a right animation among the first 6 (at least 24)`);
- assert.ok(in12 >= 27, `${in12} of 28 cases have a right animation among the first 12 (at least 27)`);
-});
-```
-
-- [ ] **Step 2: Run them and see them fail on the draft**
-
-Run: `cd "$WT/af-int" && node --test --test-reporter=spec tests/finder.test.js`
-Expected: `FIND holds the reviewed answers, not the draft`, the answer coverage test, the rules test and the test set FAIL (the draft gives every card of a category the same When and How); the diagnostics print each case's position.
-
-- [ ] **Step 3: Lint the seven lanes from the integration worktree**
-
-```bash
-cd "$WT/af-int" && for n in 01 02 03 04 05 06 07; do grep -q '^Verdict: approved' "$RUN/lanes/$n/check.md" || echo "lane $n not approved"; node "$RUN/lint-tags.mjs" "$RUN/lanes/$n/tags.md"; done
-```
-
-Expected: seven `ok: …` lines and no `not approved`.
-
-- [ ] **Step 4: The assembler** — create `$RUN/assemble-find.mjs`:
-
-```js
-#!/usr/bin/env node
-// Writes the reviewed finder answers into index.html: every row of the seven lanes' tags.md, in home order, as the FIND block right
-// after PLACES. It replaces the block that is there (the draft, or one an earlier run wrote), with its comment line. Run from the
-// root of the af-int worktree: node <run folder>/assemble-find.mjs <run folder>
-import { readFileSync, writeFileSync } from 'node:fs';
-import { join } from 'node:path';
-import { readHome, tagRows } from './home-data.mjs';
-
-const RUN = process.argv[2];
-if (!RUN) { console.error('Usage: node assemble-find.mjs <run folder>'); process.exit(2); }
-const home = readHome(), CATS = home.valueOf('CATS'), rows = new Map(), problems = [];
-for (const cat of CATS) {
- for (const [slug, what, when, how] of tagRows(readFileSync(join(RUN, 'lanes', cat.n, 'tags.md'), 'utf8'))) {
- if (rows.has(slug)) problems.push(`${slug}: in two rows`);
- rows.set(slug, [what, when, how]);
- }
-}
-const slugs = CATS.flatMap(cat => cat.entries.map(e => e[0]));
-for (const slug of slugs) if (!rows.has(slug)) problems.push(`${slug}: no row in any lane`);
-for (const slug of rows.keys()) if (!slugs.includes(slug)) problems.push(`${slug}: not a card of the home page`);
-if (problems.length) { console.error(problems.join('\n')); process.exit(1); }
-const block = ["// What moved, when and how: the finder's answers for each card, the main one first.", 'const FIND={'];
-CATS.forEach((cat, c) => {
- block.push(` // ${cat.n}`);
- cat.entries.forEach(([slug], i) => {
- const last = c === CATS.length - 1 && i === cat.entries.length - 1;
- block.push(` '${slug}':[${rows.get(slug).map(v => `'${v}'`).join(',')}]${last ? '' : ','}`);
- });
-});
-block.push('};');
-// The block that is there: from the comment line right above "const FIND={" to the ";" after its closing brace.
-const decl = home.text.indexOf('const FIND={');
-if (decl < 0) { console.error('index.html has no const FIND={'); process.exit(1); }
-const from = home.text.lastIndexOf(home.eol, decl - home.eol.length - 1) + home.eol.length;
-if (!home.text.slice(from, decl).startsWith('//')) { console.error('the line above const FIND={ is not its comment'); process.exit(1); }
-const to = home.blockEnd(home.text.indexOf('{', decl)) + 2; // past the "};"
-writeFileSync('index.html', home.text.slice(0, from) + block.join(home.eol) + home.text.slice(to));
-console.log(`Wrote FIND: ${slugs.length} cards from the seven lanes`);
-```
-
-Run: `cd "$WT/af-int" && node "$RUN/assemble-find.mjs" "$RUN"` — expected: `Wrote FIND: 166 cards from the seven lanes`; `git diff --stat` shows only `index.html`.
-
-- [ ] **Step 5: Run the tests**
-
-Run: `cd "$WT/af-int" && node --test --test-reporter=spec "tests/*.test.js"`
-Expected: every test passes, the test set with at least 24 of 28 in the first 6 and 27 in the first 12. Copy the 28 diagnostic lines into `$RUN/progress.md`.
-
-- [ ] **Step 6: If the test set falls short, fix answers, never cases.** For each case not in the first 6, read its diagnostic line (the first six it shows) and the right animation's row. Change a row only where the change is itself true by the brief's rules: give the right animation an answer a visitor who saw it would give, or take from another card an answer its effect does not show. Never add an answer just to win a case. Write each change into `$RUN/tag-fixes.md` (`| slug | was | now | case | why |`), make it in the lane's `tags.md`, run that lane's lint, then Steps 4 and 5 again. At most three rounds; if the target is still not met, stop and tell the coordinator, who shows the owner (Task 15) the cases and the rows.
-
-- [ ] **Step 7: The home check on the reviewed answers.** Take a slot, run `node tools/check-pages.mjs --base http://127.0.0.1:8906 --out "$RUN/int-answers" home`, free it.
-Expected: six `ok` lines (the desktop run checks that Hide-on-Scroll Header comes in the first six for case 22's answers).
-
-- [ ] **Step 8: Commit**
-
-```bash
-cd "$WT/af-int"
-git add index.html tests/finder.test.js
-git commit -m "feat: the finder's reviewed answers for all 166 animations, and the test set of 28 described effects with its target"
-```
-
----
-
-### Task 12: The held-out set
-
-A fresh research agent, once Task 11 is committed, beside Task 13. It may use the web; it must not read `FIND`, run the finder or open `$RUN/tag-fixes.md` before its cases are frozen.
-
-**Files:**
-- Create (run folder): `$RUN/held-out.md`
-
-**Interfaces:**
-- Consumes: the spec (its section 2 for the questions, section 9 for the 28 cases it must not repeat); `docs/superpowers/specs/2026-10-13-famous-effects-design.md` in the main checkout (the Famous effects list); the home page's card names (`CATS`).
-- Produces: `$RUN/held-out.md`, a table `| # | Source | What they described | What | When | How | Right if one of |` with 10 rows (`-` for Not sure; right names separated by `; `, each exactly a card's name in `CATS`), read by Task 14's `run-cases.mjs`.
-
-- [ ] **Step 1: The failing check:** `test -f "$RUN/held-out.md" || echo "no held-out set"` prints `no held-out set`.
-- [ ] **Step 2: Gather ten real cases** not among the spec's 28: new "what is this animation called?" threads (r/css, r/Frontend, r/web_design, the GSAP, Webflow and freeCodeCamp forums) and effects from the Famous effects list (which may give Stripe's 2026 ribbon). For each: the link, what the person described (one plain line), the answers a visitor would pick from that description alone, and the animations that count as right (the thread's accepted answer, or the technique the effect uses), named exactly as on the home page's cards.
-- [ ] **Step 3: Write `$RUN/held-out.md`** in the format above, with a line on top: `Frozen on <date> by <agent>, before running the finder. Never used to change answers.`
-- [ ] **Step 4: Record** in `$RUN/progress.md`: `Held-out set: 10 cases frozen, <sources>`. The agent does not run the cases; Task 14 does.
-
----
-
-### Task 13: Main, the docs and the generated files
-
-Runs in `af-int` once Task 11 is committed, beside Task 12. The docs are written now, on top of what `main` holds (coordination file).
-
-**Files:**
-- Merge: `main` into `feat/animation-finder` (coordination rule 2), if `main` has moved
-- Modify: `CLAUDE.md` — step 6 of "When asked to add a new animation" (lines 210–219 on main) and the Home page line of "Tests and the page check" (lines 260–263)
-- Modify: `CONTRIBUTING.md` — step 5 of "Adding a new technique" (lines 77–89) and the home check paragraph (lines 302–307)
-- Modify: `.github/pull_request_template.md` — after line 21 (the `CATS` checkbox)
-- Modify: `README.md` — How to use it, step 1 (line 31)
-- Modify: `CHANGELOG.md` — under `## Unreleased` (line 5)
-- Generated: `sitemap.xml` (the home page's date), `og-image.png` (must stay as it is), `llms.txt` and `skills/` (must stay as they are)
-
-**Interfaces:**
-- Consumes: the merged finder (Tasks 1–11).
-- Produces: the docs' finder lines (each project writes only its own lines); generated files written by their tools.
-
-- [ ] **Step 1: Take main's latest commits**
-
-```bash
-cd "$WT/af-int"
-git merge-base --is-ancestor main feat/animation-finder && echo "main is in" || git merge --no-ff --no-commit main
-```
-
-If it merged: resolve any conflict by the coordination file's map (each project keeps its own lines; a resolution that needs more than keeping both sides goes to a fresh reviewer) and `git add` each resolved file, then write the generated files again and commit them in the merge:
-
-```bash
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-# take a slot; the server on 8906 serves this worktree
-node tools/make-social-image.mjs --base http://127.0.0.1:8906
-# free the slot
-git add -A sitemap.xml llms.txt skills og-image.png
-git commit -m "Merge main into feat/animation-finder before its release"
-node --test "tests/*.test.js"
-```
-
-Expected: every test passes.
-
-- [ ] **Step 2: The failing check** — the docs do not name the finder's lines yet:
-
-Run: `cd "$WT/af-int" && grep -c "FIND" CLAUDE.md CONTRIBUTING.md .github/pull_request_template.md; grep -c "?view=find" README.md; grep -c "Animation finder" CHANGELOG.md`
-Expected: `0` for each file.
-
-- [ ] **Step 3: `CLAUDE.md`.** In step 6, after the sentence `Without one the card shows the category's generic picture.`, add:
-
-```markdown
- Give it its finder answers in `FIND` too, a row right after `PLACES` in `CATS` order:
- `'slug':['what','when','how']`, each a space-separated list of answer keys from `FIND_Q`, the main one first. What takes 1–3
- (the main one is what the demo moves), When 1–3 (every trigger the effect is commonly used with, the most common first) and
- How 1–4 (the most visible movement first, then the ones a visitor might name instead). Tag what a visitor sees and would say,
- not how it is built; a page transition answers `newpage`, a loop page `loop`, a Scroll-Based or scroll page `scroll`.
- `tests/finder.test.js` checks the row and runs the finder's test set.
-```
-
-In the **Home page:** line of "Tests and the page check", before `Run it after changing any page's settings or prompt.`, add:
-
-```markdown
-Every setup also opens the finder (`?view=find`): its desktop run works the answers, See N matches,
- Start over, Show all, the Not here? link and the ways in, and its reduced-motion run checks that every How picture holds a still.
-```
-
-- [ ] **Step 4: `CONTRIBUTING.md`.** In step 5, after `one the card shows the category's generic picture.`, add:
-
-```markdown
- Give it its finder answers in `FIND` too, a row right after `PLACES` in `CATS` order:
- `'slug':['what','when','how']`, each a space-separated list of answer keys from `FIND_Q`, the
- main one first. What takes 1–3 (the main one is what the demo moves), When 1–3 (every trigger
- the effect is commonly used with, the most common first) and How 1–4 (the most visible movement
- first, then the ones a visitor might name instead). Tag what a visitor sees and would say, not
- how it is built; a page transition answers `newpage`, a loop page `loop`, a Scroll-Based or
- scroll page `scroll`. `tests/finder.test.js` checks the row and runs the finder's test set.
-```
-
-In the home check paragraph, before `Run it after changing any page's settings or prompt.`, add:
-
-```markdown
-Every setup also opens the finder (`?view=find`): its desktop run works the answers, See N
-matches, Start over, Show all, the Not here? link and the ways in, and its reduced-motion run
-checks that every How picture holds a still.
-```
-
-- [ ] **Step 5: `.github/pull_request_template.md`.** After the line that starts `- [ ] A card in the category's \`entries\``, add:
-
-```markdown
-- [ ] Its finder answers in `FIND`, main first: a row right after `PLACES`, in `CATS` order (`tests/finder.test.js` checks it and runs the finder's test set)
-```
-
-- [ ] **Step 6: `README.md`.** Step 1 of How to use it becomes:
-
-```markdown
-1. **Find it.** On the [home page](https://matinmonshizadeh.github.io/animation-handbook/), pick where the animation goes — Buttons, Text, Images & cards, Backgrounds, Menus & forms, Loading & messages, Page intros, Scrolling, or Page changes — or describe it in your own words, like "a button that bounces when clicked", or, if you saw it somewhere and don't know its name, answer three questions in the [finder](https://matinmonshizadeh.github.io/animation-handbook/?view=find).
-```
-
-- [ ] **Step 7: `CHANGELOG.md`.** Right under `## Unreleased` and its blank line, add:
-
-```markdown
-- The Animation finder: saw an animation on a website and don't know its name? Answer three short questions on the home page
- (what moved, when and how) and the animations that match play, with their names. Not here? opens a short GitHub form.
-```
-
-- [ ] **Step 8: Generated files and every check**
-
-```bash
-cd "$WT/af-int"
-node tools/update-sitemap.mjs && node tools/make-skill.mjs && git status --short sitemap.xml llms.txt skills
-```
-
-Expected: at most `sitemap.xml` changed, and only on its first `<url>` line (the home page's `lastmod`; nothing if Step 1 already wrote it); `llms.txt` and `skills/` unchanged. Take a slot, run `node tools/make-social-image.mjs --base http://127.0.0.1:8906`, then `node tools/check-pages.mjs --base http://127.0.0.1:8906 --out "$RUN/int-docs" home`, free the slot. Expected: `git status --short og-image.png` prints nothing (the picture is unchanged), and six `ok` lines. Run `node --test "tests/*.test.js"`: every test passes.
-
-- [ ] **Step 9: Commit**
-
-```bash
-cd "$WT/af-int"
-git add CLAUDE.md CONTRIBUTING.md .github/pull_request_template.md README.md CHANGELOG.md sitemap.xml
-git commit -m "docs: a new animation gets its finder answers, the home check names the finder, the README points to it and the changelog lists it under Unreleased; the sitemap dates the home page"
-```
-
----
-
-### Task 14: Final review (three reviewers at once)
-
-**Files:**
-- Create (run folder): `$RUN/run-cases.mjs`, `$RUN/final-review-tags.md`, `$RUN/final-review-code.md`, `$RUN/final-review-visual.md`
-- Fixes, if any, go into `af-int` by the original builders (the coordinator dispatches them)
-
-**Interfaces:**
-- Consumes: `feat/animation-finder` after Tasks 11 and 13; `$RUN/held-out.md` (Task 12); `readHome` (Task 0).
-- Produces: three verdicts; the held-out result (`N of 10 in the first 6`).
-
-- [ ] **Step 1: A frozen checkout and the case runner.** `git -C "$MAIN" worktree add --detach "$WT/af-final" feat/animation-finder`; serve it on 8907. Create `$RUN/run-cases.mjs`:
-
-```js
-#!/usr/bin/env node
-// Runs described effects through the finder as the page runs it and prints where the first right animation comes, and the totals.
-// The cases are a table | # | Source | What they described | What | When | How | Right if one of | ("-" for Not sure; right names
-// separated by "; "). Usage, from the root of a checkout of feat/animation-finder: node <run folder>/run-cases.mjs <cases.md>
-import { readFileSync } from 'node:fs';
-import vm from 'node:vm';
-import { readHome } from './home-data.mjs';
-
-const home = readHome(), CATS = home.valueOf('CATS');
-const context = vm.createContext({ CATS, PLACES: home.valueOf('PLACES'), FIND_Q: home.valueOf('FIND_Q'), FIND: home.valueOf('FIND') });
-vm.runInContext(home.text.slice(home.text.indexOf('const PLACE_LIST=['), home.text.indexOf('const BY_SLUG=')), context);
-for (const name of ['findScore', 'findMatches']) vm.runInContext(home.functionSource(name), context);
-const names = new Set(CATS.flatMap(cat => cat.entries.map(e => e[1])));
-let cases = 0, in6 = 0, in12 = 0;
-for (const line of readFileSync(process.argv[2], 'utf8').split(/\r?\n/)) {
- const cells = line.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map(c => c.trim());
- if (cells.length !== 7 || !/^\d+$/.test(cells[0])) continue;
- const [n, , , what, when, how, rightCell] = cells, right = rightCell.split(';').map(s => s.trim()).filter(Boolean);
- for (const name of right) if (!names.has(name)) console.log(`case ${n}: no card is named "${name}"`);
- const answers = { what: what === '-' ? '' : what, when: when === '-' ? '' : when, how: how === '-' ? '' : how };
- const found = context.findMatches(answers), list = [...found.best, ...found.close].map(e => e.name);
- const position = list.findIndex(name => right.includes(name)) + 1;
- cases++; if (position && position <= 6) in6++; if (position && position <= 12) in12++;
- console.log(`case ${n} (${[what, when, how].join(' · ')}): ${position ? `${list[position - 1]} at ${position}` : 'not found'}; first six: ${list.slice(0, 6).join(', ')}`);
-}
-console.log(`${in6} of ${cases} in the first 6, ${in12} of ${cases} in the first 12`);
-```
-
-Check it on two of the spec's cases: write `$RUN/two-cases.md` with the rows `| 16 | spec | menu icon | button | click | morph | Hamburger Menu Toggle |` and `| 22 | spec | header hides | menu | scroll | slide | Hide-on-Scroll Header |`, run `cd "$WT/af-final" && node "$RUN/run-cases.mjs" "$RUN/two-cases.md"`. Expected: the same positions the test set's diagnostics gave for cases 16 and 22 in Task 11. Delete `two-cases.md`.
-
-- [ ] **Step 2: Reviewer A, the answers** (a fresh agent; it may now read everything). Reads the 166 rows of `FIND` beside each card's facts (`node $RUN/card-facts.mjs <NN> $RUN` from `af-final`) and its desktop still in `$RUN/lanes/<NN>/stills/`, asking of each row "would someone who saw this pick these?"; reads `$RUN/tag-fixes.md` (each fix must be true by the rules, not only win a case); runs `cd "$WT/af-final" && node "$RUN/run-cases.mjs" "$RUN/held-out.md"`. Writes `$RUN/final-review-tags.md`: the rows to change with why, and the held-out line. At least 7 of 10 in the first 6 passes; fewer is reported to the owner at Task 15 (the questions or the rules need work), never answered by more tag changes.
-
-- [ ] **Step 3: Reviewer B, code and tests** (a fresh agent). Reads `git diff main...feat/animation-finder`. Checks: only the files of the Global Constraints changed (`git diff --stat`); no animation page, shared file or version line touched; every word of the contract exact; `findMatches` pure, weights 3/2/1, the main answer double, Close only with two or more answers, ties to fewer answers then home order; the address and history rules; the focus rules; native radios, words as names, pictures hidden from screen readers, 44px targets, 4.5:1 text; reduced motion; `fd-` keyframes moving only transform and opacity, no name twice; the page check's additions only new functions and one block; `404.html` never sends anyone off the site; the issue form a valid GitHub form (name, description, body items with type, id, attributes, validations); each test would fail if the behavior it names broke. Writes `$RUN/final-review-code.md` with findings by severity.
-
-- [ ] **Step 4: Reviewer C, the look** (a fresh agent). Take a slot, run `cd "$WT/af-final" && node tools/check-pages.mjs --base http://127.0.0.1:8907 --out "$RUN/final" home` (six `ok` lines expected), then dark-theme shots: `node "$RUN/shoot.mjs" --url "http://127.0.0.1:8907/?view=find&what=text&when=load&how=stagger" --theme dark --size 1366x768 --full --shot "$RUN/final/dark-laptop.png"` and the same with `--size 375x812 --mobile --shot "$RUN/final/dark-phone.png"`; free the slot. Looks at every `home-*-finder*.png` and both dark shots: words readable and not cut, the tick visible in both themes, each How picture reading as its words, the reduced-motion stills clear with their arrows, nothing overflowing at 320px, question 3 on a 375px phone. Writes `$RUN/final-review-visual.md`.
-
-- [ ] **Step 5: Fixes.** The coordinator sends each finding to the builder of the part it concerns (answers to the lane's tagger through Task 11's fix rules), in `af-int`; then Task 11's Step 5 and Step 7 and Task 13's Step 8 again for what changed, and the reviewer re-checks its findings. Commit each fix with a `fix:` message naming what it fixes; log each in `$RUN/progress.md`.
-
----
-
-### Task 15: The owner's look
-
-**Files:**
-- Create (run folder): `$RUN/owner/*.png`
-
-**Interfaces:**
-- Consumes: `feat/animation-finder` after Task 14, served from `af-int` on 8906; `shoot.mjs`.
-- Produces: the owner's answers: go live (yes or no, and when), question 3 as it is or the fallback (Task 16), the `finder` label (yes or no).
-
-- [ ] **Step 1: Pictures of three effects the owner has seen.** Take a slot, then for each address — `?view=find&what=background&when=loop&how=color` (soft colors moving behind a page, like Stripe's), `?view=find&what=text&when=scroll&how=color` (words lighting up as you scroll, like Apple's), `?view=find&what=button&when=click&how=morph` (a menu icon turning into an X) — run:
-
-```bash
-node "$RUN/shoot.mjs" --url "http://127.0.0.1:8906/<address>" --size 1366x768 --full --shot "$RUN/owner/<name>-laptop.png"
-node "$RUN/shoot.mjs" --url "http://127.0.0.1:8906/<address>" --size 375x812 --mobile --full --shot "$RUN/owner/<name>-phone.png"
-```
-
-with `<name>` `stripe`, `apple`, `menu`; and question 3 on a phone:
-
-```bash
-node "$RUN/shoot.mjs" --url "http://127.0.0.1:8906/?view=find" --size 375x812 --mobile --eval "document.querySelector('.fd-how').scrollIntoView()" --shot "$RUN/owner/question-3-phone.png"
-```
-
-Free the slot. Open each with the Read tool before sending.
-
-- [ ] **Step 2: Ask the owner**, in very short, simple words, with the pictures:
-
-```markdown
-The finder is ready to look at. It is a view of the home page, so it opens like a page of its own at …/?view=find.
-Pictures: Stripe-like soft colors, Apple-like words lighting up, and a menu icon turning into an X, each on a laptop and a
-phone; and question 3 on a phone.
-1. Put it live now? (The next launch post is <Reddit on 2026-10-17 | Show HN on 2026-10-25>.)
-2. Question 3 has 17 picture answers. Keep all 17, or show the 9 most used first and "More ways it moved" for the other 8?
-3. May I create the label "finder" on GitHub? The form works without it.
-```
-
-Add one line with the held-out result if it fell short of 7 of 10. If the owner wants to click through it, open `http://127.0.0.1:8906/?view=find` in the browser pane for them.
-
-- [ ] **Step 3: Record** the three answers, word for word, in `$RUN/progress.md`. "Show 9 first" → Task 16; a change asked for → a fix in `af-int` by the builder of that part, then Tasks 14 Step 5's checks again; "go live" → Task 17.
-
----
-
-### Task 16: Question 3 shows nine answers first (only if the owner asks for it at Task 15)
-
-**Files:**
-- Modify: `index.html` — the end of the finder block (script), `showFinder`, the end of the `/* ── finder ── */` CSS block
-- Modify: `tools/check-pages.mjs` — `finderViewProblems` and `finderMotionProblems` (Task 7's functions)
-- Modify: `tests/finder.test.js` — under `// ── The finder view, its ways in and Not here? ──`
-
-**Interfaces:**
-- Consumes: `finderEl`, `state`, `showFinder` (Task 3); `FIND` (Task 11).
-- Produces: `.fd-more` (More ways it moved), the eight least used How labels hidden until it is pressed; `showMoreHow(focus)`.
-
-- [ ] **Step 1: Write the failing test:**
-
-```js
-test('question 3 can start with the nine movements most cards carry, and More ways it moved shows the other eight', () => {
- assert.ok(HOME.includes("moreHow.textContent='More ways it moved'"), 'the button');
- assert.ok(HOME.includes('howCount(b.key)-howCount(a.key)).slice(0,9)'), 'the nine most used shown first');
-});
-```
-
-Run `node --test tests/finder.test.js` — expected: it FAILS on `the button`.
-
-- [ ] **Step 2: Implement.** At the end of the finder block:
-
-```js
-// Question 3 at first shows the nine movements most cards carry; More ways it moved shows the other eight (the owner's ruling at
-// the finder's review: 17 answers were too many at once on a phone). An answer among the eight, from the address or Back, shows
-// them too, and pressing the button moves keyboard focus to the first of them, as the button goes away.
-const HOW_Q=FIND_Q.find(qu=>qu.key==='how'),howCount=k=>Object.values(FIND).filter(r=>r[2].split(' ').includes(k)).length;
-const FIRST_HOW=new Set([...HOW_Q.answers].sort((a,b)=>howCount(b.key)-howCount(a.key)).slice(0,9).map(a=>a.key));
-const howBox=finderEl.querySelector('.fd-how .fd-as');
-const howExtra=[...howBox.querySelectorAll('.fd-a')].filter(l=>{const k=l.querySelector('.fd-r').value;return k!=='unsure'&&!FIRST_HOW.has(k);});
-const moreHow=document.createElement('button');
-moreHow.type='button';moreHow.className='pillbtn fd-more';moreHow.textContent='More ways it moved';moreHow.setAttribute('aria-expanded','false');
-howExtra.forEach(l=>{l.hidden=true;});
-howBox.after(moreHow);
-function showMoreHow(focus){
- if(moreHow.hidden)return;
- howExtra.forEach(l=>{l.hidden=false;});moreHow.hidden=true;moreHow.setAttribute('aria-expanded','true');
- if(focus)howExtra[0].querySelector('.fd-r').focus();
-}
-moreHow.addEventListener('click',()=>showMoreHow(true));
-```
-
-In `showFinder`, after the radios line, add (the first render comes after this block, so `howExtra` is ready by then):
-
-```js
- if(howExtra.some(l=>l.querySelector('.fd-r').value===state.how))showMoreHow(false);
-```
-
-At the end of the `/* ── finder ── */` CSS block:
-
-```css
-.fd-more{margin-top:12px}
-```
-
-- [ ] **Step 3: The page check shows the eight before using them.** In `finderViewProblems`, right after the first `look()`, and in `finderMotionProblems`, right before `const pics = …`, add:
-
-```js
- await evaluate(`(() => { const b = document.querySelector('.fd-more'); if (b && !b.hidden) b.click(); })()`);
-```
-
-- [ ] **Step 4: Tests and the home check.** Run `node --test "tests/*.test.js"` (every test passes) and, with a slot, `node tools/check-pages.mjs --base http://127.0.0.1:8906 --out "$RUN/fallback" home` (six `ok` lines). Shoot question 3 on a phone again (Task 15 Step 1's last command) for the owner.
-
-- [ ] **Step 5: Commit**
-
-```bash
-cd "$WT/af-int"
-git add index.html tools/check-pages.mjs tests/finder.test.js
-git commit -m "feat: the finder's third question starts with the nine movements most animations show, and More ways it moved shows the other eight"
-```
-
----
-
-### Task 17: Release, on the owner's word (coordinator)
-
-**Files:**
-- Merge: `feat/animation-finder` into `main` in the release worktree; then `main` into `feat/see-inside-compare`
-- Generated: `sitemap.xml`, `llms.txt`, `skills/`, `og-image.png`, written again in each merge
-
-**Interfaces:**
-- Consumes: the owner's word for this release (Task 15) and, between 2026-10-23 and 2026-10-26, the owner's word for that day.
-- Produces: the finder live at `https://matinmonshizadeh.github.io/animation-handbook/?view=find`; the `finder` label if the owner said yes.
-
-- [ ] **Step 1: Main's latest first.** If `main` moved since Task 13 (`git -C "$WT/af-int" merge-base --is-ancestor main feat/animation-finder` fails), repeat Task 13 Step 1 and Step 8 in `af-int`.
-
-- [ ] **Step 2: Merge in the release worktree** (coordination rule 3)
-
-```bash
-MAIN=C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook; WT=$MAIN/.claude/worktrees
-git -C "$MAIN" worktree list | grep -q '/release ' || git -C "$MAIN" worktree add "$WT/release" main
-cd "$WT/release" && git status --short && git merge --no-ff --no-commit feat/animation-finder
-```
-
-Serve `release` on 8990 (background), take a slot, then:
-
-```bash
-node tools/update-sitemap.mjs && node tools/make-skill.mjs && node tools/make-social-image.mjs --base http://127.0.0.1:8990
-git add -A sitemap.xml llms.txt skills og-image.png
-git commit -m "Merge feat/animation-finder: the Animation finder, three questions that name an animation someone saw"
-node --test "tests/*.test.js"
-node tools/check-pages.mjs --base http://127.0.0.1:8990 home
-```
-
-(and `node tools/check-pages.mjs --base http://127.0.0.1:8990 famous` once the Famous effects page exists). Free the slot.
-Expected: every test passes; six `ok` lines.
-
-- [ ] **Step 3: Push** — `git -C "$WT/release" push origin main`. Then check the live site once GitHub Pages has built: `curl -s https://matinmonshizadeh.github.io/animation-handbook/ | grep -c 'id="finder"'` prints `1`.
-
-- [ ] **Step 4: The label, if the owner said yes**
-
-```bash
-gh label create finder --repo matinmonshizadeh/animation-handbook --description "Someone could not find an animation with the finder" --color 2f5bea
-```
-
-- [ ] **Step 5: The same day, main into the rollout's branch** (coordination rule 4): in the main checkout (on `feat/see-inside-compare`, never switched), `git merge --no-ff --no-commit main`, resolve by the file map, write the generated files again as in Step 2 (with the main checkout served by the coordinator's own review server, on a port no lane is using), commit the merge, run the tests and `home`.
-
-- [ ] **Step 6: Clean up.** Stop every finder server; remove the worktrees `af-logic`, `af-pics`, `af-view`, `af-404`, `af-check`, `af-tags`, `af-int`, `af-final` (`git worktree remove …`) and delete the merged `af/*` branches (`git branch -d …`); keep `feat/animation-finder` until the ten new animations have taken it in. With the owner's OK, delete leftover `hb-chrome-*` folders in the temp folder. Log the release (hashes, date, the label) in `$RUN/progress.md`, and tell the coordinator that the ten new animations' lanes now add their own `FIND` rows by the rules of Task 8's brief, and that Ink Spread Reveal joins case 9 of `CASES` at their integration.
-
----
-
-## Self-review against the spec
-
-| Spec | Requirement | Task |
-|---|---|---|
-| Owner rulings | Not here? opens a short GitHub form with the answers filled in; live from the home page on the owner's word; tabs later | 5, 15, 17 (tabs: out of scope, Task 17 Step 6 hands over) |
-| What the owner will see 1–5 | Find button, Finder link, the finder in place of the top, three questions with Not sure, cards in two groups, Not here?, answers in the address | 3, 4, 5 |
-| §1 | A view of the home page `?view=find`; the tab's title; no new page | 3 |
-| §2 | The three questions, keys and words exactly; Not sure; still icons for What and When, moving pictures for How | 1 (data), 2 (pictures), 3 (built from `FIND_Q`) |
-| §3 | `FIND` right after `PLACES`, in `CATS` order, main first; `FIND_Q` one list read by the page and tests; tagging rules; seven lanes with stills, a checker per lane, integrator, fresh reviewer | 1 (draft, shape tests), 8, 9, 11, 14 |
-| §4 | Points (main 2×, other 1×), weights How 3 · What 2 · When 1, Best and Close, order, nothing for no answer, `findMatches(answers)` pure and tested with vm | 1 |
-| §5 | Layout, fieldsets with numbered legends, five and two across, six and three across, Not sure, See N matches, Start over, Your matches and its line, groups, 12 then Show all, no phone bar; behavior; address and history; old addresses; works from disk | 3, 4 (aria-current, ways in) |
-| §6 | The Not here? panel and its words; the form `animation_not_here.yml` with its four fields and label; the prefilled address; the contact link | 5 |
-| §7 | Find button under Popular, full width on phones, first-screen measured; Finder link before Browse all, How it works leaves the bar below the measured width; modified clicks left to the browser; 404 routes and third way back; the tab pass is later | 4, 6 |
-| §8 | Radios in fieldsets, words as names, hidden pictures, focus ring and tick, 400 ms live line, focus rules, 4.5:1, 44px, no sideways scroll at 320px, reduced motion | 3, 2, 7 (checked), 14 |
-| §9 | The 28 cases and the 24/28 and 27/28 targets with positions printed; held-out set of 10, at least 7, never tuned; the owner's look with the question-3 still, the fallback ready, the one line, the label question; every unit test; every page-check step | 11, 12, 14, 15, 16, 1–7 |
-| §10 | Files, no shared-file bump, docs at integration, README and CHANGELOG lines, `make-social-image` hides both ways in and the picture stays the same | 4, 13, Global Constraints |
-| §11 and coordination | Branch from `main`, worktrees `af-*`, run folder, ports 8901–8909, the shared slot pool, headless only, no `git stash`, merge never rebase, generated files by their tools, release rules and the launch window | Global Constraints, 0, 10, 13, 17 |
-
-Placeholder scan: every code step holds its code; the lane-specific values (`<NN>`, `<Category>`, `<folder>`, `<count>`) come from Task 8's table, and `<date>`, `<hash>` and the owner's answers are recorded, not invented. Names checked across tasks: `FIND_Q`, `FIND`, `findQuery`, `findWords`, `findScore`, `findMatches`, `findIssueURL`, `fromURL`, `writeURL`, `render(answered)`, `say`, `answeredAny`, `findLine`, `showFinder`, `showFound`, `showNotHere`, `enterFind`, `navFind`, `FIND_PAGE`, `FIND_TITLE`, the ids `finder`, `find-title`, `find-qs`, `find-see`, `find-reset`, `find-not`, `find-not-s`, `find-gh`, `find-words`, `nav-find`, the classes `fd-*`, and the run scripts `home-data.mjs` (`readHome`, `KEYS`, `MAX`, `tagRows`), `lint-tags.mjs`, `card-facts.mjs`, `shoot.mjs`, `draft-find.mjs`, `fd-preview.mjs`, `assemble-find.mjs`, `run-cases.mjs`.
diff --git a/docs/superpowers/plans/2026-10-13-famous-effects.md b/docs/superpowers/plans/2026-10-13-famous-effects.md
deleted file mode 100644
index 6c987262..00000000
--- a/docs/superpowers/plans/2026-10-13-famous-effects.md
+++ /dev/null
@@ -1,2363 +0,0 @@
-# Famous Effects Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Add a Famous effects page (`famous/`) that describes twelve effects people admire on well-known websites in our own words, shows the handbook animations that make something similar with their moving previews, and gives one prompt to build each; reached from the home page's footer and the README, live once the owner approves it.
-
-**Architecture:** One static page, `famous/index.html`, in the home page's look: its entries are plain HTML (`section.fx`, each with the site link, a title, what you see, one to three cards and a prompt), and its own short script runs the previews, the jump links, Copy prompt (with the copy-keys fallback) and the five-line clamp on phones. The previews are the home page's: `tools/make-famous.mjs` copies their CSS and markup from `index.html` into two marked blocks of the page, and `tests/famous.test.js` fails when the blocks drift. The page check gains a `famous` target, the sitemap and `llms.txt` tools list the page, and the home page links it from its footer.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build, no dependencies); Node 22+ (`node --test`, `node:vm`, an ES-module tool); the repo's Chrome-driven page check (`tools/check-pages.mjs`); the browser pane for the live check of the real sites.
-
-**Spec:** `docs/superpowers/specs/2026-10-13-famous-effects-design.md` and `docs/superpowers/specs/2026-10-13-next-projects-coordination.md` (it wins where they differ). Read both first.
-
-## Global Constraints
-
-- Branch `feat/famous-effects`, cut from `main` (never from `feat/see-inside-compare`); the coordinator merges each reviewed lane into it with `git merge --no-ff` inside `.claude/worktrees/fx-int`. Nothing is pushed before Task 11.
-- Lanes: one git worktree each, `.claude/worktrees/fx-<lane>`, on a branch `fx/<lane>` cut from the current `feat/famous-effects`. The main checkout stays on `feat/see-inside-compare` and is never switched.
-- The spec, the coordination file and this plan live on `feat/see-inside-compare`: read them in the main checkout, `C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/docs/superpowers/…`; a worktree cut from `main` does not hold them.
-- Run folder (not in the repository): `C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/` (the start date; use the real one if the run starts later): the live-check record, briefs, reports, the ledger and screenshot folders.
-- Ports, one server per worktree (`python -m http.server <port> --bind 127.0.0.1` from the worktree root, as a background command, stopped when the task ends): Task 3 → 8931, Task 4 → 8932, Task 5 → 8933, Tasks 7 and 8 → 8934, Task 9 → 8935, Task 10 → 8936; Task 11 uses 8990 in the release worktree.
-- Page checks only through the shared pool of eight (the rollout's run folder; the coordinator names another date in the brief if it differs), one command that takes a free slot, runs the check and frees the slot:
-
-```bash
-POOL=C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-see-inside-compare/slots; for n in 1 2 3 4 5 6 7 8; do if mkdir "$POOL/slot-$n" 2>/dev/null; then node tools/check-pages.mjs --base http://127.0.0.1:<port> --out <out folder> <target>; rc=$?; rmdir "$POOL/slot-$n"; exit $rc; fi; done; echo "all eight slots are busy: run it again in a minute"; exit 3
-```
-
-- Files this project may change (the coordination file's map): new `famous/index.html`, `tools/make-famous.mjs`, `tests/famous.test.js`, `.github/ISSUE_TEMPLATE/famous_effect.yml`; `tools/update-sitemap.mjs`, `tools/make-skill.mjs`, `tests/skill.test.js`; `tests/pages.test.js` (the sitemap count and one new footer test only); `tools/check-pages.mjs` (new functions and blocks; shared lines only to list `famous`: header, usage, the main loop's target dispatch); `index.html` (the footer link, its one CSS rule and its one line for links opened from disk); at integration `README.md` (one line after step 3), `CHANGELOG.md` (one Unreleased line), `CLAUDE.md`, `CONTRIBUTING.md`, `.github/pull_request_template.md`; generated `sitemap.xml` and `llms.txt` by their tools. Never: animation pages, anything in `assets/`, `404.html`, `.github/ISSUE_TEMPLATE/config.yml`, `og-image.png`, `tools/make-social-image.mjs`; `skills/` changes only when `node tools/make-skill.mjs` writes it again after a merge of `main`.
-- Generated files (`sitemap.xml`, `llms.txt`, `skills/animation-handbook/`, the two marked blocks of `famous/index.html`) are written by `node tools/update-sitemap.mjs`, `node tools/make-skill.mjs` and `node tools/make-famous.mjs`, never by hand; after any merge take either side and run the tools again.
-- Legal rules, binding on every entry: the title, what you see and the prompt in our own words (no sentence, feature name or slogan from a site); the site named in plain text, in the page's own font and colors (no logo, icon, brand color or typeface), and linked to its public page; shown only with the handbook's own demos and previews; nothing from a site in the repository or in posts (no code, screenshots, videos, pictures, icons or logos); the not-connected line above the first entry, on the first screen; nothing that implies approval ("official", "approved", "partner", "as used by"; no company name in the page's title, description or social card); "Seen on <site> in <year>" with the day checked in `datetime`.
-- Prompt rules: 60 to 130 words; starts "Add "; at least one [part to fill in], each inside `<mark>`; no code, backtick, `<code>` or `<pre>`; never "Match the settings listed below."; says what happens under reduced motion; names touch, a tap or a finger when the entry starts on hover or press; names no site of the page by name or address; asks for the reader's own colors and content, never a copy of the site.
-- Nothing from elsewhere: no `<img>`, `<video>`, `<iframe>`, `<picture>`, `<object>`, `<embed>`, `@import` or `url(http`; every `src` and every stylesheet or icon `href` is a repository file; the page links neither `demo-page.css` nor `demo-page.js`; the only request that leaves the site is the GitHub star count the home page already makes.
-- Words: plain words for someone new to animation, American spelling (color, gray, center), no hype, no code on the page.
-- Accessibility: landmarks (the top bar's `nav`, `main`, the jump `nav`, the footer) and a skip link to the first entry; headings `h1`, `h2` per entry, `h3` for its two parts, `h4` for card names; site links end "(opens in a new tab)"; previews `aria-hidden`; each Copy prompt names its entry and its label change is announced; text at least 4.5:1 in both themes; every link and button reachable by keyboard with a visible focus ring; hover effects only under `@media(hover:hover)`; on phones every link, chip, card and button at least 44×44px; under reduced motion every preview holds a still frame, jumps do not glide and the message does not slide.
-- Live check: only in the browser pane, only while the owner is not reviewing there, logged out. Never sign in, fill in or send a form (a site search too), accept terms or cookies, or download; decline non-essential cookies where a banner asks; screenshots are looked at, never saved.
-- Do not use `git stash` (every worktree shares it); compare versions with `git show <rev>:<path> > <scratch file>`.
-- Tests: `node --test "tests/*.test.js"` from the worktree root (Node 22 or later). Page check: the pool command above with the target `famous` or `home`; a passing target prints six `ok` lines.
-- Commit messages in the repo's style, `feat: …`, `fix: …`, `test: …`, `docs: …`, `chore: …`, in plain words.
-- On a usage-limit hit this project pauses first, before the rollout.
-- Release only on the owner's word for this project; nothing merges into `main` from 2026-10-23 to 2026-10-26 without the owner's explicit word for that day.
-
-## Phases
-
-- **Setup (coordinator, before Phase A):**
-
-```bash
-cd C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-git worktree add .claude/worktrees/fx-int -b feat/famous-effects main
-mkdir -p .superpowers/sdd/2026-10-14-famous-effects
-git worktree add .claude/worktrees/fx-tool -b fx/tool feat/famous-effects
-git worktree add .claude/worktrees/fx-check -b fx/check feat/famous-effects
-git worktree add .claude/worktrees/fx-footer -b fx/footer feat/famous-effects
-```
-
- Later lanes are cut the same way when their phase starts: `fx/frame` (fx-frame), `fx/sitemap` (fx-sitemap), `fx/entries` (fx-entries).
-- **Phase A (in parallel, from the start):** Task 1 (live check, browser pane), Task 2 (`tools/make-famous.mjs`), Task 3 (page check target), Task 4 (home footer link). Each lane is merged into `feat/famous-effects` as soon as its review is clean.
-- **Phase B (after Tasks 2 and 3 are merged):** Task 5 (the page frame and the issue template). It holds no entry, so it does not wait for the live check (spec §9 step 1: no entry is written before the check).
-- **Phase C (after Task 5 is merged):** Task 6 (sitemap and `llms.txt`) in parallel with Task 7 (entries 1 to 6). Task 7 also waits for Task 1's record, read and approved by the coordinator.
-- **Phase D (after Task 7 is reviewed):** Task 8 (entries 7 to 12, the count and the pill), in the same lane.
-- **Phase E (after Tasks 4, 6 and 8 are merged):** Task 9 (integration, docs, generated files, final review).
-- **Phase F:** Task 10 (the owner's review, entries 7 and 8 on the owner's accounts). **Phase G:** Task 11 (release, on the owner's word).
-
-## Reserve entries (used by Tasks 7, 8 and 10)
-
-The spec names three reserves but gives them no text; these drafts follow the same rules (the tests in Tasks 7 and 8 pass on them). A reserve is used only when the live check found it (Task 1's record says `passed`), in order R1, R2, R3, in the place of the entry it replaces, with its chip in that entry's place in the jump row; if the record gives a corrected sentence for it, that sentence replaces the matching one in its What you see. Its `datetime` is the day the record checked it.
-
-**R1 · Rockstar Games: The logo that opens into a window** (chip and section):
-
-```html
- <a href="#rockstar-window">Rockstar Games · logo</a>
-```
-
-```html
- <section class="fx" id="rockstar-window" aria-labelledby="rockstar-window-t" data-fx-site="Rockstar Games" data-fx-start="scroll">
- <p class="fx-seen">Seen on <a href="https://www.rockstargames.com/VI" target="_blank" rel="noopener">rockstargames.com/VI<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-14">2026</time></p>
- <h2 id="rockstar-window-t" tabindex="-1">The logo that opens into a window</h2>
- <p class="fx-what">As you scroll, the large logo in the middle of the screen grows, and the scene behind it shows through its letters like a window. It keeps growing until the window fills the screen and the scene takes over, then the page scrolls on to the next part.</p>
- <h3 class="fx-sub">Made with these animations</h3>
- <div class="fx-cards">
- <article class="card c1" data-slug="zoom-into-image"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The growing window</span></div><div class="meta"><h4 class="title"><a href="../animations/01-scroll-based/zoom-into-image/">Zoom Into Image</a></h4><p class="desc">A small window opens up to fill the box as you scroll. Best for hero images.</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>
- </div>
- <h3 class="fx-sub">A prompt to build something similar</h3>
- <div class="fx-pbox"><p class="fx-prompt">Add a scroll-driven window reveal to <mark>[the logo or large title at the top of your page, with a picture or video behind it]</mark>. Pin the section while the visitor scrolls through a few screens of it. At first the scene shows only through the letters of the logo; as they scroll, let the logo grow from its center until the scene fills the whole screen, then let the page scroll on. Grow the logo with a transform, never by changing its size, so it stays smooth. Touch scrolling drives it the same way, and screen readers get the logo as text. If the visitor has reduced motion turned on, show the full scene at once with the logo above it.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for The logo that opens into a window"><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>
-```
-
-**R2 · Linear (or Cursor): The card edges that glow near the pointer.** Written for linear.app; if the record found it on cursor.com instead, use the four Cursor lines below in place of the matching ones.
-
-```html
- <a href="#linear-glow">Linear · glow</a>
-```
-
-```html
- <section class="fx" id="linear-glow" aria-labelledby="linear-glow-t" data-fx-site="Linear" data-fx-start="hover">
- <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-14">2026</time></p>
- <h2 id="linear-glow-t" tabindex="-1">The card edges that glow near the pointer</h2>
- <p class="fx-what">Move the pointer over the grid of feature cards and a soft light follows it, brightening the edges of the cards nearest to it and fading out on the ones farther away, as if a small lamp were passing behind the grid.</p>
- <h3 class="fx-sub">Made with these animations</h3>
- <div class="fx-cards">
- <article class="card c4" data-slug="spotlight-hover"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The glow</span></div><div class="meta"><h4 class="title"><a href="../animations/04-micro-interactions/spotlight-hover/">Spotlight Hover Glow</a></h4><p class="desc">A soft glow follows the pointer and lights card edges. Best for feature grids.</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 pointer glow to <mark>[the grid of cards on your page]</mark>. As the pointer moves over the grid, a soft round light follows it and brightens the borders of the cards it passes near, strongest at the closest edge and fading with distance, while the cards' contents stay as they are. Draw the light as a gradient that moves with the pointer, not as a blur, and move it at most once per frame. Give the card that has keyboard focus the same lit border. On touch screens, where nothing points, keep the borders plain. If the visitor has reduced motion turned on, light only the border of the card under the pointer, without the moving glow.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for The card edges that glow near the pointer"><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>
-```
-
-The Cursor lines (chip, section opening, Seen on, heading):
-
-```html
- <a href="#cursor-glow">Cursor · glow</a>
- <section class="fx" id="cursor-glow" aria-labelledby="cursor-glow-t" data-fx-site="Cursor" data-fx-start="hover">
- <p class="fx-seen">Seen on <a href="https://cursor.com/" target="_blank" rel="noopener">cursor.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-14">2026</time></p>
- <h2 id="cursor-glow-t" tabindex="-1">The card edges that glow near the pointer</h2>
-```
-
-**R3 · Apple: The color that sweeps across the headline** (used only after R1 and R2). If the record found the headline on another address of apple.com, write that address in the link and its text (without `https://` and `www.`).
-
-```html
- <a href="#apple-sweep">Apple · sweep</a>
-```
-
-```html
- <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-14">2026</time></p>
- <h2 id="apple-sweep-t" tabindex="-1">The color that sweeps across the headline</h2>
- <p class="fx-what">As the product's headline 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>
- <h3 class="fx-sub">Made 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>
- <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>
- </section>
-```
-
----
-
-### Task 1: Live check of the real sites (browser pane, before any entry is written)
-
-**Files:**
-- Create (run folder, not the repository): `.superpowers/sdd/2026-10-14-famous-effects/live-check.md`
-
-**Interfaces:**
-- Produces: one section per site checked (entries 1–6 and 9–12, reserves R1–R3), each with `- Checked:` (the day), `- Verdict:` (`confirmed`, `differs`, `not found` or `blocked`; for a reserve `passed` or `failed` follows in Decisions), `- What shows:` (our own words), `- Names and slogans:` (what the site calls the effect or writes beside it, to keep out of our text) and `- Change:` (a corrected sentence of What you see, or `none`); then `## Decisions`. Tasks 7 and 8 write the entries from it, Task 9's legal review reads its names and slogans, Task 10 uses the reserves that passed.
-
-- [ ] **Step 1: Ask for the pane.** The coordinator asks the owner in one line: "May I use the browser pane for about 90 minutes now, to watch the effects on the real sites? You can't review there meanwhile." Start only on a yes; otherwise ask again later. Entries 7 (ChatGPT) and 8 (X) are not checked here: the owner checks them on their own accounts at the review (Task 10).
-
-- [ ] **Step 2: Start the record**
-
-```markdown
-# Live check of the Famous effects (2026-10-14)
-
-Logged out, in the browser pane, at 1280px wide unless a step says otherwise. No screenshot was saved; nothing from the
-sites is copied here but the names and slogans to keep out of our text. Entries 7 and 8: the owner, at the review.
-```
-
-- [ ] **Step 3: Rules for every site.** Open each address with `mcp__Claude_Browser__navigate` (the first call opens the pane). Look with `mcp__Claude_Browser__computer` (`screenshot`, `scroll`, `hover`, `wait`) or `mcp__Claude_Browser__browser_batch` for quick sequences. A cookie banner: choose "Reject", "Decline" or "Necessary only"; if there is none, close it with its close button or leave it; never accept. A sign-in wall, an age check or any form: stop, verdict `blocked`. Never type into a site, never sign in, never download. Write each site's section right after watching it:
-
-```markdown
-## <n> · <id> — <address>
-- Checked: 2026-10-14
-- Verdict: confirmed | differs | not found | blocked
-- What shows: <one to three sentences in our own words>
-- Names and slogans: <what the site calls the effect or writes beside it, or none>
-- Change: <a corrected sentence of What you see in our own words, or none>
-```
-
-- [ ] **Step 4: 1 · stripe-ribbon — https://stripe.com/.** Wait 5 s at the top; take two screenshots 2 s apart. Confirmed when a thick ribbon of colored light twists slowly in depth behind the headline, partly blurred, under grain. A flat gradient or a still picture only: `differs` (say which).
-
-- [ ] **Step 5: 2 · apple-scroll — https://www.apple.com/apple-vision-pro/.** Scroll down three wheel ticks at a time through the first screens, screenshot after each, then scroll back up. Confirmed when the headset stays in the middle while its parts rise out layer by layer, it tips up to show its lenses, scrolling back puts it together, and the phrase beside it turns from gray to white.
-
-- [ ] **Step 6: 3 · landonorris-reveal — https://landonorris.com/.** Wait for the page to finish its opening; `hover` at six points across the large portrait, a screenshot after each. Confirmed when a soft, liquid-looking blob under the pointer shows a second picture (his racing helmet).
-
-- [ ] **Step 7: 4 · linear-intro — https://linear.app/.** In one `browser_batch`: navigate, screenshot, wait 0.5 s, screenshot, wait 0.5 s, screenshot, wait 1 s, screenshot. Confirmed when the headline's words appear in turn, each rising out of a blur, then the line under it, the buttons and a picture of the app tilted slightly back come into focus the same way.
-
-- [ ] **Step 8: 5 · apple-menu — https://www.apple.com/.** At 1280px: `hover` a top item (Store) and screenshot twice, 0.2 s apart: a panel grows down, its links appear in turn and the page behind blurs. Then `mcp__Claude_Browser__resize_window` with `preset: "mobile"`, reload, press the two-line menu button and screenshot twice: it folds into an X while the menu fills the screen and its links drop in one after another. Reset with `preset: "desktop"`.
-
-- [ ] **Step 9: 6 · wikipedia-previews — https://en.wikipedia.org/wiki/Animation.** `hover` a link in the article text for 1 s, screenshot, move the pointer away, screenshot. Confirmed when a small card with the linked article's first lines and picture fades in under the link, rising slightly, and fades out after.
-
-- [ ] **Step 10: 9 · spotify-cards — https://open.spotify.com/.** `hover` an album or playlist card on Home, screenshot. Confirmed when the card lightens and a round green play button fades in, rising into the cover's bottom corner.
-
-- [ ] **Step 11: 10 · youtube-loading — https://www.youtube.com/.** The pane cannot slow the network, so watch the page while it loads content of its own. Navigate, then run this with `mcp__Claude_Browser__javascript_tool` at once, to record the gray placeholder shapes and whether they move:
-
-```js
-window.__shapes = [];
-new MutationObserver(() => {
- for (const el of document.querySelectorAll('[class*="skeleton" i], [class*="ghost" i], [class*="placeholder" i], [class*="shimmer" i]')) {
- if (el.__seen) continue;
- el.__seen = true;
- window.__shapes.push({ tag: el.tagName.toLowerCase(), cls: String(el.className).slice(0, 80),
- moving: el.getAnimations({ subtree: true }).map(a => a.animationName || a.transitionProperty || 'script').join(' ') });
- }
-}).observe(document.documentElement, { subtree: true, childList: true, attributes: true, attributeFilter: ['class'] });
-'observing';
-```
-
-Then press the YouTube logo and, separately, a video thumbnail (both load new content inside the page), screenshot at once and after 0.3 s each time, and read `JSON.stringify(window.__shapes.slice(0, 20))`. Confirmed when gray boxes and bars in the shapes of thumbnails, round channel pictures and titles show before the videos; write in What shows whether they stay still, pulse or have a light sweeping over them. If no placeholder is ever seen, `not found`.
-
-- [ ] **Step 12: 11 · pudding-chart — https://pudding.cool/2025/11/democracy/.** Scroll through the story three ticks at a time, screenshot after each, then scroll back. Confirmed when a chart of dots stays on screen while short paragraphs scroll past, each changing which dots light up, and scrolling back undoes each step.
-
-- [ ] **Step 13: 12 · medium-top-bar — https://medium.com/tag/web-design.** Open a free article from the list (no star beside it). Scroll down ten ticks, screenshot; scroll up one tick, screenshot. Confirmed when the top bar slides up out of the way as you scroll down and comes back on a small scroll up.
-
-- [ ] **Step 14: R1 · rockstar-window — https://www.rockstargames.com/VI.** Scroll three ticks at a time through the first screens, screenshot after each. Passed when the large logo works as a window that grows as you scroll until the scene behind it fills the screen. An age check: `blocked`.
-
-- [ ] **Step 15: R2 · glow — https://linear.app/ then https://cursor.com/.** On each, find a grid of feature cards on the home page and `hover` across it at four points, screenshot after each. Passed on the first site where a soft light follows the pointer and lights the edges of the nearby cards; write which site in the heading line.
-
-- [ ] **Step 16: R3 · apple-sweep — https://www.apple.com/iphone-18-pro/.** If that address does not open, take the current iPhone Pro page from apple.com's iPhone menu and write its address. Scroll to the first large headline, screenshot three times 0.3 s apart. Passed when a band of color sweeps across the headline once.
-
-- [ ] **Step 17: Decisions, then give the pane back.** Close the tabs you opened (`mcp__Claude_Browser__tabs_close`). Add:
-
-```markdown
-## Decisions
-- Written as in the plan: <entry numbers>
-- Rewritten (the Change sentence replaces the matching sentence of What you see): <entry numbers, or none>
-- Swapped (failed entry → reserve that passed, in its place): <for example "10 → R1", or none>
-- Reserves that passed, in order: R1 <passed|failed>, R2 <passed on linear.app|passed on cursor.com|failed>, R3 <passed|failed>
-- Day of the check: 2026-10-14
-```
-
-An entry whose verdict is `not found` or `blocked` is swapped for the next reserve that passed; an entry that `differs` only in a detail one sentence states is rewritten with its Change sentence; one that differs in the effect itself is swapped.
-
-- [ ] **Step 18: Check the record is complete**
-
-Run: `grep -c "^- Verdict: " C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/live-check.md`
-Expected: `13` (ten entries and three reserves), and the file ends with `## Decisions`. The coordinator reads the record and approves the decisions; if any entry is rewritten or swapped, they tell the owner in one short line. Nothing is committed (the run folder is not in the repository).
-
----
-
-### Task 2: `tools/make-famous.mjs`, the tool that copies the previews
-
-**Files:**
-- Create: `tools/make-famous.mjs`
-- Create: `tests/famous.test.js` (the tool's section; Tasks 5, 7 and 8 add the page's sections)
-
-**Interfaces:**
-- Produces (exports of `tools/make-famous.mjs`): `CSS_START`, `CSS_END`, `JS_START`, `JS_END` (the marker lines); `homeConst(home, name)` (a `const NAME=` literal of the home page's script, read with `vm`); `previewBlocks(home, slugs) → { css, data }`; `replaceBetween(text, start, end, inner) → text`; `cardSlugs(page) → string[]`; `buildFamousFrom(home, page) → page text`; `buildFamous(root) → { 'famous/index.html': text }` (LF line endings, writes nothing). Run as a command it rewrites the two blocks of `famous/index.html`, keeping its line endings.
-- The marker lines, each alone on its line at column 0: in the page's `<style>`, `/* ── previews: written by tools/make-famous.mjs from the home page; run it again, never edit by hand ── */` … `/* ── end of previews ── */`; in its `<script>`, `// ── previews: written by tools/make-famous.mjs from the home page; run it again, never edit by hand ──` … `// ── end of previews ──`.
-- The data block is `const PREVIEWS={` + one line per card slug in page order (each once) `"<slug>":{"pv":"<key>","still":<0..1>,"markup":"<html with <\/ escaped>"}` + `};`. Drift is detected by `tests/famous.test.js` comparing `buildFamous(ROOT)['famous/index.html']` with the file (Task 5).
-
-- [ ] **Step 1: Write the failing tests.** Create `tests/famous.test.js`:
-
-```js
-// Checks the Famous effects page (famous/index.html) and the tool that writes its previews (tools/make-famous.mjs), from
-// docs/superpowers/specs/2026-10-13-famous-effects-design.md: first the tool on a small stand-in home page, then the page.
-// Run from the repo root: node --test "tests/*.test.js"
-const test = require('node:test');
-const assert = require('node:assert/strict');
-const fs = require('node:fs');
-const path = require('node:path');
-const { pathToFileURL } = require('node:url');
-
-const ROOT = path.resolve(__dirname, '..');
-const TOOL = 'node tools/make-famous.mjs';
-const tool = () => import(pathToFileURL(path.join(ROOT, 'tools', 'make-famous.mjs')).href);
-
-// ---------- The tool, on a stand-in home page ----------
-// What the tool reads, in small: the accent classes and the base preview rules; a comment that holds a brace and a rule; a
-// @property; a preview with a data URI that holds url(…); a rule shared with a preview the page does not show; a preview whose
-// key only starts like a shown one; keyframes used and unused; a phone rule beside another page's rule; the reduced-motion
-// rule; and CATS, PV, pvMarkup(), engines and STILL.
-const FIXTURE_HOME = `<style>
-:root{--c1:#6ea8ff}
-.c1{--accent:var(--c1)}.c2{--accent:var(--c2)}.c3{--accent:var(--c3)}.c4{--accent:var(--c4)}.c5{--accent:var(--c5)}.c6{--accent:var(--c6)}.c7{--accent:var(--c7)}
-.pv{position:absolute;inset:0}
-/* a comment with a brace { and a rule .pv-aaa{color:red} inside */
-.pv *{will-change:transform}
-.card:not(.playing) .pv .anim,.card:not(.playing) .pv .anim::before,.card:not(.playing) .pv .anim::after{animation-play-state:paused!important}
-@property --p{syntax:'<percentage>';inherits:false;initial-value:0%}
-.pv-aaa{background:url("data:image/svg+xml,%3Csvg filter='url(%23m)'%3E")}
-.pv-aaa .x{animation:spin-a 2s linear infinite;--p:10%}
-.pv-aaab{background:#111}
-.pv-bbb,.pv-zzz{color:red}
-@keyframes spin-a{to{transform:rotate(360deg)}}
-@keyframes unused{to{opacity:0}}
-@media(max-width:600px){.pv-aaa .x{width:5px}.other{color:blue}}
-@media(prefers-reduced-motion:reduce){
- .pv .anim,.pv .anim::before,.pv .anim::after{animation-play-state:paused!important}
-}
-</style>
-<script>
-const CATS=[{name:'One',cat:'c1-cat',n:'01',folder:'animations/01-one',entries:[['first','First','Line one.'],['second','Second','Line two.'],['third','Third','Line three.'],['fourth','Fourth','Line four.']]}];
-const PV={'first':'aaa','second':'bbb','third':'ccc'};
-function pvMarkup(k){
- switch(k){
- case 'aaa': return '<span class="x anim"></span>';
- case 'bbb': return '<b class="anim">B</b>';
- case 'ccc': return '';
- default: return '';
- }
-}
-const engines={ccc:pv=>make(pv,1,true)};
-const STILL={bbb:.7};
-</script>`;
-
-test('make-famous: the CSS block holds the base rules and, for each preview shown, its rules, its keyframes and the @property it uses', async () => {
- const { previewBlocks } = await tool();
- const lines = previewBlocks(FIXTURE_HOME, ['first', 'second']).css.split('\n');
- for (const line of ['.c1{--accent:var(--c1)}', '.c7{--accent:var(--c7)}', '.pv{position:absolute;inset:0}', '.pv *{will-change:transform}',
- '.card:not(.playing) .pv .anim,.card:not(.playing) .pv .anim::before,.card:not(.playing) .pv .anim::after{animation-play-state:paused!important}',
- '@media(prefers-reduced-motion:reduce){.pv .anim,.pv .anim::before,.pv .anim::after{animation-play-state:paused!important}}',
- "@property --p{syntax:'<percentage>';inherits:false;initial-value:0%}",
- `.pv-aaa{background:url("data:image/svg+xml,%3Csvg filter='url(%23m)'%3E")}`, '.pv-aaa .x{animation:spin-a 2s linear infinite;--p:10%}',
- '@keyframes spin-a{to{transform:rotate(360deg)}}', '@media(max-width:600px){.pv-aaa .x{width:5px}}', '.pv-bbb{color:red}']) {
- assert.ok(lines.includes(line), `the CSS block has the line ${line}`);
- }
- const css = lines.join('\n');
- for (const absent of ['.pv-aaab', '.pv-zzz', 'unused', '.other', '.pv-aaa{color:red}']) assert.ok(!css.includes(absent), `no ${absent}`);
-});
-
-test('make-famous: the PREVIEWS block gives each card once, in page order, with its preview key, still point and markup', async () => {
- const { previewBlocks } = await tool();
- assert.equal(previewBlocks(FIXTURE_HOME, ['first', 'second', 'first']).data, ['const PREVIEWS={',
- '"first":{"pv":"aaa","still":0.5,"markup":"<span class=\\"x anim\\"><\\/span>"},',
- '"second":{"pv":"bbb","still":0.7,"markup":"<b class=\\"anim\\">B<\\/b>"}',
- '};'].join('\n'));
- assert.equal(previewBlocks(FIXTURE_HOME, []).data, 'const PREVIEWS={\n};', 'no cards, an empty object');
-});
-
-test('make-famous: a card that is not on the home page, or whose preview needs a script or has no markup, stops the tool', async () => {
- const { previewBlocks } = await tool();
- assert.throws(() => previewBlocks(FIXTURE_HOME, ['third']), /needs a script engine/);
- assert.throws(() => previewBlocks(FIXTURE_HOME, ['fourth']), /has no markup/);
- assert.throws(() => previewBlocks(FIXTURE_HOME, ['nowhere']), /not a card on the home page/);
-});
-
-test('make-famous: the blocks go between their marker lines, a second run changes nothing, and a missing or doubled marker stops it', async () => {
- const { buildFamousFrom, replaceBetween, CSS_START, CSS_END, JS_START, JS_END } = await tool();
- const page = ['<style>', 'body{margin:0}', CSS_START, 'old css', CSS_END, '</style>', '<article class="card c1" data-slug="second">',
- '<script>', JS_START, 'const PREVIEWS={};', JS_END, 'go();', '</script>'].join('\n');
- const once = buildFamousFrom(FIXTURE_HOME, page);
- assert.equal(buildFamousFrom(FIXTURE_HOME, once), once, 'a second run changes nothing');
- assert.ok(once.includes(`${CSS_START}\n/* the base`), 'the CSS starts right after its first marker');
- assert.ok(once.includes(`.pv-bbb{color:red}\n${CSS_END}`), 'and ends right before its last');
- assert.ok(once.includes(`${JS_START}\nconst PREVIEWS={\n"second":`) && once.includes(`};\n${JS_END}\ngo();`), 'the data between its markers');
- assert.ok(!once.includes('old css'), 'what was between the markers is gone');
- assert.throws(() => replaceBetween('no markers here', CSS_START, CSS_END, 'x'), /must each be there once/);
- assert.throws(() => replaceBetween(CSS_START + CSS_END + CSS_START, CSS_START, CSS_END, 'x'), /must each be there once/);
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `node --test tests/famous.test.js`
-Expected: four FAILs with `ERR_MODULE_NOT_FOUND` (`tools/make-famous.mjs` does not exist).
-
-- [ ] **Step 3: Write `tools/make-famous.mjs`**
-
-```js
-#!/usr/bin/env node
-// Writes the previews of the Famous effects page (famous/index.html) from the home page: a development tool, not part of the
-// site (docs/superpowers/specs/2026-10-13-famous-effects-design.md, section 4).
-// Run it from the repo root after changing the page's cards, or a preview they show on the home page: its key in PV, its case
-// in pvMarkup(), its rules or keyframes, or its STILL point. tests/famous.test.js fails until then.
-// Usage: node tools/make-famous.mjs
-// It reads the cards of famous/index.html (data-slug on <article class="card cN">, in page order) and, from index.html,
-// CATS, PV, STILL, pvMarkup() and engines (the previews a script draws, which this page has no room for) from its script,
-// and from its style the base preview rules (BASE below), every rule that names a preview the page shows (.pv-<key>, inside
-// @media too, keeping only the parts of a shared selector that name it), the @keyframes those rules and the preview's
-// markup name, and the @property rules they use. It rewrites the text between the two marker lines of each block in
-// famous/index.html: the CSS (CSS_START … CSS_END) and the PREVIEWS object (JS_START … JS_END), which gives each card its
-// preview key, markup and still point. It keeps the page's line endings, writes only when the text changed and prints what
-// it wrote; running it twice changes nothing. buildFamous(root), exported for the test, returns
-// { 'famous/index.html': text } with LF line endings and writes nothing.
-// Exit code 1 when a card is not on the home page, its preview needs a script, has no markup or animates in SVG, a base rule
-// or a preview's rules cannot be found, or a marker line is missing or written twice.
-import { existsSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
-import { join } from 'node:path';
-import { fileURLToPath } from 'node:url';
-import vm from 'node:vm';
-
-export const CSS_START = '/* ── previews: written by tools/make-famous.mjs from the home page; run it again, never edit by hand ── */';
-export const CSS_END = '/* ── end of previews ── */';
-export const JS_START = '// ── previews: written by tools/make-famous.mjs from the home page; run it again, never edit by hand ──';
-export const JS_END = '// ── end of previews ──';
-// The home page's rules every preview needs: each category's accent color, the preview box, and its animations paused unless
-// its card plays; and, under reduced motion, paused always.
-const BASE = ['.c1', '.c2', '.c3', '.c4', '.c5', '.c6', '.c7', '.pv', '.pv *',
- '.card:not(.playing) .pv .anim,.card:not(.playing) .pv .anim::before,.card:not(.playing) .pv .anim::after'];
-const BASE_REDUCED = '.pv .anim,.pv .anim::before,.pv .anim::after';
-const REDUCED = '@media(prefers-reduced-motion:reduce)';
-
-// Where the bracket that opens at text[from] ('[' or '{') is closed, stepping over strings and // comments (as the tests
-// read the home page).
-function blockEnd(text, from) {
- const open = text[from], close = open === '[' ? ']' : '}';
- let depth = 0, i = from, quote = null;
- for (; i < text.length; i++) {
- const ch = text[i];
- if (quote) { if (ch === '\\') i++; else if (ch === quote) quote = null; continue; }
- if (ch === '/' && text[i + 1] === '/') { while (i < text.length && text[i] !== '\n') i++; continue; }
- if (ch === "'" || ch === '"' || ch === '`') quote = ch;
- else if (ch === open) depth++;
- else if (ch === close && --depth === 0) break;
- }
- return i;
-}
-// The value of `const NAME=` in the home page's script: an array or object literal of plain data, read with vm.
-export function homeConst(home, name) {
- const start = home.indexOf(`const ${name}=`);
- if (start < 0) throw new Error(`index.html has no const ${name}=`);
- const from = start + `const ${name}=`.length;
- return vm.runInNewContext('(' + home.slice(from, blockEnd(home, from) + 1) + ')');
-}
-// A function of the home page's script, `function NAME(…){…}`, read with vm (pvMarkup uses no page state).
-function homeFunction(home, name) {
- const start = home.indexOf(`function ${name}(`);
- if (start < 0) throw new Error(`index.html has no function ${name}(`);
- return vm.runInNewContext('(' + home.slice(start, blockEnd(home, home.indexOf('{', start)) + 1) + ')');
-}
-// The previews the home page draws with a script (its engines object): their keys, before each ":" at the top level.
-function engineKeys(home) {
- const start = home.indexOf('const engines={');
- if (start < 0) throw new Error('index.html has no const engines={');
- const from = start + 'const engines='.length, keys = [];
- let depth = 0, part = '';
- for (const ch of home.slice(from + 1, blockEnd(home, from)) + ',') {
- if ('({['.includes(ch)) depth++;
- else if (')}]'.includes(ch)) depth--;
- if (ch === ',' && depth === 0) { keys.push(part.split(':')[0].trim()); part = ''; } else part += ch;
- }
- return keys.filter(Boolean);
-}
-// The style without its comments; a comment mark inside a string (a data URI) does not count.
-function stripComments(css) {
- let out = '', quote = null;
- for (let i = 0; i < css.length; i++) {
- const ch = css[i];
- if (quote) { out += ch; if (ch === '\\') out += css[++i] ?? ''; else if (ch === quote) quote = null; continue; }
- if (ch === '"' || ch === "'") { quote = ch; out += ch; continue; }
- if (ch === '/' && css[i + 1] === '*') { const end = css.indexOf('*/', i + 2); i = end < 0 ? css.length : end + 1; continue; }
- out += ch;
- }
- return out;
-}
-// Where the next of the characters in stops is, outside strings (css.length when there is none).
-function next(css, from, stops) {
- let quote = null;
- for (let i = from; i < css.length; i++) {
- const ch = css[i];
- if (quote) { if (ch === '\\') i++; else if (ch === quote) quote = null; continue; }
- if (ch === '"' || ch === "'") quote = ch;
- else if (stops.includes(ch)) return i;
- }
- return css.length;
-}
-const squeeze = s => s.replace(/\s*\n\s*/g, ' ').trim();
-// A style (comments already gone) as its top-level items: { kind: 'rule', selector, body } or { kind: 'at', name, head, inner,
-// items }, where items are the rules inside an @media or @supports block.
-function parseCss(css) {
- const items = [];
- for (let i = 0; i < css.length;) {
- const open = next(css, i, '{;}');
- if (open >= css.length) break;
- const head = css.slice(i, open).trim().replace(/\s+/g, ' ');
- if (css[open] !== '{') { i = open + 1; continue; }
- let depth = 1, j = open + 1;
- while (depth) {
- j = next(css, j, '{}');
- if (j >= css.length) throw new Error(`index.html: the style is not closed after "${head}"`);
- depth += css[j] === '{' ? 1 : -1;
- j++;
- }
- const inner = css.slice(open + 1, j - 1);
- if (head.startsWith('@')) {
- const name = head.slice(1).match(/^[\w-]+/)[0];
- items.push({ kind: 'at', name, head, inner: squeeze(inner), items: name === 'media' || name === 'supports' ? parseCss(inner) : [] });
- } else items.push({ kind: 'rule', selector: head, body: squeeze(inner) });
- i = j;
- }
- return items;
-}
-// The parts of a selector list, split at its top-level commas.
-function parts(selector) {
- const out = [];
- let depth = 0, part = '';
- for (const ch of selector + ',') {
- if (ch === '(' || ch === '[') depth++;
- else if (ch === ')' || ch === ']') depth--;
- if (ch === ',' && depth === 0) { out.push(part.trim()); part = ''; } else part += ch;
- }
- return out;
-}
-// The parts of a selector list that name the preview key (".pv-mesh", not ".pv-meshy"), joined again; '' when none does.
-const picked = (selector, key) => parts(selector).filter(p => new RegExp(`\\.pv-${key}(?![\\w-])`).test(p)).join(',');
-
-// The two blocks for the cards with these slugs (in page order): { css, data }.
-export function previewBlocks(home, slugs) {
- const CATS = homeConst(home, 'CATS'), PV = homeConst(home, 'PV'), STILL = homeConst(home, 'STILL');
- const pvMarkup = homeFunction(home, 'pvMarkup'), engines = engineKeys(home);
- const previews = [];
- for (const slug of new Set(slugs)) {
- const cat = CATS.find(c => c.entries.some(e => e[0] === slug));
- if (!cat) throw new Error(`famous/index.html: ${slug} is not a card on the home page`);
- const pv = PV[slug] || 'sig' + parseInt(cat.n, 10);
- if (engines.includes(pv)) throw new Error(`famous/index.html: ${slug} shows the preview ${pv}, which needs a script engine this page does not have`);
- const markup = pvMarkup(pv);
- if (!markup) throw new Error(`famous/index.html: ${slug} shows the preview ${pv}, which has no markup`);
- if (/<animate\b/.test(markup)) throw new Error(`famous/index.html: ${slug} shows the preview ${pv}, which animates in SVG (the home page takes that out under reduced motion; this page does not)`);
- previews.push({ slug, pv, still: STILL[pv] ?? 0.5, markup, name: cat.entries.find(e => e[0] === slug)[1] });
- }
- const items = parseCss(stripComments([...home.matchAll(/<style>([\s\S]*?)<\/style>/g)].map(m => m[1]).join('\n')));
- const one = (list, selector, where) => {
- const found = list.filter(it => it.kind === 'rule' && it.selector === selector);
- if (found.length !== 1) throw new Error(`index.html: ${found.length} rules for ${selector}${where}, not 1`);
- return `${selector}{${found[0].body}}`;
- };
- const named = name => items.filter(it => it.kind === 'at' && it.name === name).map(it => ({ id: it.head.split(' ')[1], text: `${it.head}{${it.inner}}` }));
- const keyframes = named('keyframes'), properties = named('property');
- const reduced = items.filter(it => it.kind === 'at' && it.head.replace(/\s+/g, '') === REDUCED).flatMap(it => it.items);
- // Each preview: a comment naming it, its rules (inside @media too, only the parts of the selector that name it), and the
- // keyframes that its rules or its markup name.
- const drawn = [...new Set(previews.map(p => p.pv))].map(key => {
- const own = [];
- for (const it of items) {
- if (it.kind === 'rule') { const sel = picked(it.selector, key); if (sel) own.push(`${sel}{${it.body}}`); }
- else if (it.name === 'media' || it.name === 'supports') {
- const inner = it.items.filter(r => r.kind === 'rule' && picked(r.selector, key)).map(r => `${picked(r.selector, key)}{${r.body}}`);
- if (inner.length) own.push(`${it.head}{${inner.join('')}}`);
- }
- }
- if (!own.length) throw new Error(`index.html: no rule draws the preview ${key}`);
- const words = new Set((own.join(' ') + ' ' + previews.find(p => p.pv === key).markup).split(/[\s,:;(){}"'=]+/));
- const who = previews.filter(p => p.pv === key).map(p => p.name).join(', ');
- return [`/* ${key}: ${who} */`, ...own, ...keyframes.filter(k => words.has(k.id)).map(k => k.text)];
- });
- const all = drawn.flat().join('\n') + previews.map(p => p.markup).join('\n');
- const css = ["/* the base: each category's accent color, the preview box, and its animations paused unless its card plays */",
- ...BASE.map(selector => one(items, selector, '')),
- `${REDUCED}{${one(reduced, BASE_REDUCED, ' under reduced motion')}}`,
- ...properties.filter(p => new RegExp(`${p.id}(?![\\w-])`).test(all)).map(p => p.text),
- ...drawn.flat()].join('\n');
- const data = ['const PREVIEWS={',
- ...previews.map((p, i) => JSON.stringify(p.slug) + ':' + JSON.stringify({ pv: p.pv, still: p.still, markup: p.markup }).replace(/<\//g, '<\\/') + (i < previews.length - 1 ? ',' : '')),
- '};'].join('\n');
- return { css, data };
-}
-
-// The text with what lies between the start and end marker lines replaced by inner (each marker there once, in that order).
-export function replaceBetween(text, start, end, inner) {
- const a = text.indexOf(start), b = a < 0 ? -1 : text.indexOf(end, a + start.length);
- if (a < 0 || b < 0 || text.indexOf(start, a + start.length) >= 0) throw new Error(`famous/index.html: the lines "${start}" and "${end}" must each be there once, in that order`);
- return text.slice(0, a + start.length) + '\n' + inner + '\n' + text.slice(b);
-}
-// The slugs of the page's cards, in page order.
-export const cardSlugs = page => [...page.matchAll(/<article class="card c[1-7]" data-slug="([a-z0-9-]+)">/g)].map(m => m[1]);
-// The page with both blocks written from the home page.
-export function buildFamousFrom(home, page) {
- const { css, data } = previewBlocks(home, cardSlugs(page));
- return replaceBetween(replaceBetween(page, CSS_START, CSS_END, css), JS_START, JS_END, data);
-}
-export function buildFamous(root) {
- const file = join(root, 'famous', 'index.html');
- if (!existsSync(file)) throw new Error('famous/index.html is missing');
- const home = readFileSync(join(root, 'index.html'), 'utf8').replace(/\r\n/g, '\n');
- return { 'famous/index.html': buildFamousFrom(home, readFileSync(file, 'utf8').replace(/\r\n/g, '\n')) };
-}
-
-// Run as a command, not imported by the test. The command's path is compared with its real path, so a run through a junction
-// or a link counts too.
-const self = (() => { try { return realpathSync(process.argv[1]); } catch { return ''; } })();
-if (self.toLowerCase() === fileURLToPath(import.meta.url).toLowerCase()) {
- const ROOT = fileURLToPath(new URL('..', import.meta.url));
- try {
- const file = join(ROOT, 'famous', 'index.html');
- const text = buildFamous(ROOT)['famous/index.html'];
- const old = readFileSync(file, 'utf8');
- const out = old.includes('\r\n') ? text.replace(/\n/g, '\r\n') : text;
- if (out !== old) writeFileSync(file, out);
- const previews = (text.match(/^"[a-z0-9-]+":\{"pv":/gm) || []).length;
- console.log(`famous/index.html: ${cardSlugs(text).length} cards, ${previews} previews${out === old ? '' : ' (written)'}`);
- } catch (err) {
- console.error(err.message);
- process.exitCode = 1;
- }
-}
-```
-
-- [ ] **Step 4: Run the tests and see them pass**
-
-Run: `node --test tests/famous.test.js`
-Expected: 4 tests pass.
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes (the other test files are untouched).
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add tools/make-famous.mjs tests/famous.test.js
-git commit -m "feat: tools/make-famous.mjs copies the home page's previews (their rules, keyframes and markup) into two marked blocks of the Famous effects page, with tests on a stand-in home page"
-```
-
----
-
-### Task 3: Page check — the `famous` target
-
-**Files:**
-- Modify: `tools/check-pages.mjs` (header comment lines 4-9; usage message line 66; after `homeCheck`, line 138; STARS comment line 152; after `homeMotionProblems`, line 908; STARS registration line 957; main loop lines 961, 978, 980, 1000 and after 1011)
-
-**Interfaces:**
-- Consumes (markup of Tasks 5, 7 and 8): `section.fx` entries with `h2`; `.fx-jump a[href="#id"]`; `.fx .card[data-slug]` with `.stage` and `.pv`; `.fx .copy` with `.copy-l`; `.fx-prompt`; `#toast .toast-t`; `h1`, `.fx-lede`, `.fx-legal`; the page script's labels `Copied`, `Press Ctrl+C to copy` and the name `Copied the prompt for <title>`.
-- Produces: `node tools/check-pages.mjs [--base URL] famous` checks `famous/` at the six setups; new functions `famousCheck`, `scrollSettled`, `famousJumpProblems`, `famousStageShot`, `famousPreviewProblems`, `famousCopyProblems`, `changedShare`, `famousMotionProblems`; screenshots `famous-<setup>.png` and `famous-desktop-full.png`.
-
-- [ ] **Step 1: See the target missing.** Serve this worktree on port 8931 (background) and run the pool command with the target `famous` and `--out C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/check-t3-before`.
-Expected: six FAIL lines with `not a guided-steps page` and `What it is is missing` (the target is unknown, so the run treats `famous/` as a demo page, and there is no page yet).
-
-- [ ] **Step 2: Header and usage.** The edits below anchor on the lines as they read on main (line numbers on main in brackets; they shift as you insert). Replace the usage line `// Usage: node tools/check-pages.mjs [--base http://127.0.0.1:8731] [--out <folder>] <page or category folder, or home>...` (line 4) with:
-
-```js
-// Usage: node tools/check-pages.mjs [--base http://127.0.0.1:8731] [--out <folder>] <page or category folder, home or famous>...
-```
-
-After the line `// tile, the slim bar and long words; the reduced-motion run checks that nothing moves.` (line 9) add:
-
-```js
-// node tools/check-pages.mjs famous checks the Famous effects page (famous/) at the same six setups: overflow, small
-// targets on phones (every link, chip, card and button), and the title, the lede and the not-connected line on the first
-// screen. The desktop run also presses each jump link, watches each entry's previews move and presses each Copy prompt,
-// once more with the clipboard refused; 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.
-```
-
-Replace the line ` console.error('Usage: node tools/check-pages.mjs [--base URL] [--out DIR] <page or category folder, or home>...');` (line 66) with:
-
-```js
- console.error('Usage: node tools/check-pages.mjs [--base URL] [--out DIR] <page or category folder, home or famous>...');
-```
-
-and the first line of the STARS comment, `// Runs at the start of every document when the run checks the home page: stores a GitHub star count in the home page's own` (line 152), with:
-
-```js
-// Runs at the start of every document when the run checks the home page or the Famous effects page: stores a GitHub star count in the home page's own
-```
-
-- [ ] **Step 3: The in-page check.** After the line `})()\`;` that closes `homeCheck` (line 138, right before the comment `// Runs at the start of every document, before the page's own scripts: records each press of a Show me button…`) add:
-
-```js
-
-// Runs inside the Famous effects page (famous/). Returns its problems: overflow, small targets on phones (every link, chip,
-// card and button, the site links and the link inside a sentence too), and the title, the lede and the not-connected line on
-// the first screen (the setups marked firstScreen: 1280×800 and 375×812). A page with no entries is a problem of its own, so
-// the desktop steps never pass on an empty page.
-const famousCheck = firstScreen => `(() => {
- const r = el => el.getBoundingClientRect();
- const phone = innerWidth <= 600;
- const problems = [];
- if (!document.querySelector('section.fx')) problems.push('no entries (section.fx): not the Famous effects page, or not built yet');
- if (document.documentElement.scrollWidth > document.documentElement.clientWidth + 1) problems.push('horizontal overflow');
- if (phone) {
- const small = [...document.querySelectorAll('.top a, .top button, .fx-jump a, .fx-seen a, .fx-what a, .fx .card, .fx .copy, .fx-toggle, .fx-suggest, .foot a')]
- .filter(el => el.getClientRects().length)
- .filter(el => { const b = r(el); return b.width < 44 || b.height < 44; })
- .map(el => el.tagName.toLowerCase() + (el.getAttribute('class') ? '.' + el.getAttribute('class').split(' ')[0] : '') + ' ' + Math.round(r(el).width) + 'x' + Math.round(r(el).height));
- if (small.length) problems.push('small targets: ' + small.join(', '));
- }
- for (const [what, el] of [['title', document.querySelector('h1')], ['lede', document.querySelector('.fx-lede')], ['not-connected line', document.querySelector('.fx-legal')]]) {
- if (!el) problems.push('no ' + what);
- else if (${firstScreen} && r(el).bottom > innerHeight) problems.push('the ' + what + ' is below the first screen');
- }
- return { problems };
-})()`;
-```
-
-- [ ] **Step 4: The famous steps.** After the closing `}` of `homeMotionProblems` (line 908), right before the comment `// The end of the run, done once: after the last page, after Ctrl+C and after an error outside the main flow.`, add:
-
-```js
-
-// Famous effects: waits until the page holds still (scrollY the same over three checks 100 ms apart, for up to 3 s).
-const scrollSettled = () => evaluate(`new Promise(done => { let last = scrollY, same = 0, left = 30;
- const tick = () => { same = scrollY === last ? same + 1 : 0; last = scrollY; if (same >= 3 || !--left) done(); else setTimeout(tick, 100); };
- setTimeout(tick, 100); })`);
-
-// Famous effects, desktop run: each link of the jump row, pressed as the keyboard presses it (focus, then activate) from the
-// top of the page, brings its entry's heading fully into the window, gives that heading keyboard focus and names the entry in
-// the address.
-async function famousJumpProblems() {
- const hrefs = await evaluate(`[...document.querySelectorAll('.fx-jump a')].map(a => a.getAttribute('href'))`);
- if (!hrefs.length) return ['no links in the jump row'];
- const problems = [];
- for (const href of hrefs) {
- await evaluate(`(() => { scrollTo(0, 0); const a = document.querySelector('.fx-jump a[href="${href}"]'); a.focus(); a.click(); })()`);
- await scrollSettled();
- const got = await evaluate(`(() => { const s = document.querySelector('${href}'), h = s && s.querySelector('h2');
- if (!h) return null;
- const b = h.getBoundingClientRect();
- return { top: Math.round(b.top), shown: b.top >= 0 && b.bottom <= innerHeight, focus: document.activeElement === h, hash: location.hash }; })()`);
- if (!got) problems.push(`jump to ${href}: no entry with that id, or no heading in it`);
- else if (!got.shown || !got.focus || got.hash !== href) problems.push(`jump to ${href}: ${JSON.stringify(got)}`);
- }
- return problems;
-}
-
-// Famous effects: a PNG (base64) of the stage of a card (an expression that finds the card in the page), where the page is
-// scrolled now.
-async function famousStageShot(card) {
- const box = await evaluate(`(() => { const b = ${card}.querySelector('.stage').getBoundingClientRect();
- return { x: b.left + scrollX, y: b.top + scrollY, width: b.width, height: b.height }; })()`);
- return (await send('Page.captureScreenshot', { format: 'png', clip: { ...box, scale: 1 } })).data;
-}
-
-// Famous effects, desktop run: with an entry's cards in the middle of the window, each card's preview moves (its picture
-// changes within 3 s); once the last entry is in view, the first entry's previews have stopped, since a preview plays only
-// while it is on screen.
-async function famousPreviewProblems() {
- const ids = await evaluate(`[...document.querySelectorAll('section.fx')].map(s => s.id)`);
- if (!ids.length) return ['no entries to play'];
- const problems = [];
- for (const id of ids) {
- const cards = await evaluate(`(async () => { const s = document.getElementById('${id}'), row = s.querySelector('.fx-cards');
- if (!row) return 0;
- row.scrollIntoView({ block: 'center' });
- await new Promise(r => setTimeout(r, 400));
- return s.querySelectorAll('.card').length; })()`);
- if (!cards) { problems.push(`${id}: no cards`); continue; }
- for (let i = 0; i < cards; i++) {
- const card = `document.querySelectorAll('#${id} .card')[${i}]`;
- const first = await famousStageShot(card);
- let moved = false;
- for (const end = Date.now() + 3000; !moved && Date.now() < end;) { await sleep(200); moved = (await famousStageShot(card)) !== first; }
- if (!moved) problems.push(`${id}: the preview of ${await evaluate(`${card}.dataset.slug`)} does not move while on screen`);
- }
- }
- const still = await evaluate(`document.querySelector('section.fx').querySelectorAll('.card.playing').length`);
- if (ids.length > 1 && still) problems.push(`the first entry's previews keep playing while it is off screen (${still} cards)`);
- 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 selects its prompt and the button 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' });
- 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 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) {
- await evaluate(`window.__clipboardGot = null`);
- const trouble = await press(id);
- if (trouble) { problems.push(`${id}: ${trouble}`); continue; }
- const got = await evaluate(`(async () => {
- for (let i = 0; i < 60 && window.__clipboardGot === null; i++) await new Promise(r => setTimeout(r, 50));
- await new Promise(r => setTimeout(r, 50));
- const btn = document.querySelector('#${id} .copy'), title = document.querySelector('#${id} h2').textContent;
- return { same: window.__clipboardGot === ${prompt(id)}, label: btn.textContent.trim(), named: (btn.getAttribute('aria-label') || '') === 'Copied the prompt for ' + title,
- toast: document.getElementById('toast').classList.contains('show') && document.querySelector('#toast .toast-t').textContent === 'Prompt copied. Paste it into your AI assistant.' };
- })()`);
- if (!got.same || got.label !== 'Copied' || !got.named || !got.toast) problems.push(`${id}: Copy prompt ${JSON.stringify(got)}`);
- }
- await evaluate(`(() => { navigator.clipboard.writeText = async () => { throw new DOMException('denied', 'NotAllowedError'); }; getSelection().removeAllRanges(); })()`);
- const trouble = await press(ids[0]);
- if (trouble) problems.push(`${ids[0]}, clipboard refused: ${trouble}`);
- else {
- const refused = await evaluate(`(async () => { const btn = document.querySelector('#${ids[0]} .copy');
- for (let i = 0; i < 60 && !btn.textContent.includes('Ctrl+C'); i++) await new Promise(r => setTimeout(r, 50));
- return { label: btn.textContent.trim(), selected: getSelection().toString().replace(/\\s+/g, ' ').trim() === ${prompt(ids[0])} }; })()`);
- if (refused.label !== 'Press Ctrl+C to copy' || !refused.selected) problems.push(`${ids[0]}, clipboard refused: ${JSON.stringify(refused)} (expected "Press Ctrl+C to copy" and the prompt selected)`);
- }
- return problems;
-}
-
-// Famous effects: the pixels that differ by more than 48 (red, green and blue summed) between two captures of the same size
-// (base64 PNG), as their share of the picture and the shares of its width and of its height that the box around them takes.
-// homeMotionProblems does the same inline for the home page; this copy serves the Famous effects page, so that one stays as it is.
-const changedShare = (a, b) => evaluate(`new Promise(done => {
- const load = src => new Promise(resolve => { const img = new Image(); img.onload = () => resolve(img); img.src = 'data:image/png;base64,' + src; });
- Promise.all([load(${JSON.stringify(a)}), load(${JSON.stringify(b)})]).then(([x, y]) => {
- const read = img => { const c = document.createElement('canvas'); c.width = img.width; c.height = img.height; const g = c.getContext('2d'); g.drawImage(img, 0, 0); return g.getImageData(0, 0, c.width, c.height).data; };
- const p = read(x), q = read(y), w = x.width, h = x.height;
- let changed = 0, left = w, right = -1, top = h, bottom = -1;
- for (let i = 0; i < p.length; i += 4) {
- if (Math.abs(p[i] - q[i]) + Math.abs(p[i + 1] - q[i + 1]) + Math.abs(p[i + 2] - q[i + 2]) <= 48) continue;
- const px = (i / 4) % w, py = Math.floor(i / 4 / w);
- changed++; left = Math.min(left, px); right = Math.max(right, px); top = Math.min(top, py); bottom = Math.max(bottom, py);
- }
- done({ share: changed / (w * h), wide: changed ? (right - left + 1) / w : 0, tall: changed ? (bottom - top + 1) / h : 0 });
- });
-})`);
-
-// 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.
-async function famousMotionProblems() {
- const problems = [];
- const running = when => evaluate(`document.getAnimations().filter(a => a.playState === 'running').map(a => {
- const t = a.effect && a.effect.target, card = t && t.closest && t.closest('.card');
- return (a.animationName || a.transitionProperty || 'an animation') + ' on ' + (card ? card.dataset.slug : t ? t.tagName.toLowerCase() : 'the page');
- })`).then(found => { if (found.length) problems.push(`reduced motion: ${found.length} animations run ${when} (${[...new Set(found)].slice(0, 8).join(', ')})`); });
- await running('at once');
- const frames = n => `new Promise(done => { let left = ${n}; const tick = () => (--left ? requestAnimationFrame(tick) : done()); requestAnimationFrame(tick); })`;
- const cards = await evaluate(`document.querySelectorAll('section.fx .card').length`);
- if (!cards) return [...problems, 'reduced motion: no cards'];
- const empty = [];
- for (let i = 0; i < cards; i++) {
- const card = `document.querySelectorAll('section.fx .card')[${i}]`;
- await evaluate(`(async () => { ${card}.querySelector('.stage').scrollIntoView({ block: 'center' }); await ${frames(2)}; })()`);
- const drawn = await famousStageShot(card);
- await evaluate(`(async () => { for (const el of ${card}.querySelector('.pv').children) el.style.visibility = 'hidden'; await ${frames(2)}; })()`);
- const bare = await famousStageShot(card);
- await evaluate(`{ for (const el of ${card}.querySelector('.pv').children) el.style.visibility = ''; }`);
- const seen = await changedShare(drawn, bare);
- if (seen.share < .003 || seen.wide * seen.tall < .01) {
- empty.push(`${await evaluate(`${card}.dataset.slug`)} (${(seen.share * 100).toFixed(2)}% of the stage, in a box of ${Math.round(seen.wide * 100)}% × ${Math.round(seen.tall * 100)}%)`);
- }
- }
- if (empty.length) problems.push(`reduced motion: ${empty.length} previews show nothing: ${empty.join(', ')}`);
- await running('once every card has been on screen');
- const jump = await evaluate(`(async () => { scrollTo(0, 0); const links = document.querySelectorAll('.fx-jump a'), a = links[links.length - 1];
- if (!a) return null;
- a.focus(); a.click(); await ${frames(2)};
- const h = document.querySelector(a.getAttribute('href') + ' h2'), b = h.getBoundingClientRect();
- return { href: a.getAttribute('href'), shown: b.top >= 0 && b.bottom <= innerHeight, top: Math.round(b.top) }; })()`);
- if (!jump) problems.push('reduced motion: no links in the jump row');
- 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)`);
- return problems;
-}
-```
-
-- [ ] **Step 5: List `famous` in the main loop.** The line ` if (pages.includes('home')) await send('Page.addScriptToEvaluateOnNewDocument', { source: STARS });` (line 957) becomes:
-
-```js
- if (pages.includes('home') || pages.includes('famous/')) await send('Page.addScriptToEvaluateOnNewDocument', { source: STARS });
-```
-
-After the line ` const home = page === 'home';` (line 961) add:
-
-```js
- const famous = page === 'famous/';
-```
-
-The line ` const result = await evaluate(home ? homeCheck(!!setup.firstScreen) : CHECK);` (line 978) becomes:
-
-```js
- const result = await evaluate(home ? homeCheck(!!setup.firstScreen) : famous ? famousCheck(!!setup.firstScreen) : CHECK);
-```
-
-The two lines ` if (!home) {` in the main loop (lines 980 and 1000) each become:
-
-```js
- if (!home && !famous) {
-```
-
-After the closing ` }` of the block that starts ` if (home) {` (line 1011, right before ` } catch (err) {`) add:
-
-```js
- if (famous) {
- if (setup.moves) {
- problems.push(...await famousJumpProblems());
- problems.push(...await famousPreviewProblems());
- problems.push(...await famousCopyProblems());
- }
- if (setup.name === 'phone-reduced') problems.push(...await famousMotionProblems());
- }
-```
-
-- [ ] **Step 6: Check the syntax and that nothing else changed**
-
-Run: `node --check tools/check-pages.mjs` — expected: no output.
-Run the pool command with the target `home` on port 8931 — expected: six `ok` lines (the home checks are untouched).
-Run it with the target `famous` and `--out C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/check-t3-after` — expected: six FAIL lines, each listing `no entries (section.fx): not the Famous effects page, or not built yet`, `no lede` and `no not-connected line` (there is no page in this worktree, so the server's error page stands in, and a console line about its 404 may follow); the desktop line also lists `no links in the jump row; no entries to play; no entries to copy`, the phone-reduced line `reduced motion: no cards`. This shows the target is wired; Tasks 5 and 7 run it on the real page. Stop the server.
-
-- [ ] **Step 7: Commit**
-
-```bash
-git add tools/check-pages.mjs
-git commit -m "feat: the page check's famous target checks the Famous effects page at six setups: first screen, touch targets, each jump link, each entry's previews and Copy prompt, and still previews under reduced motion"
-```
-
----
-
-### Task 4: The home page's footer links the Famous effects page
-
-**Files:**
-- Modify: `index.html` (CSS after line 257; footer nav line 1536; script after line 2312)
-- Test: `tests/pages.test.js` (a new test at the end, after line 857)
-
-**Interfaces:**
-- Produces: `<a class="lnk" href="famous/">Famous effects</a>` first in `footer.wrap.foot nav.nav`; opened from disk it names `famous/index.html`; the footer's links wrap on the narrowest phones.
-
-- [ ] **Step 1: Write the failing test** at the end of `tests/pages.test.js`:
-
-```js
-
-// The Famous effects page (famous/) is reached from the home page's footer until the tab pass adds it to the top bar
-// (docs/superpowers/specs/2026-10-13-famous-effects-design.md); opened from disk, the link names famous/index.html, as the
-// cards name their pages' index.html. With three links the footer's row wraps on the narrowest phones.
-test('the home page footer links the Famous effects page', () => {
- const footer = between(HOME, '<footer class="wrap foot">', '</footer>');
- assert.equal(count(footer, '<a class="lnk" href="famous/">Famous effects</a>'), 1, 'one Famous effects link in the footer');
- assert.ok(HOME.includes(`if(FROM_DISK)document.querySelectorAll('a[href="famous/"]').forEach(a=>a.setAttribute('href','famous/index.html'));`),
- 'opened from disk, the link opens famous/index.html');
- assert.ok(cssRules(between(HOME, '<style>', '</style>')).some(rule => rule.selector === '.foot .nav' && /(^|;)\s*flex-wrap:\s*wrap/.test(rule.body)),
- 'the footer links wrap on the narrowest phones');
-});
-```
-
-- [ ] **Step 2: Run it and see it fail**
-
-Run: `node --test tests/pages.test.js`
-Expected: the new test FAILS with "one Famous effects link in the footer" (0 !== 1); every other test passes.
-
-- [ ] **Step 3: Edit `index.html`.** After line 257 (`.foot-t{font-size:15px;color:var(--muted)}`) add:
-
-```css
-.foot .nav{flex-wrap:wrap} /* three links: on the narrowest phones the last one moves to a second line */
-```
-
-Replace the footer's links, line 1536 (` <nav class="nav" aria-label="Footer"><a class="lnk" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">GitHub</a><a class="lnk" href="#top">Back to top</a></nav>`), with:
-
-```html
- <nav class="nav" aria-label="Footer"><a class="lnk" href="famous/">Famous effects</a><a class="lnk" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">GitHub</a><a class="lnk" href="#top">Back to top</a></nav>
-```
-
-After line 2312 (`if(FROM_DISK)document.querySelectorAll('a.brand').forEach(a=>a.setAttribute('href','index.html'));`) add:
-
-```js
-if(FROM_DISK)document.querySelectorAll('a[href="famous/"]').forEach(a=>a.setAttribute('href','famous/index.html'));
-```
-
-- [ ] **Step 4: Run all tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes.
-
-- [ ] **Step 5: Home page check.** Serve this worktree on port 8932 and run the pool command with the target `home` and `--out C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/check-t4`.
-Expected: six `ok` lines (the footer's three links are 44px tall on phones and wrap at 320px without overflow). Look at the bottom of `home-desktop-full.png`: Famous effects, GitHub and Back to top in one row. (The phone screenshots show only the first screen; at 375px and 320px the check itself measures the footer's links and the page's width.) Stop the server.
-
-- [ ] **Step 6: Commit**
-
-```bash
-git add index.html tests/pages.test.js
-git commit -m "feat: the home page's footer links the Famous effects page (from disk, its index.html), and its links wrap on the narrowest phones"
-```
-
----
-
-### Task 5: The page frame and the issue template
-
-**Files:**
-- Create: `famous/index.html` (the frame: head, top bar, head, an empty jump row, Seen one we should add?, footer, message, script; no entries)
-- Create: `.github/ISSUE_TEMPLATE/famous_effect.yml`
-- Modify: `tests/famous.test.js` (append the frame section)
-
-**Interfaces:**
-- Consumes: Task 2's `tools/make-famous.mjs` (`buildFamous`, `CSS_START`, `CSS_END`); Task 3's `famous` target.
-- Produces: the page's structure that Tasks 7 and 8 fill: `<nav class="fx-jump" aria-label="Effects on this page">` followed on the next line by ` </nav>` (chips go between); ` <section class="fx-more" aria-labelledby="fx-more-t">` (entries go before it, each followed by a blank line); the skip link `<a class="skip" href="#stripe-ribbon">Skip to the first effect</a>`; the pill `<p class="pill">12 effects from well-known websites</p>`; the page script, which fills each `.fx .card[data-slug]` from `PREVIEWS`, runs jumps for `a[href^="#"]` to a `section.fx`, adds the clamp toggle after each `.fx-prompt` and wires each `.fx .copy`.
-
-- [ ] **Step 1: Write the failing tests.** Append to `tests/famous.test.js`:
-
-```js
-
-// ---------- The page: its frame ----------
-const FILE = path.join(ROOT, 'famous', 'index.html');
-// A file's text with Windows line endings read as plain ones: a checkout may hold either.
-const read = f => fs.readFileSync(f, 'utf8').replace(/\r\n/g, '\n');
-const PAGE = read(FILE);
-const HOME = read(path.join(ROOT, 'index.html'));
-const LIVE = 'https://matinmonshizadeh.github.io/animation-handbook/';
-const REPO = 'https://github.com/matinmonshizadeh/animation-handbook';
-const TEMPLATE = `${REPO}/issues/new?template=famous_effect.yml`;
-const TITLE = 'Famous effects — Animation Handbook';
-const LEDE = 'Effects people admire on well-known websites, the handbook animations that make something similar, and a prompt to build your own.';
-const LEGAL = "The Animation Handbook is not connected to any of these sites or their owners, and none of them has reviewed or approved this page. Each effect is described in our own words and shown only with the handbook's own demos.";
-// The sites the page may name (the twelve entries and the reserves): none belongs in its title or description.
-const SITE_NAMES = ['Stripe', 'Apple', 'Lando Norris', 'Linear', 'Wikipedia', 'ChatGPT', 'OpenAI', 'x.com', 'Spotify', 'YouTube', 'Pudding', 'Medium', 'Rockstar', 'Cursor'];
-const count = (s, sub) => s.split(sub).length - 1;
-// The part of s from the first `from` up to the next `to` after it ('' when `from` is missing).
-const between = (s, from, to) => {
- const start = s.indexOf(from);
- if (start < 0) return '';
- const end = s.indexOf(to, start + from.length);
- return s.slice(start, end < 0 ? undefined : end);
-};
-const decode = s => s.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
-// The words a piece of markup shows: tags dropped, entities decoded, white space squeezed (as the page's Copy prompt reads it).
-const textOf = html => decode(html.replace(/<[^>]*>/g, '')).replace(/\s+/g, ' ').trim();
-const meta = attr => { const m = PAGE.match(new RegExp(`<meta ${attr} content="([^"]*)">`)); return m && decode(m[1]); };
-// What a visitor reads: the page without its scripts and styles.
-const MARKUP = PAGE.replace(/<script\b[\s\S]*?<\/script>/g, '').replace(/<style\b[\s\S]*?<\/style>/g, '');
-const escapeRe = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
-// Whether a link or source of famous/index.html names a file of the repository (a folder stands for its index.html).
-const isRepoFile = ref => {
- const bare = ref.replace(/[?#].*$/, '');
- if (/^[a-z][a-z0-9+.-]*:/i.test(bare) || bare.startsWith('/')) return false;
- const file = path.resolve(ROOT, 'famous', bare || '.');
- return fs.existsSync(bare === '' || bare.endsWith('/') ? path.join(file, 'index.html') : file);
-};
-
-test('famous/index.html: one title and one description for search and social sites, with no company name in them', () => {
- assert.equal(count(PAGE, '<title>'), 1, 'one title');
- assert.ok(PAGE.includes(`<title>${TITLE}</title>`), 'the title');
- for (const attr of ['property="og:title"', 'name="twitter:title"']) assert.equal(meta(attr), TITLE, attr);
- for (const attr of ['name="description"', 'property="og:description"', 'name="twitter:description"']) assert.equal(meta(attr), LEDE, attr);
- assert.ok(PAGE.includes('<h1 class="h1">Famous effects</h1>'), 'the heading');
- assert.ok(PAGE.includes(`<p class="fx-lede">${LEDE}</p>`), 'the lede under it');
- assert.match(PAGE, /<p class="pill">\d+ effects from well-known websites<\/p>/, 'the pill');
- for (const name of SITE_NAMES) assert.ok(!new RegExp(`\\b${escapeRe(name)}\\b`, 'i').test(`${TITLE} ${LEDE}`), `no "${name}" in the title or description`);
-});
-
-test('famous/index.html: canonical and og:url are its live address, and it shares the site\'s picture', () => {
- assert.ok(PAGE.includes(`<link rel="canonical" href="${LIVE}famous/">`), 'canonical');
- assert.equal(meta('property="og:url"'), `${LIVE}famous/`);
- for (const attr of ['property="og:image"', 'name="twitter:image"']) assert.equal(meta(attr), `${LIVE}og-image.png`, attr);
-});
-
-test('the top bar is the home page\'s, with Famous effects marked as this page', () => {
- const bar = between(PAGE, '<header class="wrap top" id="top">', '</header>');
- for (const part of ['<a class="brand" href="../">', '<a class="lnk" href="../?view=all">Browse all</a>', '<a class="lnk" href="./" aria-current="page">Famous effects</a>',
- '<button type="button" class="icon-btn theme-btn" id="theme-toggle" aria-label="Switch between light and dark">',
- `<a class="gh" id="gh-stars" href="${REPO}" target="_blank" rel="noopener">`]) assert.ok(bar.includes(part), part);
- assert.equal(count(MARKUP, 'aria-current='), 1, 'one current page');
-});
-
-test('the light and dark colors and the theme switch are the home page\'s', () => {
- const block = (html, selector) => {
- const css = between(html, '<style>', '</style>'), at = css.indexOf(`${selector}{`);
- assert.ok(at >= 0, selector);
- return css.slice(at, css.indexOf('}', at) + 1).replace(/\s+/g, '');
- };
- for (const selector of [':root', ':root[data-theme="dark"]']) assert.equal(block(PAGE, selector), block(HOME, selector), selector);
- assert.ok(PAGE.includes(HOME.match(/function setTheme\(t\)\{[^\n]*\}/)[0]), 'the same setTheme as the home page');
-});
-
-test('the not-connected line is on the page once, word for word, above the jump row and every entry', () => {
- assert.equal(count(PAGE, LEGAL), 1, 'once');
- assert.ok(PAGE.includes(`<p class="fx-legal">${LEGAL}</p>`), 'in its own paragraph');
- const at = PAGE.indexOf(LEGAL);
- assert.ok(at < PAGE.indexOf('<nav class="fx-jump"'), 'above the jump row');
- assert.ok(PAGE.indexOf('<section class="fx"') < 0 || at < PAGE.indexOf('<section class="fx"'), 'above the first entry');
-});
-
-test('the page loads nothing from elsewhere, uses only the site\'s font in its own style and shows no code', async () => {
- const { CSS_START, CSS_END } = await tool();
- for (const bad of ['<img', '<video', '<iframe', '<picture', '<object', '<embed', '@import', 'url(http']) assert.ok(!PAGE.includes(bad), bad);
- assert.ok(!/demo-page\.(css|js)/.test(PAGE), 'it links neither shared file');
- for (const [, src] of PAGE.matchAll(/\ssrc="([^"]*)"/g)) assert.ok(isRepoFile(src), `src ${src}`);
- for (const [tag] of PAGE.matchAll(/<link\b[^>]*>/g)) {
- if (!/\srel="(stylesheet|icon|apple-touch-icon)"/.test(tag)) continue;
- const href = tag.match(/\shref="([^"]*)"/)[1];
- assert.ok(isRepoFile(href), `link ${href}`);
- }
- const css = between(PAGE, '<style>', '</style>').replace(/url\(\s*(["'])data:[\s\S]*?\1\s*\)/g, '');
- for (const [, ref] of css.matchAll(/url\(\s*['"]?([^'")\s]+)/g)) assert.ok(isRepoFile(ref), `url(${ref})`);
- const own = css.slice(0, css.indexOf(CSS_START)) + css.slice(css.indexOf(CSS_END));
- for (const [, family] of own.matchAll(/font-family:([^;}]+)/g)) assert.match(family.trim(), /^(var\(--disp\)|var\(--text\)|'Schibsted Grotesk')$/, `font-family:${family}`);
- assert.ok(!/`|<code|<pre/.test(MARKUP), 'no backtick, <code> or <pre> outside <script> and <style>');
-});
-
-test('the only links that leave the site are the entries\' sites, the GitHub repository and its issue template, each in a new tab', () => {
- const sites = new Set([...PAGE.matchAll(/<p class="fx-seen">Seen on <a href="([^"]+)"/g)].map(m => m[1]));
- for (const [tag, href] of PAGE.matchAll(/<a\b[^>]*\shref="(https?:[^"]*)"[^>]*>/g)) {
- assert.ok(href === REPO || href === TEMPLATE || sites.has(href), `a link that leaves the site: ${href}`);
- assert.match(tag, /\starget="_blank" rel="noopener"/, `${href} opens in a new tab`);
- }
-});
-
-test('every link inside the site opens a file of the repository, and from disk a folder link opens its index.html', () => {
- for (const [, href] of PAGE.matchAll(/<a\b[^>]*\shref="([^"]*)"/g)) {
- if (/^https?:/.test(href) || href.startsWith('#')) continue;
- assert.ok(isRepoFile(href), href);
- }
- assert.ok(PAGE.includes("if(location.protocol==='file:')document.querySelectorAll('a[href]').forEach(a=>{"), 'opened from disk, folder links name index.html');
-});
-
-test('the footer is the home page\'s, without the count', () => {
- const foot = between(PAGE, '<footer class="wrap foot">', '</footer>');
- assert.ok(foot.includes('<p class="foot-t">Web animations with live demos and copyable prompts.</p>'), 'its line, with no number');
- assert.ok(foot.includes(`<a class="lnk" href="${REPO}" target="_blank" rel="noopener">GitHub</a><a class="lnk" href="#top">Back to top</a>`), 'its links');
- assert.ok(!/\d/.test(textOf(foot)), 'no number in the footer');
-});
-
-test('the page script copies, falls back to the copy keys, shortens prompts on phones and shows the message, in the words of the animation pages and the home page', () => {
- const script = [...PAGE.matchAll(/<script>([\s\S]*?)<\/script>/g)].map(m => m[1]).join('\n');
- const shared = read(path.join(ROOT, 'assets', 'js', 'demo-page.js'));
- for (const words of ['Show the full prompt', 'Show less', 'Press ⌘C to copy', 'Press Ctrl+C to copy']) {
- assert.ok(script.includes(`'${words}'`), `the page says "${words}"`);
- assert.ok(shared.includes(`'${words}'`), `as the animation pages do: "${words}"`);
- }
- assert.ok(script.includes("toast('Prompt copied. Paste it into your AI assistant.')") && HOME.includes("toast('Prompt copied. Paste it into your AI assistant.')"), 'the home page\'s message');
- for (const words of ["'Copy prompt'", "'Copied'"]) assert.ok(script.includes(words), words);
- assert.ok(PAGE.includes('<div class="toast" id="toast" role="status" aria-live="polite">'), 'the message box');
-});
-
-test('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');
- 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`)) || '';
- for (const id of ['address', 'what']) assert.match(field(id), /\n {4}validations:\n {6}required: true/, `${id} is required`);
- assert.match(yml, /no screenshots, videos or code from the site/i, 'no screenshots or code from the site');
-});
-
-test('the two preview blocks are what tools/make-famous.mjs writes from the home page now', async () => {
- const { buildFamous } = await tool();
- assert.ok(buildFamous(ROOT)['famous/index.html'] === PAGE, `famous/index.html is out of date: run ${TOOL}`);
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `node --test tests/famous.test.js`
-Expected: the file FAILS with `ENOENT` for `famous\index.html` (the page does not exist yet).
-
-- [ ] **Step 3: Create `famous/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<meta charset="UTF-8">
-<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<title>Famous effects — Animation Handbook</title>
-<meta name="description" content="Effects people admire on well-known websites, the handbook animations that make something similar, and a prompt to build your own.">
-<meta name="robots" content="index, follow, max-image-preview:large">
-<meta name="theme-color" content="#f8f7f4">
-<link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/famous/">
-<link rel="icon" type="image/png" sizes="96x96" href="../favicon.png">
-<link rel="icon" type="image/svg+xml" href="../favicon.svg">
-<link rel="apple-touch-icon" href="../apple-touch-icon.png">
-
-<!-- Open Graph -->
-<meta property="og:type" content="website">
-<meta property="og:site_name" content="Animation Handbook">
-<meta property="og:title" content="Famous effects — Animation Handbook">
-<meta property="og:description" content="Effects people admire on well-known websites, the handbook animations that make something similar, and a prompt to build your own.">
-<meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/famous/">
-<meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
-<meta property="og:image:width" content="1200">
-<meta property="og:image:height" content="630">
-
-<!-- Twitter -->
-<meta name="twitter:card" content="summary_large_image">
-<meta name="twitter:title" content="Famous effects — Animation Handbook">
-<meta name="twitter:description" content="Effects people admire on well-known websites, the handbook animations that make something similar, and a prompt to build your own.">
-<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
-<script>
-// The theme is the visitor's own pick (ah-theme), else the system's, as on the home page.
-function setTheme(t){document.documentElement.dataset.theme=t;document.querySelector('meta[name="theme-color"]').content=t==='dark'?'#0e0e11':'#f8f7f4';}
-(function(){var t=matchMedia('(prefers-color-scheme: light)').matches?'light':'dark';try{t=localStorage.getItem('ah-theme')||t;}catch(e){}setTheme(t);})();</script>
-<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}
-
-/* the home page's colors and type, copied as they are (tests/famous.test.js compares them) */
-:root{
- --bg:#f8f7f4;--surface:#ffffff;--ink:#16161b;--ink-2:#45454f;--muted:#676771;
- --line:#e5e3dc;--line-2:#efede8;--brand:#2f5bea;--ok:#157a43;
- --shadow:0 1px 2px rgba(22,22,27,.04),0 8px 24px rgba(22,22,27,.06);
- --shadow-2:0 2px 4px rgba(22,22,27,.05),0 18px 40px rgba(22,22,27,.11);
- --c1:#6ea8ff;--c2:#5fd88a;--c3:#b98cff;--c4:#ff9d5c;--c5:#ff6f8b;--c6:#3fd6c4;--c7:#ffce5a;
- --disp:'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;--text:var(--disp);
- --ease:cubic-bezier(.22,1,.36,1);--gut:clamp(16px,4vw,40px);
- color-scheme:light;
-}
-:root[data-theme="dark"]{
- --bg:#0e0e11;--surface:#17171c;--ink:#f4f4f2;--ink-2:#c6c6cc;--muted:#9c9ca5;
- --line:rgba(255,255,255,.13);--line-2:rgba(255,255,255,.07);--brand:#86a8ff;
- --shadow:0 1px 2px rgba(0,0,0,.3),0 8px 24px rgba(0,0,0,.25);
- --shadow-2:0 2px 4px rgba(0,0,0,.35),0 18px 40px rgba(0,0,0,.45);
- color-scheme:dark;
-}
-*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
-[hidden]{display:none!important}
-html,body{background:var(--bg);color:var(--ink)}
-body{font-family:var(--text);font-size:16px;line-height:1.5;-webkit-font-smoothing:antialiased;overflow-x:hidden}
-a{color:inherit}
-button{font:inherit;color:inherit}
-:focus-visible{outline:3px solid var(--brand);outline-offset:3px}
-.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
-.skip{position:absolute;left:16px;top:-80px;z-index:100;padding:10px 16px;border-radius:10px;background:var(--ink);color:var(--bg);font-weight:700;text-decoration:none}
-.skip:focus{top:12px}
-.i{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
-.wrap{width:min(1280px,calc(100% - 2 * var(--gut)));margin-inline:auto}
-
-/* the top bar and the footer: the home page's */
-.top{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:76px}
-.brand{display:inline-flex;align-items:center;gap:12px;min-height:44px;text-decoration:none;font-size:17px;font-weight:800;letter-spacing:-.015em;white-space:nowrap}
-.mark{width:30px;height:30px;flex:none}
-.mark .ring{fill:var(--bg);stroke:currentColor;stroke-width:1.8}
-.mark .ball{fill:currentColor}
-.nav{display:flex;align-items:center;gap:6px}
-.lnk{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 14px;border-radius:999px;text-decoration:none;font-size:15px;font-weight:600;color:var(--ink-2);white-space:nowrap}
-.lnk[aria-current="page"]{color:var(--ink);background:var(--line-2)}
-.icon-btn{display:inline-grid;place-items:center;width:44px;height:44px;border-radius:999px;border:0;background:none;color:var(--ink-2);cursor:pointer}
-.theme-btn .sun,:root[data-theme="dark"] .theme-btn .moon{display:none}
-:root[data-theme="dark"] .theme-btn .sun{display:block}
-.gh{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 16px;border-radius:999px;border:1px solid var(--line);background:var(--surface);text-decoration:none;font-size:15px;font-weight:600;white-space:nowrap}
-.gh-c{color:var(--muted);font-variant-numeric:tabular-nums}
-.foot{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px 24px;padding:36px 0 44px}
-.foot-t{font-size:15px;color:var(--muted)}
-
-/* one centered column: the head, the jump row, the entries and the suggestion */
-.fx-page{width:min(1040px,calc(100% - 2 * var(--gut)));margin-inline:auto}
-.fx-head{display:flex;flex-direction:column;align-items:center;text-align:center;padding-top:clamp(16px,4vw,48px)}
-.pill{display:inline-flex;align-items:center;padding:8px 16px;border-radius:999px;background:var(--surface);border:1px solid var(--line);font-size:14px;font-weight:600;color:var(--ink-2)}
-.h1{margin-top:22px;font-size:clamp(34px,5.2vw,64px);font-weight:800;line-height:1.04;letter-spacing:-.035em}
-.fx-lede{margin-top:18px;max-width:640px;font-size:clamp(16px,1.4vw,19px);line-height:1.55;color:var(--ink-2)}
-.fx-legal{margin-top:14px;max-width:640px;font-size:14px;line-height:1.55;color:var(--muted)}
-.fx-jump{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:clamp(24px,3vw,36px)}
-.fx-jump a{display:inline-flex;align-items:center;min-height:44px;padding:0 16px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--ink-2);font-size:14px;font-weight:600;text-decoration:none;white-space:nowrap}
-
-/* an entry: seen on, the title, what you see, the cards, the prompt and Copy prompt */
-.fx{margin-top:clamp(36px,5vw,56px);padding-top:clamp(36px,5vw,56px);border-top:1px solid var(--line);scroll-margin-top:16px}
-.fx-seen{display:flex;flex-wrap:wrap;align-items:center;column-gap:.35em;font-size:15px;color:var(--muted)}
-.fx-seen a{display:inline-flex;align-items:center;min-width:44px;min-height:44px;color:var(--ink);font-weight:700;text-decoration:underline;text-decoration-color:var(--line);text-underline-offset:5px}
-.fx h2{font-size:clamp(26px,3.2vw,36px);font-weight:800;line-height:1.1;letter-spacing:-.025em}
-.fx-what{margin-top:14px;max-width:68ch;font-size:17px;line-height:1.65;color:var(--ink-2)}
-.fx-what a{color:var(--ink);text-underline-offset:4px}
-.fx-sub{margin:32px 0 14px;font-size:18px;font-weight:700;letter-spacing:-.01em}
-.fx-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}
-.fx-pbox{max-width:760px;padding:20px 22px;border-radius:20px;background:var(--surface);box-shadow:var(--shadow)}
-.fx-prompt{font-size:17px;line-height:1.65;color:var(--ink)}
-.fx-prompt mark{padding:1px 5px;border-radius:4px;background:color-mix(in srgb,var(--brand) 16%,transparent);color:var(--ink)}
-.fx-toggle{display:none;align-items:center;min-height:44px;margin-top:4px;padding:0;border:0;background:none;color:var(--brand);font-size:15px;font-weight:700;cursor:pointer}
-.copy{display:inline-flex;align-items:center;gap:10px;min-height:48px;margin-top:16px;padding:0 24px;border-radius:999px;border:0;background:var(--ink);color:var(--bg);font-size:16px;font-weight:700;cursor:pointer;transition:background .2s,color .2s}
-.copy.done{background:var(--ok);color:#fff}
-
-/* the cards: the home page's, with what each animation makes here on its preview and no Copy prompt */
-.card{position:relative;display:flex;flex-direction:column;padding:10px;border-radius:20px;background:var(--surface);box-shadow:var(--shadow);transition:transform .35s var(--ease)}
-.card:has(.title a:focus-visible){outline:3px solid var(--brand);outline-offset:3px}
-.stage{position:relative;aspect-ratio:16/10;border-radius:12px;overflow:hidden;background:#08080a}
-.tag{position:absolute;z-index:1;left:10px;top:10px;max-width:calc(100% - 20px);padding:5px 11px;border-radius:999px;background:rgba(255,255,255,.94);color:#16161b;font-size:12px;font-weight:700;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
-.meta{display:flex;flex-direction:column;flex:1;padding:14px 8px 6px}
-.title{font-size:18px;font-weight:700;letter-spacing:-.01em;line-height:1.25}
-.title a{text-decoration:none;outline:none}
-.title a::after{content:"";position:absolute;inset:0;z-index:2;border-radius:20px}
-.desc{flex:1;margin-top:6px;font-size:15px;line-height:1.5;color:var(--ink-2)}
-
-/* Seen one we should add? */
-.fx-more{display:flex;flex-direction:column;align-items:center;margin-top:clamp(36px,5vw,56px);padding-top:clamp(36px,5vw,56px);border-top:1px solid var(--line);text-align:center}
-.fx-more h2{font-size:clamp(24px,2.6vw,30px);font-weight:800;line-height:1.15;letter-spacing:-.02em}
-.fx-more p{margin-top:10px;max-width:560px;font-size:16px;line-height:1.55;color:var(--ink-2)}
-.fx-suggest{display:inline-flex;align-items:center;justify-content:center;min-height:48px;margin-top:18px;padding:0 24px;border-radius:999px;border:1.5px solid var(--ink);font-size:16px;font-weight:700;text-decoration:none;transition:background .2s,color .2s}
-.fx-more .fx-note{margin-top:18px;font-size:14px;color:var(--muted)}
-
-/* the message after a copy: the home page's */
-.toast{position:fixed;z-index:60;left:50%;bottom:24px;display:flex;align-items:center;gap:10px;min-height:52px;width:max-content;max-width:calc(100% - 32px);padding:0 18px;border-radius:16px;background:var(--ink);color:var(--bg);font-size:15px;font-weight:600;box-shadow:0 12px 32px rgba(22,22,27,.28);opacity:0;transform:translate(-50%,16px);pointer-events:none;transition:opacity .25s,transform .25s var(--ease)}
-.toast.show{opacity:1;transform:translate(-50%,0)}
-.toast .ok{display:inline-grid;place-items:center;width:28px;height:28px;flex:none;border-radius:50%;background:#1f9d57;color:#fff}
-.toast .ok .i{width:16px;height:16px}
-
-@media(hover:hover){
- .lnk:hover,.icon-btn:hover{color:var(--ink);background:var(--line-2)}
- .gh:hover,.fx-jump a:hover{border-color:var(--ink);color:var(--ink)}
- .fx-seen a:hover{text-decoration-color:currentColor}
- .card:hover{transform:translateY(-4px);box-shadow:var(--shadow-2)}
- .card:hover .pv{transform:scale(1.04)}
- .copy:hover{background:var(--brand);color:var(--bg)}
- .copy.done:hover{background:var(--ok);color:#fff}
- .fx-suggest:hover{background:var(--ink);color:var(--bg)}
-}
-/* two cards across below 761px; from 760px down the GitHub button is a round star, as on the home page */
-@media(max-width:760px){
- .fx-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
- .gh{position:relative;width:44px;padding:0;justify-content:center;gap:0}
- .gh-t{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
- .gh-c{display:none}
-}
-/* phones */
-@media(max-width:600px){
- .top{min-height:60px}
- .top .nav .lnk{display:none}
- .brand{gap:10px;font-size:15px}
- .mark{width:28px;height:28px}
- .pill{padding:7px 13px;font-size:13px}
- .fx-jump{flex-wrap:nowrap;justify-content:flex-start;width:calc(100% + 2 * var(--gut));margin-inline:calc(-1 * var(--gut));padding-inline:var(--gut);overflow-x:auto;scrollbar-width:none}
- .fx-jump a{flex:none}
- .fx-what{font-size:16px;line-height:1.6}
- .fx-what a{padding-block:14px} /* a link inside a sentence: its touch area grows to 44px without moving the lines */
- .fx-pbox{padding:16px 18px}
- .fx-prompt{font-size:16px;line-height:1.6}
- .fx-prompt.is-clamped{display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden}
- .fx-toggle{display:inline-flex}
- .copy{width:100%;justify-content:center}
- .card{padding:6px;border-radius:16px}
- .title a::after{border-radius:16px}
- .stage{border-radius:10px}
- .tag{left:6px;top:6px;max-width:calc(100% - 12px);padding:3px 8px;font-size:11px;white-space:normal} /* two cards across: a long label takes a second line instead of being cut */
- .meta{padding:10px 6px 4px}
- .title{font-size:15px}
- .desc{flex:none;margin-top:4px;font-size:13px;line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
- .fx-suggest{width:100%}
- .foot{flex-direction:column;align-items:flex-start}
-}
-@media(max-width:360px){.tag{left:5px;top:5px;max-width:calc(100% - 10px);padding:3px 6px;font-size:10px}}
-@media(max-width:359px){.gh{display:none}}
-/* reduced motion: the cards do not lift and the message fades in place (the previews hold still: see the block below) */
-@media(prefers-reduced-motion:reduce){
- .card,.card:hover,.card:hover .pv{transform:none;transition:none}
- .toast{transform:translate(-50%,0);transition:opacity .25s}
-}
-
-/* ── previews: written by tools/make-famous.mjs from the home page; run it again, never edit by hand ── */
-/* ── end of previews ── */
-</style>
-</head>
-<body>
-<a class="skip" href="#stripe-ribbon">Skip to the first effect</a>
-<header class="wrap top" id="top">
- <a class="brand" href="../"><svg class="mark" viewBox="0 0 32 32" aria-hidden="true"><circle class="ring" cx="11.16" cy="20.84" r="6.1"/><circle class="ring" cx="15.12" cy="16.88" r="6.1"/><circle class="ring" cx="18.51" cy="13.49" r="6.1"/><circle class="ball" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <nav class="nav" aria-label="Site">
- <a class="lnk" href="../?view=all">Browse all</a>
- <a class="lnk" href="./" aria-current="page">Famous effects</a>
- <button type="button" class="icon-btn theme-btn" id="theme-toggle" aria-label="Switch between light and dark">
- <svg class="i moon" viewBox="0 0 24 24" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
- <svg class="i sun" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
- </button>
- <a class="gh" id="gh-stars" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span class="gh-t">GitHub</span> <span class="gh-c" id="gh-star-count"></span></a>
- </nav>
-</header>
-
-<main class="fx-page">
- <div class="fx-head">
- <p class="pill">12 effects from well-known websites</p>
- <h1 class="h1">Famous effects</h1>
- <p class="fx-lede">Effects people admire on well-known websites, the handbook animations that make something similar, and a prompt to build your own.</p>
- <p class="fx-legal">The Animation Handbook is not connected to any of these sites or their owners, and none of them has reviewed or approved this page. Each effect is described in our own words and shown only with the handbook's own demos.</p>
- </div>
- <nav class="fx-jump" aria-label="Effects on this page">
- </nav>
-
- <section class="fx-more" aria-labelledby="fx-more-t">
- <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>
- </section>
-</main>
-
-<footer class="wrap foot">
- <a class="brand" href="../"><svg class="mark" viewBox="0 0 32 32" aria-hidden="true"><circle class="ring" cx="11.16" cy="20.84" r="6.1"/><circle class="ring" cx="15.12" cy="16.88" r="6.1"/><circle class="ring" cx="18.51" cy="13.49" r="6.1"/><circle class="ball" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <p class="foot-t">Web animations with live demos and copyable prompts.</p>
- <nav class="nav" aria-label="Footer"><a class="lnk" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">GitHub</a><a class="lnk" href="#top">Back to top</a></nav>
-</footer>
-<div class="toast" id="toast" role="status" aria-live="polite"><span class="ok" aria-hidden="true"><svg class="i" viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="toast-t"></span></div>
-
-<script>
-// The GitHub star count, as on the home page: kept for five minutes, so the page asks GitHub at most once in that time.
-(function loadStars(){
- const KEY='gh-star-count',TTL=5*60*1000;
- function show(n){const el=document.getElementById('gh-star-count');if(el)el.textContent='★ '+Number(n).toLocaleString();}
- try{const c=localStorage.getItem(KEY);if(c){const{count,ts}=JSON.parse(c);if(Date.now()-ts<TTL){show(count);return;}}}catch(e){}
- fetch('https://api.github.com/repos/matinmonshizadeh/animation-handbook')
- .then(r=>r.ok?r.json():Promise.reject()).then(d=>{show(d.stargazers_count);
- try{localStorage.setItem(KEY,JSON.stringify({count:d.stargazers_count,ts:Date.now()}));}catch(e){}}).catch(()=>{});
-})();
-
-(function(){const btn=document.getElementById('theme-toggle');if(!btn)return;
- btn.addEventListener('click',()=>{const next=document.documentElement.dataset.theme==='dark'?'light':'dark';
- setTheme(next);try{localStorage.setItem('ah-theme',next);}catch(e){}});})();
-
-const reduce=matchMedia('(prefers-reduced-motion:reduce)').matches;
-
-// Opened from disk, a link to a folder shows the browser's list of its files, so there every link to a folder names its
-// index.html (the logo, Browse all, this page's own link and the cards), as on the home page.
-if(location.protocol==='file:')document.querySelectorAll('a[href]').forEach(a=>{
- const href=a.getAttribute('href'),cut=href.search(/[?#]/),path=cut<0?href:href.slice(0,cut);
- if(/\/$/.test(path)&&!/^(?:\/|[a-z][a-z0-9+.-]*:)/i.test(path))a.setAttribute('href',path+'index.html'+href.slice(path.length));
-});
-
-// ── previews: written by tools/make-famous.mjs from the home page; run it again, never edit by hand ──
-const PREVIEWS={};
-// ── end of previews ──
-
-// Each card shows its animation's preview from the home page. It plays while the card is on screen (on phones, while the card
-// is in the middle of the screen) and while the card holds keyboard focus; under reduced motion it holds one still, clear frame
-// (the point the home page holds it at).
-const io='IntersectionObserver' in window?new IntersectionObserver(es=>es.forEach(en=>en.target.classList.toggle('playing',en.isIntersecting)),
- matchMedia('(hover:hover)').matches?{threshold:.2}:{rootMargin:'-34% 0px -34% 0px'}):null;
-function hold(card,still){
- const anims=card.querySelector('.pv').getAnimations({subtree:true});
- if(!anims.length)return;
- const at=still*anims[0].effect.getTiming().duration;
- for(const a of anims)a.currentTime=at;
-}
-document.querySelectorAll('.fx .card[data-slug]').forEach(card=>{
- const p=PREVIEWS[card.dataset.slug],pv=card.querySelector('.pv');
- if(!p||!pv)return;
- pv.classList.add('pv-'+p.pv);
- pv.innerHTML=p.markup;
- if(reduce){hold(card,p.still);return;}
- card.addEventListener('focusin',()=>card.classList.add('playing'));
- if(io)io.observe(card);else card.classList.add('playing');
-});
-
-// A link to an entry (the jump row, the skip link) brings the entry into view and gives its heading keyboard focus; under
-// reduced motion it jumps instead of gliding. A click with Ctrl, Cmd, Shift or Alt, or another button, is left to the browser.
-document.addEventListener('click',e=>{
- const a=e.target.closest('a[href^="#"]');
- if(!a||e.button||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;
- const entry=document.getElementById(a.getAttribute('href').slice(1));
- if(!entry||!entry.matches('section.fx'))return;
- e.preventDefault();
- entry.scrollIntoView({behavior:reduce?'auto':'smooth',block:'start'});
- entry.querySelector('h2').focus({preventScroll:true});
- try{history.pushState(null,'','#'+entry.id);}catch(err){}
-});
-
-// The prompts: on phones each shows five lines and "Show the full prompt", as on the animation pages.
-document.querySelectorAll('.fx-prompt').forEach(p=>{
- p.id=p.closest('section.fx').id+'-prompt';
- p.classList.add('is-clamped');
- const more=document.createElement('button');
- more.type='button';more.className='fx-toggle';
- more.setAttribute('aria-controls',p.id);more.setAttribute('aria-expanded','false');
- more.textContent='Show the full prompt';
- more.addEventListener('click',()=>{const open=!p.classList.toggle('is-clamped');more.setAttribute('aria-expanded',String(open));more.textContent=open?'Show less':'Show the full prompt';});
- p.after(more);
-});
-
-// Copy prompt copies the prompt as shown, brackets included. It reads "Copied" for about two seconds and the home page's
-// message shows; where the browser refuses the clipboard, the prompt is selected and the button asks for the copy keys.
-// Only the icon and the label's words change: the label is a live region, so a screen reader announces the change, and the
-// button's name always starts with what it shows and names its entry.
-const ICON_COPY='<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>';
-const ICON_DONE='<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
-const KEYS=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?'Press ⌘C to copy':'Press Ctrl+C to copy';
-const toastEl=document.getElementById('toast'),toastText=toastEl.querySelector('.toast-t');let toastTimer=0,toastClear=0;
-function toast(message){
- clearTimeout(toastTimer);clearTimeout(toastClear);
- toastText.textContent=message;
- toastEl.classList.add('show');
- toastTimer=setTimeout(()=>{toastEl.classList.remove('show');toastClear=setTimeout(()=>{toastText.textContent='';},300);},2400);
-}
-function copyState(btn,kind){
- const title=btn.closest('section.fx').querySelector('h2').textContent;
- clearTimeout(btn._timer);
- btn.classList.toggle('done',kind==='done');
- btn.querySelector('.i').outerHTML=kind==='done'?ICON_DONE:ICON_COPY;
- const label=kind==='done'?'Copied':kind==='keys'?KEYS:'Copy prompt';
- btn.querySelector('.copy-l').textContent=label;
- btn.setAttribute('aria-label',kind==='done'?'Copied the prompt for '+title:kind==='keys'?KEYS+': the prompt for '+title+' is selected':'Copy prompt for '+title);
- if(kind)btn._timer=setTimeout(()=>copyState(btn,''),kind==='done'?2000:4000);
-}
-document.querySelectorAll('.fx .copy').forEach(btn=>btn.addEventListener('click',()=>{
- const prompt=btn.closest('section.fx').querySelector('.fx-prompt');
- const text=prompt.textContent.replace(/\s+/g,' ').trim();
- const clip=navigator.clipboard;
- (clip&&clip.writeText?clip.writeText(text):Promise.reject(new Error('no clipboard'))).then(()=>{
- copyState(btn,'done');
- toast('Prompt copied. Paste it into your AI assistant.');
- },()=>{
- const range=document.createRange();
- range.selectNodeContents(prompt);
- const sel=getSelection();
- sel.removeAllRanges();
- sel.addRange(range);
- copyState(btn,'keys');
- });
-}));
-</script>
-</body>
-</html>
-```
-
-- [ ] **Step 4: Create `.github/ISSUE_TEMPLATE/famous_effect.yml`**
-
-```yaml
-name: Famous effect
-description: Suggest an effect from a well-known website for the Famous effects page.
-title: "[famous effect] "
-labels: ["enhancement"]
-body:
- - type: markdown
- attributes:
- value: Describe the effect in your own words, please, with no screenshots, videos or code from the site. The page shows each effect only with the handbook's own demos.
- - type: input
- id: address
- attributes:
- label: The site's address
- description: The public page where the effect shows without signing in.
- placeholder: https://example.com/
- validations:
- required: true
- - type: input
- id: where
- attributes:
- label: Where on the page
- description: For example the menu at the top, or the cards on the home page.
- - type: textarea
- id: what
- attributes:
- label: What you see
- description: In your own words, what moves and what starts it (the page opening, scrolling, pointing at something or pressing it).
- validations:
- required: true
- - type: checkboxes
- id: checks
- attributes:
- label: Before you send it
- options:
- - label: I described the effect in my own words.
- required: true
- - label: I attached no screenshots, videos or code from the site.
- required: true
-```
-
-- [ ] **Step 5: Write the preview blocks and run the tests**
-
-Run: `node tools/make-famous.mjs`
-Expected: `famous/index.html: 0 cards, 0 previews (written)` (the CSS block gets the base rules; the data block becomes `const PREVIEWS={` and `};` on two lines).
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes, including the eleven frame tests and the drift test.
-
-- [ ] **Step 6: Page check of the frame.** Serve this worktree on port 8933 and run the pool command with the target `famous` and `--out C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/check-t5`.
-Expected: six FAIL lines whose only problems are the missing entries: every line has `no entries (section.fx): not the Famous effects page, or not built yet`; the desktop line adds `no links in the jump row; no entries to play; no entries to copy`; the phone-reduced line adds `reduced motion: no cards`. No overflow, small targets, first-screen or console problem on any line. Look at `famous-desktop.png`, `famous-phone.png` and `famous-phone-small.png` (Read tool): the top bar, the pill, the heading, the lede and the not-connected line read clearly and centered; at 320px nothing is cut off; in `famous-phone.png` the theme button and the round star sit at the right of the top bar. Stop the server.
-
-- [ ] **Step 7: Commit**
-
-```bash
-git add famous/index.html .github/ISSUE_TEMPLATE/famous_effect.yml tests/famous.test.js
-git commit -m "feat: the Famous effects page's frame in the home page's look (top bar, the not-connected line, jump row, Seen one we should add?, footer) with its script for previews, jumps, Copy prompt and the phone clamp, and a Famous effect issue template"
-```
-
----
-
-### Task 6: The sitemap and `llms.txt` list the Famous effects page
-
-**Files:**
-- Modify: `tools/update-sitemap.mjs` (header lines 5-13; after line 53; after line 85; lines 90-91; line 96)
-- Modify: `tools/make-skill.mjs` (header lines 7-23; after line 350; the `llms.txt` array, lines 410-412)
-- Modify: `tests/pages.test.js` (lines 645-647, in "the counts written in the issue template, the 404 page and the sitemap match the cards")
-- Modify: `tests/skill.test.js` (a new test after line 194)
-- Generated: `sitemap.xml`, `llms.txt` (by the tools)
-
-**Interfaces:**
-- Consumes: `famous/index.html` with `<meta name="description" content="…">` (Task 5).
-- Produces: `sitemap.xml` lists the home page, then `…/famous/` (dated by its folder, `monthly`, `0.8`), then every animation; `llms.txt` has, after the last category and before `## Skill files`, the section `## Famous effects` with the line `- [Famous effects](https://matinmonshizadeh.github.io/animation-handbook/famous/): <the page's description>`.
-
-- [ ] **Step 1: Write the failing tests.** In `tests/pages.test.js` replace lines 645-647:
-
-```js
- // The sitemap lists one URL more than the total: the home page.
- const urls = count(read(path.join(ROOT, 'sitemap.xml')), '<url>');
- assert.equal(urls, cards + 1, 'sitemap.xml lists the home page and every animation');
-```
-
-with:
-
-```js
- // The sitemap lists two URLs more than the total: the home page and the Famous effects page, first and in that order.
- const sitemap = read(path.join(ROOT, 'sitemap.xml'));
- assert.equal(count(sitemap, '<url>'), cards + 2, 'sitemap.xml lists the home page, the Famous effects page and every animation');
- const LIVE = 'https://matinmonshizadeh.github.io/animation-handbook/';
- assert.deepEqual([...sitemap.matchAll(/<loc>([^<]*)<\/loc>/g)].slice(0, 2).map(m => m[1]), [LIVE, `${LIVE}famous/`], 'the home page, then Famous effects');
-```
-
-In `tests/skill.test.js`, after the test "llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files" (it ends on line 194), add:
-
-```js
-
-test('llms.txt links the Famous effects page with the page\'s own description, after the categories and before the skill files', () => {
- const text = read(path.join(ROOT, 'llms.txt'));
- const lede = decode(read(path.join(ROOT, 'famous', 'index.html')).match(/<meta name="description" content="([^"]+)">/)[1]);
- const line = `- [Famous effects](${LIVE}famous/): ${lede}`;
- assert.equal(text.split('\n').filter(l => l === line).length, 1, `llms.txt has the line ${line}`);
- assert.ok(text.includes(`## Famous effects\n\n${line}\n`), 'under its own heading');
- assert.ok(text.indexOf(line) > text.lastIndexOf(`](${LIVE}animations/`), 'after the last card');
- assert.ok(text.indexOf(line) < text.indexOf('## Skill files'), 'before the skill files');
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `node --test tests/pages.test.js tests/skill.test.js`
-Expected: the sitemap test FAILS (`167 !== 168`) and the new `llms.txt` test FAILS (no such line); every other test passes.
-
-- [ ] **Step 3: `tools/update-sitemap.mjs`.** The edits anchor on the lines as they read on main (line numbers on main in brackets). Replace the six header lines from `// The home page comes first, then every page in the order of the CATS array…` to `// priority stay as they are: weekly and 1.0 for the home page, monthly and 0.7 for every page.` (lines 5-10) with:
-
-```js
-// The home page comes first, then the Famous effects page (famous/), then every page in the order of the CATS array in
-// index.html (the home page's order), at the home page's canonical address. A page's lastmod is the date of the last
-// commit that touched its folder (git log -1 --format=%cs -- <folder>), or today's date when the folder has changes that
-// are not committed yet (a new page too); the Famous effects page is dated the same way, by famous/. The home page's
-// lastmod is the latest of index.html and the files it loads (the page script and the two fonts): a change to a page
-// alone does not change the home page. changefreq and priority: weekly and 1.0 for the home page, monthly and 0.8 for
-// the Famous effects page, monthly and 0.7 for every page.
-```
-
-The line `// Needs git on the PATH. Exit code 1 when a card has no page folder or git cannot be read.` (line 13) becomes:
-
-```js
-// Needs git on the PATH. Exit code 1 when a card has no page folder, famous/ has no index.html, or git cannot be read.
-```
-
-After the line that starts `if (missing.length) { console.error(` (line 53) add:
-
-```js
-// The Famous effects page (docs/superpowers/specs/2026-10-13-famous-effects-design.md) comes right after the home page.
-const FAMOUS = 'famous/';
-if (!existsSync(join(ROOT, FAMOUS, 'index.html'))) { console.error('famous/ has no index.html'); process.exit(1); }
-```
-
-After the line ` 'assets/fonts/schibsted-latin-ext.woff2'])).sort().pop();` that ends the `homeDate` statement (line 85) add:
-
-```js
-const famousDate = (await datesOf([FAMOUS]))[0];
-```
-
-The two lines that start `const lines = ['<?xml version="1.0" encoding="UTF-8"?>',` (lines 90-91) become:
-
-```js
-const lines = ['<?xml version="1.0" encoding="UTF-8"?>', '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">',
- line(BASE, homeDate, 'weekly', '1.0'), line(BASE + FAMOUS, famousDate, 'monthly', '0.8'),
- ...pages.map((folder, i) => line(BASE + folder, pageDates[i], 'monthly', '0.7')), '</urlset>'];
-```
-
-The line that starts `const newDates = [[BASE, homeDate],` (line 96) becomes:
-
-```js
-const newDates = [[BASE, homeDate], [BASE + FAMOUS, famousDate], ...pages.map((folder, i) => [BASE + folder, pageDates[i]])];
-```
-
-- [ ] **Step 4: `tools/make-skill.mjs`.** In the header, after the line `// demo's own values.` (line 16) add:
-
-```js
-// It also reads the Famous effects page's description (the meta description of famous/index.html): llms.txt lists that
-// page after the categories.
-```
-
-and replace the two lines `// Exit code 1 when a card has no page, a page lacks a part the skill needs, a setting has no row in its README's Key` and `// parameters, or the skill folder holds a file this tool does not write.` (lines 22-23) with:
-
-```js
-// Exit code 1 when a card has no page, a page lacks a part the skill needs, a setting has no row in its README's Key
-// parameters, famous/index.html is missing or has no description, or the skill folder holds a file this tool does not write.
-```
-
-After line 350 (`const total = CATS.reduce((n, cat) => n + cat.entries.length, 0);`) add:
-
-```js
- // The Famous effects page, which llms.txt lists after the categories with its own description.
- const famousFile = join(root, 'famous', 'index.html');
- if (!existsSync(famousFile)) throw new Error('famous/index.html is missing: llms.txt lists the Famous effects page');
- const famousLede = (readFileSync(famousFile, 'utf8').match(/<meta name="description" content="([^"]+)">/) || [])[1];
- if (!famousLede) throw new Error('famous/index.html has no description (<meta name="description" content="…">)');
-```
-
-In the `llms.txt` array, between the categories (the line ending `…: ${desc}`), '']),`) and the comment `// The skill's own files, which the site serves as they are…`, add:
-
-```js
- // The Famous effects page: effects seen on well-known websites, each with the animations that make something similar.
- '## Famous effects', '',
- `- [Famous effects](${base}famous/): ${decode(famousLede, 'famous/index.html')}`, '',
-```
-
-- [ ] **Step 5: Write the generated files and run the tests**
-
-Run: `node tools/update-sitemap.mjs`
-Expected: it prints `168 URLs` and at least one lastmod date new or changed (the new `famous/` line; the home page's date moves too when Task 4's footer change is in this branch). `sitemap.xml` now starts with the home page, then `https://matinmonshizadeh.github.io/animation-handbook/famous/` with `monthly` and `0.8`.
-Run: `node tools/make-skill.mjs`
-Expected: `llms.txt: … (written)`; every `skills/animation-handbook/…` line ends without `(written)`.
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes. `git status --short` shows only the four tool and test files, `sitemap.xml` and `llms.txt`.
-
-- [ ] **Step 6: Commit**
-
-```bash
-git add tools/update-sitemap.mjs tools/make-skill.mjs tests/pages.test.js tests/skill.test.js sitemap.xml llms.txt
-git commit -m "feat: the sitemap lists the Famous effects page right after the home page, and llms.txt links it with its description"
-```
-
----
-
-### Task 7: Entries 1 to 6
-
-**Files:**
-- Modify: `famous/index.html` (the jump row and the entries before `<section class="fx-more"`; the two preview blocks by the tool)
-- Modify: `tests/famous.test.js` (append the entries section)
-- May fix: `tools/check-pages.mjs`, the famous functions only (`famousCheck`, `scrollSettled`, `famousJumpProblems`, `famousStageShot`, `famousPreviewProblems`, `famousCopyProblems`, `changedShare`, `famousMotionProblems`), if this first real run shows a bug in them; say so in the report.
-
-**Interfaces:**
-- Consumes: Task 1's record (`## Decisions`, each entry's `Checked:` day and `Change:`); Task 5's frame; Task 2's tool; Task 3's target; the Reserve entries above.
-- Produces: six `section.fx` entries and their chips; the test section `ENTRIES`, `CARD`, `STARTS`, `words`, `siteWords`, `names` that Task 8 extends.
-
-- [ ] **Step 1: Read the record.** In `.superpowers/sdd/2026-10-14-famous-effects/live-check.md`, for each of entries 1-6: "Written as in the plan" → its markup in Step 4 as it is; "Rewritten" → its markup with the record's Change sentence in place of the sentence it corrects (What you see stays 25 to 70 words); "Swapped" → the reserve's chip and section from Reserve entries, in this entry's place. Every `datetime` is that entry's `Checked:` day. If entry 1 is swapped, the skip link's `href` becomes the reserve's id.
-
-- [ ] **Step 2: Write the failing tests.** Append to `tests/famous.test.js`:
-
-```js
-
-// ---------- The page: entries, cards and prompts ----------
-const STARTS = ['loop', 'load', 'scroll', 'hover', 'press'];
-const words = s => s.split(/\s+/).filter(Boolean).length;
-// Each entry as { id, site, start, body }, in page order.
-const ENTRIES = [...PAGE.matchAll(/<section class="fx" id="([a-z0-9-]+)" aria-labelledby="\1-t" data-fx-site="([^"]+)" data-fx-start="([a-z]+)">([\s\S]*?)<\/section>/g)]
- .map(m => ({ id: m[1], site: decode(m[2]), start: m[3], body: m[4] }));
-// A card exactly as the template writes it: its accent, slug, label, link, name and line.
-const CARD = /<article class="card (c[1-7])" data-slug="([a-z0-9-]+)"><div class="stage"><div class="pv" aria-hidden="true"><\/div><span class="tag">([^<]+)<\/span><\/div><div class="meta"><h4 class="title"><a href="([^"]+)">([^<]+)<\/a><\/h4><p class="desc">([^<]+)<\/p><\/div><\/article>/g;
-// The words that would name an entry's site in a prompt: its name (without a leading "The"), its address and the name in that
-// address. A single letter, as X, is too short to count ("an X" is a shape); its address still counts.
-const siteWords = e => {
- const href = e.body.match(/<p class="fx-seen">Seen on <a href="([^"]+)"/)[1], host = new URL(href).hostname.replace(/^www\./, '');
- return [e.site.replace(/^The /, ''), host, host.split('.').slice(-2)[0]].filter(w => w.length > 1);
-};
-// Whether text holds word as a word of its own (not inside a longer one), ignoring case.
-const names = (text, word) => new RegExp('(^|[^a-z0-9])' + escapeRe(word.toLowerCase()) + '([^a-z0-9]|$)', 'i').test(text);
-
-test('every entry is written as the template says, so the tests below see it', () => {
- assert.ok(ENTRIES.length > 0, 'the page has entries');
- assert.equal(ENTRIES.length, count(PAGE, '<section class="fx"'), 'each <section class="fx"> has its id, aria-labelledby, data-fx-site and data-fx-start in that order');
- assert.equal(new Set(ENTRIES.map(e => e.id)).size, ENTRIES.length, 'every id is unique');
- assert.ok(PAGE.indexOf('<nav class="fx-jump"') < PAGE.indexOf('<section class="fx"'), 'the entries come after the jump row');
-});
-
-for (const e of ENTRIES) {
- test(`${e.id}: seen on its site in the year it was checked, a heading, what you see in 25 to 70 words and what starts it`, () => {
- const seen = e.body.match(/<p class="fx-seen">Seen on <a href="(https:\/\/[^"]+)" target="_blank" rel="noopener">([^<]+)<span class="sr"> \(opens in a new tab\)<\/span><\/a> in <time datetime="((\d{4})-\d{2}-\d{2})">(\d{4})<\/time><\/p>/);
- assert.ok(seen, 'Seen on: the site\'s address as a link that opens a new tab, then the year in a <time>');
- const [, href, label, day, year, shown] = seen;
- assert.equal(label, href.replace(/^https:\/\//, '').replace(/^www\./, '').replace(/\/$/, ''), 'the link shows the address without https:// or www.');
- assert.equal(shown, year, 'the year shown is the year of the day checked');
- assert.ok(!Number.isNaN(Date.parse(day)) && Date.parse(day) <= Date.now(), `${day} is a day that has come`);
- assert.equal(count(e.body, '<p class="fx-seen">'), 1, 'one Seen on line');
- assert.equal(count(e.body, '<h2 '), 1, 'one heading');
- assert.ok(e.body.includes(`<h2 id="${e.id}-t" tabindex="-1">`), 'the heading the entry is named by, which a jump focuses');
- const what = e.body.match(/<p class="fx-what">([\s\S]*?)<\/p>/);
- assert.ok(what, 'what you see');
- const n = words(textOf(what[1]));
- assert.ok(n >= 25 && n <= 70, `what you see has ${n} words, not 25 to 70`);
- 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');
- });
-
- 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 () => {
- const { homeConst } = await tool();
- const CATS = homeConst(HOME, 'CATS');
- const cards = [...e.body.matchAll(CARD)];
- assert.equal(cards.length, count(e.body, '<article'), 'every card is written as the template says');
- assert.ok(cards.length >= 1 && cards.length <= 3, `${cards.length} cards, not 1 to 3`);
- for (const [, accent, slug, label, href, name, desc] of cards) {
- const cat = CATS.find(c => c.entries.some(x => x[0] === slug));
- assert.ok(cat, `${slug} is a card on the home page`);
- const [, cardName, line] = cat.entries.find(x => x[0] === slug);
- assert.equal(accent, cat.cat.replace('-cat', ''), `${slug}: its category's accent`);
- assert.equal(href, `../${cat.folder}/${slug}/`, `${slug}: its page's link`);
- assert.ok(fs.existsSync(path.join(ROOT, cat.folder, slug, 'index.html')), `${slug}: its page exists`);
- assert.equal(decode(name), cardName, `${slug}: the home page's name`);
- assert.equal(decode(desc), line, `${slug}: the home page's line`);
- const n = words(decode(label));
- assert.ok(n >= 1 && n <= 3, `${slug}: the label "${label}" has ${n} words, not 1 to 3`);
- }
- });
-
- test(`${e.id}: its prompt follows the rules for prompts and names no site of the page, and Copy prompt names the entry`, () => {
- const box = e.body.match(/<div class="fx-pbox"><p class="fx-prompt">([\s\S]*?)<\/p><\/div>/);
- assert.ok(box, 'the prompt in its box');
- const prompt = textOf(box[1]), n = words(prompt);
- assert.ok(n >= 60 && n <= 130, `${n} words, not 60 to 130`);
- assert.ok(prompt.startsWith('Add '), 'starts with "Add "');
- const parts = prompt.match(/\[[^\]]+\]/g) || [];
- assert.ok(parts.length >= 1, 'at least one [part to fill in]');
- assert.equal(count(box[1], '<mark>['), parts.length, 'each [part] is marked');
- assert.ok(!/`|<code|<pre/.test(box[1]), 'no code');
- assert.ok(!prompt.includes('Match the settings listed below.'), 'the page has no settings to match');
- assert.match(prompt, /reduced motion/i, 'says what happens under reduced motion');
- if (e.start === 'hover' || e.start === 'press') assert.match(prompt, /\b(touch|tap|finger)/i, 'names touch, a tap or a finger');
- for (const other of ENTRIES) for (const w of siteWords(other)) assert.ok(!names(prompt, w), `names "${w}"`);
- const title = e.body.match(/<h2 [^>]*>([^<]+)<\/h2>/)[1];
- assert.ok(e.body.includes(`<button type="button" class="copy" aria-label="Copy prompt for ${title}">`), 'Copy prompt names its entry');
- });
-}
-
-test('the jump row links each entry once, in page order, each chip starting with its site, and the skip link leads to the first entry', () => {
- const nav = between(PAGE, '<nav class="fx-jump" aria-label="Effects on this page">', '</nav>');
- const links = [...nav.matchAll(/<a href="#([a-z0-9-]+)">([^<]+)<\/a>/g)];
- assert.deepEqual(links.map(m => m[1]), ENTRIES.map(e => e.id), 'one chip per entry, in order');
- for (const [, id, label] of links) assert.ok(decode(label).startsWith(`${ENTRIES.find(e => e.id === id).site} · `), `${id}: "${label}" starts with its site`);
- assert.ok(PAGE.includes(`<a class="skip" href="#${ENTRIES[0].id}">Skip to the first effect</a>`), 'the skip link');
-});
-
-test('two different animations on the page never share a preview', async () => {
- const { homeConst } = await tool();
- const CATS = homeConst(HOME, 'CATS'), PV = homeConst(HOME, 'PV');
- const byPreview = new Map();
- for (const slug of new Set([...PAGE.matchAll(CARD)].map(m => m[2]))) {
- const cat = CATS.find(c => c.entries.some(x => x[0] === slug));
- const key = PV[slug] || 'sig' + parseInt(cat.n, 10);
- byPreview.set(key, [...(byPreview.get(key) || []), slug]);
- }
- assert.deepEqual([...byPreview].filter(([, slugs]) => slugs.length > 1).map(([key, slugs]) => `${key}: ${slugs.join(', ')}`), []);
-});
-
-test('no company name in the page\'s title, description or social card, and no word that implies approval', () => {
- const head = [TITLE, LEDE, meta('property="og:title"'), meta('property="og:description"'), meta('name="twitter:title"'), meta('name="twitter:description"')].join(' ');
- for (const w of ENTRIES.flatMap(siteWords)) assert.ok(!names(head, w), `"${w}" in the title, description or social card`);
- const shown = textOf(MARKUP.replace(`<p class="fx-legal">${LEGAL}</p>`, ''));
- assert.ok(!/\b(official|officially|approved|endorsed|sponsored|partner|partners|as used by)\b/i.test(shown), 'no word that implies approval');
-});
-```
-
-- [ ] **Step 3: Run them and see them fail**
-
-Run: `node --test tests/famous.test.js`
-Expected: two FAILs: "every entry is written as the template says, so the tests below see it" ("the page has entries") and the jump-row test (there is no first entry for the skip link); every other test passes.
-
-- [ ] **Step 4: Insert the chips.** In `famous/index.html`, between ` <nav class="fx-jump" aria-label="Effects on this page">` and ` </nav>`, add:
-
-```html
- <a href="#stripe-ribbon">Stripe · ribbon</a>
- <a href="#apple-scroll">Apple · headset</a>
- <a href="#landonorris-reveal">Lando Norris · reveal</a>
- <a href="#linear-intro">Linear · headline</a>
- <a href="#apple-menu">Apple · menu</a>
- <a href="#wikipedia-previews">Wikipedia · previews</a>
-```
-
-- [ ] **Step 5: Insert entries 1 to 6** before the line ` <section class="fx-more" aria-labelledby="fx-more-t">`, each followed by a blank line (write each `datetime` from the record):
-
-```html
- <section class="fx" id="stripe-ribbon" aria-labelledby="stripe-ribbon-t" data-fx-site="Stripe" data-fx-start="loop">
- <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-14">2026</time></p>
- <h2 id="stripe-ribbon-t" tabindex="-1">The twisting ribbon of light</h2>
- <p class="fx-what">Behind the headline, a thick ribbon of glowing color slowly twists in depth, sharp in places and blurred in others, as if filmed by a camera, under a fine grain. From 2020 to 2025 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>
- <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>
- <article class="card c6" data-slug="webgl-shader-animation"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">On the chip</span></div><div class="meta"><h4 class="title"><a href="../animations/06-3d-advanced/webgl-shader-animation/">WebGL Shader Animation</a></h4><p class="desc">Moving color patterns computed for every pixel. Best for bold backgrounds.</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 slowly twisting ribbon of colored light behind <mark>[the heading at the top of your page]</mark>. Draw one thick, soft band in three or four of your own colors that drifts and turns in depth, so parts of it come into sharp focus while others blur, like a camera with a shallow focus, and lay a fine grain over it so the colors feel printed rather than flat. Keep the movement slow and the heading readable on every color it passes. Draw it on the graphics chip, show a still picture of it until it is ready, and pause it when it is off screen. On phones, draw a lighter version. If the visitor has reduced motion turned on, show the still picture.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for The twisting ribbon of light"><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>
-
- <section class="fx" id="apple-scroll" aria-labelledby="apple-scroll-t" data-fx-site="Apple" data-fx-start="scroll">
- <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-14">2026</time></p>
- <h2 id="apple-scroll-t" tabindex="-1">The headset that comes apart as you scroll</h2>
- <p class="fx-what">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. Beside it, the phrase about the part on screen turns from gray to white.</p>
- <h3 class="fx-sub">Made with these animations</h3>
- <div class="fx-cards">
- <article class="card c1" data-slug="scroll-image-sequence"><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/scroll-image-sequence/">Scroll Image Sequence</a></h4><p class="desc">Scrolling plays a series of pictures like a flip-book. Best for products.</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>
- <article class="card c1" data-slug="text-fill-on-scroll"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Words light up</span></div><div class="meta"><h4 class="title"><a href="../animations/01-scroll-based/text-fill-on-scroll/">Text Fill on Scroll</a></h4><p class="desc">Words light up one by one as you scroll. Best for key statements.</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 scroll-driven product reveal to <mark>[your product section]</mark>. Pin the product in the middle of the screen while the visitor scrolls through a section a few screens tall, and let the scroll play a short video or a series of pictures of it, so it turns or comes apart as they scroll down and goes back together as they scroll up. Beside it, keep a short paragraph in dim gray and light up the phrase about the part on screen. Show a still picture until the video or pictures are ready, and give the product a text description for screen readers. Touch scrolling drives it the same way. If the visitor has reduced motion turned on, show a few still pictures with their text instead.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for The headset that comes apart as you scroll"><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>
-
- <section class="fx" id="landonorris-reveal" aria-labelledby="landonorris-reveal-t" data-fx-site="Lando Norris" data-fx-start="hover">
- <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-14">2026</time></p>
- <h2 id="landonorris-reveal-t" tabindex="-1">The liquid reveal under the pointer</h2>
- <p class="fx-what">A large portrait fills the screen. Wherever the pointer goes, 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>
- <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>
- <article class="card c2" data-slug="clip-path-reveal"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The hidden picture</span></div><div class="meta"><h4 class="title"><a href="../animations/02-entrance-and-exit/clip-path-reveal/">Clip-Path Reveal</a></h4><p class="desc">A growing shape uncovers it while it stays still. Best for images and banners.</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 liquid reveal to <mark>[the picture at the top of your page, with a second picture hidden under it]</mark>. Stack the two pictures exactly. Wherever the pointer goes, a soft, round blob follows a little behind it, wobbling and stretching with its speed, and the hidden picture shows through the blob, as if the top picture were being wiped away. Let the blob shrink away when the pointer stops or leaves. Draw the mask on the graphics chip or with a clip, never by resizing the pictures, so it stays smooth. On touch screens, let a finger dragged across the picture do the same. If the visitor has reduced motion turned on, show a plain circle at the pointer, without the wobble or the lag.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for The liquid reveal under the pointer"><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>
-
- <section class="fx" id="linear-intro" aria-labelledby="linear-intro-t" data-fx-site="Linear" data-fx-start="load">
- <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-14">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's words appear one after another, each rising a little out of a blur; the line under it and the buttons follow, then a large picture of the app, tilted slightly back, comes into focus the same way.</p>
- <h3 class="fx-sub">Made 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">Words 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>
- <article class="card c1" data-slug="stagger-reveal"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Part after part</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>
- </div>
- <h3 class="fx-sub">A prompt to build something similar</h3>
- <div class="fx-pbox"><p class="fx-prompt">Add a focus-in opening to <mark>[the headline, the line under it and the main picture at the top of your page]</mark>. As the page opens, show the headline's words one after another, each fading in while it rises a little and sharpens out of a soft blur; then let the line under it, the buttons and the main picture follow the same way, in order. Keep each step short, so the whole opening is over in about a second and nobody waits to read. Animate only fading, blur and small moves, and use less blur on phones, where it costs more. If the visitor has reduced motion turned on, show everything at once.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for The headline that comes into focus"><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>
-
- <section class="fx" id="apple-menu" aria-labelledby="apple-menu-t" data-fx-site="Apple" data-fx-start="press">
- <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-14">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>
- <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>
- <article class="card c6" data-slug="glassmorphism-animated"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The blurred page</span></div><div class="meta"><h4 class="title"><a href="../animations/06-3d-advanced/glassmorphism-animated/">Glassmorphism Animated</a></h4><p class="desc">Frosted glass cards blur the colors behind them. Best for cards and panels.</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 menu that opens in steps to <mark>[the main menu in your site's header]</mark>. On phones, a tap on the menu button folds its lines into an X while the menu opens to fill the screen, and its links drop a few pixels into place one after another. On computers, pointing at a top item, or reaching it with the keyboard, opens a panel below it the same way while the page behind blurs. Keep the wait between links tiny, so the whole menu is there in about half a second, and close it faster than it opens. Make every opener a real button that tells screen readers whether its menu is open. If the visitor has reduced motion turned on, show and hide the menus at once.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for The menu that drops in, link by link"><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>
-
- <section class="fx" id="wikipedia-previews" aria-labelledby="wikipedia-previews-t" data-fx-site="Wikipedia" data-fx-start="hover">
- <p class="fx-seen">Seen on <a href="https://www.wikipedia.org/" target="_blank" rel="noopener">wikipedia.org<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-14">2026</time></p>
- <h2 id="wikipedia-previews-t" tabindex="-1">Link previews</h2>
- <p class="fx-what">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>
- <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>
- </div>
- <h3 class="fx-sub">A prompt to build something similar</h3>
- <div class="fx-pbox"><p class="fx-prompt">Add link previews to <mark>[the links in your articles that point to other pages]</mark>. When the pointer rests on a link for a moment, a small card with the linked page's title, first sentences and picture fades in just below the link while rising a little into place; when the pointer leaves, it fades away. The wait keeps cards from flashing while the pointer only passes by, and a card that would fall off the screen opens above the link instead. Show the same card when keyboard focus reaches the link. On touch screens, where there is no hover, let a tap open the link as usual. If the visitor has reduced motion turned on, show and hide the card without movement.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for Link previews"><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>
-```
-
-- [ ] **Step 6: Write the previews and run the tests**
-
-Run: `node tools/make-famous.mjs`
-Expected: `famous/index.html: 17 cards, 16 previews (written)` with the plan's entries (Stagger Reveal shows twice; a swap changes both numbers by the reserve's cards).
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes.
-
-- [ ] **Step 7: Page check.** Serve this worktree on port 8934 and run the pool command with the target `famous` and `--out C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/check-t7`.
-Expected: six `ok` lines. If a famous step in `tools/check-pages.mjs` fails for a reason in the check itself (not the page), fix it there and say so in the report. Look at `famous-desktop-full.png`, `famous-phone.png`, `famous-phone-reduced.png` and `famous-phone-small.png` (Read tool): every preview shows its animation (still under reduced motion, never an empty dark box), every label reads in full (a long one may take two lines on phones), the prompts sit in their boxes, Copy prompt is full width on phones, nothing is cut off at 320px. Stop the server.
-
-- [ ] **Step 8: Commit**
-
-```bash
-git add famous/index.html tests/famous.test.js
-git commit -m "feat: Famous effects entries 1 to 6 (Stripe, Apple's headset, Lando Norris, Linear, Apple's menu, Wikipedia), each with its cards and prompt, and tests for entries, cards and prompts"
-```
-
-(Add `tools/check-pages.mjs` to the `git add` only if Step 7 needed a fix in it.)
-
----
-
-### Task 8: Entries 7 to 12, the count and the pill
-
-**Files:**
-- Modify: `famous/index.html` (chips 7-12 after chip 6; entries 7-12 after entry 6; the preview blocks by the tool; the pill if the count is not 12)
-- Modify: `tests/famous.test.js` (append the count test)
-- May fix: `tools/check-pages.mjs`, the famous functions only, as in Task 7.
-
-**Interfaces:**
-- Consumes: Task 7's entries and tests; Task 1's record for 9 to 12; the Reserve entries.
-- Produces: the page with 10 to 12 entries and a pill that counts them. Entries 7 (ChatGPT) and 8 (X) are written as below and confirmed by the owner in Task 10, or swapped there.
-
-- [ ] **Step 1: Write the failing test.** Append to `tests/famous.test.js`:
-
-```js
-
-test('the page holds 10 to 12 entries, and its pill counts them', () => {
- assert.ok(ENTRIES.length >= 10 && ENTRIES.length <= 12, `${ENTRIES.length} entries, not 10 to 12`);
- assert.ok(PAGE.includes(`<p class="pill">${ENTRIES.length} effects from well-known websites</p>`), 'the pill gives the number of entries');
-});
-```
-
-- [ ] **Step 2: Run it and see it fail**
-
-Run: `node --test tests/famous.test.js`
-Expected: the new test FAILS ("6 entries, not 10 to 12"); every other test passes.
-
-- [ ] **Step 3: Read the record** for entries 9 to 12 as in Task 7 Step 1 (entries 7 and 8 are written as below, with the `datetime` of today). If no reserve is left for an entry that failed, leave that entry out (its chip too) and write the pill with the number of entries that remain.
-
-- [ ] **Step 4: Insert the chips** after ` <a href="#wikipedia-previews">Wikipedia · previews</a>`:
-
-```html
- <a href="#chatgpt-reply">ChatGPT · reply</a>
- <a href="#x-heart">X · heart</a>
- <a href="#spotify-cards">Spotify · cards</a>
- <a href="#youtube-loading">YouTube · loading</a>
- <a href="#pudding-chart">The Pudding · chart</a>
- <a href="#medium-top-bar">Medium · top bar</a>
-```
-
-- [ ] **Step 5: Insert entries 7 to 12** before the line ` <section class="fx-more" aria-labelledby="fx-more-t">`, each followed by a blank line:
-
-```html
- <section class="fx" id="chatgpt-reply" aria-labelledby="chatgpt-reply-t" data-fx-site="ChatGPT" data-fx-start="load">
- <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 the word “Thinking” 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>
- <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>
- <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>
-
- <section class="fx" id="x-heart" aria-labelledby="x-heart-t" data-fx-site="X" data-fx-start="press">
- <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>
- <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>
- <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>
-
- <section class="fx" id="spotify-cards" aria-labelledby="spotify-cards-t" data-fx-site="Spotify" data-fx-start="hover">
- <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-14">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>
- <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>
- </div>
- <h3 class="fx-sub">A prompt to build something similar</h3>
- <div class="fx-pbox"><p class="fx-prompt">Add a hover effect to <mark>[the album or playlist cards in your grid]</mark>. When the pointer rests on a card, its background lightens a little and a round play button rises a few pixels into place at the bottom corner of the picture while it fades in; when the pointer leaves, both go back. Use only fading and transforms, and keep it quick, so moving across the grid feels light. Show the play button when a card gets keyboard focus too, and on touch screens, where there is no hover, show it all the time. Give the button a name that says what it plays. If the visitor has reduced motion turned on, show and hide the button without movement.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for The play button that rises"><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>
-
- <section class="fx" id="youtube-loading" aria-labelledby="youtube-loading-t" data-fx-site="YouTube" data-fx-start="load">
- <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-14">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>
- <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>
- <article class="card c2" data-slug="fade-in-out"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">Content arrives</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>
- </div>
- <h3 class="fx-sub">A prompt to build something similar</h3>
- <div class="fx-pbox"><p class="fx-prompt">Add a loading state to <mark>[the grid or feed whose content loads]</mark>. While the content loads, show gray shapes in the sizes of what is coming, such as a picture box, a round avatar and two lines of text, and let them pulse gently between lighter and darker. When the content arrives, put it exactly where the shapes were and fade it in, so nothing on the page jumps. Show only as many shapes as fit the screen, fewer on phones, and stop the pulse as soon as the content is in. Tell screen readers that the content is loading. If the visitor has reduced motion turned on, keep the shapes still.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for Gray shapes while it loads"><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>
-
- <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-14">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. Each new paragraph changes it, lighting up the dots it talks about; scrolling back undoes each step.</p>
- <h3 class="fx-sub">Made 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>
- </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>
- <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>
- </section>
-
- <section class="fx" id="medium-top-bar" aria-labelledby="medium-top-bar-t" data-fx-site="Medium" data-fx-start="scroll">
- <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-14">2026</time></p>
- <h2 id="medium-top-bar-t" tabindex="-1">The top bar that hides while you read</h2>
- <p class="fx-what">Scroll down into an article and the top bar slides up out of the way; scroll up even a little and it slides back into view.</p>
- <h3 class="fx-sub">Made 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>
- <h3 class="fx-sub">A prompt to build something similar</h3>
- <div class="fx-pbox"><p class="fx-prompt">Add a hide-on-scroll top bar to <mark>[the header of your article pages]</mark>. When the reader scrolls down into the text, slide the bar up out of view, so the words get the whole screen; the moment they scroll up, even a little, slide it back. Always show it near the top of the page. Tell the direction by comparing each scroll position with the last one, ignore tiny moves so the bar never flickers, and move it only with a transform. Touch scrolling works the same way, and keyboard focus moving into the bar brings it back. If the visitor has reduced motion turned on, fade the bar out and in instead of sliding it.</p></div>
- <button type="button" class="copy" aria-label="Copy prompt for The top bar that hides while 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>
- </section>
-```
-
-- [ ] **Step 6: Write the previews and run the tests**
-
-Run: `node tools/make-famous.mjs`
-Expected: `famous/index.html: 29 cards, 27 previews (written)` with the plan's entries (Stagger Reveal and Fade In / Fade Out each show twice).
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes, including "the page holds 10 to 12 entries, and its pill counts them".
-
-- [ ] **Step 7: Page check.** Serve on port 8934 and run the pool command with the target `famous` and `--out C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/check-t8`.
-Expected: six `ok` lines. Look at `famous-desktop-full.png` and `famous-phone.png`: twelve entries divided by thin lines, the jump row wraps on the desktop and scrolls sideways on the phone. Stop the server.
-
-- [ ] **Step 8: Commit**
-
-```bash
-git add famous/index.html tests/famous.test.js
-git commit -m "feat: Famous effects entries 7 to 12 (ChatGPT, X, Spotify, YouTube, The Pudding, Medium), and a test that the pill counts the 10 to 12 entries"
-```
-
----
-
-### Task 9: Integration, docs, generated files and the final review
-
-**Files:**
-- Merge: every lane branch into `feat/famous-effects` (in `.claude/worktrees/fx-int`), then `main` if it has moved
-- Modify: `CLAUDE.md` (lines 236-238; before line 240; lines 248-250; after line 263, all on main), `CONTRIBUTING.md` (after line 307; the end), `.github/pull_request_template.md` (after line 11), `README.md` (after line 33), `CHANGELOG.md` (the end of Unreleased, after line 13)
-- Generated: `sitemap.xml`, `llms.txt`, the two blocks of `famous/index.html`
-
-**Interfaces:**
-- Consumes: Tasks 2 to 8.
-- Produces: `feat/famous-effects` ready for the owner: tests pass, `famous` and `home` give six `ok` lines each, the docs say how the page is kept, and two reviews (legal and words; code and tests) are clean.
-
-- [ ] **Step 1: Merge.** In `.claude/worktrees/fx-int`, check that every lane is in: `git log --oneline main..feat/famous-effects` lists the merges of `fx/tool`, `fx/check`, `fx/footer`, `fx/frame`, `fx/sitemap` and `fx/entries`. Merge any that is missing with `git merge --no-ff fx/<lane>`. If `git log --oneline feat/famous-effects..main` lists commits (another project went live), take them in with the generated files written inside the merge (coordination rule 5):
-
-```bash
-git merge --no-ff --no-commit main
-node tools/update-sitemap.mjs
-node tools/make-skill.mjs
-node tools/make-famous.mjs
-git add sitemap.xml llms.txt skills famous/index.html
-git commit -m "Merge main into feat/famous-effects, with the generated files written again"
-```
-
-Resolve each overlap before the tools run, by the coordination file's map, keeping both sides' own lines (a resolution that needs more than that is reviewed by a fresh agent); for a generated file take either side, since the tools write it again.
-
-- [ ] **Step 2: `CLAUDE.md`.** Replace the paragraph on lines 236-238 ("Changing anything the skill or `llms.txt` repeats …") with:
-
-```markdown
-Changing anything the skill or `llms.txt` repeats (a page's title, one-line description, kind, prompt, settings or
-Good for and Avoid on tags, a README's Key parameters, a card's name, places or order in `CATS`, or the Famous effects
-page's description) also means running `node tools/make-skill.mjs` again: the skill test (`tests/skill.test.js`) fails
-until then. Changing a preview that the Famous effects page shows (its key in `PV`, its `case` in `pvMarkup()`, its
-rules or keyframes, its `STILL` point) or that page's cards means running `node tools/make-famous.mjs` again: the famous
-test (`tests/famous.test.js`) fails until then.
-```
-
-Before `## When asked to refactor` add:
-
-```markdown
-## Famous effects page
-`famous/index.html` shows effects people admire on well-known websites: what you see, in plain words; the handbook
-animations that make something similar, as cards with their moving previews; and one prompt to build it
-(`docs/superpowers/specs/2026-10-13-famous-effects-design.md`). It is one page in the home page's look and colors (a test
-compares them); it links neither shared file, and its own script copies, shows the message, falls back to the copy keys and
-shortens prompts on phones in the animation pages' words. Its two marked blocks, the previews' CSS and the `PREVIEWS`
-object, are written by `node tools/make-famous.mjs` from the home page, never by hand.
-
-**An entry** is a `section.fx` with an id (`site-what`, as `stripe-ribbon`), `data-fx-site` (the site's name) and
-`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)") and
-the 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
-link and `data-slug`, and on its preview a label of one to three words saying what that animation makes here; two different
-animations on the page never share a preview); "A prompt to build something similar" and Copy prompt, which names its
-entry. Copy a neighbor entry's markup, add its chip to the jump row and count it in the pill.
-
-**Its prompt** follows "The copyable prompt" above, but the page has no settings, so it never ends "Match the settings
-listed below.": 60 to 130 words, starting "Add a … to [what the reader fills in]" with each bracketed part in a `<mark>`; it
-asks for the reader's own colors and content, never a copy of the site, says what happens under reduced motion and, when
-the effect starts on hover or press, what touch does. It never names a site of the page, by name or by address.
-
-**The legal checklist** binds every entry (rules to follow, not legal advice):
-- The title, what you see and the prompt are in our own words: no sentence, feature name or slogan from the site.
-- The site is named in plain text, in the page's own font and colors (no logo, icon, brand color or typeface), and linked
- to its public page.
-- Shown only with the handbook's own demos and previews; nothing from the site in the repository or in posts about the
- page: no code, screenshots, videos, pictures, icons or logos.
-- The line saying the handbook is not connected to these sites stays on the page, above the first entry, on the first
- screen.
-- Nothing implies approval or partnership: no "official", "approved", "partner", "as used by"; no company name in the
- page's title, description or social card; the prompt names no company.
-- "Seen on <site> in <year>", with the day checked in `datetime`.
-- A site owner who asks for an entry to be changed or removed gets it done promptly (the Suggest link is the contact).
-
-**Adding or checking an entry again.** Watch the effect on the live site, logged out, and write what you see in your own
-words; add the entry, its chip and its count in the pill; run `node tools/make-famous.mjs`, `node tools/update-sitemap.mjs`,
-the tests and the page check's `famous` target. Every entry is checked again on its site before each release of the page
-and at least once a year: an effect that changed is described again from what shows now, one that has gone stays true as
-a past sighting or is replaced, and its `datetime` takes the day of the check.
-```
-
-In the **Tests:** bullet (lines 248-250) change "checks every page and its README, the shared stylesheet and the home page." to "checks every page and its README, the shared stylesheet, the home page and the Famous effects page.". After the **Home page:** bullet (ending on line 263, "Run it after changing any page's settings or prompt.") add:
-
-```markdown
-- **Famous effects:** `node tools/check-pages.mjs --base http://127.0.0.1:<port> famous` checks `famous/` at the same six
- setups (six `ok` lines): the first screen, overflow and touch targets; its desktop run presses each jump link, watches
- each entry's previews and presses each Copy prompt (once more with the clipboard refused); 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.
-```
-
-If another project has already reworded one of these lines on `main`, make the same change to the line as it now reads.
-
-- [ ] **Step 3: `CONTRIBUTING.md`.** After the paragraph ending "changing any page's settings or prompt." (line 307) add:
-
-```markdown
-
-The Famous effects page has one too: `node tools/check-pages.mjs --base http://127.0.0.1:<port> famous`. It checks the
-layout at the six setups, presses each jump link and each Copy prompt and watches the previews; its reduced-motion run
-checks that nothing moves. Its previews come from the home page: after changing a preview it shows, run
-`node tools/make-famous.mjs`.
-```
-
-At the end of the file add:
-
-```markdown
-
-## Suggesting a famous effect
-
-The [Famous effects](https://matinmonshizadeh.github.io/animation-handbook/famous/) page shows effects people admire on
-well-known websites, each with the handbook animations that make something similar and a prompt to build your own. Seen
-one we should add? Open an issue with the *Famous effect* template: the site's address, where on the page it shows and
-what you see, in your own words. Please attach no screenshots, videos or code from the site: the page describes each
-effect in its own words and shows it only with the handbook's own demos (the rules are in `CLAUDE.md`, under Famous
-effects page).
-```
-
-- [ ] **Step 4: `.github/pull_request_template.md`.** After line 11 (the home page check line) add:
-
-```markdown
-- [ ] If the change touches the Famous effects page (`famous/`), its cards or a preview it shows, `node tools/make-famous.mjs` has run and its check gives six `ok` lines too (`node tools/check-pages.mjs --base http://127.0.0.1:<port> famous`)
-```
-
-- [ ] **Step 5: `README.md` and `CHANGELOG.md`.** In `README.md`, after line 33 (step 3, "**Copy the prompt.** …") add a blank line and:
-
-```markdown
-**Seen it on a famous site?** [Famous effects](https://matinmonshizadeh.github.io/animation-handbook/famous/) shows effects people admire on well-known websites, the handbook animations that make something similar, and a prompt to build your own.
-```
-
-In `CHANGELOG.md`, at the end of the `## Unreleased` list (after the bullet ending "…loops pause out of view).") add, writing the number of entries in words (twelve unless Task 1 or Task 10 left one out):
-
-```markdown
-- A Famous effects page: twelve effects people admire on well-known websites, each described in plain words with the
- handbook animations that make something similar and a prompt to build your own. It is linked from the home page's footer.
-```
-
-- [ ] **Step 6: Generated files and tests**
-
-Run: `node tools/make-famous.mjs` — expected: no `(written)` (or written once after a merge of `main`).
-Run: `node tools/update-sitemap.mjs` — expected: `168 URLs` (or the new total + 2 if more cards came from `main`).
-Run: `node tools/make-skill.mjs` — expected: `llms.txt` and the skill files unchanged unless `main` brought changes.
-Run: `node --test "tests/*.test.js"` — expected: every test passes.
-
-- [ ] **Step 7: Page checks.** Serve `.claude/worktrees/fx-int` on port 8935 and run the pool command twice, with the targets `famous` and `home`, both with `--out C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/check-t9`.
-Expected: six `ok` lines for each.
-
-- [ ] **Step 8: Final review (two fresh reviewers in parallel).** Each writes a report into the run folder and touches nothing.
- - **Reviewer A, legal and words** (`final-review-legal.md`): for every entry, the seven items of the legal checklist (Global Constraints), checked against `famous/index.html` and the live-check record's "Names and slogans" (none of them in our text); plain words, American spelling, no hype; the not-connected line on the first screen in `famous-desktop.png` and `famous-phone.png` (from Step 7's `--out` folder); the prompts ask for the reader's own colors and content; `git diff --stat main...feat/famous-effects` holds no picture, video or font file and nothing copied from a site. One line per entry: pass, or what to change.
- - **Reviewer B, code and tests** (`final-review-code.md`): `git diff main...feat/famous-effects`: the tool against spec §4; the page script (previews, still frames, jumps, Copy prompt and its fallback, the clamp, links from disk); the accessibility list in Global Constraints; the check's famous functions; that every changed file is on the coordination file's map and that shared lines of `tools/check-pages.mjs`, `index.html` and `tests/pages.test.js` were touched only as listed; that the tests would fail on a real fault (for example a prompt of 59 words, a chip out of order, a stale preview block).
- Fix what they find, re-run Steps 6 and 7, and have the reviewer confirm each fix.
-
-- [ ] **Step 9: Commit**
-
-```bash
-git add CLAUDE.md CONTRIBUTING.md .github/pull_request_template.md README.md CHANGELOG.md sitemap.xml llms.txt famous/index.html
-git commit -m "docs: how the Famous effects page is kept (entry template, prompt rules, legal checklist, make-famous, the famous check), its README line and CHANGELOG entry, and the generated files written again"
-```
-
----
-
-### Task 10: The owner's review
-
-**Files:**
-- Modify (only on the owner's answers): `famous/index.html` (entries 7 and 8: their `datetime`, or a swap; any change the owner asks for), `CHANGELOG.md` (the number in words, if it changed)
-
-**Interfaces:**
-- Consumes: Task 9's branch; the Reserve entries; Task 1's record (the reserves that passed and are still unused).
-- Produces: the owner's approval of the real page at phone and desktop sizes, entries 7 and 8 confirmed or swapped, and the owner's word on going live (Task 11).
-
-- [ ] **Step 1: Show the page.** Serve `.claude/worktrees/fx-int` on port 8936 (background) and open it in the browser pane with `mcp__Claude_Browser__preview_start` and the url `http://127.0.0.1:8936/famous/`. Run the pool command with the target `famous` and `--out C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-14-famous-effects/owner-shots`; send the owner `famous-desktop-full.png`, `famous-phone.png` and `famous-tablet.png`.
-
-- [ ] **Step 2: Ask, in very short words** (one message):
-
-```markdown
-Famous effects is ready to look at (open in the pane; screenshots attached).
-1. ChatGPT, on your account: send any question. Does a small dot pulse, then the answer appear a few words at a time? (yes/no)
-2. X, signed in: press a heart. Does it shrink, pop back and burst with a ring and dots? (yes/no)
-3. Two card labels were shortened to fit the page's three-word rule ("On the chip", "Blur to sharp"), and the Medium text ends "slides back into view". OK?
-4. Anything to change? If not: may it go live, linked from the home page's footer and the README? The next launch post is Reddit on 2026-10-17.
-```
-
-Before 2026-10-18 the message names Reddit on 2026-10-17 as above; from 2026-10-18 it reads "The next launch post is Show HN on 2026-10-25."; from 2026-10-23 to 2026-10-26 it adds "Today is inside the launch window: going live today needs your explicit word for today."
-
-- [ ] **Step 3: Apply the answers.** A yes for entry 7 or 8: its `datetime` becomes the day of the owner's answer (and the year shown stays that day's year). A no: replace that entry with the next reserve that passed and is unused (R1, R2, R3), its chip in the same place, by the Reserve entries section; with none left, remove the entry and its chip, change the pill's number and the CHANGELOG line's number. Any other change the owner asks for: make it within the Global Constraints. Then run `node tools/make-famous.mjs`, `node tools/update-sitemap.mjs`, `node --test "tests/*.test.js"` (every test passes) and the `famous` check (six `ok` lines), show the owner again, and commit:
-
-```bash
-git add famous/index.html CHANGELOG.md sitemap.xml
-git commit -m "fix: Famous effects as the owner approved it: entries 7 and 8 confirmed on the owner's accounts (or replaced), and the owner's changes"
-```
-
-- [ ] **Step 4: Stop the server.** The page waits for the owner's explicit word to go live (Task 11).
-
----
-
-### Task 11: Release on the owner's word
-
-**Files:**
-- Merge `feat/famous-effects` into `main` (release worktree `.claude/worktrees/release`, port 8990), then `main` into `feat/see-inside-compare`
-
-**Interfaces:**
-- Consumes: the owner's explicit word for this project (Task 10 Step 2, item 4), given outside 2026-10-23 to 2026-10-26 or with the owner's explicit word for that day.
-- Produces: the page live at `https://matinmonshizadeh.github.io/animation-handbook/famous/`, linked from the home page's footer and the README.
-
-- [ ] **Step 1: Take main's latest commits into the branch (coordination rule 2).** Skip when `git log --oneline feat/famous-effects..main` is empty. Otherwise, in `.claude/worktrees/fx-int`:
-
-```bash
-git merge --no-ff --no-commit main
-node tools/update-sitemap.mjs
-node tools/make-skill.mjs
-node tools/make-famous.mjs
-git add sitemap.xml llms.txt skills famous/index.html
-git commit -m "Merge main into feat/famous-effects before its release, with the generated files written again"
-```
-
-Resolve overlaps before the tools run, by the map, keeping both sides' lines. Then `node --test "tests/*.test.js"` passes and the `home` and `famous` checks give six `ok` lines each (port 8935).
-
-- [ ] **Step 2: Merge into main (rule 3).** In `.claude/worktrees/release` (on `main`):
-
-```bash
-git merge --no-ff --no-commit feat/famous-effects
-node tools/update-sitemap.mjs
-node tools/make-skill.mjs
-node tools/make-famous.mjs
-git add sitemap.xml llms.txt skills famous/index.html
-git commit -m "Merge feat/famous-effects: the Famous effects page, reached from the home page's footer and the README"
-node --test "tests/*.test.js"
-```
-
-Expected: every test passes. Serve the release worktree on port 8990 and run the `home` and `famous` checks: six `ok` lines each.
-
-- [ ] **Step 3: Push, on the owner's word only**
-
-```bash
-git push origin main
-```
-
-Then check the live page after GitHub Pages has built (a minute or two): `curl -s -o /dev/null -w "%{http_code}" https://matinmonshizadeh.github.io/animation-handbook/famous/` prints `200`, and the live home page's footer shows the Famous effects link.
-
-- [ ] **Step 4: The same day, merge main into the rollout's branch (rule 4).** In the main checkout (on `feat/see-inside-compare`):
-
-```bash
-git merge --no-ff --no-commit main
-node tools/update-sitemap.mjs
-node tools/make-skill.mjs
-node tools/make-famous.mjs
-git add sitemap.xml llms.txt skills famous/index.html
-git commit -m "Merge main (Famous effects) into feat/see-inside-compare, with the generated files written again"
-```
-
-Resolve overlaps before the tools run, by the map: in `tools/check-pages.mjs` the rollout's Phase 0 lines and the `famous` target both stay and the `learn` target stays gone. A resolution that needs more than keeping both sides is reviewed by a fresh agent. Then the tests pass and `home` and `famous` give six `ok` lines each.
-
-- [ ] **Step 5: Clean up.** Stop every server this project started; remove its worktrees (`git worktree remove .claude/worktrees/fx-<lane>` for each, then `fx-int`) and its merged lane branches (`git branch -d fx/<lane>`); with the owner's OK, delete any `hb-chrome-*` folders left in the temp folder.
-
----
-
-## Self-review
-
-**Spec coverage.**
-- §1 The twelve entries: texts, cards and prompts in Tasks 7 and 8; live check first (Task 1); 7 and 8 at the owner's review (Task 10); "Seen on … in 2026" with the day in `datetime` (Tasks 7, 8, 10).
-- §2 Reserves in order (Reserve entries; Tasks 1, 7, 8, 10). §3 Gaps: none is part of this work (nothing to build).
-- §4 The page: own page, previews written in by `tools/make-famous.mjs` (Task 2) and kept equal by a test (Task 5); home colors compared (Task 5); no shared file, own copy, toast, Ctrl+C/⌘C and clamp in the pages' words (Task 5); layout (top bar, head, pill, lede, not-connected line, jump row, entries, Suggest, footer without the count: Task 5); entry markup, `data-fx-start`, `data-fx-site`, cards without Copy prompt, three across from 761px (Tasks 5, 7); accessibility, phones and reduced motion (Task 5 CSS and script, checked by Task 3's target).
-- §5 Legal checklist: tests for what they can see (Tasks 5, 7), Reviewer A for the rest (Task 9), the rules in `CLAUDE.md` (Task 9).
-- §6 Tests: frame, entries, cards, prompts, previews, nothing from elsewhere (Tasks 5, 7, 8); changed tests: sitemap + 2 and `llms.txt` (Task 6), footer link (Task 4).
-- §7 Page check: the `famous` target with every listed step (Task 3), run for real in Tasks 5, 7, 8, 9; `home` still six `ok` (Tasks 4, 9).
-- §8 Docs and tools: `CLAUDE.md`, `CONTRIBUTING.md`, `README.md`, `CHANGELOG.md` (Task 9), the issue template (Task 5), sitemap and `llms.txt` tools (Task 6); the PR template line comes from the coordination file's map (Task 9).
-- §9 and the coordination file: branch from `main`, worktrees `fx-*`, run folder, ports 8931-8939, the slot pool, the pane only while the owner is free, no `git stash`, generated files never merged by hand, merge rules 2-4, the launch window and the release on the owner's word (Global Constraints, Phases, Tasks 9 and 11).
-
-**Placeholder scan.** Every step that writes code or markup shows it in full; the only values filled in at run time are the ones the process produces (the live-check day in `datetime`, the record's corrected sentence, the next launch post's date), each with the rule that sets it.
-
-**Names.** `CSS_START`, `CSS_END`, `JS_START`, `JS_END`, `homeConst`, `previewBlocks`, `replaceBetween`, `cardSlugs`, `buildFamousFrom`, `buildFamous` (Task 2) are the names Tasks 5, 7 and 8 import; `section.fx`, `.fx-seen`, `.fx-what`, `.fx-cards`, `.card[data-slug]`, `.fx-pbox`, `.fx-prompt`, `.fx-toggle`, `.copy`/`.copy-l`, `.fx-jump`, `.fx-lede`, `.fx-legal`, `.fx-suggest`, `#toast .toast-t` are the same in the page (Task 5), the tests (Tasks 5, 7, 8) and the check (Task 3); the labels "Copied", "Copied the prompt for <title>" and "Press Ctrl+C to copy" match between the page script and the check.
-
-**Where this plan differs from the spec's own words, and why (each is shown to the owner in Task 10 where it changes what they see):**
-1. Two card labels have four words against the spec's "one to three words" (§4, §6): "Drawn on the chip" → "On the chip", "Out of the blur" → "Blur to sharp".
-2. Entry 12's What you see has 24 words against §6's 25 to 70: it ends "slides back into view".
-3. Copy prompt's name is "Copy prompt for <title>" (the spec's sketch reads "Copy the prompt for"): the visible label starts the name, as on the home page (WCAG 2.5.3).
-4. The prompt sits in a `div.fx-pbox` (the sketch has the `p` alone): the box carries the padding, so the five-line clamp cuts cleanly on phones.
-5. The head is a `div.fx-head`, not a section, so it adds no landmark beyond those §4 lists.
-6. The frame (Task 5) starts before the live check: it holds no entry, and §9 step 1 only keeps entries waiting.
-7. The reserves have no text in the spec: Reserve entries drafts them by the same rules; the owner sees any that is used.
-8. "A footer link" on the home page also needs one CSS rule (three links overflow at 320px) and one line for links opened from disk.
-9. The sitemap gives `famous/` monthly and 0.8 (the spec sets no values).
diff --git a/docs/superpowers/plans/2026-10-13-learn-pilot.md b/docs/superpowers/plans/2026-10-13-learn-pilot.md
deleted file mode 100644
index 9c61c952..00000000
--- a/docs/superpowers/plans/2026-10-13-learn-pilot.md
+++ /dev/null
@@ -1,1501 +0,0 @@
-# Learn Pilot Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Add See inside, Compare, a learning path and two idea lessons to the handbook, on Parallax Scrolling only, for the owner to approve before any rollout.
-
-**Architecture:** The shared page script and stylesheet gain a mode switch (Normal · See inside · Compare) that marks the stage with `data-hb-mode` and sends `hb:mode`, so each page draws its own modes; the shared script also boots on pages without a prompt (idea lessons). A static Learn page (`learn/index.html`) holds the 25-step path, which the tests read as the single source of truth; the pages on the path carry a lesson line and a lesson nav that the tests compare with it. The page check learns the mode switch and a `learn` target.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build, no dependencies); Node 22+ test runner (`node --test`); the repo's Chrome-driven page check (`tools/check-pages.mjs`).
-
-**Spec:** `docs/superpowers/specs/2026-10-13-learn-pilot-design.md` (read it first).
-
-## Global Constraints
-
-- Branch `feat/learn-pilot`; every lane works in its own git worktree made from it. Nothing is pushed.
-- The site shows no code: no code snippets, no backticks, no `<code>` or `<pre>` on any page.
-- Plain HTML + CSS + vanilla JS; no dependencies, no CDN; a page loads only files from this repository and works from a checkout.
-- Plain words for someone new to animation; American spelling (color, center, gray); no hype ("stunning", "powerful").
-- Never use the name `hb-view` anywhere in a page: the tests forbid it as old markup. New names use `hb-mode`.
-- Shared files stay at `?v=8` on every page until Task 8 bumps every page, the home page and the Learn pages to `?v=9` at once.
-- Touch targets at least 44×44px on phones (≤600px wide); text at least 4.5:1 against its background.
-- Animate only `transform` and `opacity`. A JavaScript frame loop moves by elapsed time: `FRAME = 1000 / 60`, `dt = lastT === null ? 0 : Math.min(ts - lastT, 50)`, every step times `dt / FRAME`; a start, a Play and `visibilitychange` set `lastT = null`.
-- Reduced motion: loops start paused, nothing is pressed for the visitor on arrival, and each mode shows a still version.
-- A page script's `hb:pause` and `hb:mode` listeners sit at the top level of its script (the inline script runs before the deferred shared script).
-- Do not use `git stash` (it is shared by every worktree). Compare versions with `git show <rev>:<path> > <scratch file>`.
-- Never type a ` ` escape through Write or Edit (it stores the raw character).
-- Each lane serves its own worktree on its own port: Task 3 → 8761, Task 4 → 8762, Task 5 → 8763, Task 6 → 8764, Task 7 → 8765, Task 8 → 8770. Serve with `python -m http.server <port> --bind 127.0.0.1` from the worktree root, as a background command; stop it when done.
-- Tests: `node --test "tests/*.test.js"` from the worktree root. Page check: `node tools/check-pages.mjs --base http://127.0.0.1:<port> <folder>`; a passing page prints six `ok` lines.
-- Commit messages follow the repo's style: `feat: …`, `fix: …`, `test: …`, `docs: …`, in plain words.
-
-## Phases
-
-- **Phase A (in parallel):** Task 1 (shared script), Task 2 (shared stylesheet), Task 3 (page check). Merge all three into `feat/learn-pilot`.
-- **Phase B (in parallel, from the merged Phase A):** Task 4 (Parallax Scrolling), Task 5 (Learn page and path tests), Task 6 (lesson 11), Task 7 (lesson 21). Merge all four.
-- **Phase C:** Task 8 (integration, version bump, whole-site check, final review), Task 9 (owner review).
-
----
-
-### Task 1: Shared script — boot without a prompt, and the mode switch
-
-**Files:**
-- Modify: `assets/js/demo-page.js` (header comment lines 1-10; `boot()` lines 220-240 and 515-549)
-- Test: `tests/demo-page.test.js` (the `standInPage` helper, lines 131-169; new tests at the end of the boot tests)
-
-**Interfaces:**
-- Produces: on a page with `[data-hb-modes]`, buttons `[data-hb-mode="normal|inside|compare"]`; a press sets `aria-pressed` and class `on` on exactly one button, sets `data-hb-mode` on `.stage`, un-hides the `[data-hb-for=<mode>]` note inside `.hb-page` (all hidden for `normal`) and dispatches `CustomEvent('hb:mode', { detail: { mode } })` on `document`. At boot the stage gets `data-hb-mode="normal"`; no event is sent at boot.
-- Produces: `boot()` runs on any page with `.hb-page`, with or without `.hb-prompt` (idea lessons have none; the home page has no `.hb-page` and is still skipped).
-
-- [ ] **Step 1: Extend the stand-in page in `tests/demo-page.test.js`**
-
-Replace the `standInPage` signature and body parts as follows (keep everything else in the helper as it is):
-
-```js
-// `extra` ({ modes, noPrompt }): modes adds the mode switch (Normal, See inside, Compare) and one note for See inside and one
-// for Compare; noPrompt leaves the prompt out, as on an idea lesson.
-function standInPage(kind, reduced, bodyAttributes, copy, links, extra) {
- const opts = extra || {};
- const timers = [], sent = [];
-```
-
-After the line `const stage = node(), player = node(), prompt = node(), demo = node(), play = node(), top = node();` add:
-
-```js
- const modeButtons = opts.modes ? ['normal', 'inside', 'compare'].map(mode => {
- const b = node();
- b.setAttribute('data-hb-mode', mode);
- b.setAttribute('aria-pressed', String(mode === 'normal'));
- return b;
- }) : [];
- const notes = opts.modes ? ['inside', 'compare'].map(mode => {
- const p = node();
- p.setAttribute('data-hb-for', mode);
- p.hidden = true;
- return p;
- }) : [];
- const modes = opts.modes && Object.assign(node(), { querySelectorAll: selector => (selector === '[data-hb-mode]' ? modeButtons : []) });
-```
-
-In the `wanted` object change the prompt entry and add the switch:
-
-```js
- const wanted = { '.hb-prompt': !opts.noPrompt && prompt, '.stage': stage, '.hb-player': player, '[data-hb-demo]': kind === 'do' && demo,
- '[data-hb-autoscroll]': kind === 'scroll' && play, '[data-hb-top]': kind === 'scroll' && top, '.hb-copy': button,
- '.hb-try': copy && copy.controls && Object.assign(node(), { querySelectorAll: () => copy.controls }),
- '[data-hb-modes]': modes };
- const page = { querySelector: selector => wanted[selector] || null,
- querySelectorAll: selector => (selector === '[data-hb-for]' ? notes : []) };
-```
-
-And return the new parts:
-
-```js
- return { doc, win, stage, player, demo, play, button, anchors, sent, modeButtons, notes,
- runTimers: () => timers.forEach(t => t.fn()), timerDelays: () => timers.map(t => t.ms) };
-```
-
-- [ ] **Step 2: Write the failing tests** (after the test "a scroll page with an empty sentence of its own gets the usual note…")
-
-```js
-test('a page with no prompt, such as an idea lesson, still gets its player: a scroll page scrolls on arrival and notes reduced motion', () => {
- const page = standInPage('scroll', false, {}, null, null, { noPrompt: true });
- page.runTimers();
- assert.equal(page.play.clicks, 1);
- const reduced = standInPage('scroll', true, {}, null, null, { noPrompt: true });
- assert.deepEqual(reduced.player.children.map(c => c.className), ['hb-player-note']);
-});
-
-test("the mode switch presses one mode at a time, marks the stage, shows only that mode's note and tells the page", () => {
- const page = standInPage('scroll', false, {}, null, null, { modes: true });
- assert.equal(page.stage.getAttribute('data-hb-mode'), 'normal');
- const [normal, inside, compare] = page.modeButtons;
- const pressed = () => page.modeButtons.map(b => b.getAttribute('aria-pressed'));
- const shown = () => page.notes.map(n => !n.hidden);
- const told = () => page.sent.filter(e => e.type === 'hb:mode').map(e => e.detail.mode);
- assert.deepEqual(told(), [], 'nothing is sent at boot');
- inside.emit('click', visitor);
- assert.deepEqual(pressed(), ['false', 'true', 'false']);
- assert.equal(page.stage.getAttribute('data-hb-mode'), 'inside');
- assert.deepEqual(shown(), [true, false]);
- compare.emit('click', visitor);
- assert.deepEqual(pressed(), ['false', 'false', 'true']);
- assert.deepEqual(shown(), [false, true]);
- normal.emit('click', visitor);
- assert.deepEqual(pressed(), ['true', 'false', 'false']);
- assert.deepEqual(shown(), [false, false]);
- assert.equal(page.stage.getAttribute('data-hb-mode'), 'normal');
- assert.deepEqual(told(), ['inside', 'compare', 'normal']);
-});
-
-test('a page without the mode switch gets no data-hb-mode and sends no hb:mode', () => {
- const page = standInPage('scroll', false);
- page.runTimers();
- assert.equal(page.stage.getAttribute('data-hb-mode'), null);
- assert.equal(page.sent.filter(e => e.type === 'hb:mode').length, 0);
-});
-```
-
-- [ ] **Step 3: Run the tests and see the new ones fail**
-
-Run: `node --test tests/demo-page.test.js`
-Expected: the three new tests FAIL (Play is not clicked without a prompt; no `data-hb-mode`); every older test passes.
-
-- [ ] **Step 4: Implement in `assets/js/demo-page.js`**
-
-In the header comment, after the line about scroll pages, add:
-
-```js
- * The mode switch (Normal, See inside, Compare) marks the stage with data-hb-mode, shows that mode's note and sends
- * "hb:mode", so the page draws the mode. Pages without a prompt (the idea lessons) get everything but the prompt parts.
-```
-
-At the start of `boot()` replace
-
-```js
- var page = doc.querySelector('.hb-page');
- var promptEl = page && page.querySelector('.hb-prompt');
- if (!promptEl) return;
-```
-
-with
-
-```js
- var page = doc.querySelector('.hb-page');
- if (!page) return;
- var promptEl = page.querySelector('.hb-prompt');
-```
-
-After `var topCtl = page.querySelector('[data-hb-top]');` add:
-
-```js
- var modesCtl = page.querySelector('[data-hb-modes]');
-```
-
-Before the comment `// While the device asks for reduced motion, Loop and Slow motion are switched off…` add:
-
-```js
- // See inside and Compare: the mode switch above the stage. Pressing a mode presses its button (one at a time), marks the
- // stage with data-hb-mode, shows the note for that mode (Normal has none) and sends "hb:mode", so the page draws the mode.
- // Nothing scrolls and nothing takes focus, and a running Play goes on: the switch sits outside the stage, whose input
- // stops Play.
- function setUpModes() {
- var buttons = Array.prototype.slice.call(modesCtl.querySelectorAll('[data-hb-mode]'));
- var notes = Array.prototype.slice.call(page.querySelectorAll('[data-hb-for]'));
- function choose(mode) {
- buttons.forEach(function (b) {
- var on = b.getAttribute('data-hb-mode') === mode;
- b.classList.toggle('on', on);
- b.setAttribute('aria-pressed', String(on));
- });
- notes.forEach(function (n) { n.hidden = n.getAttribute('data-hb-for') !== mode; });
- if (stage) stage.setAttribute('data-hb-mode', mode);
- doc.dispatchEvent(new win.CustomEvent('hb:mode', { detail: { mode: mode } }));
- }
- buttons.forEach(function (b) {
- b.addEventListener('click', function () { choose(b.getAttribute('data-hb-mode')); });
- });
- if (stage) stage.setAttribute('data-hb-mode', 'normal');
- }
-```
-
-Replace `setUpPrompt();` (the call near the end of `boot()`) with `if (promptEl) setUpPrompt();`, and after `if (scrollCtl && scroller) setUpScroll();` add `if (modesCtl) setUpModes();`.
-
-- [ ] **Step 5: Run all tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes (the page and skill tests are untouched by this change).
-
-- [ ] **Step 6: Commit**
-
-```bash
-git add assets/js/demo-page.js tests/demo-page.test.js
-git commit -m "feat: the shared script runs on pages without a prompt and drives the mode switch (Normal, See inside, Compare)"
-```
-
----
-
-### Task 2: Shared stylesheet — the mode switch, its notes, the lesson line and nav, and the idea lessons' sections
-
-**Files:**
-- Modify: `assets/css/demo-page.css`
-- Test: `tests/pages.test.js` (one new test after "the shared stylesheet keeps choice buttons at least 44px wide")
-
-**Interfaces:**
-- Consumes (markup from the spec): `div.seg.hb-modes` with `button[data-hb-mode]`; `div.hb-mode-notes > p[data-hb-for]`; `p.hb-lesson > a`; `nav.hb-lesson-nav` with `p.hb-lesson-title`, `a.hb-lesson-prev`, `a.hb-lesson-next` (each `<span>` then `<b>`) and `a.hb-lesson-all`; `section.hb-why` (`h2` + `p`); `section.hb-seen` (`h2` + `div.hb-rel-list` of `a.hb-rel`).
-- Produces: from 761px the switch sits at the right end of the Watch step's heading row (the stage does not move down); from 601px the lesson line shares the category line's row; an empty notes box takes no room.
-
-- [ ] **Step 1: Write the failing test** in `tests/pages.test.js`
-
-```js
-test('the shared stylesheet draws the mode switch beside the Watch heading from 761px, hides an empty notes box, and styles the lesson line, the lesson nav and the idea lessons\' sections', () => {
- const css = read(path.join(ROOT, 'assets', 'css', 'demo-page.css'));
- const rules = cssRules(css);
- const has = sel => rules.some(r => r.selector.split(',').map(s => s.trim()).includes(sel));
- for (const sel of ['.hb-page .hb-modes', '.hb-mode-notes p', '.hb-lesson', '.hb-lesson a', '.hb-lesson-nav', '.hb-lesson-prev',
- '.hb-lesson-next', '.hb-lesson-all', '.hb-why p', '.hb-seen']) assert.ok(has(sel), sel);
- assert.ok(rules.some(r => r.selector === '.hb-mode-notes:not(:has(> p:not([hidden])))' && /display:none/.test(r.body)),
- 'an empty notes box takes no room');
- assert.match(css, /@media\(min-width:761px\)\{\s*\.hb-watch:has\(> \.hb-modes\)\{display:grid/, 'from 761px the switch shares the heading row');
- assert.match(css, /@media\(min-width:601px\)\{\s*\.hb-head:has\(> \.hb-lesson\)\{display:grid/, 'from 601px the lesson line shares the category row');
-});
-```
-
-- [ ] **Step 2: Run it and see it fail**
-
-Run: `node --test tests/pages.test.js`
-Expected: the new test FAILS on `.hb-page .hb-modes`.
-
-- [ ] **Step 3: Add the rules to `assets/css/demo-page.css`**
-
-After the rule `[data-hb-autoscrolling]{scroll-snap-type:none!important}` add:
-
-```css
-
-/* See inside and Compare: the mode switch (Normal · See inside · Compare) above the stage, and under the player bar the note
- that says what the stage shows. Normal has no note, and the empty box then takes no room. From 761px the switch sits at the
- right end of the Watch step's heading row (below), so the stage keeps its place on a laptop's first screen. */
-.hb-page .hb-modes{gap:6px}
-.hb-mode-notes:not(:has(> p:not([hidden]))){display:none}
-.hb-mode-notes p{margin:0;max-width:72ch;font:400 15px/1.55 var(--hb-font);color:var(--hb-dim)}
-.hb-mode-notes a{color:var(--hb-ink);text-underline-offset:3px}
-```
-
-After the rule `.hb-rel span{…}` add:
-
-```css
-
-/* The learning path: the lesson line beside the category line (below it on phones), the previous and next lessons at the end
- of a page of the path, and an idea lesson's Why it works and Where you'll see it */
-.hb-lesson{margin:0;font:600 14px/1.3 var(--hb-font);letter-spacing:.02em}
-.hb-lesson a{color:var(--hb-dim);text-decoration:underline;text-decoration-color:var(--hb-edge-2);text-underline-offset:4px}
-.hb-lesson-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding-top:clamp(28px,4vw,36px);border-top:1px solid var(--hb-line)}
-.hb-lesson-title{grid-column:1/-1;margin:0;font:700 22px/1.2 var(--hb-font);letter-spacing:-.01em;color:var(--hb-ink)}
-.hb-lesson-prev,.hb-lesson-next{display:flex;flex-direction:column;gap:6px;padding:18px 20px;border:1px solid rgba(255,255,255,.12);
- border-radius:10px;text-decoration:none}
-.hb-lesson-next{grid-column:2;text-align:right}
-.hb-lesson-prev span,.hb-lesson-next span{font:600 14px/1.3 var(--hb-font);color:var(--hb-accent)}
-.hb-lesson-prev b,.hb-lesson-next b{font:700 18px/1.25 var(--hb-font);color:var(--hb-ink)}
-.hb-lesson-all{grid-column:1/-1;justify-self:start;display:inline-flex;align-items:center;min-height:44px;color:var(--hb-dim);
- font:600 15px/1 var(--hb-font)}
-.hb-why,.hb-seen{padding-top:clamp(28px,4vw,36px);border-top:1px solid var(--hb-line)}
-.hb-why h2,.hb-seen h2{margin:0 0 12px;font:700 22px/1.2 var(--hb-font);letter-spacing:-.01em;color:var(--hb-ink)}
-.hb-why p{margin:0;max-width:68ch;font:400 17px/1.7 var(--hb-font);color:var(--hb-dim)}
-.hb-why p+p{margin-top:12px}
-```
-
-Inside the existing `@media(hover:hover){…}` block add:
-
-```css
- .hb-lesson-prev:hover,.hb-lesson-next:hover{border-color:color-mix(in srgb,var(--hb-accent) 55%,transparent)}
- .hb-lesson a:hover,.hb-lesson-all:hover{color:var(--hb-ink)}
-```
-
-Before the comment `/* Short laptop screens (1366×768 leaves about 650px of page)…` add:
-
-```css
-/* From 601px the lesson line shares the category line's row, at its right end, so the header grows no taller */
-@media(min-width:601px){
- .hb-head:has(> .hb-lesson){display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:16px}
- .hb-head:has(> .hb-lesson) > *{grid-column:1/-1}
- .hb-head:has(> .hb-lesson) > .hb-cat{grid-column:1}
- .hb-head:has(> .hb-lesson) > .hb-lesson{grid-column:2;justify-self:end;align-self:center}
-}
-/* From 761px the mode switch sits at the right end of the Watch step's heading row */
-@media(min-width:761px){
- .hb-watch:has(> .hb-modes){display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:20px;align-items:end}
- .hb-watch:has(> .hb-modes) > *{grid-column:1/-1}
- .hb-watch:has(> .hb-modes) > .hb-step-head{grid-column:1}
- .hb-watch:has(> .hb-modes) > .hb-modes{grid-column:2;flex-wrap:nowrap}
-}
-/* Up to 760px the switch has a row of its own above the stage, its three buttons sharing it equally */
-@media(max-width:760px){
- .hb-page .hb-modes button{flex:1 1 0;padding:0 8px}
-}
-```
-
-Inside the existing `@media(max-width:600px){…}` block add:
-
-```css
- .hb-lesson a{display:inline-flex;align-items:center;min-height:44px}
- .hb-lesson-nav{grid-template-columns:minmax(0,1fr)}
- .hb-lesson-next{grid-column:auto}
-```
-
-- [ ] **Step 4: Run all tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: every test passes.
-
-- [ ] **Step 5: Commit**
-
-```bash
-git add assets/css/demo-page.css tests/pages.test.js
-git commit -m "feat: the shared stylesheet draws the mode switch and its notes, the lesson line and nav, and the idea lessons' sections"
-```
-
----
-
-### Task 3: Page check — the mode switch and the `learn` target
-
-**Files:**
-- Modify: `tools/check-pages.mjs` (header comment lines 1-31; page list lines 55-62; `CHECK` lines 83-110; new helpers after `stageChanges`; the main loop's per-setup checks)
-
-**Interfaces:**
-- Consumes: the markup of Tasks 1-2 (`.hb-modes [data-hb-mode]`, `.stage[data-hb-mode]`, `.hb-mode-notes [data-hb-for]`); `body.hb-learn` on Learn pages; `.hb-path a` on the Learn page.
-- Produces: `node tools/check-pages.mjs … learn` checks `learn/index.html` and every `learn/<lesson>/` at six setups; screenshots `<name>-<setup>-inside.png` and `<name>-<setup>-compare.png` for pages with the switch.
-
-- [ ] **Step 1: Header comment.** After the sentence ending "…and nothing more." add:
-
-```js
-// A page with the mode switch (Normal, See inside, Compare): at every setup each mode marks the stage, shows its note and
-// overflows nothing, and a screenshot of each mode is saved. At the desktop and reduced-motion setups, with the stage at rest
-// (a scroll page at the top, a loop paused, a plays-once page with Loop off), See inside and Compare must each change the
-// stage and differ from each other, Normal must bring the first picture back, and on a scroll page Play must keep scrolling
-// through a mode change. "learn" stands for the Learn page and every idea lesson in learn/: the page checks run there too,
-// without the prompt parts (chips, What it is), and each lesson's kind is worked like any other page's.
-```
-
-and change the usage line to `// Usage: node tools/check-pages.mjs [--base http://127.0.0.1:8731] [--out <folder>] <page or category folder, home or learn>...`.
-
-- [ ] **Step 2: Expand `learn`.** In the `pages` builder, make the `flatMap` callback start with:
-
-```js
- // "learn" stands for the Learn page and every idea lesson in its folder.
- if (p === 'learn/') {
- const lessons = existsSync(join(ROOT, 'learn')) ? readdirSync(join(ROOT, 'learn'), { withFileTypes: true })
- .filter(d => d.isDirectory() && isPage(`learn/${d.name}`)).map(d => `learn/${d.name}/`).sort() : [];
- return ['learn/', ...lessons];
- }
-```
-
-and the usage error message to `'Usage: node tools/check-pages.mjs [--base URL] [--out DIR] <page or category folder, home or learn>...'`.
-
-- [ ] **Step 3: `CHECK` on Learn pages.** In `CHECK`, after `const problems = [];` add `const learn = document.body.classList.contains('hb-learn');`. Add `.hb-lesson a, .hb-lesson-nav a, .hb-path a` to the small-target selector list (after `.hb-rel`). Replace
-
-```js
- if (chips !== controls) problems.push('chips ' + chips + ' vs settings ' + controls);
- const what = document.querySelector('.hb-what-text');
- if (!what || !what.querySelector('p')) problems.push('What it is is missing');
- else if (what.querySelector('a[href="README.md"]')) problems.push('What it is did not load from the README');
-```
-
-with
-
-```js
- // Learn pages have no prompt, so no chips, and no README
- if (!learn && chips !== controls) problems.push('chips ' + chips + ' vs settings ' + controls);
- const what = document.querySelector('.hb-what-text');
- if (!learn && (!what || !what.querySelector('p'))) problems.push('What it is is missing');
- else if (!learn && what.querySelector('a[href="README.md"]')) problems.push('What it is did not load from the README');
-```
-
-- [ ] **Step 4: Add the helpers** after `stageChanges`:
-
-```js
-// The stage once it has stopped changing: captures 250 ms apart until two in a row match (up to 4 s).
-async function stillShot() {
- let shot = await stageShot();
- for (let i = 0; i < 16; i++) {
- await sleep(250);
- const next = await stageShot();
- if (next === shot) break;
- shot = next;
- }
- return shot;
-}
-
-// Pages with the mode switch: see the header comment. name and setup name the screenshots; kind is the page kind.
-async function modeProblems(name, setup, kind) {
- if (!(await evaluate(`!!document.querySelector('[data-hb-modes]')`))) return [];
- const problems = [];
- const press = mode => evaluate(`document.querySelector('.hb-modes [data-hb-mode="${mode}"]').click()`);
- const deep = !!(setup.moves || setup.reduce);
- if (deep) {
- if (kind === 'scroll') await evaluate(`document.querySelector('[data-hb-top]').click()`);
- if (kind === 'loop') await evaluate(`(() => { const p = document.querySelector('[data-hb-pause]'); if (p && p.getAttribute('data-state') !== 'paused') p.click(); })()`);
- if (kind === 'once') await evaluate(`(() => { const l = document.querySelector('[data-hb-loop]'); if (l && l.checked) l.click(); })()`);
- }
- const first = deep ? await stillShot() : null;
- const shots = {};
- for (const mode of ['inside', 'compare']) {
- const label = mode === 'inside' ? 'See inside' : 'Compare';
- await press(mode);
- await sleep(700);
- const state = await evaluate(`(() => ({ mode: document.querySelector('.hb-page .stage').getAttribute('data-hb-mode'),
- overflow: document.documentElement.scrollWidth > document.documentElement.clientWidth + 1,
- note: !!document.querySelector('.hb-mode-notes [data-hb-for="${mode}"]:not([hidden])') }))()`);
- if (state.mode !== mode) problems.push(`${label}: the stage is not marked data-hb-mode="${mode}"`);
- if (state.overflow) problems.push(`${label}: horizontal overflow`);
- if (!state.note) problems.push(`${label}: its note is not shown`);
- const shot = await send('Page.captureScreenshot', { format: 'png' });
- writeFileSync(join(OUT, `${name}-${setup.name}-${mode}.png`), Buffer.from(shot.data, 'base64'));
- if (deep) {
- shots[mode] = await stillShot();
- if (await samePicture(shots[mode], first)) problems.push(`${label} does not change the stage`);
- }
- }
- if (deep && await samePicture(shots.inside, shots.compare)) problems.push('See inside and Compare show the same picture');
- await press('normal');
- if (deep && !(await samePicture(await stillShot(), first))) problems.push('Normal does not bring the first picture back');
- if (deep && kind === 'scroll' && !setup.reduce) {
- const box = `(document.querySelector('[data-hb-scroller]') || document.querySelector('.hb-page .stage'))`;
- await evaluate(`document.querySelector('[data-hb-autoscroll]').click()`);
- await sleep(400);
- await press('inside');
- const before = await evaluate(`${box}.scrollTop`);
- await sleep(500);
- if (await evaluate(`${box}.scrollTop`) <= before) problems.push('changing the mode stops Play');
- await evaluate(`document.querySelector('[data-hb-top]').click()`);
- await press('normal');
- }
- return problems;
-}
-```
-
-- [ ] **Step 5: Call it.** In the main loop, right after the line `if (result.kind === 'scroll' && (setup.moves || setup.reduce)) problems.push(...await scrollProblems(!!setup.reduce));` and still inside that `if (!home) {…}` block, add:
-
-```js
- problems.push(...await modeProblems(name, setup, result.kind));
-```
-
-- [ ] **Step 6: Check for regressions.** Serve the worktree on port 8761 and run
-
-`node tools/check-pages.mjs --base http://127.0.0.1:8761 animations/01-scroll-based/parallax-scrolling animations/07-ambient-background/aurora home`
-
-Expected: six `ok` lines for each of the three (no page has the switch yet, so `modeProblems` returns at once). Then run `node tools/check-pages.mjs --base http://127.0.0.1:8761 learn` and expect it to FAIL with "page did not finish loading" or a 404-shaped problem (there is no Learn page yet): this shows the target expands and runs. Stop the server.
-
-- [ ] **Step 7: Commit**
-
-```bash
-git add tools/check-pages.mjs
-git commit -m "feat: the page check works the mode switch (each mode's note, picture and screenshot) and checks the Learn pages with the learn target"
-```
-
----
-
-### Task 4: Parallax Scrolling — See inside, Compare, notes, lesson line and lesson nav
-
-**Files:**
-- Modify: `animations/01-scroll-based/parallax-scrolling/index.html` (style block lines 23-38, Watch step lines 55-127, header lines 49-53, end of `main` lines 180-184, script lines 186-234)
-- Test: `tests/pages.test.js` (a new mode-switch test)
-- May fix: `tools/check-pages.mjs`, `modeProblems` only, if the page check's mode code has a bug (say so in the report)
-
-**Interfaces:**
-- Consumes: Task 1's `hb:mode` event and `data-hb-mode` on the stage; Task 2's CSS classes; Task 3's mode check.
-- Produces: the mode-switch template that the rollout will copy; links to `../../../learn/` and `../../../learn/far-things-move-slower/` (made by Tasks 5 and 7).
-
-- [ ] **Step 1: Write the failing test** in `tests/pages.test.js`, after the `for (const d of steps)` block that ends with the pager-link check:
-
-```js
-// The mode switch (See inside and Compare), exactly as in the template, between the Watch step's heading and its stage, with
-// a note for See inside and one for Compare after the player bar, both hidden until their mode is pressed.
-const MODES = '<div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes><button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button><button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button><button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button></div>';
-for (const d of steps.filter(d => pageOf(d).includes('data-hb-modes'))) {
- test(`${d.slug}: the mode switch is as in the template, before the stage, with a note for See inside and Compare`, () => {
- const html = pageOf(d), flat = html.replace(/>\s+</g, '><');
- assert.equal(count(html, 'data-hb-modes'), 1, 'one mode switch');
- assert.ok(flat.includes(MODES), 'the mode switch is exactly as in the template');
- const watch = between(flat, '<section class="hb-step hb-watch"', '</section>');
- const at = watch.indexOf(MODES);
- assert.ok(at > watch.indexOf('<div class="hb-step-head">') && at < watch.indexOf('<div class="stage"'), 'between the heading and the stage');
- const notes = between(watch, '<div class="hb-mode-notes" aria-live="polite">', '</div>');
- assert.ok(notes && watch.indexOf(notes) > watch.indexOf('<div class="hb-player">'), 'the notes come after the player bar');
- for (const mode of ['inside', 'compare']) assert.equal(count(notes, `<p data-hb-for="${mode}" hidden>`), 1, `one ${mode} note, hidden at first`);
- for (const [, href] of notes.matchAll(/<a href="([^"]+)"/g)) assert.ok(isDemoDir(path.resolve(d.dir, href)) || href.includes('/learn/'), `note link ${href}`);
- });
-}
-```
-
-(The `learn/` exception lasts only until Task 8, which makes the lesson exist; Task 5's tests then check every lesson link.)
-
-Run: `node --test tests/pages.test.js` — expected: no new test runs yet (no page has `data-hb-modes`). Add the switch markup of Step 2, run again and see it FAIL until Steps 2-3 are complete.
-
-- [ ] **Step 2: Markup.** In `header.hb-head`, right after `<p class="hb-cat">01.02 · Scroll-Based</p>` add:
-
-```html
- <p class="hb-lesson"><a href="../../../learn/">Learning path · Lesson 22 of 25</a></p>
-```
-
-In the Watch step, between `</div>` of `div.hb-step-head` and the stage, add:
-
-```html
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
-```
-
-Replace the stage (lines 60-122) with the same SVGs inside a new frame, each layer with its label:
-
-```html
- <div class="stage" id="stage" tabindex="0" role="region" aria-label="A landscape in four layers that move at different speeds">
- <div class="scene">
- <div class="frame">
- <div class="layers" id="main">
- <p class="side">With parallax</p>
-
- <!-- L1: Sky + stars -->
- <div class="layer" id="l1">
- (the existing L1 svg, unchanged)
- <span class="tag"><b>Sky</b><span></span><i></i></span>
- </div>
-
- <!-- L2: Distant ridge -->
- <div class="layer" id="l2">
- (the existing L2 svg, unchanged)
- <span class="tag"><b>Hills</b><span></span><i></i></span>
- </div>
-
- <!-- L3: Pine treeline -->
- <div class="layer" id="l3">
- (the existing L3 svg, unchanged)
- <span class="tag"><b>Trees</b><span></span><i></i></span>
- </div>
-
- <!-- L4: Foreground grass -->
- <div class="layer" id="l4">
- (the existing L4 svg, unchanged)
- <span class="tag"><b>Grass</b><span></span><i></i></span>
- </div>
-
- </div>
- </div>
- </div>
- </div>
-```
-
-("(the existing … svg, unchanged)" means: keep that `<svg>…</svg>` element exactly as it is in the file today.)
-
-After `</div>` of `div.hb-player` add:
-
-```html
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden><span class="say">Inside, the picture is four flat layers. As the box scrolls, the far layers move least and the near grass moves most.</span> <a href="../../../learn/far-things-move-slower/">The idea: far things move slower</a></p>
- <p data-hb-for="compare" hidden>On the left every layer moves the same, so the picture looks flat. On the right each layer moves its own amount, so it looks deep.</p>
- </div>
-```
-
-After `</section>` of `section.hb-related` (before `</main>`) add:
-
-```html
- <nav class="hb-lesson-nav" aria-label="Learning path">
- <p class="hb-lesson-title">Learning path</p>
- <a class="hb-lesson-prev" href="../../../learn/far-things-move-slower/"><span>← Lesson 21</span><b>Far things move slower</b></a>
- <a class="hb-lesson-next" href="../../06-3d-advanced/parallax-3d-tilt/"><span>Lesson 23 →</span><b>Parallax 3D Tilt</b></a>
- <a class="hb-lesson-all" href="../../../learn/">All 25 lessons</a>
- </nav>
-```
-
-- [ ] **Step 3: Styles.** Replace the page's `<style>` block with:
-
-```html
- <style>
- :root{--ui-accent:#6ea8ff}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{position:relative;overflow-y:auto;scrollbar-width:none;container-type:size;background:#0b0b0d}
- .stage::-webkit-scrollbar{display:none}
- .scene{height:300cqh}
- /* The frame stays put while the box scrolls and holds the scene: one copy, or two side by side in Compare */
- .frame{position:sticky;top:0;height:100cqh;display:grid;grid-template-columns:minmax(0,1fr);overflow:hidden}
- /* matches the top stop of the sky gradient so layer travel never
- exposes the page background above the backmost layer */
- .layers{position:relative;overflow:hidden;background:#0a1628}
- .layer{
- position:absolute;top:0;left:0;width:100%;height:100%;
- will-change:transform;
- }
- .layer svg{width:100%;height:100%}
- .twin,.tag,.side{display:none}
- /* See inside: the four layers pulled apart in depth, far at the back, each outlined and labeled with how far it moves.
- The labels are larger on the far layers, which the depth draws smaller, so all of them read at about the same size. */
- .stage[data-hb-mode="inside"] .layers{overflow:visible;background:none;perspective:1200px;perspective-origin:50% 25%}
- .stage[data-hb-mode="inside"] .layer{outline:2px solid rgba(244,244,242,.6);outline-offset:-2px;rotate:y -34deg;scale:.58}
- .stage[data-hb-mode="inside"] #l1{translate:-34% -4% -320px}
- .stage[data-hb-mode="inside"] #l2{translate:-11% -1% -110px}
- .stage[data-hb-mode="inside"] #l3{translate:11% 1% 100px}
- .stage[data-hb-mode="inside"] #l4{translate:34% 4% 310px}
- .stage[data-hb-mode="inside"] .tag{display:flex}
- .tag{position:absolute;top:6%;left:5%;flex-direction:column;gap:.3em;padding:.4em .6em;border-radius:.4em;
- background:rgba(11,11,13,.86);color:#f4f4f2;font-family:var(--hb-font);font-weight:600;font-size:var(--size);line-height:1.2}
- .tag span{font-weight:400;color:#d6d6da}
- .tag i{display:block;height:.3em;width:calc(var(--far,1) * 5em);border-radius:.15em;background:var(--ui-accent)}
- #l1 .tag{--size:28px} #l2 .tag{--size:24px} #l3 .tag{--size:21px} #l4 .tag{--size:18px}
- /* Compare: the scene without parallax on the left and with it on the right, each named at its top */
- .stage[data-hb-mode="compare"] .frame{grid-template-columns:repeat(2,minmax(0,1fr));gap:2px}
- .stage[data-hb-mode="compare"] .twin,.stage[data-hb-mode="compare"] .side{display:block}
- .side{position:absolute;z-index:5;top:10px;left:10px;padding:5px 10px;border-radius:999px;background:rgba(11,11,13,.82);
- color:#f4f4f2;font:600 13px/1.2 var(--hb-font)}
- @media(prefers-reduced-motion:reduce){.layer{will-change:auto}}
- </style>
-```
-
-- [ ] **Step 4: Script.** Replace the page's `<script>` with:
-
-```html
-<script>
- // Speed multipliers of the sky, ridge, trees and grass under each Depth choice
- const DEPTHS = {
- flat: [1, 1, 1, 1],
- shallow: [0.5, 0.65, 0.8, 1],
- normal: [0.1, 0.3, 0.6, 1],
- deep: [0, 0.25, 0.7, 1.5],
- };
- const stage = document.getElementById('stage');
- const main = document.getElementById('main');
- // Compare's left side: a copy of the scene without parallax, named "Without parallax". The copy loses its ids (its sky
- // gradient gets one of its own) and its labels.
- const twin = main.cloneNode(true);
- twin.querySelectorAll('.tag').forEach(t => t.remove());
- twin.querySelectorAll('[id]').forEach(el => el.removeAttribute('id'));
- twin.removeAttribute('id');
- twin.classList.add('twin');
- twin.querySelector('linearGradient').id = 'sky-twin';
- twin.querySelector('rect[fill="url(#sky)"]').setAttribute('fill', 'url(#sky-twin)');
- twin.querySelector('.side').textContent = 'Without parallax';
- main.before(twin);
- const copies = twin.querySelectorAll('.layer');
- const LAYERS = DEPTHS.normal.map((s, i) => {
- const el = document.getElementById('l' + (i + 1));
- return { el, copy: copies[i], tag: el.querySelector('.tag'), speed: s };
- });
- const motionMQ = window.matchMedia('(prefers-reduced-motion: reduce)');
- const LABELS = {
- normal: 'A landscape in four layers that move at different speeds',
- inside: 'The landscape pulled apart into its four layers, each labeled with how much it moves',
- compare: 'Two copies of the landscape side by side, without parallax on the left and with parallax on the right',
- };
- const insideSay = document.querySelector('[data-hb-for="inside"] .say');
- const compareNote = document.querySelector('[data-hb-for="compare"]');
- let mode = 'normal';
- let ticking = false;
-
- function update() {
- const st = stage.scrollTop;
- const max = stage.scrollHeight - stage.clientHeight;
- const progress = max > 0 ? st / max : 0;
- // A layer at 100% travels a quarter of the box, so the grass just leaves it at the end of the scroll
- const MAX_PARALLAX = stage.clientHeight / 4;
- // Reduced motion: the layers never move with the scroll. Compare then shows both sides as they stand halfway down, so
- // the difference still shows without any movement.
- const still = motionMQ.matches;
- const p = still ? (mode === 'compare' ? 0.5 : 0) : progress;
- LAYERS.forEach(L => {
- L.el.style.transform = `translate3d(0,${Math.round(p * MAX_PARALLAX * L.speed)}px,0)`;
- L.copy.style.transform = `translate3d(0,${Math.round(p * MAX_PARALLAX)}px,0)`;
- });
- ticking = false;
- }
-
- // Each label says how far its layer moves next to the others, in words and as a bar (a share of the longest one); the
- // notes say what Flat does.
- function describe() {
- const speeds = LAYERS.map(L => L.speed), most = Math.max(...speeds);
- const flat = speeds.every(s => s === speeds[0]);
- LAYERS.forEach(L => {
- const s = L.speed;
- L.tag.querySelector('span').textContent = flat ? 'moves with the rest' : s === 0 ? 'stays still' : s === most ? 'moves most'
- : s <= most * 0.2 ? 'barely moves' : s <= most * 0.5 ? 'moves a little' : 'moves more';
- L.tag.style.setProperty('--far', most ? s / most : 1);
- });
- insideSay.textContent = flat
- ? 'Inside, the picture is four flat layers. Depth is set to Flat, so they all move the same and the picture looks flat.'
- : 'Inside, the picture is four flat layers. As the box scrolls, the far layers move least and the near grass moves most.';
- compareNote.textContent = flat
- ? 'Depth is set to Flat, so both sides move the same. Pick another Depth in Try it to see the difference.'
- : 'On the left every layer moves the same, so the picture looks flat. On the right each layer moves its own amount, so it looks deep.';
- }
-
- document.addEventListener('hb:mode', e => {
- mode = e.detail.mode;
- stage.setAttribute('aria-label', LABELS[mode]);
- update();
- });
- stage.addEventListener('scroll', () => {
- if (!ticking) { requestAnimationFrame(update); ticking = true; }
- }, { passive: true });
- // Reduced motion turned on or off while the page is open
- motionMQ.addEventListener('change', update);
-
- function choices(id, pick) {
- const buttons = document.querySelectorAll('#' + id + ' button');
- buttons.forEach(b => b.addEventListener('click', () => {
- buttons.forEach(x => { x.classList.toggle('on', x === b); x.setAttribute('aria-pressed', String(x === b)); });
- pick(b.dataset);
- }));
- }
- choices('depth-seg', d => {
- DEPTHS[d.depth].forEach((s, i) => { LAYERS[i].speed = s; });
- describe();
- update();
- });
-
- describe();
- update();
-</script>
-```
-
-- [ ] **Step 5: Run the tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: all pass, including the new mode-switch test.
-
-- [ ] **Step 6: Page check and screenshots.** Serve on port 8762 and run
-`node tools/check-pages.mjs --base http://127.0.0.1:8762 animations/01-scroll-based/parallax-scrolling`.
-Expected: six `ok` lines. Open the saved `…-desktop-inside.png`, `…-desktop-compare.png`, `…-phone-inside.png`, `…-phone-compare.png` and `…-phone-reduced-inside.png` with the Read tool and tune only the See inside numbers (`perspective`, `rotate`, `scale`, the four `translate` values, the label sizes) until, at both 1280px and 375px: all four layers are visible as separate outlined planes from far (back) to near (front); every label is readable (about 12px or more on screen) and not cut off; nothing important leaves the box. If the 3D spread cannot meet this at 375px, switch to a flat diagonal fan (no `perspective`, no `rotate`; `scale:.62` and translate offsets of about ±18% across and ±10% down) and keep whichever reads clearer. Re-run the page check after every change; it must stay at six `ok` lines.
-
-- [ ] **Step 7: Commit**
-
-```bash
-git add animations/01-scroll-based/parallax-scrolling/index.html tests/pages.test.js
-git commit -m "feat: Parallax Scrolling shows its four layers pulled apart (See inside) and the scene without and with parallax side by side (Compare), with a lesson line and the previous and next lessons"
-```
-
----
-
-### Task 5: The Learn page and the path tests
-
-**Files:**
-- Create: `learn/index.html`
-- Create: `tests/learn.test.js`
-
-**Interfaces:**
-- Produces: the path as static `li[data-step][data-kind]` items (with `data-soon` and no link while a step is not built); `body.hb-learn`; the tests that every page of the path matches it.
-- Note: lessons 11 and 21 are built in parallel by Tasks 6 and 7. In this task write them as not built yet (exactly like the other unbuilt ideas); Task 8 turns them into links.
-
-- [ ] **Step 1: Write the failing tests** — create `tests/learn.test.js`:
-
-```js
-// Static checks for the Learn pages: the learning path on learn/index.html (the single source of truth for the path), the idea
-// lessons in learn/<slug>/, and the lesson line and lesson nav on every page of the path that has them.
-// Run from the repo root: node --test "tests/*.test.js"
-const test = require('node:test');
-const assert = require('node:assert/strict');
-const fs = require('node:fs');
-const path = require('node:path');
-
-const ROOT = path.resolve(__dirname, '..');
-const LEARN = path.join(ROOT, 'learn');
-const ANIM = path.join(ROOT, 'animations');
-const read = f => fs.readFileSync(f, 'utf8');
-const count = (s, sub) => s.split(sub).length - 1;
-const HUB = read(path.join(LEARN, 'index.html'));
-const HOME = read(path.join(ROOT, 'index.html'));
-
-// The steps of the path in page order: { n, kind, soon, href (null while not built), title, body }.
-const STEPS = [...HUB.matchAll(/<li data-step="(\d+)" data-kind="(idea|animation)"( data-soon)?>([\s\S]*?)<\/li>/g)].map(m => {
- const link = m[4].match(/<a href="([^"]+)"/);
- return { n: Number(m[1]), kind: m[2], soon: !!m[3], href: link ? link[1] : null, title: (m[4].match(/<b>([^<]+)<\/b>/) || [])[1], body: m[4] };
-});
-const dirOf = href => path.resolve(LEARN, href);
-const h1Of = dir => ((read(path.join(dir, 'index.html')).match(/<h1>([^<]+)<\/h1>/) || [])[1] || '').replace(/&amp;/g, '&');
-const LESSONS = fs.readdirSync(LEARN, { withFileTypes: true })
- .filter(d => d.isDirectory() && fs.existsSync(path.join(LEARN, d.name, 'index.html'))).map(d => path.join(LEARN, d.name));
-const FOOTER = '<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>';
-const STAR = '<a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub">';
-const version = (html, file) => (html.match(new RegExp(`demo-page\\.${file}\\?v=(\\d+)`)) || [])[1];
-
-test('the path has 25 steps in five chapters of five, numbered in order', () => {
- assert.deepEqual(STEPS.map(s => s.n), Array.from({ length: 25 }, (_, i) => i + 1));
- const chapters = [...HUB.matchAll(/<section class="hb-chapter"[\s\S]*?<\/section>/g)].map(m => count(m[0], '<li data-step='));
- assert.deepEqual(chapters, [5, 5, 5, 5, 5]);
-});
-
-test('every built step links to an existing page and shows its title; a step not built yet has no link and says so', () => {
- for (const s of STEPS) {
- if (s.soon) {
- assert.equal(s.href, null, `step ${s.n} has no link`);
- assert.ok(s.body.includes('Not built yet'), `step ${s.n} says Not built yet`);
- continue;
- }
- assert.ok(s.href, `step ${s.n} has a link`);
- const dir = dirOf(s.href);
- assert.ok(fs.existsSync(path.join(dir, 'index.html')), `step ${s.n}: ${s.href} exists`);
- assert.equal(s.title, h1Of(dir), `step ${s.n} shows the page's title`);
- assert.ok(dir.startsWith((s.kind === 'idea' ? LEARN : ANIM) + path.sep), `step ${s.n}: ideas live in learn/, animations in animations/`);
- }
-});
-
-test('every idea lesson in learn/ is a built step of the path', () => {
- for (const dir of LESSONS) {
- assert.ok(STEPS.some(s => s.href && s.kind === 'idea' && dirOf(s.href) === dir), `${path.basename(dir)} is a built idea step`);
- }
-});
-
-// Every page of the path that has a lesson line or lesson nav: each idea lesson, and any animation page that carries them.
-const onPath = STEPS.filter(s => s.href).map(s => ({ step: s, dir: dirOf(s.href) }))
- .filter(p => fs.existsSync(path.join(p.dir, 'index.html')) && read(path.join(p.dir, 'index.html')).includes('class="hb-lesson'));
-for (const { step, dir } of onPath) {
- test(`step ${step.n} (${step.title}): its lesson line and lesson nav match the Learn page`, () => {
- const html = read(path.join(dir, 'index.html'));
- const learnHref = path.relative(dir, LEARN).split(path.sep).join('/') + '/';
- const line = step.kind === 'idea' ? `<p class="hb-cat">Lesson ${step.n} of 25 · Idea</p>`
- : `<p class="hb-lesson"><a href="${learnHref}">Learning path · Lesson ${step.n} of 25</a></p>`;
- assert.ok(html.includes(line), `lesson line: ${line}`);
- const nav = html.match(/<nav class="hb-lesson-nav" aria-label="Learning path">([\s\S]*?)<\/nav>/);
- assert.ok(nav, 'lesson nav');
- assert.ok(nav[1].includes('<p class="hb-lesson-title">Learning path</p>'), 'lesson nav title');
- const prev = STEPS[step.n - 2], next = STEPS[step.n];
- for (const [cls, other, label] of [['hb-lesson-prev', prev, prev && `← Lesson ${prev.n}`], ['hb-lesson-next', next, next && `Lesson ${next.n} →`]]) {
- const a = nav[1].match(new RegExp(`<a class="${cls}" href="([^"]+)"><span>([^<]+)</span><b>([^<]+)</b></a>`));
- if (!other) { assert.equal(a, null, `no ${cls} at the end of the path`); continue; }
- assert.ok(other.href, `step ${other.n}, next to step ${step.n}, is built`);
- assert.ok(a, cls);
- assert.equal(a[2], label, `${cls} label`);
- assert.equal(a[3], other.title, `${cls} title`);
- assert.equal(path.resolve(dir, a[1]), dirOf(other.href), `${cls} opens step ${other.n}`);
- }
- assert.ok(nav[1].includes(`<a class="hb-lesson-all" href="${learnHref}">All 25 lessons</a>`), 'All 25 lessons');
- if (step.kind === 'idea') {
- for (const [rel, other, word] of [['prev', prev, 'Previous'], ['next', next, 'Next']]) {
- const a = html.match(new RegExp(`<a href="([^"]+)" rel="${rel}" aria-label="${word} lesson: ([^"]+)">`));
- assert.ok(a, `top bar ${rel} link`);
- assert.equal(path.resolve(dir, a[1]), dirOf(other.href), `top bar ${rel} opens step ${other.n}`);
- assert.equal(a[2], other.title, `top bar ${rel} names step ${other.n}`);
- }
- }
- });
-}
-
-for (const file of [path.join(LEARN, 'index.html'), ...LESSONS.map(d => path.join(d, 'index.html'))]) {
- const name = path.relative(ROOT, file).split(path.sep).join('/');
- test(`${name}: the shared frame (top bar with the Star link, footer, shared files at the home page's version) and no code`, () => {
- const html = read(file);
- assert.match(html, /<body class="hb hb-learn"/, 'body class hb hb-learn');
- assert.equal(count(html, '<nav class="hb-bar"'), 1);
- assert.ok(html.includes(STAR), 'the Star link in the top bar');
- assert.equal(count(html, '<main class="hb-page">'), 1);
- assert.equal(count(html, '<header class="hb-head">'), 1);
- assert.ok(html.replace(/>\s+</g, '><').includes(FOOTER), 'the shared footer');
- for (const f of ['css', 'js']) assert.equal(version(html, f), version(HOME, f), `demo-page.${f} at the home page's version`);
- assert.ok(!/`|<code|<pre/.test(html.replace(/<script[\s\S]*?<\/script>/g, '').replace(/<style[\s\S]*?<\/style>/g, '')), 'no code on the page');
- assert.ok(!html.includes('hb-view'), 'no old hb-view markup');
- });
-}
-
-test('the Learn page names itself and has five chapters', () => {
- assert.ok(HUB.includes('<h1>Learn web animation</h1>'));
- assert.ok(HUB.includes('<p class="hb-lede">25 short lessons, from easy to advanced. You watch and try; you never write code.</p>'));
- assert.equal(count(HUB, '<section class="hb-chapter"'), 5);
-});
-
-for (const dir of LESSONS) {
- test(`learn/${path.basename(dir)}: an idea lesson with a stage, Why it works, Where you'll see it and no prompt`, () => {
- const html = read(path.join(dir, 'index.html'));
- const body = html.match(/<body class="hb hb-learn" data-hb-kind="(once|loop|scroll|do)"( data-hb-autoplay)?(?: data-hb-motion-note="[^"]*")?>/);
- assert.ok(body, 'the body declares the page kind');
- for (const part of ['<section class="hb-step hb-watch"', '<div class="hb-player">', '<section class="hb-why"', '<section class="hb-seen"', '<nav class="hb-lesson-nav"']) {
- assert.equal(count(html, part), 1, `exactly one ${part}`);
- }
- assert.ok(!html.includes('hb-prompt'), 'no prompt');
- if (body[1] === 'loop') assert.equal(count(html, 'data-hb-pause'), 1, 'a loop has Pause');
- if (body[1] === 'scroll') {
- assert.ok(body[2], 'a scroll lesson scrolls once on arrival');
- assert.equal(count(html, 'data-hb-autoscroll'), 1, 'Play');
- assert.equal(count(html, 'data-hb-top'), 1, 'Back to top');
- }
- const why = html.match(/<section class="hb-why"[\s\S]*?<\/section>/)[0].replace(/<[^>]+>/g, ' ');
- const sentences = why.replace('Why it works', '').split(/[.!?](?:\s|$)/).filter(s => s.trim()).length;
- assert.ok(sentences >= 2 && sentences <= 4, `Why it works has ${sentences} sentences`);
- const seen = [...html.match(/<section class="hb-seen"[\s\S]*?<\/section>/)[0].matchAll(/<a class="hb-rel" href="([^"]+)"><b>([^<]+)<\/b>/g)];
- assert.ok(seen.length >= 3 && seen.length <= 6, `${seen.length} pages in Where you'll see it`);
- for (const [, href, title] of seen) {
- const target = path.resolve(dir, href);
- assert.ok(target.startsWith(ANIM + path.sep) && fs.existsSync(path.join(target, 'index.html')), `${href} is an animation page`);
- assert.equal(title, h1Of(target), `${href} shows the page's title`);
- }
- });
-}
-```
-
-- [ ] **Step 2: Run it and see it fail**
-
-Run: `node --test tests/learn.test.js`
-Expected: FAIL with `ENOENT … learn/index.html`.
-
-- [ ] **Step 3: Create `learn/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Learn Web Animation — Animation Handbook</title>
- <meta name="description" content="25 short lessons, from easy to advanced. You watch and try; you never write code.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/learn/">
- <link rel="icon" type="image/png" sizes="96x96" href="../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../favicon.svg">
- <link rel="apple-touch-icon" href="../apple-touch-icon.png">
- <meta property="og:type" content="website">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Learn Web Animation — Animation Handbook">
- <meta property="og:description" content="25 short lessons, from easy to advanced. You watch and try; you never write code.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/learn/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Learn Web Animation — Animation Handbook">
- <meta name="twitter:description" content="25 short lessons, from easy to advanced. You watch and try; you never write code.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <style>
- :root{--ui-accent:#c8f169}
- .hb-chapter{display:flex;flex-direction:column;gap:14px;padding-top:clamp(28px,4vw,36px);border-top:1px solid var(--hb-line)}
- .hb-chapter h2{margin:0;font:700 clamp(22px,2.6vw,26px)/1.2 var(--hb-font);letter-spacing:-.015em;color:var(--hb-ink)}
- .hb-chapter h2 span{display:block;margin-bottom:4px;font:600 14px/1.3 var(--hb-font);letter-spacing:.04em;color:var(--hb-accent)}
- .hb-path{display:flex;flex-direction:column;gap:10px;margin:0;padding:0;list-style:none}
- .hb-path li > a,.hb-path li > div{display:grid;grid-template-columns:44px minmax(0,1fr);column-gap:16px;row-gap:2px;align-items:center;
- padding:14px 18px;border:1px solid rgba(255,255,255,.12);border-radius:10px;text-decoration:none}
- .hb-path .n{grid-row:1/span 3;display:flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:50%;
- border:1px solid var(--hb-edge);font:700 16px/1 var(--hb-font);color:var(--hb-ink)}
- .hb-path [data-kind="idea"] .n{border-color:var(--hb-accent);background:var(--hb-accent);color:#0b0b0d}
- .hb-path .k{font:600 13px/1.3 var(--hb-font);color:var(--hb-muted)}
- .hb-path b{font:700 18px/1.25 var(--hb-font);color:var(--hb-ink)}
- .hb-path .line{font:400 15px/1.45 var(--hb-font);color:var(--hb-dim)}
- .hb-path [data-soon] > div{border-style:dashed}
- .hb-path [data-soon] b,.hb-path [data-soon] .line{color:var(--hb-muted)}
- @media(hover:hover){.hb-path a:hover{border-color:color-mix(in srgb,var(--hb-accent) 55%,transparent)}}
- </style>
- <link rel="stylesheet" href="../assets/css/demo-page.css?v=8">
- <script src="../assets/js/demo-page.js?v=8" defer></script>
-</head>
-<body class="hb hb-learn">
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">Learning path</p>
- <h1>Learn web animation</h1>
- <p class="hb-lede">25 short lessons, from easy to advanced. You watch and try; you never write code.</p>
- </header>
-
- <section class="hb-chapter" aria-labelledby="ch-1">
- <h2 id="ch-1"><span>Chapter 1</span>Appear and leave</h2>
- <ol class="hb-path">
- <li data-step="1" data-kind="idea" data-soon><div><span class="n">1</span><span class="k">Idea · Not built yet</span><b>How long it takes</b><span class="line">Fast feels snappy and slow feels calm: pick the time that fits the moment.</span></div></li>
- <li data-step="2" data-kind="animation"><a href="../animations/02-entrance-and-exit/fade-in-out/"><span class="n">2</span><span class="k">Animation</span><b>Fade In / Fade Out</b><span class="line">Fades in to appear and fades out to leave.</span></a></li>
- <li data-step="3" data-kind="idea" data-soon><div><span class="n">3</span><span class="k">Idea · Not built yet</span><b>Slowing down</b><span class="line">Real things speed up and slow down, so smooth animations do too.</span></div></li>
- <li data-step="4" data-kind="animation"><a href="../animations/02-entrance-and-exit/slide-in/"><span class="n">4</span><span class="k">Animation</span><b>Slide In</b><span class="line">Travels into place from one edge.</span></a></li>
- <li data-step="5" data-kind="animation"><a href="../animations/02-entrance-and-exit/scale-in/"><span class="n">5</span><span class="k">Animation</span><b>Scale In / Zoom In</b><span class="line">Grows from smaller to full size.</span></a></li>
- </ol>
- </section>
-
- <section class="hb-chapter" aria-labelledby="ch-2">
- <h2 id="ch-2"><span>Chapter 2</span>Answer the visitor</h2>
- <ol class="hb-path">
- <li data-step="6" data-kind="idea" data-soon><div><span class="n">6</span><span class="k">Idea · Not built yet</span><b>Answer every action</b><span class="line">A press, a tap or a hover gets a quick, small reply, so people know it worked.</span></div></li>
- <li data-step="7" data-kind="animation"><a href="../animations/04-micro-interactions/button-press-scale/"><span class="n">7</span><span class="k">Animation</span><b>Button Press Scale</b><span class="line">Shrinks as you press it and springs back as you let go.</span></a></li>
- <li data-step="8" data-kind="animation"><a href="../animations/04-micro-interactions/hover-state/"><span class="n">8</span><span class="k">Animation</span><b>Hover State Animation</b><span class="line">Six ways a card can react when you point at it.</span></a></li>
- <li data-step="9" data-kind="animation"><a href="../animations/04-micro-interactions/toggle-switch/"><span class="n">9</span><span class="k">Animation</span><b>Toggle / Switch Slide</b><span class="line">The knob slides across as the switch turns on or off.</span></a></li>
- <li data-step="10" data-kind="animation"><a href="../animations/04-micro-interactions/loading-spinner/"><span class="n">10</span><span class="k">Animation</span><b>Loading Spinner</b><span class="line">Six small shapes loop to show that something is loading.</span></a></li>
- </ol>
- </section>
-
- <section class="hb-chapter" aria-labelledby="ch-3">
- <h2 id="ch-3"><span>Chapter 3</span>Move with the scroll</h2>
- <ol class="hb-path">
- <li data-step="11" data-kind="idea" data-soon><div><span class="n">11</span><span class="k">Idea · Not built yet</span><b>Follows the scroll</b><span class="line">Some animations play by themselves; others move only when you scroll.</span></div></li>
- <li data-step="12" data-kind="animation"><a href="../animations/01-scroll-based/reveal-on-scroll/"><span class="n">12</span><span class="k">Animation</span><b>Reveal on Scroll</b><span class="line">Cards appear as they cross a line in the box.</span></a></li>
- <li data-step="13" data-kind="idea" data-soon><div><span class="n">13</span><span class="k">Idea · Not built yet</span><b>One after another</b><span class="line">A short wait between items leads the eye through a group.</span></div></li>
- <li data-step="14" data-kind="animation"><a href="../animations/01-scroll-based/stagger-reveal/"><span class="n">14</span><span class="k">Animation</span><b>Stagger Reveal</b><span class="line">Items in a group appear one after another as it scrolls in.</span></a></li>
- <li data-step="15" data-kind="animation"><a href="../animations/01-scroll-based/progress-bar/"><span class="n">15</span><span class="k">Animation</span><b>Progress Bar</b><span class="line">A bar fills as you read down the page.</span></a></li>
- </ol>
- </section>
-
- <section class="hb-chapter" aria-labelledby="ch-4">
- <h2 id="ch-4"><span>Chapter 4</span>Change pages</h2>
- <ol class="hb-path">
- <li data-step="16" data-kind="idea" data-soon><div><span class="n">16</span><span class="k">Idea · Not built yet</span><b>Keep your place</b><span class="line">When the page changes, motion shows where things went.</span></div></li>
- <li data-step="17" data-kind="animation"><a href="../animations/03-page-transitions/crossfade/"><span class="n">17</span><span class="k">Animation</span><b>Crossfade Transition</b><span class="line">The old page fades out as the new one fades in.</span></a></li>
- <li data-step="18" data-kind="animation"><a href="../animations/03-page-transitions/slide-transition/"><span class="n">18</span><span class="k">Animation</span><b>Slide Transition</b><span class="line">Pages slide across, and going back slides the other way.</span></a></li>
- <li data-step="19" data-kind="animation"><a href="../animations/03-page-transitions/shared-element-transition/"><span class="n">19</span><span class="k">Animation</span><b>Shared Element Transition</b><span class="line">A picture grows from the list into the next page's header.</span></a></li>
- <li data-step="20" data-kind="animation"><a href="../animations/03-page-transitions/flip-technique/"><span class="n">20</span><span class="k">Animation</span><b>FLIP Technique</b><span class="line">Cards glide to their new places when the layout changes.</span></a></li>
- </ol>
- </section>
-
- <section class="hb-chapter" aria-labelledby="ch-5">
- <h2 id="ch-5"><span>Chapter 5</span>Depth and 3D</h2>
- <ol class="hb-path">
- <li data-step="21" data-kind="idea" data-soon><div><span class="n">21</span><span class="k">Idea · Not built yet</span><b>Far things move slower</b><span class="line">Near things pass quickly and far things slowly: that is how depth looks.</span></div></li>
- <li data-step="22" data-kind="animation"><a href="../animations/01-scroll-based/parallax-scrolling/"><span class="n">22</span><span class="k">Animation</span><b>Parallax Scrolling</b><span class="line">Far layers move slower than near ones as you scroll.</span></a></li>
- <li data-step="23" data-kind="animation"><a href="../animations/06-3d-advanced/parallax-3d-tilt/"><span class="n">23</span><span class="k">Animation</span><b>Parallax 3D Tilt</b><span class="line">A card tilts toward your pointer, and a light slides over it.</span></a></li>
- <li data-step="24" data-kind="animation"><a href="../animations/06-3d-advanced/flip-card-3d/"><span class="n">24</span><span class="k">Animation</span><b>3D Flip Card</b><span class="line">A card turns over in 3D to show its back.</span></a></li>
- <li data-step="25" data-kind="idea" data-soon><div><span class="n">25</span><span class="k">Idea · Not built yet</span><b>Less is more</b><span class="line">When not to animate, and how to respect people who ask for less motion.</span></div></li>
- </ol>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-</body>
-</html>
-```
-
-- [ ] **Step 4: Run all tests**
-
-Run: `node --test "tests/*.test.js"`
-Expected: all pass (Parallax's lesson line and nav are not in this worktree yet, and no lesson exists, so those tests are not generated here).
-
-- [ ] **Step 5: Page check.** Serve on port 8763 and run `node tools/check-pages.mjs --base http://127.0.0.1:8763 learn`.
-Expected: six `ok` lines for `learn`. Look at `learn-desktop-full.png` and `learn-phone.png` (Read tool): the five chapters read clearly, idea steps stand out by their filled number, unbuilt steps are dashed and muted but still readable (4.5:1), and no card overflows at 320px.
-
-- [ ] **Step 6: Commit**
-
-```bash
-git add learn/index.html tests/learn.test.js
-git commit -m "feat: a Learn page with a 25-step learning path in five chapters, and tests that keep every page of the path in step with it"
-```
-
----
-
-### Task 6: Lesson 11 · Follows the scroll
-
-**Files:**
-- Create: `learn/follows-the-scroll/index.html`
-
-**Interfaces:**
-- Consumes: Task 1 (boot without a prompt), Task 2 (lesson CSS), the existing scroll-page behavior (`data-hb-scroller`, Play, Back to top).
-- Produces: step 11 of the path (Task 8 links it from the Learn page).
-
-- [ ] **Step 1: Create the page**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Follows the Scroll — Animation Handbook</title>
- <meta name="description" content="Some animations play on their own, like a video. Others follow your scroll: they move when you scroll and stop when you stop.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/learn/follows-the-scroll/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../favicon.svg">
- <link rel="apple-touch-icon" href="../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Follows the Scroll — Animation Handbook">
- <meta property="og:description" content="Some animations play on their own, like a video. Others follow your scroll: they move when you scroll and stop when you stop.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/learn/follows-the-scroll/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Follows the Scroll — Animation Handbook">
- <meta name="twitter:description" content="Some animations play on their own, like a video. Others follow your scroll: they move when you scroll and stop when you stop.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <style>
- :root{--ui-accent:#c8f169}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px;background:#0b0b0d;overflow:hidden}
- .panel{position:relative;min-width:0;background:#14151b}
- .view{display:flex;flex-direction:column;justify-content:center;gap:14px;height:100%;padding:clamp(14px,3vw,28px)}
- .name{font:700 clamp(15px,2vw,19px)/1.2 var(--hb-font);color:#f4f4f2}
- .says{font:400 clamp(13px,1.6vw,15px)/1.45 var(--hb-font);color:#c4c4cb}
- .track{position:relative;height:28px;border-bottom:2px dashed rgba(255,255,255,.24)}
- .runner{position:absolute;inset:0;will-change:transform}
- .ball{width:28px;height:28px;border-radius:50%;background:var(--ui-accent)}
- /* Plays by itself: the ball crosses its track on a timer, whatever the visitor does */
- .clock .runner{animation:cross 2.4s ease-in-out infinite alternate}
- @keyframes cross{to{transform:translateX(calc(100% - 28px))}}
- /* Follows the scroll: this panel is the box that scrolls. Its view stays put while the ball sits wherever the scroll says. */
- .scroll{overflow-y:auto;scrollbar-width:none}
- .scroll::-webkit-scrollbar{display:none}
- .scroll .tall{height:300%}
- .scroll .view{position:sticky;top:0;height:calc(100% / 3)}
- .where{font:600 14px/1.3 var(--hb-font);color:var(--ui-accent)}
- @media(prefers-reduced-motion:reduce){.clock .runner{animation:none}}
- </style>
- <link rel="stylesheet" href="../../assets/css/demo-page.css?v=8">
- <script src="../../assets/js/demo-page.js?v=8" defer></script>
-</head>
-<body class="hb hb-learn" data-hb-kind="scroll" data-hb-autoplay data-hb-motion-note="The ball that plays by itself stays still">
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../../animations/04-micro-interactions/loading-spinner/" rel="prev" aria-label="Previous lesson: Loading Spinner"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Loading Spinner</span></a><a href="../../animations/01-scroll-based/reveal-on-scroll/" rel="next" aria-label="Next lesson: Reveal on Scroll"><span><span class="hb-dir">Next: </span>Reveal on Scroll</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">Lesson 11 of 25 · Idea</p>
- <h1>Follows the scroll</h1>
- <p class="hb-lede">Some animations play on their own, like a video. Others follow your scroll: they move when you scroll and stop when you stop.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Scroll it</h2><p>Scroll the right box, or press Play and it scrolls for you. The left ball keeps its own time.</p></div>
- </div>
- <div class="stage" id="stage" role="region" aria-label="Two boxes side by side: a ball that plays by itself, and a ball that follows the scroll of its box">
- <div class="panel clock">
- <div class="view">
- <p class="name">Plays by itself</p>
- <div class="track"><div class="runner"><div class="ball"></div></div></div>
- <p class="says">Moves on a timer, whatever you do.</p>
- </div>
- </div>
- <div class="panel scroll" id="scroll-box" data-hb-scroller tabindex="0" aria-label="A box to scroll: its ball follows the scroll">
- <div class="tall">
- <div class="view">
- <p class="name">Follows the scroll</p>
- <div class="track"><div class="runner" id="scroll-runner"><div class="ball"></div></div></div>
- <p class="says">Goes where the scroll goes. <span class="where" id="where">0% scrolled</span></p>
- </div>
- </div>
- </div>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-scroll" data-hb-autoscroll><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M19 12l-7 7-7-7"/></svg>Play</button>
- <button class="hb-play" type="button" id="btn-top" data-hb-top><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 19V5M5 12l7-7 7 7"/></svg>Back to top</button>
- </div>
- </section>
-
- <section class="hb-why" aria-labelledby="hb-why-title">
- <h2 id="hb-why-title">Why it works</h2>
- <p>When an animation follows the scroll, the visitor controls it: scroll slowly and it moves slowly, scroll back and it plays backward, stop and it stops. That ties the movement to reading the page, so it feels like part of it. An animation that plays by itself runs on a clock instead, whatever the visitor does.</p>
- </section>
-
- <section class="hb-seen" aria-labelledby="hb-seen-title">
- <h2 id="hb-seen-title">Where you'll see it</h2>
- <div class="hb-rel-list">
- <a class="hb-rel" href="../../animations/01-scroll-based/parallax-scrolling/"><b>Parallax Scrolling</b><span>Far layers move slower than near ones as you scroll.</span></a>
- <a class="hb-rel" href="../../animations/01-scroll-based/scrub-animation/"><b>Scrub Animation</b><span>Scroll plays it forward and back, like dragging a video.</span></a>
- <a class="hb-rel" href="../../animations/01-scroll-based/progress-bar/"><b>Progress Bar</b><span>A bar fills as you read down the page.</span></a>
- <a class="hb-rel" href="../../animations/01-scroll-based/text-fill-on-scroll/"><b>Text Fill on Scroll</b><span>Words light up one by one as you scroll.</span></a>
- <a class="hb-rel" href="../../animations/06-3d-advanced/scroll-driven-3d-rotation/"><b>Scroll-Driven 3D Rotation</b><span>Scrolling turns a 3D cube from pose to pose.</span></a>
- </div>
- </section>
-
- <nav class="hb-lesson-nav" aria-label="Learning path">
- <p class="hb-lesson-title">Learning path</p>
- <a class="hb-lesson-prev" href="../../animations/04-micro-interactions/loading-spinner/"><span>← Lesson 10</span><b>Loading Spinner</b></a>
- <a class="hb-lesson-next" href="../../animations/01-scroll-based/reveal-on-scroll/"><span>Lesson 12 →</span><b>Reveal on Scroll</b></a>
- <a class="hb-lesson-all" href="../">All 25 lessons</a>
- </nav>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- // The right ball sits as far along its track as the box is scrolled, read once per frame while the box scrolls.
- const box = document.getElementById('scroll-box');
- const runner = document.getElementById('scroll-runner');
- const where = document.getElementById('where');
- let ticking = false;
- function follow() {
- const max = box.scrollHeight - box.clientHeight;
- const p = max > 0 ? box.scrollTop / max : 0;
- runner.style.transform = `translateX(calc(${p.toFixed(4)} * (100% - 28px)))`;
- where.textContent = `${Math.round(p * 100)}% scrolled`;
- ticking = false;
- }
- box.addEventListener('scroll', () => {
- if (!ticking) { requestAnimationFrame(follow); ticking = true; }
- }, { passive: true });
- follow();
-</script>
-</body>
-</html>
-```
-
-- [ ] **Step 2: Run all tests** — `node --test "tests/*.test.js"`. Expected: all pass (in this worktree the Learn page does not exist, so `tests/learn.test.js` is not present; Task 8 runs everything together).
-
-- [ ] **Step 3: Page check.** Serve on port 8764 and run `node tools/check-pages.mjs --base http://127.0.0.1:8764 learn/follows-the-scroll`.
-Expected: six `ok` lines (the scroll checks run on the right box: it scrolls on arrival, Play, Back to top, a wheel turn stops Play; reduced motion shows the page's own note). Look at the desktop, phone and phone-reduced screenshots: both panels readable at 375px, the right ball part-way along after the arrival run, the left ball at rest under reduced motion.
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add learn/follows-the-scroll/index.html
-git commit -m "feat: idea lesson 11, Follows the scroll: a ball that plays by itself beside one that follows its box's scroll"
-```
-
----
-
-### Task 7: Lesson 21 · Far things move slower
-
-**Files:**
-- Create: `learn/far-things-move-slower/index.html`
-
-**Interfaces:**
-- Consumes: Task 1 (boot without a prompt; Pause sends `hb:pause`), Task 2 (lesson CSS).
-- Produces: step 21 of the path, linked from Parallax Scrolling's See inside note and lesson nav.
-
-- [ ] **Step 1: Create the page**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Far Things Move Slower — Animation Handbook</title>
- <meta name="description" content="Look out of a moving train: the fence rushes by, the hills crawl and the moon seems to stay put. A short visual lesson on the idea behind parallax.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/learn/far-things-move-slower/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../favicon.svg">
- <link rel="apple-touch-icon" href="../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Far Things Move Slower — Animation Handbook">
- <meta property="og:description" content="Look out of a moving train: the fence rushes by, the hills crawl and the moon seems to stay put. A short visual lesson on the idea behind parallax.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/learn/far-things-move-slower/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Far Things Move Slower — Animation Handbook">
- <meta name="twitter:description" content="Look out of a moving train: the fence rushes by, the hills crawl and the moon seems to stay put. A short visual lesson on the idea behind parallax.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <style>
- :root{--ui-accent:#c8f169}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{position:relative;overflow:hidden;background:#141b33}
- /* Each layer is twice the window's width and repeats halfway, so it can slide forever without a seam */
- .strip{position:absolute;top:0;left:0;width:200%;height:100%;will-change:transform}
- .strip svg{position:absolute;inset:0;width:100%;height:100%}
- .sky{background:linear-gradient(#141b33,#2e2a4a 70%,#3d3456)}
- .moon{position:absolute;top:12%;height:18%;aspect-ratio:1;border-radius:50%;background:#f3e7c4}
- .moon.a{left:14%} .moon.b{left:64%}
- .speeds{position:absolute;inset:0;list-style:none;pointer-events:none}
- .speed{position:absolute;left:clamp(10px,3vw,24px);display:flex;align-items:center;gap:8px;padding:5px 10px;border-radius:999px;
- background:rgba(11,11,13,.8);color:#f4f4f2;font:600 13px/1.2 var(--hb-font)}
- .speed span{font-weight:400;color:#d6d6da}
- .speed i{display:block;height:6px;width:calc(var(--bar,0) * 72px);border-radius:3px;background:var(--ui-accent)}
- .speed:nth-child(1){top:5%} .speed:nth-child(2){top:38%} .speed:nth-child(3){top:60%} .speed:nth-child(4){top:82%}
- @media(prefers-reduced-motion:reduce){.strip{will-change:auto}}
- </style>
- <link rel="stylesheet" href="../../assets/css/demo-page.css?v=8">
- <script src="../../assets/js/demo-page.js?v=8" defer></script>
-</head>
-<body class="hb hb-learn" data-hb-kind="loop">
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../../animations/03-page-transitions/flip-technique/" rel="prev" aria-label="Previous lesson: FLIP Technique"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>FLIP Technique</span></a><a href="../../animations/01-scroll-based/parallax-scrolling/" rel="next" aria-label="Next lesson: Parallax Scrolling"><span><span class="hb-dir">Next: </span>Parallax Scrolling</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">Lesson 21 of 25 · Idea</p>
- <h1>Far things move slower</h1>
- <p class="hb-lede">Look out of a moving train: the fence rushes by, the hills crawl and the moon seems to stay put. Your eyes use that difference to judge distance.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Watch it</h2><p>A view from a train window. Each layer slides past at its own speed.</p></div>
- </div>
- <div class="stage" id="stage" role="img" aria-label="A view from a train window: a moon that stays put, mountains that crawl, hills that go faster and a fence that rushes by">
- <div class="strip sky">
- <svg viewBox="0 0 1600 400" preserveAspectRatio="none" aria-hidden="true">
- <defs><pattern id="stars" width="800" height="400" patternUnits="userSpaceOnUse">
- <circle cx="60" cy="40" r="1.5" fill="#fff" opacity=".6"/><circle cx="240" cy="90" r="1.2" fill="#fff" opacity=".5"/>
- <circle cx="390" cy="30" r="1.4" fill="#fff" opacity=".7"/><circle cx="520" cy="110" r="1.1" fill="#fff" opacity=".4"/>
- <circle cx="660" cy="55" r="1.5" fill="#fff" opacity=".6"/><circle cx="760" cy="130" r="1.2" fill="#fff" opacity=".5"/>
- </pattern></defs>
- <rect width="1600" height="400" fill="url(#stars)"/>
- </svg>
- <div class="moon a"></div><div class="moon b"></div>
- </div>
- <div class="strip far">
- <svg viewBox="0 0 1600 400" preserveAspectRatio="none" aria-hidden="true">
- <g id="mtn"><polygon fill="#3b4270" points="0,250 70,190 140,230 230,150 320,215 400,175 480,225 560,160 650,220 730,185 800,250 800,400 0,400"/></g>
- <use href="#mtn" x="800"/>
- </svg>
- </div>
- <div class="strip mid">
- <svg viewBox="0 0 1600 400" preserveAspectRatio="none" aria-hidden="true">
- <g id="hill"><path fill="#2a5a52" d="M0 300 C 100 250, 200 250, 300 290 S 500 330, 600 280 S 750 270, 800 300 L 800 400 L 0 400 Z"/></g>
- <use href="#hill" x="800"/>
- </svg>
- </div>
- <div class="strip near">
- <svg viewBox="0 0 1600 400" preserveAspectRatio="none" aria-hidden="true">
- <defs><pattern id="posts" width="50" height="400" patternUnits="userSpaceOnUse"><rect x="10" y="300" width="8" height="62" fill="#e6d5ad"/></pattern></defs>
- <rect y="355" width="1600" height="45" fill="#1b2a26"/>
- <rect y="316" width="1600" height="5" fill="#d9c7a0"/>
- <rect y="336" width="1600" height="5" fill="#d9c7a0"/>
- <rect width="1600" height="400" fill="url(#posts)"/>
- </svg>
- </div>
- <ul class="speeds" aria-hidden="true">
- <li class="speed"><b>Moon</b><span></span><i></i></li>
- <li class="speed"><b>Mountains</b><span></span><i></i></li>
- <li class="speed"><b>Hills</b><span></span><i></i></li>
- <li class="speed"><b>Fence</b><span></span><i></i></li>
- </ul>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-pause" data-hb-pause data-state="playing"><svg class="hb-ic hb-i-pause" viewBox="0 0 24 24" aria-hidden="true"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg><svg class="hb-ic hb-i-play" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3l14 9-14 9z"/></svg><span class="hb-pause-label">Pause</span></button>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Give every layer the same speed and watch the depth disappear.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Same speed for everything</span><input class="hb-switch" type="checkbox" role="switch" id="same" autocomplete="off"></label>
- <p class="hb-hint">On, the scene slides like one flat picture. Off, near things pass faster and it looks deep.</p>
- </div>
- </div>
- </section>
-
- <section class="hb-why" aria-labelledby="hb-why-title">
- <h2 id="hb-why-title">Why it works</h2>
- <p>Near things cross your view quickly and far things slowly, so your eyes read the difference as distance. Give a picture's far layers small moves and its near layers big moves, and a flat picture looks deep. That is the whole idea behind parallax, and it works best with a few layers and gentle speeds.</p>
- </section>
-
- <section class="hb-seen" aria-labelledby="hb-seen-title">
- <h2 id="hb-seen-title">Where you'll see it</h2>
- <div class="hb-rel-list">
- <a class="hb-rel" href="../../animations/01-scroll-based/parallax-scrolling/"><b>Parallax Scrolling</b><span>Far layers move slower than near ones as you scroll.</span></a>
- <a class="hb-rel" href="../../animations/01-scroll-based/parallax-depth-of-field/"><b>Parallax Depth-of-Field</b><span>Layers move at their own speed as the focus shifts.</span></a>
- <a class="hb-rel" href="../../animations/06-3d-advanced/2-5d-pseudo-3d/"><b>2.5D / Pseudo-3D</b><span>Flat layers slide by different amounts, faking depth.</span></a>
- <a class="hb-rel" href="../../animations/06-3d-advanced/depth-map-photo/"><b>Depth-Map Photo</b><span>A flat photo turns 3D as you point: near parts shift more.</span></a>
- <a class="hb-rel" href="../../animations/07-ambient-background/wave-layers/"><b>Wave Layers</b><span>Layers of waves drift sideways, each at its own speed.</span></a>
- <a class="hb-rel" href="../../animations/07-ambient-background/grid-dot-pattern-parallax/"><b>Grid / Dot Pattern Parallax</b><span>A dot grid shifts gently against your pointer for depth.</span></a>
- </div>
- </section>
-
- <nav class="hb-lesson-nav" aria-label="Learning path">
- <p class="hb-lesson-title">Learning path</p>
- <a class="hb-lesson-prev" href="../../animations/03-page-transitions/flip-technique/"><span>← Lesson 20</span><b>FLIP Technique</b></a>
- <a class="hb-lesson-next" href="../../animations/01-scroll-based/parallax-scrolling/"><span>Lesson 22 →</span><b>Parallax Scrolling</b></a>
- <a class="hb-lesson-all" href="../">All 25 lessons</a>
- </nav>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const FRAME = 1000 / 60;
- // Window widths per second: the moon stays put, the mountains crawl, the hills go faster, the fence rushes by
- const SPEEDS = [0, 0.02, 0.07, 0.4];
- const SAME = 0.1;
- const WORDS = ['stays put', 'slow', 'faster', 'fastest'];
- const stage = document.getElementById('stage');
- const strips = [...stage.querySelectorAll('.strip')];
- const tags = [...stage.querySelectorAll('.speed')];
- const same = document.getElementById('same');
- const pos = strips.map(() => 0);
- let lastT = null, raf = 0, paused = false;
-
- function speedOf(i) { return same.checked ? SAME : SPEEDS[i]; }
- function frame(ts) {
- const dt = lastT === null ? 0 : Math.min(ts - lastT, 50);
- lastT = ts;
- const w = stage.clientWidth;
- strips.forEach((s, i) => {
- pos[i] = (pos[i] + speedOf(i) * w / 60 * (dt / FRAME)) % w;
- s.style.transform = `translate3d(${-pos[i].toFixed(2)}px,0,0)`;
- });
- raf = requestAnimationFrame(frame);
- }
- function start() { if (!raf && !paused && !document.hidden) { lastT = null; raf = requestAnimationFrame(frame); } }
- function stop() { cancelAnimationFrame(raf); raf = 0; }
- // Pause and Play (and reduced motion, which starts the page paused) come from the shared script
- document.addEventListener('hb:pause', e => { paused = e.detail.paused; if (paused) stop(); else start(); });
- document.addEventListener('visibilitychange', () => { if (document.hidden) stop(); else start(); });
-
- // Each label says how fast its layer goes, in words and as a bar a share of the fence's speed
- function describe() {
- tags.forEach((t, i) => {
- t.querySelector('span').textContent = same.checked ? 'same speed' : WORDS[i];
- t.style.setProperty('--bar', speedOf(i) / SPEEDS[3]);
- });
- stage.setAttribute('aria-label', same.checked
- ? 'A view from a train window where every layer slides at the same speed, like one flat picture'
- : 'A view from a train window: a moon that stays put, mountains that crawl, hills that go faster and a fence that rushes by');
- }
- same.addEventListener('change', describe);
- describe();
- start();
-</script>
-</body>
-</html>
-```
-
-- [ ] **Step 2: Run all tests** — `node --test "tests/*.test.js"`. Expected: all pass.
-
-- [ ] **Step 3: Page check.** Serve on port 8765 and run `node tools/check-pages.mjs --base http://127.0.0.1:8765 learn/far-things-move-slower`.
-Expected: six `ok` lines (the loop checks: it moves, Pause stops it at once and Play starts it again; under reduced motion it starts paused). Look at the desktop, phone and phone-reduced screenshots: the four labels readable and not covering each other at 375px, the bars clearly different (the fence's longest, the moon's none), the scene seamless (no gap at the strip edge after it has moved).
-
-- [ ] **Step 4: Commit**
-
-```bash
-git add learn/far-things-move-slower/index.html
-git commit -m "feat: idea lesson 21, Far things move slower: a train-window scene whose layers slide at their own speeds, and a switch that makes them move as one"
-```
-
----
-
-### Task 8: Integration, version bump, whole-site check and final review
-
-**Files:**
-- Modify: `learn/index.html` (steps 11 and 21 become links)
-- Modify: every page that links the shared files (`animations/*/*/index.html`, `index.html`, `learn/**/index.html`): `?v=8` → `?v=9`
-
-- [ ] **Step 1: Merge.** In the main checkout on `feat/learn-pilot`, merge the Phase B lane branches one at a time (`git merge --no-ff <lane branch>`), resolving conflicts if any (none are expected: the lanes touch different files, except that Task 4 may have fixed `modeProblems` in `tools/check-pages.mjs`).
-
-- [ ] **Step 2: Link the built lessons.** In `learn/index.html` replace
-
-```html
- <li data-step="11" data-kind="idea" data-soon><div><span class="n">11</span><span class="k">Idea · Not built yet</span><b>Follows the scroll</b><span class="line">Some animations play by themselves; others move only when you scroll.</span></div></li>
-```
-
-with
-
-```html
- <li data-step="11" data-kind="idea"><a href="follows-the-scroll/"><span class="n">11</span><span class="k">Idea</span><b>Follows the scroll</b><span class="line">Some animations play by themselves; others move only when you scroll.</span></a></li>
-```
-
-and
-
-```html
- <li data-step="21" data-kind="idea" data-soon><div><span class="n">21</span><span class="k">Idea · Not built yet</span><b>Far things move slower</b><span class="line">Near things pass quickly and far things slowly: that is how depth looks.</span></div></li>
-```
-
-with
-
-```html
- <li data-step="21" data-kind="idea"><a href="far-things-move-slower/"><span class="n">21</span><span class="k">Idea</span><b>Far things move slower</b><span class="line">Near things pass quickly and far things slowly: that is how depth looks.</span></a></li>
-```
-
-In `tests/pages.test.js` remove the temporary `|| href.includes('/learn/')` from the mode-switch test's note-link check (the lesson now exists).
-
-- [ ] **Step 3: Bump the shared files' version**
-
-```bash
-grep -rl --include=index.html "demo-page\.\(css\|js\)?v=8" . | grep -v node_modules | xargs sed -i 's/demo-page\.css?v=8/demo-page.css?v=9/; s/demo-page\.js?v=8/demo-page.js?v=9/'
-grep -rl --include=index.html "demo-page\.\(css\|js\)?v=8" . | wc -l
-```
-
-Expected: the second command prints `0`. (`sed -i` keeps each file's line endings; check `git diff --stat` shows one changed line per page.)
-
-- [ ] **Step 4: Tests and generated files**
-
-Run: `node --test "tests/*.test.js"` — expected: all pass, now including the lesson-line and lesson-nav tests for steps 11, 21 and 22 and the two idea-lesson tests.
-Run: `node tools/make-skill.mjs` then `git status --short` — expected: no change to `skills/` or `llms.txt`.
-
-- [ ] **Step 5: Page checks.** Serve the main checkout on port 8770 (background) and run
-`node tools/check-pages.mjs --base http://127.0.0.1:8770 animations/01-scroll-based/parallax-scrolling learn home`
-Expected: six `ok` lines for each of: Parallax Scrolling, `learn`, `learn/far-things-move-slower`, `learn/follows-the-scroll`, `home`.
-Then the whole site, in seven background runs (one per category folder, each under 30 minutes):
-`node tools/check-pages.mjs --base http://127.0.0.1:8770 animations/01-scroll-based` … `animations/07-ambient-background`. Expected: no `FAIL` line anywhere.
-
-- [ ] **Step 6: Final review (two reviewers in parallel).**
- - Reviewer A (visual and plain words): opens the mode screenshots of Parallax Scrolling (desktop, laptop, tablet, phone, phone-reduced, phone-small) and the Learn pages' screenshots; checks See inside and Compare are understandable from the picture alone, labels readable, notes plain, nothing cut off, and that every text follows the Global Constraints.
- - Reviewer B (code and tests): reads the diff `git diff main...feat/learn-pilot`; checks the spec is met, the shared script still behaves exactly as before on every other page, no `hb-view`, frame loops by elapsed time, listeners at the top level, tests meaningful.
- Fix what they find, re-run Steps 4-5 for what changed.
-
-- [ ] **Step 7: Commit, clean up**
-
-```bash
-git add -A learn tests animations index.html tools assets
-git commit -m "chore: the shared files at v=9 on every page, and the Learn page links the two idea lessons"
-```
-
-Stop every server started for the lanes; remove the lane worktrees and branches once merged; delete any `hb-chrome-*` folders left in the temp folder.
-
----
-
-### Task 9: Owner review
-
-- [ ] **Step 1:** Start the preview (`.claude/launch.json` → `static-site`, port 8731) in the browser pane at `/animations/01-scroll-based/parallax-scrolling/`.
-- [ ] **Step 2:** Send the owner the screenshots: Parallax Scrolling in Normal, See inside and Compare at desktop and phone size; the Learn page; the two idea lessons.
-- [ ] **Step 3:** Ask, in very short and simple words, whether to roll it out to all 166 animations, and what to change. Nothing is pushed or published without the owner's go-ahead.
diff --git a/docs/superpowers/plans/2026-10-13-see-inside-compare-phase0-first-batch.md b/docs/superpowers/plans/2026-10-13-see-inside-compare-phase0-first-batch.md
deleted file mode 100644
index 089cd141..00000000
--- a/docs/superpowers/plans/2026-10-13-see-inside-compare-phase0-first-batch.md
+++ /dev/null
@@ -1,4486 +0,0 @@
-# See Inside and Compare: Phase 0 and the First Batch Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Make the shared files, the page check and the review kit ready for See inside and Compare on every page, take the paused learning path off the branch, freeze the shared files at `?v=10`, then build both views on the first seven pages (one per category, Parallax Scrolling included) and put them in front of the owner.
-
-**Architecture:** Phase 0 changes only shared pieces, one agent per shared file: the clean-up of the learning path (one revertable commit), the shared script's "play once after a mode press" (ruling 1), the page check's do-it path, run waits and caption, id and name checks (with a fixture site that proves each rule), the switch tests and the final gate, the review kit for any list of pages, and one version bump. The first batch then builds each page's two views in that page's own code, in its own slot (worktree, branch, port), checked by the page check and reviewed by a fresh agent; the batch is merged through category branches and shown to the owner with the review kit's stills, clips and Normal before-and-after counts.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (no build, no packages); Node 22+ (`node --test`, built-in `WebSocket`); headless Chrome driven over the DevTools protocol (`tools/check-pages.mjs`, the review kit); WebGL 1 and canvas 2D on two pages; Python's `http.server` for local serving; ffmpeg (through Python's `imageio_ffmpeg`) for the kit's clips.
-
-**Spec:** `docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md` (sections 1 to 5 and 7; section 6's docs are written at integration, in the next plan) and `docs/superpowers/specs/2026-10-13-next-projects-coordination.md` (where the two differ, the coordination file wins). Read both, and CLAUDE.md, before any task. The reference build is Parallax Scrolling as it stands on `feat/see-inside-compare` (`animations/01-scroll-based/parallax-scrolling/index.html`); the page surveys are `.superpowers/sdd/2026-10-13-learn-pilot/rollout-survey-01-03.md`, `-04.md` and `-05-07.md`.
-
-## Global Constraints
-
-- **Checkout and branch:** the main checkout `C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook` stays on `feat/see-inside-compare` for the whole run; it is never switched. Nothing is pushed, nothing is merged into `main`, nothing is published.
-- **Merges:** `git merge --no-ff` only; never rebase, never squash. The coordinator (the main session) merges Phase 0 lanes and categories into `feat/see-inside-compare`; a lane lead merges an approved slot into `sic/cat-NN`, and, for a fix round after the batch is on the branch (Task 14, Step 6), `feat/see-inside-compare` into the slot branch first.
-- **Phase 0 lanes:** worktree `.claude/worktrees/sic-00<x>` on branch `sic/00<x>` (x = a to e), each made from the head of `feat/see-inside-compare` when its task starts, removed once merged.
-- **Page slots (first batch):** worktree `.claude/worktrees/sic-<NN>a` on branch `sic/<NN>a`, made from `feat/see-inside-compare` after Task 6; category branches `sic/cat-NN`, made from `feat/see-inside-compare` after Task 6.
-- **Ports:** 8800 = the before-pictures server (detached checkout of `main` in `.claude/worktrees/sic-before`); the 20 slots 01a 8801, 01b 8802, 01c 8803, 02a 8804, 02b 8805, 03a 8806, 03b 8807, 04a 8808, 04b 8809, 04c 8810, 04d 8811, 05a 8812, 05b 8813, 06a 8814, 06b 8815, 06c 8816, 06d 8817, 07a 8818, 07b 8819, 07c 8820; Phase 0 borrows 8801 to 8806 and 8809 before any slot exists; 8731 = the owner's preview of the main checkout (`.claude/launch.json`, `static-site`). Never 8901 to 8909 (finder), 8931 to 8939 (Famous effects) or 8990 (releases).
-- **Run folder:** `.superpowers/sdd/2026-10-13-see-inside-compare/` (git-ignored, in the main checkout): `ledger.md`, `lanes/`, `briefs/`, `checks/`, `kit/`, `scratch/<lane>/`, the slot pool `slots/`, `slot.mjs`, `first-batch-rulings.json`. If Phase 0 starts on another day, the folder is named by that day and the name below changes everywhere at once.
-- **Shell variables:** every Bash call that uses them starts with `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; FX=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/fixtures` (each Bash call starts in a fresh shell).
-- **Machine:** at most eight Chrome runs at once on the machine, for every project: every page check and every kit run goes through `node $RUN/slot.mjs run <who> -- <command>`. The other projects take slots in the same pool with a plain `mkdir slot-N` / `rmdir slot-N` (`list` shows them with `?`); a `?` slot older than two hours (the folder's time: `ls -ld $RUN/slots/slot-N`) is reported to its project's coordinator, never removed by a rollout agent. Headless Chrome only; never the browser pane (it is the owner's; only Task 14 opens pages there, for the owner). One server and one scratch folder (`$RUN/scratch/<lane>/`) per lane.
-- **Servers:** `python -m http.server <port> --bind 127.0.0.1`, started from the worktree root as a background command, stopped when the task ends.
-- **No `git stash`** (every worktree shares it). To compare versions: `git show <rev>:<path> > <scratch file>`.
-- **Version:** the shared files stay at `?v=9` until Task 6 bumps every animation page and the home page to `?v=10` in one commit, on tracked files only (`git ls-files`), line endings kept (`i/lf w/crlf`; `sed -b`). After Task 6, `assets/css/demo-page.css`, `assets/js/demo-page.js` and `tests/demo-page.test.js` are frozen (and, during the first batch, `tools/check-pages.mjs` and `tests/pages.test.js` too: a lane that needs a change writes it in its ledger and tells the coordinator); a shared change the owner asks for at Task 14 takes `?v=11` before the other 159 pages start.
-- **Pages:** a first-batch task changes only its page's `index.html` (fix rounds add commits to the same file). No README, home page, `CATS`, prompt, setting, chip or tag changes. `node tools/make-skill.mjs` must write identical files.
-- **Names:** never `hb-view` anywhere in a page. The switch and notes markup are exactly as on Parallax Scrolling. Every page CSS selector part that contains `data-hb-mode` starts its stage part with `.stage[data-hb-mode="inside"]` or `.stage[data-hb-mode="compare"]` (attribute straight after `.stage`); no rule on `[data-hb-mode="normal"]`. No element's class is exactly `lbl` (the tests' old-markup guard): a label class always has a second name.
-- **The page's `hb:mode` listener (spec section 1):** `document.addEventListener('hb:mode', …)` at the top level of the page's inline script; hears every press, never one at boot; draws the current state at once; safe to run twice; never scrolls, moves focus, presses a control, stops Play or changes Pause. The shared script, not the page, plays the demo once after See inside or Compare (ruling 1).
-- **Copies:** made once (at load or on first entry); ids removed or renamed (gradients, masks, filters, `for`); `inert`; `aria-hidden="true"`; not rendered outside Compare.
-- **Captions:** every label and half name carries `data-hb-caption`; at least 12px as drawn; 4.5:1 against its own backing; inside the stage; covering neither the part it names nor another caption; at most six (four on phones); amounts as a beginner says them, never ms, px, deg or CSS names.
-- **Notes:** exactly two, `p[data-hb-for="inside"]` then `p[data-hb-for="compare"]`, direct children of `div.hb-mode-notes`; one or two plain sentences, about 35 words at most, on what the visitor sees; the Compare note names the halves by their labels; a note says left and right only on a page whose halves never stack, otherwise it names the halves by their labels only; when the stage looks like Normal until the visitor acts, the note ends with what to do; a note the script rewrites (a setting, reduced motion) uses the markup's own words for the default state.
-- **Motion:** only transform and opacity animate; a frame loop moves by elapsed time (`FRAME = 1000 / 60`, `dt = lastT === null ? 0 : Math.min(ts - lastT, 50)`, each step × `dt / FRAME`, × 1/3 in Slow motion); on phones each Compare half gets half the budget (particles, dots, tiles); a blur is never doubled; one WebGL context.
-- **Reduced motion:** every mode is a still picture that still teaches; no mode adds movement; the shared script presses nothing.
-- **Phones:** the box keeps its size in every mode, Compare included (ruling 4); halves side by side while each keeps about 160px of scene, else stacked; anything a mode adds that can be pressed is at least 44×44px (checked by hand: the page check skips the stage); hover and drag keep their touch equivalents.
-- **Words and size:** no code on the page; American spelling; no hype; about 300 lines for the demo plus about 150 for its two views.
-- **Checks:** tests are `node --test "tests/*.test.js"` from the worktree root: all pass. The page check is `node tools/check-pages.mjs --base http://127.0.0.1:<port> --out <folder> <page or category folder, or home>`: six `ok` lines per page.
-- **Acceptance for each page (spec section 1), confirmed line by line by a reviewer who is never the builder:** (1) clear from the picture alone in the mode screenshots at 1280 and 375, start outlines where a movement is shrunk; (2) every mode still under reduced motion and still teaching; (3) Normal at rest pixel-identical to before (a few antialiased corner pixels aside; random pages by eye), Try it, chips and prompt unchanged; (4) a mode change never scrolls the page or the box, moves focus, stops Play or changes Pause, shows the current state at once, then plays once on plays-once and do-it pages (not under reduced motion); (5) notes as above; (6) captions as above; (7) every setting visibly changes See inside and Compare; (8) phones as above; (9) keyboard works in every mode as in Normal, copies inert and hidden from screen readers, a named picture names each mode, a control's name contains its visible words; (10) light enough, as above; (11) tests pass and six `ok` lines; (12) words and size as above.
-- **People:** builders and reviewers run on the strongest model. One builder per page, then one fresh reviewer (never the builder); at most three fix rounds by the same builder, then the lead escalates (a design question goes to the owner). Every Phase 0 task is reviewed by a fresh agent before it is merged.
-- **Commits:** messages in the repository's plain-words style: `feat: …`, `fix: …`, `test: …`, `chore: …`, `docs: …`; merge commits say what they bring.
-
-## Phases
-
-| Step | Tasks | Where | Runs |
-|---|---|---|---|
-| 0-A | Task 0 (run folder, slot pool, before-pictures server) | the main checkout, the run folder, `sic-before` (8800) | first and alone; the finder and Famous effects already take slots in the same pool with a plain `mkdir slot-N` / `rmdir slot-N`, which works beside `slot.mjs` |
-| 0-B | Task 1 (the clean-up) | `sic-00a` / `sic/00a`, port 8801 | alone; reviewed, then merged |
-| 0-C | Task 2 (shared script), Task 3 (page check and fixtures), Task 4 (switch tests and Parallax's notes), Task 5 (review kit) | `sic-00b` (8802), `sic-00c` (8803; fixture site 8809), `sic-00d` (8804), outside the repository (main checkout served on 8805) | in parallel, each from the merged Task 1; no two touch the same file; merged in the order 2, 4, 3 (Task 5 is not in the repository; its real run, Step 7, waits for the merge of Task 3 and ends before Task 6 is merged). The seven lane leads write the first-batch briefs (Step 1 of Tasks 7 to 13) at the same time |
-| 0-D | Task 6 (`?v=10`, whole-site check) | `sic-00e`, port 8806 | alone; merged; the shared files are frozen; Phase 0 worktrees removed |
-| 1 | Tasks 7 to 13 (one page each) | `sic-01a` 8801, `sic-02a` 8804, `sic-03a` 8806, `sic-04a` 8808, `sic-05a` 8812, `sic-06a` 8814, `sic-07a` 8818 | in parallel; each builder then a fresh reviewer; the lane lead merges the approved slot into `sic/cat-NN` |
-| 2 | Task 14 (merge the batch, the kit run, the owner's review) | the main checkout, the owner's preview (8731) | after the seven categories are approved |
-
-### Who touches which file
-
-| File | Task |
-|---|---|
-| `learn/` (removed), `tests/learn.test.js` (removed), `docs/superpowers/specs/2026-10-13-learn-pilot-design.md` (status line) | 1 |
-| `assets/css/demo-page.css` | 1 |
-| `assets/js/demo-page.js`, `tests/demo-page.test.js` | 1 (one comment, one test name), then 2 |
-| `tools/check-pages.mjs` | 1 (the `learn` target out), then 3 |
-| `tests/pages.test.js` | 1 (lesson selectors out, guard test in), then 4 |
-| `animations/01-scroll-based/parallax-scrolling/index.html` | 1 (lesson line, nav and link out), 4 (notes in two sentences), 6 (version), 7 (the batch's changes) |
-| every `animations/*/*/index.html` and `index.html`: the version line only | 6 |
-| each first-batch page | its own task (8 to 13) and Task 6's version line |
-| outside the repository: `$RUN/*`, `$FX/sic-gen.mjs`, `$FX/README.md`, `$KIT/*` | 0, 3, 5 |
-
----
-### Task 0: Run folder, slot pool and the before-pictures server (coordinator)
-
-**Files:**
-- Create (outside the repository): `$RUN/slot.mjs`, `$RUN/slot.test.mjs`, `$RUN/ledger.md`, `$RUN/first-batch-rulings.json`, folders `$RUN/slots`, `$RUN/lanes`, `$RUN/briefs`, `$RUN/checks`, `$RUN/kit`, `$RUN/scratch`
-- Create: worktree `.claude/worktrees/sic-before` (detached at `main`; nobody commits in it)
-- No repository file changes.
-
-**Interfaces:**
-- Consumes: Phase 0 item 1 (fix wave A, round 2), already merged at `765521a`.
-- Produces: `node $RUN/slot.mjs take <who>` prints the slot it took (`slot-1` … `slot-8`), waiting while none is free, and records no process (a slot taken by hand is freed only with `free`); `free <slot-N>`; `list`; `sweep` (frees the slots of a `run` whose own process and command have both ended; never a slot taken by hand, nor another project's plain `mkdir` slot, which has no `who.json`); `run <who> -- <command…>` (takes a slot, records its own pid and its command's, runs the command, frees the slot, exits with the command's code). Environment: `SLOT_POOL` (pool folder, default `$RUN/slots`), `SLOT_WAIT` (seconds, default 3600). The before-pictures site at `http://127.0.0.1:8800` (the pages of `main`).
-
-- [ ] **Step 1: Confirm that Phase 0 item 1 is already in**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO merge-base --is-ancestor f775fe1 feat/see-inside-compare && echo "fix wave A round 2 is in"; git -C $REPO log --oneline -1 765521a`
-Expected: `fix wave A round 2 is in` and `765521a Merge the final review's fix wave A, round 2: …`. Then `cd $REPO && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"`: `ℹ fail 0`. Write in the ledger (Step 7) that item 1 needed no work.
-
-- [ ] **Step 2: Write the failing tests of the slot pool**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; mkdir -p $RUN/slots $RUN/lanes $RUN/briefs $RUN/checks $RUN/kit $RUN/scratch`
-
-Create `$RUN/slot.test.mjs`:
-
-```js
-// Tests of slot.mjs: node --test slot.test.mjs (from the run folder). They use a pool of their own in the temp folder.
-import test from 'node:test';
-import assert from 'node:assert/strict';
-import { mkdtempSync, writeFileSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { join } from 'node:path';
-import { spawnSync } from 'node:child_process';
-
-const POOL = mkdtempSync(join(tmpdir(), 'sic-pool-'));
-process.env.SLOT_POOL = POOL;
-const { tryTake, free, list, sweep } = await import('./slot.mjs');
-const SLOT = join(import.meta.dirname, 'slot.mjs');
-const env = extra => ({ env: { ...process.env, SLOT_POOL: POOL, ...extra }, encoding: 'utf8' });
-
-test('eight slots, then none until one is freed', () => {
- const taken = Array.from({ length: 8 }, (_, i) => tryTake(`t${i}`));
- assert.deepEqual(taken, ['slot-1', 'slot-2', 'slot-3', 'slot-4', 'slot-5', 'slot-6', 'slot-7', 'slot-8']);
- assert.equal(tryTake('t9'), null);
- free('slot-3');
- assert.equal(tryTake('t10'), 'slot-3');
- assert.equal(list().length, 8);
- taken.forEach(free);
- assert.deepEqual(list(), []);
-});
-
-test('sweep frees a slot whose process has ended and keeps a live one', () => {
- tryTake('dead', 999999);
- tryTake('alive', process.pid);
- assert.deepEqual(sweep(), ['slot-1']);
- assert.deepEqual(list().map(s => s.who), ['alive']);
- free('slot-2');
-});
-
-test('sweep never frees a slot taken by hand, nor one whose command still runs after its run process ended', () => {
- tryTake('hand', null);
- tryTake('orphan', 999999);
- writeFileSync(join(POOL, 'slot-2', 'who.json'), JSON.stringify({ who: 'orphan', pid: 999999, child: process.pid, since: new Date().toISOString() }));
- assert.deepEqual(sweep(), []);
- assert.deepEqual(list().map(s => s.who), ['hand', 'orphan']);
- free('slot-1');
- free('slot-2');
-});
-
-test('run takes a slot, passes on the exit code and frees the slot afterwards', () => {
- const r = spawnSync(process.execPath, [SLOT, 'run', 'tester', '--', process.execPath, '-e', 'process.exit(3)'], env({}));
- assert.equal(r.status, 3);
- assert.deepEqual(list(), []);
-});
-
-test('run waits while every slot is taken, and gives up after SLOT_WAIT', () => {
- for (let i = 0; i < 8; i++) tryTake(`busy${i}`);
- const r = spawnSync(process.execPath, [SLOT, 'run', 'late', '--', process.execPath, '-e', '0'], env({ SLOT_WAIT: '1' }));
- assert.notEqual(r.status, 0);
- assert.match(r.stderr, /no slot came free/);
- for (let n = 1; n <= 8; n++) free(`slot-${n}`);
-});
-```
-
-- [ ] **Step 3: Run them and see them fail**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node --test slot.test.mjs`
-Expected: `Error [ERR_MODULE_NOT_FOUND]: Cannot find module '…slot.mjs'`, then `✖ slot.test.mjs` and `ℹ fail 1`.
-
-- [ ] **Step 4: Write the slot pool**
-
-Create `$RUN/slot.mjs`:
-
-```js
-#!/usr/bin/env node
-// The machine-wide pool of page-check slots: at most eight Chrome runs at once (page checks and review-kit runs, of every
-// project running at the time). A run takes a slot by creating its folder, which fails when the folder is there already, so two
-// runs never take the same slot; it frees the slot by removing the folder. Not part of the repository.
-// node slot.mjs take <who> takes a free slot and prints its name (slot-1 … slot-8); waits while none is free;
-// records no process, so only free frees it
-// node slot.mjs free <slot-N> frees that slot
-// node slot.mjs list prints the slots taken, by whom and since when
-// node slot.mjs sweep frees the slots of a run whose own process and command have both ended (a run killed
-// before it could free its slot); never a slot taken by hand, nor a slot with no
-// who.json (another project's plain mkdir slot)
-// node slot.mjs run <who> -- <command…> takes a slot, runs the command (its output shown as it comes), frees the slot when
-// the command ends or on Ctrl+C, and exits with the command's exit code
-// SLOT_POOL sets the pool folder (default: slots/ beside this file); SLOT_WAIT the longest wait for a free slot, in seconds
-// (default 3600).
-import { spawn } from 'node:child_process';
-import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
-import { dirname, join, resolve } from 'node:path';
-import { fileURLToPath } from 'node:url';
-
-const HERE = dirname(fileURLToPath(import.meta.url));
-const POOL = process.env.SLOT_POOL || join(HERE, 'slots');
-const SIZE = 8;
-const WAIT_MS = Number(process.env.SLOT_WAIT ?? 3600) * 1000;
-const sleep = ms => new Promise(done => setTimeout(done, ms));
-
-// Takes the first free slot for `who` (pid: the process that holds it, or null for none, which sweep never frees) and returns
-// its name, or null when all eight are taken.
-export function tryTake(who, pid = process.pid) {
- mkdirSync(POOL, { recursive: true });
- for (let n = 1; n <= SIZE; n++) {
- const dir = join(POOL, `slot-${n}`);
- try { mkdirSync(dir); } catch (err) { if (err.code === 'EEXIST') continue; throw err; }
- writeFileSync(join(dir, 'who.json'), JSON.stringify({ who, pid, since: new Date().toISOString() }));
- return `slot-${n}`;
- }
- return null;
-}
-export async function take(who, pid) {
- for (const end = Date.now() + WAIT_MS; ; await sleep(2000)) {
- const slot = tryTake(who, pid);
- if (slot) return slot;
- if (Date.now() >= end) throw new Error(`no slot came free in ${WAIT_MS / 1000} s`);
- }
-}
-export function free(slot) {
- if (!/^slot-[1-8]$/.test(slot)) throw new Error(`not a slot: ${slot}`);
- rmSync(join(POOL, slot), { recursive: true, force: true });
-}
-export function list() {
- if (!existsSync(POOL)) return [];
- return readdirSync(POOL).filter(n => /^slot-[1-8]$/.test(n)).sort().map(slot => {
- let info = {};
- try { info = JSON.parse(readFileSync(join(POOL, slot, 'who.json'), 'utf8')); } catch { /* a slot being taken right now */ }
- return { slot, ...info };
- });
-}
-const alive = pid => { try { process.kill(pid, 0); return true; } catch (err) { return err.code === 'EPERM'; } };
-// A slot is swept when its run's own process has ended and so has the command it started (a run stopped hard, as a stopped
-// background command on Windows is, can leave its command and Chrome running)
-export function sweep() {
- const freed = list().filter(s => s.pid && !alive(s.pid) && !(s.child && alive(s.child))).map(s => s.slot);
- freed.forEach(free);
- return freed;
-}
-
-async function main(argv) {
- const [cmd, ...rest] = argv;
- // From the command line no process outlives this call that the pool could watch (Git Bash runs node under a stub that
- // ends with it), so a slot taken by hand records none: sweep never frees it, and it is freed by hand with free.
- if (cmd === 'take' && rest[0]) { console.log(await take(rest[0], null)); return 0; }
- if (cmd === 'free' && rest[0]) { free(rest[0]); return 0; }
- if (cmd === 'list') {
- for (const s of list()) console.log(`${s.slot} ${s.who || '?'} pid ${s.pid || '?'} since ${s.since || '?'}`);
- return 0;
- }
- if (cmd === 'sweep') { console.log(sweep().join(' ') || 'nothing to free'); return 0; }
- if (cmd === 'run' && rest[0] && rest[1] === '--' && rest.length > 2) {
- const slot = await take(rest[0]);
- const child = spawn(rest[2], rest.slice(3), { stdio: 'inherit', shell: false });
- // The slot names this process and the command's, so sweep frees it only once both have ended
- writeFileSync(join(POOL, slot, 'who.json'), JSON.stringify({ who: rest[0], pid: process.pid, child: child.pid, since: new Date().toISOString() }));
- let done = false;
- const finish = code => { if (done) return; done = true; free(slot); process.exit(code); };
- for (const signal of ['SIGINT', 'SIGTERM', 'SIGBREAK', 'SIGHUP']) process.on(signal, () => { child.kill(); finish(130); });
- child.on('error', err => { console.error(`could not start ${rest[2]}: ${err.message}`); finish(127); });
- child.on('exit', code => finish(code ?? 1));
- return new Promise(() => {}); // finish() ends the process
- }
- console.error('usage: node slot.mjs take <who> | free <slot-N> | list | sweep | run <who> -- <command…>');
- return 2;
-}
-if (resolve(process.argv[1] || '').toLowerCase() === fileURLToPath(import.meta.url).toLowerCase()) {
- main(process.argv.slice(2)).then(code => process.exit(code), err => { console.error(err.message); process.exit(1); });
-}
-```
-
-- [ ] **Step 5: Run the tests and see them pass**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node --test slot.test.mjs`
-Expected: `ℹ tests 5`, `ℹ pass 5`, `ℹ fail 0`. Then `node $RUN/slot.mjs list` prints nothing, or only other projects' slots (shown with `?`).
-
-- [ ] **Step 6: The before-pictures checkout and its server**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add --detach $REPO/.claude/worktrees/sic-before main`
-Then start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-before && python -m http.server 8800 --bind 127.0.0.1`
-Check: `curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8800/animations/02-entrance-and-exit/fade-in-out/` prints `200`. This server stays up for the whole run (Tasks 6 to 14 read it). Nobody commits in `sic-before`; when `main` moves (the finder or Famous effects going live), refresh it with `git -C $REPO/.claude/worktrees/sic-before checkout --detach main` (neither project changes an animation page, so Normal's before-pictures stay valid).
-
-- [ ] **Step 7: The ledger and the rulings file**
-
-Create `$RUN/ledger.md`:
-
-```markdown
-# SDD ledger: docs/superpowers/plans/2026-10-13-see-inside-compare-phase0-first-batch.md
-
-Branch feat/see-inside-compare (main checkout, never switched). Run folder .superpowers/sdd/2026-10-13-see-inside-compare/.
-Slot pool: node slot.mjs run <who> -- <command> (8 at once, every project). Before-pictures: sic-before (detached main) on 8800.
-
-Task 0: Phase 0 item 1 (fix wave A, round 2) already merged at 765521a; tests pass; pool and before-pictures server ready.
-```
-
-Create `$RUN/first-batch-rulings.json` (read by the review kit, Task 5 and Task 14):
-
-```json
-{
- "shrinks": ["animations/01-scroll-based/parallax-scrolling/"],
- "mistakes": ["animations/05-text-typography/marquee-ticker/", "animations/07-ambient-background/flow-field/"]
-}
-```
-
-- [ ] **Step 8: No commit**
-
-Everything in this task is git-ignored or a worktree; `git -C $REPO status --short` shows nothing new. Tell the finder's and Famous effects' coordinators (the same main session) that `slot.mjs` is ready in the pool they already use: their plain mkdir/rmdir slots work beside `slot.mjs`; nothing to change.
-
-- [ ] **Step 9: Review (a fresh agent)**
-
-A fresh reviewer gets this task and reads `$RUN/slot.mjs` and `$RUN/slot.test.mjs`, then runs `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node --test --test-reporter=spec slot.test.mjs 2>&1 | grep -E "^ℹ (pass|fail)"` (`ℹ pass 5`, `ℹ fail 0`). They confirm: two runs never take the same slot; `take` from the command line records no process, so no `sweep` frees a slot whose check is still running; `sweep` frees only a slot whose `run` process and command have both ended, never another project's plain slot (no `who.json`); `run` frees its slot when the command ends or on a signal and passes on the command's exit code. Their findings are fixed before Task 1 starts; a ledger line.
-
----
-
-### Task 1: The learning path and the idea lessons wait on `feat/learn-pilot` (the clean-up)
-
-**Files:**
-- Delete: `learn/index.html`, `learn/follows-the-scroll/index.html`, `learn/far-things-move-slower/index.html`, `tests/learn.test.js`
-- Modify: `animations/01-scroll-based/parallax-scrolling/index.html` (line 85, the lesson line; line 175, the See inside note; lines 235-240, the lesson nav; script lines 275 and 332)
-- Modify: `assets/css/demo-page.css` (lines 198-214, 234-235, 262-268, 331-333)
-- Modify: `tools/check-pages.mjs` (line 4; lines 42-43; lines 76-93; line 113; line 118; lines 130-134)
-- Modify: `tests/pages.test.js` (top requires; the stylesheet test, lines 561-608; a new guard test after it)
-- Modify: `assets/js/demo-page.js` (line 10), `tests/demo-page.test.js` (lines 132 and 278)
-- Modify: `docs/superpowers/specs/2026-10-13-learn-pilot-design.md` (a status line under its title)
-- Line numbers are those of `03a00d0`.
-
-**Interfaces:**
-- Consumes: nothing from earlier tasks.
-- Produces: ONE commit, `chore: the learning path and the idea lessons wait on feat/learn-pilot`, that the learning path's resumption will revert (fix rounds amend it: the spec wants one commit to revert). After it: no `learn/`, no lesson CSS, no `learn` target in the page check, Parallax's See inside note is a plain `<p data-hb-for="inside" hidden>` that the script writes with `insideNote.textContent` (no `span.say`), and a guard test `while the learning path waits, no tracked page links into learn/ and the shared stylesheet has none of its rules`.
-
-- [ ] **Step 1: The lane**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/00a $REPO/.claude/worktrees/sic-00a feat/see-inside-compare`
-Work in `$REPO/.claude/worktrees/sic-00a` for the rest of this task.
-
-- [ ] **Step 2: Write the failing guard test**
-
-In `tests/pages.test.js`, after the line `const vm = require('node:vm');` add:
-
-```js
-const { execFileSync } = require('node:child_process');
-```
-
-After the test that starts `test('the shared stylesheet draws the mode switch beside the Watch heading` (it ends just before `test('the home page uses Schibsted Grotesk and asks what to animate'`), add:
-
-```js
-// The learning path and the idea lessons wait on feat/learn-pilot (docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md,
-// section 5): no tracked page links into learn/ and the shared stylesheet keeps none of their rules. Delete this test when the
-// learning path resumes (its first step reverts the clean-up commit, which takes this test away too).
-test('while the learning path waits, no tracked page links into learn/ and the shared stylesheet has none of its rules', () => {
- let pages;
- try {
- pages = execFileSync('git', ['ls-files', '--', '*.html'], { cwd: ROOT, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).split(/\r?\n/).filter(Boolean);
- } catch {
- // No git here (a copy from a source zip): every page in the folder, outside git's, the agents' and the packages' folders
- const walk = dir => fs.readdirSync(path.join(ROOT, dir), { withFileTypes: true }).flatMap(e => e.isDirectory()
- ? (['.git', '.claude', '.superpowers', 'node_modules'].includes(e.name) ? [] : walk(path.join(dir, e.name)))
- : e.name.endsWith('.html') ? [path.join(dir, e.name)] : []);
- pages = walk('');
- }
- assert.ok(pages.length > 100, `the tracked pages are found (${pages.length})`);
- const linking = pages.filter(f => /href="(?:(?:\.\.\/)+|\/animation-handbook\/)?learn\//.test(read(path.join(ROOT, f))));
- assert.deepEqual(linking, [], 'pages that link into learn/');
- assert.ok(!fs.existsSync(path.join(ROOT, 'learn')), 'the learn/ folder is gone');
- const css = read(path.join(ROOT, 'assets', 'css', 'demo-page.css')).replace(/\/\*[\s\S]*?\*\//g, '');
- for (const name of ['hb-lesson', 'hb-why', 'hb-seen', 'hb-learn', 'hb-path']) assert.ok(!css.includes(name), `no ${name} rule`);
-});
-```
-
-- [ ] **Step 3: Run it and see it fail**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00a && node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -E "^✖ |AssertionError|^ℹ (pass|fail)|parallax-scrolling/index.html"`
-Expected: `ℹ fail 1` and `✖ while the learning path waits, no tracked page links into learn/ and the shared stylesheet has none of its rules` (named again under `✖ failing tests:`), with `AssertionError [ERR_ASSERTION]: pages that link into learn/` and lines that list only `'animations/01-scroll-based/parallax-scrolling/index.html'` (the lesson pages link to each other without the `learn/` part, so only Parallax is listed; the folder and the CSS assertions would fail next).
-
-- [ ] **Step 4: Remove the learning path's files**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00a && git rm -q -r learn tests/learn.test.js`
-
-- [ ] **Step 5: Parallax Scrolling without its lesson line, lesson nav and lesson link**
-
-In `animations/01-scroll-based/parallax-scrolling/index.html`:
-
-Delete the line
-```html
- <p class="hb-lesson"><a href="../../../learn/">Learning path · Lesson 22 of 25</a></p>
-```
-
-Replace
-```html
- <p data-hb-for="inside" hidden><span class="say">Inside, the picture is four flat layers. As the box scrolls, the far layers move least and the near grass moves most. Scroll the box or press Play to watch.</span> <a href="../../../learn/far-things-move-slower/">The idea: far things move slower</a></p>
-```
-with
-```html
- <p data-hb-for="inside" hidden>Inside, the picture is four flat layers. As the box scrolls, the far layers move least and the near grass moves most. Scroll the box or press Play to watch.</p>
-```
-
-Delete these six lines (between `</section>` of `section.hb-related` and `</main>`):
-```html
- <nav class="hb-lesson-nav" aria-label="Learning path">
- <h2 class="hb-lesson-title">Learning path</h2>
- <a class="hb-lesson-prev" href="../../../learn/far-things-move-slower/"><span>← Lesson 21</span><b>Far things move slower</b></a>
- <a class="hb-lesson-next" href="../../06-3d-advanced/parallax-3d-tilt/"><span>Lesson 23 →</span><b>Parallax 3D Tilt</b></a>
- <a class="hb-lesson-all" href="../../../learn/">All 25 lessons</a>
- </nav>
-```
-
-In the script replace ` const insideSay = document.querySelector('[data-hb-for="inside"] .say');` with ` const insideNote = document.querySelector('[data-hb-for="inside"]');` and ` insideSay.textContent = notes.inside;` with ` insideNote.textContent = notes.inside;`.
-
-- [ ] **Step 6: The shared stylesheet without the lesson CSS**
-
-In `assets/css/demo-page.css` delete, exactly:
-
-the block (lines 198-214)
-```css
-/* The learning path: the lesson line beside the category line (below it on phones), the previous and next lessons at the end
- of a page of the path, and an idea lesson's Why it works and Where you'll see it */
-.hb-lesson{margin:0;font:600 14px/1.3 var(--hb-font);letter-spacing:.02em}
-.hb-lesson a{color:var(--hb-dim);text-decoration:underline;text-decoration-color:var(--hb-edge-2);text-underline-offset:4px}
-.hb-lesson-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding-top:clamp(28px,4vw,36px);border-top:1px solid var(--hb-line)}
-.hb-lesson-title{grid-column:1/-1;margin:0;font:700 22px/1.2 var(--hb-font);letter-spacing:-.01em;color:var(--hb-ink)}
-.hb-lesson-prev,.hb-lesson-next{display:flex;flex-direction:column;gap:6px;padding:18px 20px;border:1px solid rgba(255,255,255,.12);
- border-radius:10px;text-decoration:none}
-.hb-lesson-next{grid-column:2;text-align:right}
-.hb-lesson-prev span,.hb-lesson-next span{font:600 14px/1.3 var(--hb-font);color:var(--hb-accent)}
-.hb-lesson-prev b,.hb-lesson-next b{font:700 18px/1.25 var(--hb-font);color:var(--hb-ink)}
-.hb-lesson-all{grid-column:1/-1;justify-self:start;display:inline-flex;align-items:center;min-height:44px;color:var(--hb-dim);
- font:600 15px/1 var(--hb-font)}
-.hb-why,.hb-seen{padding-top:clamp(28px,4vw,36px);border-top:1px solid var(--hb-line)}
-.hb-why h2,.hb-seen h2{margin:0 0 12px;font:700 22px/1.2 var(--hb-font);letter-spacing:-.01em;color:var(--hb-ink)}
-.hb-why p{margin:0;max-width:68ch;font:400 17px/1.7 var(--hb-font);color:var(--hb-dim)}
-.hb-why p+p{margin-top:12px}
-```
-and the blank line after it; the two hover rules inside `@media(hover:hover){…}`
-```css
- .hb-lesson-prev:hover,.hb-lesson-next:hover{border-color:color-mix(in srgb,var(--hb-accent) 55%,transparent)}
- .hb-lesson a:hover,.hb-lesson-all:hover{color:var(--hb-ink)}
-```
-the whole 601px block with its comment
-```css
-/* From 601px the lesson line shares the category line's row, at its right end, so the header grows no taller */
-@media(min-width:601px){
- .hb-head:has(> .hb-lesson){display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:16px}
- .hb-head:has(> .hb-lesson) > *{grid-column:1/-1}
- .hb-head:has(> .hb-lesson) > .hb-cat{grid-column:1}
- .hb-head:has(> .hb-lesson) > .hb-lesson{grid-column:2;justify-self:end;align-self:center}
-}
-```
-and the three phone rules at the end of `@media(max-width:600px){…}`
-```css
- .hb-lesson a{display:inline-flex;align-items:center;min-height:44px}
- .hb-lesson-nav{grid-template-columns:minmax(0,1fr)}
- .hb-lesson-next{grid-column:auto}
-```
-
-- [ ] **Step 7: The page check without the `learn` target**
-
-In `tools/check-pages.mjs`:
-
-Line 4 becomes
-```js
-// Usage: node tools/check-pages.mjs [--base http://127.0.0.1:8731] [--out <folder>] <page or category folder, or home>...
-```
-
-Delete lines 42-43:
-```js
-// "learn" stands for the Learn page and every idea lesson in learn/: the page checks run there too, without the prompt parts
-// (chips, What it is), and each lesson's kind is worked like any other page's. "learn/index.html" is the Learn page alone.
-```
-
-Replace the page list (from `const pages = args.map(` to the `process.exit(2);` of its usage error, then `}`) with:
-```js
-const pages = args.map(p => (p === 'home' ? p : p.replace(/\\/g, '/').replace(/^\.?\//, '').replace(/\/?(index\.html)?$/, '/')))
- .flatMap(p => {
- if (p === 'home' || isPage(p) || !existsSync(join(ROOT, p))) return [p];
- const inside = readdirSync(join(ROOT, p), { withFileTypes: true })
- .filter(d => d.isDirectory() && isPage(p + d.name)).map(d => `${p}${d.name}/`).sort();
- return inside.length ? inside : [p];
- });
-if (!pages.length) {
- console.error('Usage: node tools/check-pages.mjs [--base URL] [--out DIR] <page or category folder, or home>...');
- process.exit(2);
-}
-```
-
-In `CHECK`, delete the line ` const learn = document.body.classList.contains('hb-learn');`, remove `, .hb-lesson a, .hb-lesson-nav a, .hb-path a` from the small-target selector list (it then ends `… .hb-star-row a, .hb-rel')]`), and replace
-```js
- // Learn pages have no prompt, so no chips, and no README
- if (!learn && chips !== controls) problems.push('chips ' + chips + ' vs settings ' + controls);
- const what = document.querySelector('.hb-what-text');
- if (!learn && (!what || !what.querySelector('p'))) problems.push('What it is is missing');
- else if (!learn && what.querySelector('a[href="README.md"]')) problems.push('What it is did not load from the README');
-```
-with
-```js
- if (chips !== controls) problems.push('chips ' + chips + ' vs settings ' + controls);
- const what = document.querySelector('.hb-what-text');
- if (!what || !what.querySelector('p')) problems.push('What it is is missing');
- else if (what.querySelector('a[href="README.md"]')) problems.push('What it is did not load from the README');
-```
-
-- [ ] **Step 8: The stylesheet test without the lesson selectors**
-
-In `tests/pages.test.js`, in the test that starts `test('the shared stylesheet draws the mode switch beside the Watch heading and the note beside a short player bar from 761px, hides an empty notes box, and styles the lesson line, the lesson nav and the idea lessons\' sections'`:
-- its title becomes `'the shared stylesheet draws the mode switch beside the Watch heading and the note beside a short player bar from 761px, and hides an empty notes box'`;
-- the selector loop becomes `for (const sel of ['.hb-page .seg.hb-modes', '.hb-mode-notes p']) assert.ok(has(sel), sel);` (one line in place of the two);
-- delete its last assertion, `assert.match(css, /@media\(min-width:601px\)\{\s*\.hb-head:has\(> \.hb-lesson\)\{display:grid/, 'from 601px the lesson line shares the category row');`.
-
-- [ ] **Step 9: The shared script's comment and its test's words**
-
-In `assets/js/demo-page.js` line 10, `Pages without a prompt (the idea lessons) get everything but the prompt parts.` becomes `Pages without a prompt get everything but the prompt parts.`
-
-In `tests/demo-page.test.js` line 132, `// for Compare; noPrompt leaves the prompt out, as on an idea lesson.` becomes `// for Compare; noPrompt leaves the prompt out.`; line 278's title `'a page with no prompt, such as an idea lesson, still gets its player: a scroll page scrolls on arrival and notes reduced motion'` becomes `'a page with no prompt still gets its player: a scroll page scrolls on arrival and notes reduced motion'`.
-
-- [ ] **Step 10: The pilot spec's status line**
-
-In `docs/superpowers/specs/2026-10-13-learn-pilot-design.md`, between the title line `# Learn pilot: design` and the blank line after it, add a blank line and:
-
-```markdown
-> **Status (2026-10-13):** See inside (A) and Compare (B) roll out to every page by `2026-10-13-see-inside-compare-rollout-design.md`.
-> The learning path (C) and Motion basics (D) wait on `feat/learn-pilot`; the commit "chore: the learning path and the idea lessons
-> wait on feat/learn-pilot" took them off `feat/see-inside-compare`, and reverting it is the first step when they resume.
-```
-
-- [ ] **Step 11: Run the tests and the leftovers search**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00a && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)|^✔ while the learning path waits"`
-Expected: `✔ while the learning path waits, no tracked page links into learn/ …` and `ℹ fail 0`.
-Run: `git grep -n -e "hb-lesson" -e "hb-learn" -e "hb-why" -e "hb-seen" -e "hb-path" -e "idea lesson" -e "learn/" -- . ':!docs' ':!tests/pages.test.js'`
-Expected: no output.
-Run the same search on `-- tests/pages.test.js` alone: `git grep -n -e "hb-lesson" -e "hb-learn" -e "hb-why" -e "hb-seen" -e "hb-path" -e "idea lesson" -e "learn/" -- tests/pages.test.js`
-Expected: only the six lines of the guard test (its two comment lines, its title, the two assertion messages and the list of names).
-
-- [ ] **Step 12: Page check**
-
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00a && python -m http.server 8801 --bind 127.0.0.1`
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-00a && node $RUN/slot.mjs run sic-00a -- node tools/check-pages.mjs --base http://127.0.0.1:8801 --out $RUN/checks/sic-00a animations/01-scroll-based/parallax-scrolling home`
-Expected: twelve `ok` lines. Open `$RUN/checks/sic-00a/01-parallax-scrolling-desktop-full.png` (Read tool): the header has the category line and the title, with no lesson line; the page ends with Similar animations and the footer, with no Learning path. `grep -c learn tools/check-pages.mjs` prints `0`. Stop the server.
-
-- [ ] **Step 13: Commit (one commit)**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00a
-git add animations/01-scroll-based/parallax-scrolling/index.html assets/css/demo-page.css assets/js/demo-page.js tests/demo-page.test.js tests/pages.test.js tools/check-pages.mjs docs/superpowers/specs/2026-10-13-learn-pilot-design.md
-git status --short # 4 lines "D " (staged by Step 4) and 7 lines "M ", nothing unstaged
-git commit -m "chore: the learning path and the idea lessons wait on feat/learn-pilot"
-git show --stat HEAD | tail -12
-git show --stat HEAD | tail -1
-```
-Expected: 11 files changed (4 deleted); the last line starts `11 files changed`. If it does not, stop before the review. Fix rounds after review use `git commit --amend --no-edit` on this same commit, so the clean-up stays one commit to revert.
-
-- [ ] **Step 14: Review and merge (coordinator)**
-
-A fresh reviewer gets: spec section 5, this task, and `git -C $REPO/.claude/worktrees/sic-00a show HEAD`. They confirm every item of section 5's Removed, Kept and Added lists (Kept: the boot without a prompt and its test, the underlined note link rule and the test that every note link opens an existing page), that the commit is the only one on `sic/00a`, and that nothing outside those lists changed. Then:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && git merge --no-ff sic/00a -m "Merge Phase 0, Task 1: the learning path and the idea lessons wait on feat/learn-pilot"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-git worktree remove .claude/worktrees/sic-00a && git branch -d sic/00a
-```
-Expected: `ℹ fail 0`. Write the clean-up commit's hash in the ledger (the commit to revert later).
-
----
-### Task 2: Shared script: a mode press plays the demo once (ruling 1), Copy prompt only with a prompt, the event order pinned
-
-**Files:**
-- Modify: `assets/js/demo-page.js` (header comment lines 9-10; `setUpModes`, lines 488-509; the call `if (copyBtn) setUpCopy();`, line 543)
-- Test: `tests/demo-page.test.js` (the `standInPage` helper, lines 125-188; new tests after `'the mode switch gives the class on to the pressed mode only'`)
-- Line numbers are those of `03a00d0` (Task 1 changes only one comment line and one test title in these files).
-
-**Interfaces:**
-- Consumes: Task 1's merge.
-- Produces: after the page's `hb:mode` listeners have run for See inside or Compare (the pressed mode too), the shared script clicks `[data-hb-replay]` on a `data-hb-kind="once"` page or `[data-hb-demo]` on a `data-hb-kind="do"` page, once; never under reduced motion, never after Normal, never on scroll or loop pages. A mode press on a do-it page counts as the visitor's action, so the Show me press on arrival is skipped. `setUpCopy` runs only when the page has a prompt. Task 3's page check waits for the run this press starts.
-
-- [ ] **Step 1: The lane**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/00b $REPO/.claude/worktrees/sic-00b feat/see-inside-compare`
-Work in `$REPO/.claude/worktrees/sic-00b`.
-
-- [ ] **Step 2: Extend the stand-in page in `tests/demo-page.test.js`**
-
-In `standInPage`:
-
-Replace ` const timers = [], sent = [];` with:
-```js
- const timers = [], sent = [], log = [];
-```
-
-In the `node()` factory replace `click() { this.clicks++; }` with:
-```js
-click() { this.clicks++; if (this.onClick) this.onClick(); }
-```
-
-Replace ` const stage = node(), player = node(), prompt = node(), demo = node(), play = node(), top = node();` with:
-```js
- const stage = node(), player = node(), prompt = node(), demo = node(), play = node(), top = node(), replay = node();
- // A loop's Pause button: the shared script looks for its label inside it
- const pause = Object.assign(node(), { querySelector: () => null });
- replay.onClick = () => log.push('Replay');
- demo.onClick = () => log.push('Show me');
-```
-
-In the `wanted` object add, after `'[data-hb-demo]': kind === 'do' && demo,`:
-```js
- '[data-hb-replay]': kind === 'once' && replay, '[data-hb-pause]': kind === 'loop' && pause,
-```
-
-Replace `dispatchEvent: event => sent.push(event),` in `doc` with:
-```js
-dispatchEvent: event => {
- // What the page could see when hb:mode reached it: the stage's mark, the pressed buttons and the notes on show
- if (event.type === 'hb:mode') {
- event.seen = { mark: stage.getAttribute('data-hb-mode'), pressed: modeButtons.map(b => b.getAttribute('aria-pressed')), shown: notes.map(n => !n.hidden) };
- log.push('hb:mode ' + event.detail.mode);
- }
- sent.push(event);
- },
-```
-
-Replace the return line with:
-```js
- return { doc, win, stage, player, demo, play, replay, pause, button, anchors, sent, log, modeButtons, notes,
- runTimers: () => timers.forEach(t => t.fn()), timerDelays: () => timers.map(t => t.ms) };
-```
-
-Extend the helper's comment (the paragraph above `function standInPage`) with two lines:
-```js
-// A plays-once page also has Replay and a loop has Pause; `log` keeps, in order, every hb:mode sent and every press of Replay
-// or Show me, and each hb:mode event carries `seen`: the stage's mark, the buttons' aria-pressed and the notes on show then.
-```
-
-- [ ] **Step 3: Write the failing tests** (after the test `'the mode switch gives the class on to the pressed mode only'`)
-
-```js
-test('a mode press changes the buttons, the notes and the stage mark before hb:mode is sent', () => {
- const page = standInPage('scroll', false, {}, null, null, { modes: true });
- page.modeButtons[1].emit('click', visitor);
- page.modeButtons[2].emit('click', visitor);
- assert.deepEqual(page.sent.filter(e => e.type === 'hb:mode').map(e => e.seen), [
- { mark: 'inside', pressed: ['false', 'true', 'false'], shown: [true, false] },
- { mark: 'compare', pressed: ['false', 'false', 'true'], shown: [false, true] }
- ]);
-});
-
-test('See inside and Compare play a plays-once page once, pressing Replay after hb:mode; the pressed mode again plays again; Normal plays nothing', () => {
- const page = standInPage('once', false, {}, null, null, { modes: true });
- const [normal, inside, compare] = page.modeButtons;
- inside.emit('click', visitor);
- compare.emit('click', visitor);
- compare.emit('click', visitor);
- normal.emit('click', visitor);
- assert.deepEqual(page.log, ['hb:mode inside', 'Replay', 'hb:mode compare', 'Replay', 'hb:mode compare', 'Replay', 'hb:mode normal']);
-});
-
-test('See inside and Compare press Show me on a do-it page after hb:mode, and the Show me press on arrival is then skipped', () => {
- const page = standInPage('do', false, {}, null, null, { modes: true });
- page.modeButtons[2].emit('click', visitor);
- assert.deepEqual(page.log, ['hb:mode compare', 'Show me']);
- page.runTimers();
- assert.equal(page.demo.clicks, 1, 'the press on arrival is skipped: the visitor acted first');
-});
-
-test('under reduced motion a mode press plays nothing', () => {
- for (const kind of ['once', 'do']) {
- const page = standInPage(kind, true, {}, null, null, { modes: true });
- page.modeButtons[1].emit('click', visitor);
- page.modeButtons[2].emit('click', visitor);
- assert.deepEqual(page.log, ['hb:mode inside', 'hb:mode compare'], kind);
- }
-});
-
-test('a mode press plays nothing on a scroll page or a loop', () => {
- const scroll = standInPage('scroll', false, {}, null, null, { modes: true });
- scroll.modeButtons[1].emit('click', visitor);
- assert.equal(scroll.play.clicks, 0, 'Play is not pressed');
- const loop = standInPage('loop', false, {}, null, null, { modes: true });
- loop.modeButtons[2].emit('click', visitor);
- assert.equal(loop.pause.clicks, 0, 'Pause is not pressed');
- assert.deepEqual(loop.log, ['hb:mode compare']);
-});
-
-test('a page without a prompt does not set up Copy prompt, even when it has the button', () => {
- const page = standInPage('once', false, {}, { prompt: '', controls: null, clipboard: { writeText: () => Promise.resolve() } }, null, { noPrompt: true });
- assert.equal((page.button.handlers.click || []).length, 0);
-});
-```
-
-- [ ] **Step 4: Run them and see them fail**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00b && node --test --test-reporter=spec tests/demo-page.test.js 2>&1 | grep -E "^✖ |^ℹ (pass|fail)"`
-Expected: `ℹ fail 3`, and the `✖` lines (each failing test is named twice: in the run, then again under `✖ failing tests:`) name three tests: `✖ See inside and Compare play a plays-once page once…` (the log has no `Replay`), `✖ See inside and Compare press Show me on a do-it page…` (no `Show me`), `✖ a page without a prompt does not set up Copy prompt…` (one click handler). The event-order test, the reduced-motion test and the scroll-or-loop test already pass: they pin what must not change. See the event-order test fail once by mutation: in `assets/js/demo-page.js` move the line `doc.dispatchEvent(new win.CustomEvent('hb:mode', { detail: { mode: mode } }));` to the top of `choose()`, run the file again (the event-order test fails), and put the line back.
-
-- [ ] **Step 5: Implement in `assets/js/demo-page.js`**
-
-In the header comment replace the two lines
-```js
- * The mode switch (Normal, See inside, Compare) marks the stage with data-hb-mode, shows that mode's note and sends
- * "hb:mode", so the page draws the mode. Pages without a prompt get everything but the prompt parts.
-```
-with
-```js
- * The mode switch (Normal, See inside, Compare) marks the stage with data-hb-mode, shows that mode's note and sends
- * "hb:mode", so the page draws the mode; after See inside or Compare it plays the demo once (Replay or Show me), except under
- * reduced motion. Pages without a prompt get everything but the prompt parts.
-```
-
-Replace the whole `setUpModes` function and its comment with:
-```js
- // See inside and Compare: the mode switch above the stage. Pressing a mode presses its button (one at a time), marks the
- // stage with data-hb-mode and shows the note for that mode (Normal has none), and only then sends "hb:mode", so the page
- // finds the buttons, the notes and the mark already changed when it draws the mode. A press on the mode already pressed
- // sends "hb:mode" again. Nothing scrolls and nothing takes focus, and a running Play goes on: the switch sits outside the
- // stage, whose input stops Play.
- // Once the page has drawn See inside or Compare, the demo plays once by itself so the view is seen working: Replay on a
- // plays-once page, Show me on a do-it page (a press of a mode is the visitor acting, so the Show me press on arrival is then
- // skipped). Never under reduced motion, never after Normal, never on a scroll page (Play is there for that) or a loop (it is
- // already moving). The page's own hb:mode listener presses nothing.
- function setUpModes() {
- var buttons = Array.prototype.slice.call(modesCtl.querySelectorAll('[data-hb-mode]'));
- var notes = Array.prototype.slice.call(page.querySelectorAll('[data-hb-for]'));
- var kind = doc.body.getAttribute('data-hb-kind');
- function playOnce() {
- if (reduce && reduce.matches) return;
- if (kind === 'once' && replayCtl) replayCtl.click();
- else if (kind === 'do' && demoCtl) { visitorActed = true; demoCtl.click(); }
- }
- function choose(mode) {
- buttons.forEach(function (b) {
- var on = b.getAttribute('data-hb-mode') === mode;
- b.classList.toggle('on', on);
- b.setAttribute('aria-pressed', String(on));
- });
- notes.forEach(function (n) { n.hidden = n.getAttribute('data-hb-for') !== mode; });
- if (stage) stage.setAttribute('data-hb-mode', mode);
- doc.dispatchEvent(new win.CustomEvent('hb:mode', { detail: { mode: mode } }));
- if (mode !== 'normal') playOnce();
- }
- buttons.forEach(function (b) {
- b.addEventListener('click', function () { choose(b.getAttribute('data-hb-mode')); });
- });
- if (stage) stage.setAttribute('data-hb-mode', 'normal');
- }
-```
-
-Replace ` if (copyBtn) setUpCopy();` with:
-```js
- if (promptEl && copyBtn) setUpCopy();
-```
-
-(`visitorActed` is a `var` of `boot()` declared above `setUpModes`, at line 418; `setUpModes()` is called at the end of `boot()`, after that declaration has run.)
-
-- [ ] **Step 6: Run all tests**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00b && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)|^✔ (a mode press|See inside and Compare|under reduced motion a mode press|a page without a prompt does not set up)"`
-Expected: the six new tests' `✔` lines and `ℹ fail 0`.
-
-- [ ] **Step 7: A real page still behaves**
-
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00b && python -m http.server 8802 --bind 127.0.0.1`
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-00b && node $RUN/slot.mjs run sic-00b -- node tools/check-pages.mjs --base http://127.0.0.1:8802 --out $RUN/checks/sic-00b animations/01-scroll-based/parallax-scrolling animations/02-entrance-and-exit/fade-in-out animations/04-micro-interactions/magnetic-button`
-Expected: eighteen `ok` lines (Parallax is a scroll page, so nothing is pressed after a mode press; the other two have no switch yet and must be exactly as before). Stop the server.
-
-- [ ] **Step 8: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00b
-git add assets/js/demo-page.js tests/demo-page.test.js
-git commit -m "feat: pressing See inside or Compare plays a plays-once or do-it demo once (never under reduced motion), and Copy prompt is set up only on a page with a prompt"
-```
-
-- [ ] **Step 9: Review and merge (coordinator)**
-
-A fresh reviewer gets spec section 4 item 4, ruling 1, this task and `git -C $REPO/.claude/worktrees/sic-00b diff feat/see-inside-compare...sic/00b`; they confirm each case of ruling 1 has a test, that pages without the switch take exactly the old path (no new code runs without `[data-hb-modes]`), and that the shared script never presses anything for a page's own `hb:mode` listener. Then `cd $REPO && git merge --no-ff sic/00b -m "Merge Phase 0, Task 2: a mode press plays the demo once, and Copy prompt only with a prompt"`, tests (`node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"`: `ℹ fail 0`), `git worktree remove .claude/worktrees/sic-00b && git branch -d sic/00b`, a ledger line.
-
----
-
-### Task 3: Page check: the do-it path, rest as 750 ms unchanged, waiting for the run a mode press starts, and captions, ids and names in every mode
-
-**Files:**
-- Modify: `tools/check-pages.mjs`: the header paragraph that starts `// A page with the mode switch (Normal, See inside, Compare)` (lines 26-41 at `03a00d0`); `settledShot` (lines 285-296) becomes `restShot`, and `stillShot` (lines 336-347) goes; two lines of `movementProblems` (308 and 312); a new `TIMERS` constant after `STARS` (after line 187); new `waitForRun`, `pictureName` and `captionProblems` after `watchStepShot` (after line 420); `modeProblems` (lines 422-575: its comment, `look` and everything after `capture`); one line before `await send('Page.addScriptToEvaluateOnNewDocument', { source: RECORD });` (line 1253). Task 1 removed about a dozen lines above some of these; find each place by the code quoted below.
-- Create (outside the repository): `$FX/sic-gen.mjs`
-- Modify (outside the repository): `$FX/README.md` (a new section 0 after its title)
-
-**Interfaces:**
-- Consumes: Task 1's merge (no `learn` target, no `hb-learn` exceptions). Ruling 1 as Task 2 builds it (the fixtures' inline script stands in for it, so this task does not wait for Task 2).
-- Produces: `restShot(wait = 0)` → `{ shot, still }` (rest = the stage unchanged for 750 ms, four captures 250 ms apart, up to 10 s); `waitForRun()` → `true` when no page timer of 6 s or less is waiting and no finite animation on the stage runs, three looks in a row (up to 12 s); `captionProblems(label)` → problem strings; `pictureName()` → the stage's (or its canvas's or picture's) `aria-label`, or `null`; the instrumentation `TIMERS` (`window.__hbWaiting()`). Problem messages the builders will meet: `the demo does not come to rest before the modes are tried (…)`, `<Mode>: the run it started does not end within 12 s`, `the stage does not come to rest in <Mode>`, `<Mode>: the box changes size (Npx, not Mpx)`, `<Mode>: the player bar moves (Npx below the top of the box, not Mpx)`, `<Mode>: N labels (at most M here)`, `<Mode>: the label "…" is not inside the stage`, `<Mode>: the label "…" is drawn at Npx (at least 12px)`, `<Mode>: the labels "…" and "…" overlap`, `<Mode>: ids used twice: …`, `<Mode>: the control "…" is named "…", which leaves out its visible words`, `the picture's name is the same in <Mode> and <Mode>: "…"`.
-
-- [ ] **Step 1: The lane**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/00c $REPO/.claude/worktrees/sic-00c feat/see-inside-compare`
-Work in `$REPO/.claude/worktrees/sic-00c`.
-
-- [ ] **Step 2: Write the fixture site (the failing test)**
-
-The fixtures are this task's test: small guided-steps pages with the switch, some right and some with one defect each, in one site root with its own copy of the check. The pilot's roots used the `learn` target, which Task 1 removed, so the new generator puts them in four fixture categories. Create `$FX/sic-gen.mjs`:
-
-```js
-// Fixture site for the page check, rollout Phase 0 (Task 3 of docs/superpowers/plans/2026-10-13-see-inside-compare-phase0-first-batch.md).
-// Not part of the repository. Builds one site root holding a copy of a worktree's tools/check-pages.mjs and four fixture
-// categories. Every page is a small guided-steps page with the mode switch, driven by an inline script in place of the shared
-// script (it also plays a plays-once or do-it demo once after See inside or Compare, as the shared script does since Phase 0),
-// some right and some with one deliberate defect each:
-// animations/90-ok the pages that are right (fix wave A's faA, without the Learn page)
-// animations/91-old the defects of the pilot's first rounds (faB)
-// animations/92-wave-a the rules added in fix wave A (faC)
-// animations/93-phase0 the rules added in Phase 0: the do-it path, runs that hold still, captions, ids, names, snapping, resizes,
-// the box's size
-// usage: node sic-gen.mjs <root to build> <worktree with tools/check-pages.mjs>
-// The root folder itself stays (a server may be running in it); its animations/ and tools/ are written again.
-import { copyFileSync, existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
-import { join, resolve } from 'node:path';
-
-const [OUT, WT] = process.argv.slice(2).map(p => (p ? resolve(p) : p));
-if (!OUT || !WT || !existsSync(join(WT, 'tools', 'check-pages.mjs'))) {
- console.error('usage: node sic-gen.mjs <root to build> <worktree with tools/check-pages.mjs>');
- process.exit(2);
-}
-const WRAP_RULE = '.hb-mode-notes:not(:has([data-hb-for]:not([hidden]))){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}';
-const OLD_RULE = '.hb-mode-notes:not(:has(> p:not([hidden]))){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}';
-
-const CSS = `
-:root{--bg:#0e0e11;--ink:#f2f2f4;--accent:#c8f169}
-*{box-sizing:border-box}
-html,body{margin:0}
-body{background:var(--bg);color:var(--ink);font:16px/1.4 system-ui,sans-serif}
-a{color:var(--accent)}
-.hb-bar{display:flex;gap:8px;padding:4px 16px}
-.hb-bar a,.hb-foot a{display:inline-flex;align-items:center;min-height:44px;min-width:44px;padding:0 12px}
-.hb-page{max-width:1000px;margin:0 auto;padding:0 16px 24px;display:flex;flex-direction:column;gap:10px}
-.hb-head h1{margin:0;font-size:clamp(24px,5vw,40px)}
-.hb-head p{margin:2px 0}
-.hb-page button{min-height:44px;min-width:44px;padding:0 14px;border:1px solid #666;background:none;color:inherit;border-radius:8px;font:inherit;cursor:pointer}
-.hb-page button[aria-pressed=true]{border-color:var(--accent);color:var(--accent)}
-.seg{display:flex;flex-wrap:wrap;gap:8px}
-.stage{position:relative;height:240px;overflow:hidden;border:1px solid #444;border-radius:8px;background:#1b1b22}
-[data-hb-kind=scroll] .stage{overflow-y:auto;overflow-x:hidden}
-[data-hb-kind=scroll] .stage.inner{overflow:hidden}
-.inner .scroller{height:100%;overflow-y:auto;overflow-x:hidden}
-[data-hb-autoscrolling]{scroll-snap-type:none!important}
-.hb-player{display:flex;gap:8px;align-items:center;flex-wrap:wrap;min-height:44px}
-.hb-switch-row{display:inline-flex;align-items:center;gap:8px;min-height:44px;min-width:44px}
-.hb-mode-notes p,.hb-what-text p{margin:4px 0}
-.hb-chips{margin:0;padding:0;list-style:none}
-.hb-foot{display:flex;gap:16px;padding:8px 16px;flex-wrap:wrap}
-.scene{position:relative;width:100%;height:100%}
-.scene.tall{height:1400px;background:repeating-linear-gradient(#1b1b22 0 120px,#2a2a55 120px 240px)}
-.pin{position:sticky;top:0;height:240px;width:100%}
-.box{position:absolute;left:12%;top:40%;width:70px;height:70px;border-radius:10px;background:#66ccff}
-.twin{position:absolute;left:55%;top:40%;width:70px;height:70px;border-radius:10px;background:#ffcc66}
-.tag{position:absolute;left:12%;top:10%;padding:8px 12px;border-radius:6px;background:#ff66cc;color:#111;font-weight:700}
-.wide{height:4px;width:3000px;background:#ff3333}
-@keyframes slide{from{transform:translateX(0)}to{transform:translateX(420%)}}
-.sq{animation:slide 3s linear infinite alternate}
-.stage.hb-paused .sq{animation-play-state:paused}
-@keyframes rise{from{opacity:0;transform:translateY(40px)}to{opacity:1;transform:none}}
-.stage.go .box{animation:rise .8s ease both}
-@keyframes reveal{from{opacity:0}to{opacity:1}}
-.stage.delay.go .box{animation:reveal .5s ease .9s both}
-@keyframes wander{from{transform:translateX(0)}to{transform:translateX(60px)}}
-.wander{animation:wander 1.7s linear infinite}
-.cap{position:absolute;padding:4px 8px;border-radius:6px;background:#111;color:#fff;font-weight:600;line-height:1.2;white-space:nowrap}
-.box.slides{transition:transform .6s ease}
-.stage.go-do .box{transform:translateX(160px)}
-.badge{position:absolute;right:10%;top:12%;padding:6px 10px;border-radius:6px;background:#3c3;color:#111;font-weight:700}
-.stagebtn{position:absolute;right:8px;bottom:8px}
-canvas.dots{position:absolute;inset:0;width:100%;height:100%}
-.snapbox{scroll-snap-type:y mandatory}
-.snapscene .pinlayer{position:sticky;top:0;height:0;z-index:2}
-.snapscene .sec{height:240px;scroll-snap-align:start;display:grid;place-items:center;font-size:28px;border-bottom:1px solid #333}
-.stage.short .sec{height:200px}
-`;
-
-const SCRIPT = `
-(function () {
- var D = __DEFECTS__;
- var stage = document.querySelector('.stage');
- var scroller = document.querySelector('[data-hb-scroller]') || stage;
- var kind = document.body.getAttribute('data-hb-kind');
- var reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
- var tag = stage.querySelector('.tag'), twin = stage.querySelector('.twin'), wide = document.querySelector('.wide');
- var notes = document.querySelectorAll('[data-hb-for]');
- var buttons = document.querySelectorAll('.hb-modes [data-hb-mode]');
- var auto = false, raf = 0, last = null;
- function stopAuto() { cancelAnimationFrame(raf); raf = 0; auto = false; last = null; scroller.removeAttribute('data-hb-autoscrolling'); }
- // Labels (data-hb-caption) for the modes, each [left, top, words, size in px]: made once, shown in their own mode only
- if (D.caps) Object.keys(D.caps).forEach(function (m) {
- D.caps[m].forEach(function (c) {
- var el = document.createElement('span');
- el.className = 'cap cap-' + m; el.setAttribute('data-hb-caption', ''); el.hidden = true;
- el.style.left = c[0]; el.style.top = c[1]; el.style.fontSize = c[3] + 'px'; el.textContent = c[2];
- stage.appendChild(el);
- });
- });
- function draw(mode) {
- if (D.noReturn && mode === 'normal') return;
- var m = D.same && mode === 'compare' ? 'inside' : mode;
- tag.hidden = !(m === 'inside' && D.noChange !== 'inside');
- twin.hidden = !(m === 'compare' && D.noChange !== 'compare');
- if (wide) wide.hidden = D.overflow !== mode;
- stage.querySelectorAll('.cap').forEach(function (el) { el.hidden = !el.classList.contains('cap-' + mode); });
- if (D.label) stage.setAttribute('aria-label', D.label[mode]);
- if (D.dup && mode === 'compare' && !stage.querySelector('.dupcopy')) {
- var copy = document.createElement('span'); copy.id = 'dup'; copy.className = 'dupcopy'; copy.hidden = true; stage.appendChild(copy);
- }
- if (D.relayout) stage.classList.toggle('short', mode === 'inside');
- }
- if (D.label) stage.setAttribute('aria-label', D.label.normal);
- buttons.forEach(function (b) {
- b.addEventListener('click', function () {
- var mode = b.getAttribute('data-hb-mode');
- buttons.forEach(function (x) { var on = x === b; x.classList.toggle('on', on); x.setAttribute('aria-pressed', on ? 'true' : 'false'); });
- if (D.noMark !== mode) stage.setAttribute('data-hb-mode', mode);
- if (!(D.normalLeavesNote && mode === 'normal')) {
- notes.forEach(function (n) {
- var mine = n.getAttribute('data-hb-for') === mode;
- if (D.otherNote && mode !== 'normal') { if (mine) n.hidden = false; return; }
- n.hidden = !mine || D.noNote === mode;
- });
- }
- if (D.lateNormal && mode === 'normal') setTimeout(function () { draw(mode); }, D.lateNormal); else draw(mode);
- if (D.playStops && auto) stopAuto();
- if (D.resetBox) scroller.scrollTop = 0;
- if (D.scrollPage) window.scrollTo(0, 150);
- if (D.focusStage) { stage.setAttribute('tabindex', '-1'); stage.focus(); }
- if (D.focusButton) b.focus();
- document.dispatchEvent(new CustomEvent('hb:mode', { detail: { mode: mode } }));
- // As the shared script does: See inside or Compare plays a plays-once or do-it demo once, never under reduced motion
- if (!reduce && mode !== 'normal') {
- var sel = kind === 'once' ? '[data-hb-replay]' : kind === 'do' ? '[data-hb-demo]' : '';
- var run = sel && document.querySelector(sel);
- if (run) run.click();
- }
- });
- });
- if (D.jsDraw) {
- var drawn = stage.querySelector('.box'), ticking = false;
- var redraw = function () {
- var max = scroller.scrollHeight - scroller.clientHeight, p = max > 0 ? scroller.scrollTop / max : 0;
- drawn.style.transform = 'translateY(' + Math.round(p * 60) + 'px)';
- twin.style.transform = 'translateY(' + Math.round(p * 20) + 'px)';
- ticking = false;
- };
- scroller.addEventListener('scroll', function () { if (!ticking) { ticking = true; requestAnimationFrame(redraw); } }, { passive: true });
- document.addEventListener('hb:mode', redraw);
- redraw();
- }
- if (kind === 'loop') {
- var pause = document.querySelector('[data-hb-pause]');
- var setPaused = function (p) { stage.classList.toggle('hb-paused', p); pause.setAttribute('data-state', p ? 'paused' : 'playing'); pause.textContent = p ? 'Play' : 'Pause'; };
- pause.addEventListener('click', function () { setPaused(pause.getAttribute('data-state') !== 'paused'); });
- setPaused(reduce);
- }
- if (kind === 'scroll') {
- var play = document.querySelector('[data-hb-autoscroll]'), top = document.querySelector('[data-hb-top]');
- var step = function (ts) {
- if (!auto) return;
- var dt = last === null ? 0 : Math.min(ts - last, 50); last = ts;
- var max = scroller.scrollHeight - scroller.clientHeight;
- scroller.scrollTop = Math.min(max, scroller.scrollTop + max / 6000 * dt);
- if (scroller.scrollTop >= max) { stopAuto(); return; }
- raf = requestAnimationFrame(step);
- };
- var startAuto = function () {
- stopAuto();
- if (scroller.scrollTop >= scroller.scrollHeight - scroller.clientHeight - 1) scroller.scrollTop = 0;
- scroller.setAttribute('data-hb-autoscrolling', '');
- auto = true; raf = requestAnimationFrame(step);
- };
- if (play) play.addEventListener('click', startAuto);
- if (top) top.addEventListener('click', function () { stopAuto(); scroller.scrollTop = 0; });
- ['wheel', 'touchstart', 'pointerdown', 'keydown'].forEach(function (t) {
- stage.addEventListener(t, function (e) { if (e.isTrusted) stopAuto(); }, { passive: true });
- });
- if (!reduce) startAuto();
- }
- if (kind === 'once') {
- var replay = document.querySelector('[data-hb-replay]'), loop = document.querySelector('[data-hb-loop]'), slow = document.querySelector('[data-hb-slowmo]');
- var timer = 0;
- var playOnce = function () { stage.classList.remove('go'); void stage.offsetWidth; stage.classList.add('go'); };
- var tick = function () { clearTimeout(timer); if (loop.checked) { playOnce(); timer = setTimeout(tick, 2600); } };
- replay.addEventListener('click', function () { playOnce(); if (loop.checked) { clearTimeout(timer); timer = setTimeout(tick, 2600); } });
- loop.addEventListener('change', function () { if (loop.checked) tick(); else clearTimeout(timer); });
- // a setting change replays the stage 250 ms later, as the shared script does
- document.querySelectorAll('.hb-try .seg button').forEach(function (c) {
- c.addEventListener('click', function () {
- document.querySelectorAll('.hb-try .seg button').forEach(function (x) { x.setAttribute('aria-pressed', x === c ? 'true' : 'false'); });
- setTimeout(playOnce, 250);
- });
- });
- if (reduce) { loop.checked = false; slow.checked = false; loop.disabled = true; slow.disabled = true; playOnce(); }
- else { playOnce(); setTimeout(function () { loop.checked = true; tick(); }, 400); }
- }
- if (kind === 'do') {
- var demo = document.querySelector('[data-hb-demo]'), reset = document.querySelector('[data-hb-reset]');
- var mover = stage.querySelector('.box'), badge = stage.querySelector('.badge'), acted = false, runT = [], badgeT = 0;
- mover.classList.add('slides');
- var stopRun = function () { runT.forEach(clearTimeout); runT = []; stage.classList.remove('go-do'); };
- var endless = function () { setTimeout(endless, 500); };
- // Show me: the box slides across, holds still on a timer, and slides back (about two seconds); with D.endless it also
- // starts a chain of timers that never ends
- demo.addEventListener('click', function (e) {
- if (e.isTrusted) acted = true;
- stopRun();
- stage.classList.add('go-do');
- runT.push(setTimeout(function () { stage.classList.remove('go-do'); }, 600 + (D.hold || 1000)));
- if (D.endless) endless();
- });
- if (reset) reset.addEventListener('click', function () { stopRun(); clearTimeout(badgeT); badge.hidden = true; });
- // As the shared script does: the visitor's own input in the stage goes out as hb:input
- ['pointerdown', 'keydown', 'wheel', 'touchstart', 'click'].forEach(function (t) {
- stage.addEventListener(t, function (e) {
- if (!e.isTrusted) return;
- acted = true;
- document.dispatchEvent(new CustomEvent('hb:input', { detail: { type: t } }));
- }, { capture: true, passive: true });
- });
- // A click in the stage shows a result that goes back by itself on a timer
- stage.addEventListener('click', function (e) {
- if (!e.isTrusted || !D.revert) return;
- badge.hidden = false; clearTimeout(badgeT);
- badgeT = setTimeout(function () { badge.hidden = true; }, D.revert);
- });
- if (!reduce) setTimeout(function () { if (!acted) demo.click(); }, 400);
- }
- // A canvas of dots drawn again, at random, on every resize of the window, even one that leaves the stage as it was
- if (D.resizeCanvas) {
- var cv = document.createElement('canvas'); cv.className = 'dots'; cv.setAttribute('aria-hidden', 'true'); stage.prepend(cv);
- var paint = function () {
- cv.width = stage.clientWidth; cv.height = stage.clientHeight;
- var g = cv.getContext('2d'); g.fillStyle = '#7fd';
- for (var i = 0; i < 60; i++) { g.beginPath(); g.arc(Math.random() * cv.width, Math.random() * cv.height, 3, 0, 7); g.fill(); }
- };
- addEventListener('resize', paint); paint();
- }
-})();
-`;
-
-function player(kind, d) {
- if (kind === 'loop') return '<button type="button" data-hb-pause data-state="playing">Pause</button>';
- if (kind === 'scroll') {
- const html = (d.dropPlay ? '' : '<button type="button" data-hb-autoscroll>Play</button>') + (d.dropTop ? '' : '<button type="button" data-hb-top>Back to top</button>');
- return html || '<span>Nothing to play</span>';
- }
- if (kind === 'once') {
- return '<button type="button" data-hb-replay>Replay</button>'
- + '<label class="hb-switch-row"><input type="checkbox" role="switch" class="hb-switch" data-hb-loop autocomplete="off"><span>Loop</span></label>'
- + '<label class="hb-switch-row"><input type="checkbox" role="switch" class="hb-switch" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>';
- }
- if (kind === 'do') return '<button type="button" data-hb-demo>Show me</button>' + (d.noReset ? '' : '<button type="button" data-hb-reset>Reset</button>');
- return '<span>Nothing to play</span>';
-}
-
-const MODE_BUTTONS = [
- ['normal', 'Normal', ' class="on" aria-pressed="true"'],
- ['inside', 'See inside', ' aria-pressed="false"'],
- ['compare', 'Compare', ' aria-pressed="false"']
-];
-
-function page({ title, kind = '', defects = {}, smallFoot = false, tryChoice = false, rule = '', wrapNotes = false, inner = false, pageTall = false, noWhat = false, snap = false }) {
- const autoplay = kind && kind !== 'loop' ? ' data-hb-autoplay' : '';
- const kindAttr = kind ? ` data-hb-kind="${kind}"` : '';
- const boxClass = ['box', kind === 'loop' ? 'sq' : '', defects.neverRest === 'always' ? 'wander' : ''].filter(Boolean).join(' ');
- const twinClass = ['twin', defects.neverRest === 'compare' ? 'wander' : ''].filter(Boolean).join(' ');
- const stageClass = ['stage', defects.delayReveal ? 'delay' : '', inner ? 'inner' : '', snap ? 'snapbox' : ''].filter(Boolean).join(' ');
- const footStyle = smallFoot ? ' style="min-height:0;height:24px"' : '';
- const dropped = defects.drop || [];
- const modeButtons = MODE_BUTTONS.filter(([m]) => !dropped.includes(m))
- .map(([m, label, extra]) => `<button type="button" data-hb-mode="${m}"${extra}>${label}</button>`).join('\n ');
- const tryHtml = tryChoice
- ? '\n <section class="hb-try"><div class="seg" role="group" aria-label="Speed"><button type="button" aria-pressed="true">Slow</button><button type="button" aria-pressed="false">Fast</button></div></section>'
- : '';
- const extras = (kind === 'do' ? '<span class="badge" hidden>Saved</span>' : '')
- + (defects.stageButton ? `<button type="button" class="stagebtn" aria-label="${defects.stageButton.label}">${defects.stageButton.text}</button>` : '')
- + (defects.dup ? '<span id="dup" hidden></span>' : '');
- let scene;
- if (snap) scene = `<div class="snapscene"><div class="pinlayer"><div class="tag" hidden>Inside</div><div class="${twinClass}" hidden></div></div>${[1, 2, 3, 4, 5].map(n => `<div class="sec">${n}</div>`).join('')}</div>`;
- else if (kind === 'scroll') scene = `<div class="scene tall"><div class="pin"><div class="${boxClass}"></div><div class="tag" hidden>Inside</div><div class="${twinClass}" hidden></div></div></div>`;
- else scene = `<div class="scene"><div class="${boxClass}"></div><div class="tag" hidden>Inside</div><div class="${twinClass}" hidden></div>${extras}</div>`;
- const stageInner = inner ? `<div class="scroller" data-hb-scroller>${scene}</div>` : scene;
- const noteP = `<p data-hb-for="inside" hidden>The inside note.</p>\n <p data-hb-for="compare" hidden>The compare note.</p>`;
- const notesHtml = wrapNotes ? `<div class="wrap">\n ${noteP}\n </div>` : noteP;
- const what = noWhat ? '' : '\n <section class="hb-about"><div class="hb-what-text"><p>A fixture page for the page check.</p></div></section>';
- const spacer = pageTall ? '\n <div style="height:1500px"></div>' : '';
- return `<!doctype html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width,initial-scale=1">
-<title>${title}</title>
-<link rel="icon" href="data:,">
-<style>${CSS}${rule}</style>
-</head>
-<body class="hb"${kindAttr}${autoplay}>
-<nav class="hb-bar" aria-label="Fixture"><a class="hb-home" href="../../../">Home</a><a class="hb-star" href="#">Star</a></nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">Fixture</p>
- <h1>${title}</h1>
- <p class="hb-lede">A fixture page for the page check.</p>
- </header>
- <section class="hb-watch">
- <div class="hb-step-head"><h2>1 · Watch it</h2></div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- ${modeButtons}
- </div>
- <div class="${stageClass}" data-hb-mode="normal">${stageInner}</div>
- <div class="hb-player">${player(kind, defects)}</div>
- <div class="hb-mode-notes" aria-live="polite">
- ${notesHtml}
- </div>
- </section>${tryHtml}
- <section class="hb-prompt-step"><ul class="hb-chips">${tryChoice ? '<li>Speed: Slow</li>' : ''}</ul></section>${what}
- <div class="wide" hidden></div>${spacer}
-</main>
-<footer class="hb-foot"><span>Fixture</span><a href="#"${footStyle}>Source</a><a href="#top"${footStyle}>Back to top</a></footer>
-<script>${SCRIPT.replace('__DEFECTS__', () => JSON.stringify(defects))}</script>
-</body>
-</html>
-`;
-}
-
-const SETS = {
- '90-ok': {
- 'ok-plain': { title: 'OK plain' },
- 'ok-loop': { title: 'OK loop', kind: 'loop' },
- 'ok-scroll': { title: 'OK scroll', kind: 'scroll' },
- 'ok-scroll-inner': { title: 'OK scroll inner', kind: 'scroll', inner: true },
- 'ok-once': { title: 'OK once', kind: 'once' },
- 'ok-once-delay': { title: 'OK once delay', kind: 'once', tryChoice: true, defects: { delayReveal: true } },
- 'ok-latenormal': { title: 'OK late Normal', defects: { lateNormal: 450 } },
- 'ok-focusbutton': { title: 'OK focus on the button', defects: { focusButton: true } },
- 'ok-wrapnote': { title: 'OK wrapped notes', wrapNotes: true, rule: WRAP_RULE },
- 'ok-scroll-js': { title: 'OK scroll, drawn by script on scroll', kind: 'scroll', defects: { jsDraw: true } }
- },
- '91-old': {
- 'bad-marks': { title: 'Bad marks', defects: { noMark: 'inside', noNote: 'compare', overflow: 'compare' } },
- 'bad-pictures': { title: 'Bad pictures', defects: { noChange: 'inside', noReturn: true } },
- 'bad-same': { title: 'Bad same', defects: { same: true } },
- 'bad-playstops': { title: 'Bad play stops', kind: 'scroll', defects: { playStops: true } },
- 'bad-othernote': { title: 'Bad other note', defects: { otherNote: true } },
- 'bad-normal': { title: 'Bad Normal', defects: { noMark: 'normal', normalLeavesNote: true } },
- 'bad-small': { title: 'Bad small', smallFoot: true },
- // was "not a Learn page" (the chips and What it is checks then apply): now a page without What it is
- 'bad-notlearn': { title: 'Bad no What it is', noWhat: true }
- },
- '92-wave-a': {
- 'bad-scrollsbox': { title: 'Bad scrolls the box', kind: 'scroll', defects: { resetBox: true } },
- 'bad-focus': { title: 'Bad moves focus', defects: { focusStage: true } },
- 'bad-scrollspage': { title: 'Bad scrolls the page', pageTall: true, defects: { scrollPage: true } },
- 'bad-clipnote': { title: 'Bad clipped note', wrapNotes: true, rule: OLD_RULE },
- 'bad-nobutton-a': { title: 'Bad no button A', defects: { drop: ['inside', 'normal'] } },
- 'bad-nobutton-b': { title: 'Bad no button B', defects: { drop: ['compare'] } },
- 'bad-scroll-nobuttons': { title: 'Bad scroll no buttons', kind: 'scroll', defects: { dropPlay: true, dropTop: true } },
- 'bad-neverrest-compare': { title: 'Bad never rest compare', defects: { neverRest: 'compare' } },
- 'bad-neverrest-always': { title: 'Bad never rest always', defects: { neverRest: 'always' } }
- },
- '93-phase0': {
- 'ok-do-revert': { title: 'OK do-it page whose result goes back on a timer', kind: 'do', defects: { revert: 2000, hold: 1000 } },
- 'ok-loop-resize': { title: 'OK paused loop that redraws on every resize', kind: 'loop', defects: { resizeCanvas: true } },
- 'ok-snap': { title: 'OK scroll snapping', kind: 'scroll', snap: true },
- 'ok-captions': { title: 'OK labels, names and ids', defects: {
- caps: { inside: [['8%', '10%', 'Inside label', 13], ['8%', '70%', 'Another label', 13]], compare: [['8%', '10%', 'Without', 13], ['55%', '10%', 'With', 13]] },
- label: { normal: 'A fixture picture', inside: 'The fixture picture taken apart', compare: 'The fixture picture twice, without and with' },
- stageButton: { text: 'Start now', label: 'Start now, the fixture demo' } } },
- // a control whose only visible sign is a symbol, named in words: a symbol is not a word
- 'ok-glyph-name': { title: 'OK sign named in words', defects: { stageButton: { text: '×', label: 'Close the panel' } } },
- 'bad-caption-small': { title: 'Bad small label', defects: { caps: { inside: [['8%', '10%', 'Tiny label', 10]] } } },
- 'bad-caption-outside': { title: 'Bad label outside the stage', defects: { caps: { inside: [['8%', '-40px', 'Outside label', 13]] } } },
- 'bad-caption-overlap': { title: 'Bad labels on each other', defects: { caps: { inside: [['8%', '10%', 'First label', 13], ['10%', '12%', 'Second label', 13]] } } },
- 'bad-caption-many': { title: 'Bad five labels', defects: { caps: { inside: [5, 23, 41, 59, 77].map((top, i) => ['4%', `${top}%`, `Label ${i + 1}`, 13]) } } },
- 'bad-dup-id': { title: 'Bad copy keeps an id', defects: { dup: true } },
- 'bad-label-same': { title: 'Bad name stays the same', defects: { label: { normal: 'A fixture picture', inside: 'A fixture picture', compare: 'A fixture picture' } } },
- 'bad-name': { title: 'Bad control name', defects: { stageButton: { text: 'Start now', label: 'Open the menu' } } },
- 'bad-snap-relayout': { title: 'Bad mode that changes the snapping content', kind: 'scroll', snap: true, defects: { relayout: true } },
- 'bad-do-endless': { title: 'Bad run that never ends', kind: 'do', defects: { endless: true, noReset: true } },
- 'bad-box-size': { title: 'Bad Compare that makes the box taller', rule: '.stage[data-hb-mode="compare"]{height:300px}' }
- }
-};
-
-rmSync(join(OUT, 'animations'), { recursive: true, force: true });
-mkdirSync(join(OUT, 'tools'), { recursive: true });
-copyFileSync(join(WT, 'tools', 'check-pages.mjs'), join(OUT, 'tools', 'check-pages.mjs'));
-for (const [cat, pages] of Object.entries(SETS)) {
- for (const [slug, opts] of Object.entries(pages)) {
- mkdirSync(join(OUT, 'animations', cat, slug), { recursive: true });
- writeFileSync(join(OUT, 'animations', cat, slug, 'index.html'), page(opts));
- }
- console.log(`${cat}: ${Object.keys(pages).length} pages`);
-}
-console.log(`check script from ${WT}`);
-```
-
-- [ ] **Step 3: Run the fixtures with today's check and see the new rules go unchecked**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; FX=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/fixtures; mkdir -p $RUN/scratch/sic-00c/sicfx && node $FX/sic-gen.mjs $RUN/scratch/sic-00c/sicfx $REPO/.claude/worktrees/sic-00c`
-Expected: `90-ok: 10 pages`, `91-old: 8 pages`, `92-wave-a: 9 pages`, `93-phase0: 15 pages`.
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-13-see-inside-compare/scratch/sic-00c/sicfx && python -m http.server 8809 --bind 127.0.0.1`
-Run, as a background command (a fixture category takes about ten minutes): `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; S=$RUN/scratch/sic-00c; node $RUN/slot.mjs run sic-00c-before -- node $S/sicfx/tools/check-pages.mjs --base http://127.0.0.1:8809 --out $S/out-before animations/93-phase0 > $S/93-before.log 2>&1`
-When it has ended (the log's last line is `Screenshots: …`), run `grep -E "^(ok|FAIL)" $S/93-before.log | cut -c1-90`.
-Expected: `bad-caption-small`, `bad-caption-outside`, `bad-caption-overlap`, `bad-caption-many`, `bad-dup-id`, `bad-label-same`, `bad-name`, `bad-do-endless` and `bad-box-size` print `ok` at every setup (their rules do not exist yet); `ok-do-revert` prints `FAIL` at `desktop` and `phone-reduced` (the 250 ms rest catches the run's hold or the result that goes back on its timer); `bad-snap-relayout` prints `FAIL` at `desktop` and `phone-reduced` (the box rule of fix wave A). Keep the log for the review.
-
-- [ ] **Step 4: Implement the check**
-
-In `tools/check-pages.mjs`:
-
-(a) Replace the header paragraph from `// A page with the mode switch (Normal, See inside, Compare): at every setup each mode marks the stage, shows its own note` down to `// mid-movement.` with:
-
-```js
-// A page with the mode switch (Normal, See inside, Compare): at every setup each mode marks the stage, shows its own note
-// (one that is on show: rendered, not clipped away) and no other (Normal shows none) and overflows nothing, a mode change
-// moves neither the page nor the keyboard focus (the pressed button itself may take it), and the box keeps its size and the
-// player bar its place under it (a stage that grows with its text, hb-grow, aside). In each mode the labels and half names
-// (data-hb-caption) on show must be inside the stage, at least 12px as drawn, clear of each other and at most six (four on
-// phones); no id may be used twice (a copy that kept one); a control in the stage named with aria-label must say its visible
-// words; and where the page names its picture (an aria-label on the stage, or on its canvas or picture), each mode must name it
-// differently. A plays-once page is tried with Loop off and a do-it page from rest (Reset where it has one). On both, except under
-// reduced motion, a press of See inside or Compare plays the demo once (the shared script presses Replay or Show me), and the
-// check waits for that run to end (no timer of the page set for 6 s or less still waiting, no animation on the stage running
-// apart from endless ones) and then for the stage to rest before it looks. Only setTimeout timers and animations are seen: a run
-// driven by a frame loop or by setInterval shows only as a stage that changes, so a pause of 750 ms or more inside it would pass
-// for rest (a run holds its pauses with setTimeout). The stage is at rest when it has not changed for 750 ms. The whole Watch
-// step (its heading, the switch, the stage, the player bar and the notes) is saved as a screenshot of See inside and of Compare
-// (Normal's is the setup's own screenshot); a mode button the page lacks is named. At the desktop and
-// reduced-motion setups, with the stage at rest (a scroll page with its box at the middle of its range, a loop paused), the box
-// does not scroll either, See inside and Compare must each change the stage and differ from each other, Normal must bring the
-// first picture back, and on a scroll page Play must keep scrolling through a mode change. Each mode's screenshot is taken after
-// that mode's own picture checks, by scrolling the page until the step shows and taking it with plain clips (in parts, joined,
-// where it is taller than the window), so the window is not resized and no scroll box moves: the Normal check that follows sees
-// the page as it was. Chrome's capture beyond the viewport, which resizes the window for a moment and sends every scroll box to
-// the top (a page can redraw itself for that), is only the last resort for a step that cannot be made to show. Either way each of
-// those two screenshots must show the stage as it was seen at rest in that mode (the stage is cut out of it and compared, and the
-// screenshot taken again, after putting the box back, up to three more times if it differs). A stage that never comes to rest is
-// a problem of its own, and nothing is compared with a frame taken in mid-movement.
-```
-
-(b) After the `STARS` constant (it ends with `})()\`;` after `try { localStorage.setItem('gh-star-count', …); } catch {}`) add the block below; the blank line before `const sleep` stays in place. (Not after `RECORD`: Famous effects rewrites the first line of the `STARS` comment, and a block there would meet that change in the merge.)
-
-```js
-
-// Runs at the start of every document, before the page's own scripts: keeps count of the page's timers that are still waiting
-// (those set for 6 s or less: a longer one is not part of a run), so the mode check can tell when a run has ended.
-const TIMERS = `(() => {
- const waiting = new Set(), set = window.setTimeout, clear = window.clearTimeout, clearI = window.clearInterval;
- window.setTimeout = function (fn, ms, ...rest) {
- if (typeof fn !== 'function') return set.apply(window, arguments);
- const id = set.call(window, function () { waiting.delete(id); return fn.apply(this, arguments); }, ms, ...rest);
- if (!(ms > 6000)) waiting.add(id);
- return id;
- };
- window.clearTimeout = function (id) { waiting.delete(id); return clear.call(window, id); };
- window.clearInterval = function (id) { waiting.delete(id); return clearI.call(window, id); };
- window.__hbWaiting = () => waiting.size;
-})()`;
-```
-
-(c) Replace the whole `settledShot` function and its comment (`// Waits 3 s for the demo to settle, then (for slower demos) until two captures 250ms apart match.` … `}`) with:
-
-```js
-// The stage once it has come to rest: after waiting `wait` ms, captures 250 ms apart until the picture has stayed the same for
-// 750 ms (four captures in a row), for up to 10 s. still says whether it did; when it did not, shot is only the last frame of a
-// movement that goes on and is not worth comparing with anything.
-async function restShot(wait = 0) {
- if (wait) await sleep(wait);
- let shot = await stageShot(), same = 0;
- for (const end = Date.now() + 10000; Date.now() < end;) {
- await sleep(250);
- const next = await stageShot();
- if (next !== shot) { shot = next; same = 0; continue; }
- if (++same === 3) return { shot, still: true };
- }
- return { shot, still: false };
-}
-```
-
-In `movementProblems` replace `const settled = await settledShot();` with `const settled = (await restShot(3000)).shot;` and `const settledAgain = await settledShot();` with `const settledAgain = (await restShot(3000)).shot;`.
-
-Delete the whole `stillShot` function and its two-line comment (`// The stage once it has stopped changing: captures 250 ms apart until two in a row match (up to 4 s). still says whether it` … `}`).
-
-(d) After the `watchStepShot` function (before the comment `// Pages with the mode switch: see the header comment.`) add:
-
-```js
-// After a press that may start a run (Replay or Show me, pressed by the shared script after a mode press, or Reset): waits until
-// no timer of the page set for 6 s or less is waiting (TIMERS counts them) and no animation on the stage runs (one that never
-// ends, such as a blinking caret, does not count), three looks in a row 100 ms apart, for up to 12 s. A run often holds still
-// on a timer between two moves, so a stage that has not changed for a while is not yet a run that has ended. A frame loop or a
-// setInterval is not seen here: such a run is waited for only by restShot, so its pauses must be setTimeout holds. Says whether
-// it ended.
-async function waitForRun() {
- const calm = () => evaluate(`(() => {
- const stage = document.querySelector('.hb-page .stage');
- const busy = document.getAnimations().some(a => {
- const t = a.effect && a.effect.target;
- return a.playState === 'running' && t && stage.contains(t) && a.effect.getComputedTiming().endTime !== Infinity;
- });
- return !busy && (window.__hbWaiting ? window.__hbWaiting() : 0) === 0;
- })()`);
- let quiet = 0;
- for (const end = Date.now() + 12000; Date.now() < end; await sleep(100)) {
- quiet = (await calm()) ? quiet + 1 : 0;
- if (quiet === 3) return true;
- }
- return false;
-}
-
-// The name the page gives its picture (the stage's aria-label, else its canvas's or picture's), or null where it gives none.
-const pictureName = () => evaluate(`(() => {
- const stage = document.querySelector('.hb-page .stage');
- const named = stage.hasAttribute('aria-label') ? stage : stage.querySelector('canvas[aria-label], [role="img"][aria-label], svg[aria-label]');
- return named ? named.getAttribute('aria-label') : null;
-})()`);
-
-// The labels and half names (data-hb-caption) of the mode on show: every one that is drawn must be inside the stage, at least
-// 12px as drawn (its smallest text, scaled as it is drawn) and clear of the others, and there are at most six (four on phones).
-// No id may be used twice on the page (a copy that kept one), and a control in the stage that is named with aria-label must say
-// its visible words. label names the mode in each problem.
-async function captionProblems(label) {
- const found = await evaluate(`(() => {
- const stage = document.querySelector('.hb-page .stage'), s = stage.getBoundingClientRect(), out = [];
- const drawn = el => el.getClientRects().length > 0 &&
- el.checkVisibility({ opacityProperty: true, visibilityProperty: true, checkOpacity: true, checkVisibilityCSS: true });
- const words = el => (el.textContent || '').replace(/\\s+/g, ' ').trim().slice(0, 40);
- const size = el => {
- const texts = [el, ...el.querySelectorAll('*')].filter(n => [...n.childNodes].some(c => c.nodeType === 3 && c.textContent.trim()));
- return Math.min(...texts.map(n => {
- const r = n.getBoundingClientRect(), own = n instanceof SVGGraphicsElement ? n.getBBox().height : n.offsetHeight;
- return parseFloat(getComputedStyle(n).fontSize) * (own > 0 ? r.height / own : 1);
- }));
- };
- const caps = [...stage.querySelectorAll('[data-hb-caption]')].filter(drawn).map(el => ({ el, r: el.getBoundingClientRect() }));
- const most = innerWidth <= 600 ? 4 : 6;
- if (caps.length > most) out.push(caps.length + ' labels (at most ' + most + ' here)');
- for (const { el, r } of caps) {
- if (r.left < s.left - 1 || r.right > s.right + 1 || r.top < s.top - 1 || r.bottom > s.bottom + 1) out.push('the label "' + words(el) + '" is not inside the stage');
- const px = size(el);
- if (px < 11.95) out.push('the label "' + words(el) + '" is drawn at ' + px.toFixed(1) + 'px (at least 12px)');
- }
- for (let i = 0; i < caps.length; i++) for (let j = i + 1; j < caps.length; j++) {
- const a = caps[i], b = caps[j];
- if (a.el.contains(b.el) || b.el.contains(a.el)) continue;
- if (a.r.left < b.r.right - 1 && b.r.left < a.r.right - 1 && a.r.top < b.r.bottom - 1 && b.r.top < a.r.bottom - 1) out.push('the labels "' + words(a.el) + '" and "' + words(b.el) + '" overlap');
- }
- const ids = [...document.querySelectorAll('[id]')].map(e => e.id), twice = [...new Set(ids.filter((id, i) => ids.indexOf(id) !== i))];
- if (twice.length) out.push('ids used twice: ' + twice.join(', '));
- const wordsOf = t => (t || '').toLowerCase().replace(/[^\\p{L}\\p{N}]+/gu, ' ').trim();
- for (const c of stage.querySelectorAll('button, a[href], input, select, textarea, [role="button"], [role="link"], [role="switch"], [role="checkbox"], [role="tab"]')) {
- if (!c.getClientRects().length || c.closest('[inert], [aria-hidden="true"]')) continue;
- // a form field's value is not its label; only an input button shows its words as its value
- const shown = c.matches('input[type="button"], input[type="submit"], input[type="reset"]') ? c.value : c.matches('input, select, textarea') ? '' : c.innerText;
- const own = wordsOf(c.getAttribute('aria-label')), seen = wordsOf(shown);
- if (own && seen && !own.includes(seen)) out.push('the control "' + shown.replace(/\\s+/g, ' ').trim().slice(0, 40) + '" is named "' + c.getAttribute('aria-label') + '", which leaves out its visible words');
- }
- return out;
- })()`);
- return found.map(p => `${label}: ${p}`);
-}
-```
-
-(e) Replace the comment above `async function modeProblems(name, setup, kind) {` (the three lines that start `// Pages with the mode switch: see the header comment.`) with:
-
-```js
-// Pages with the mode switch: see the header comment. name and setup name the screenshots; kind is the page kind. The page is
-// left in Normal and, on a plays-once page, with Loop off; at the desktop and reduced-motion setups a loop is also left paused
-// and a scroll page with Play stopped and the box at the top.
-```
-
-Inside `modeProblems` keep everything from its first line through the end of `const capture = async (mode, expected) => { … };` exactly as it is, except `look` and its comment (from `// What the page shows now:` to the `})()\`);` that ends `look`), which become:
-
-```js
- // What the page shows now: the mark on the stage, the notes on show (by the mode each belongs to; a note counts only when the
- // box around the notes is rendered, taller than 1px, not clipped away), any sideways overflow, the box's height and how far
- // below its top the player bar starts (and whether the box grows with its text, hb-grow), and what the last press changed: the
- // page's scroll, the box's scroll, and keyboard focus (named when it went anywhere but to the pressed button).
- const look = () => evaluate(`(() => {
- const was = window.__hbBefore, a = document.activeElement, wrap = document.querySelector('.hb-mode-notes'), box = ${BOX};
- const stage = document.querySelector('.hb-page .stage'), bar = document.querySelector('.hb-player'), s = stage.getBoundingClientRect();
- const name = el => el.tagName.toLowerCase() + (el.id ? '#' + el.id : '') + (el.getAttribute('class') ? '.' + el.getAttribute('class').split(' ')[0] : '');
- const rendered = !!wrap && wrap.getBoundingClientRect().height > 1;
- return {
- mode: document.querySelector('.hb-page .stage').getAttribute('data-hb-mode'),
- overflow: document.documentElement.scrollWidth > document.documentElement.clientWidth + 1,
- notes: rendered ? [...wrap.querySelectorAll('[data-hb-for]:not([hidden])')].map(n => n.getAttribute('data-hb-for')) : [],
- stageH: Math.round(s.height),
- barTop: bar ? Math.round(bar.getBoundingClientRect().top - s.top) : null,
- grow: stage.classList.contains('hb-grow'),
- page: !!was && (scrollX !== was.x || scrollY !== was.y),
- box: !!was && !!box && Math.abs(box.scrollTop - was.top) >= 1,
- focus: was && a && a !== was.focus && a !== was.button ? name(a) : ''
- };
- })()`);
-```
-
-Replace everything after `capture` (from `const deep = !!(setup.moves || setup.reduce);` down to, but not including, the function's closing `}`) with:
-
-```js
- const deep = !!(setup.moves || setup.reduce);
- // A press of See inside or Compare on a plays-once or do-it page also plays the demo once (the shared script presses Replay or
- // Show me), except under reduced motion: at every setup the check then waits for that run to end and for the stage to rest.
- const runs = (kind === 'once' || kind === 'do') && !setup.reduce;
- // The pictures are compared at the deep setups, except for a scroll page with no Back to top button: its box cannot be
- // brought to the top, so nothing is compared there (the Play check below names the missing button).
- let pictures = deep;
- if (deep) {
- if (kind === 'scroll') pictures = await evaluate(`(() => { const t = document.querySelector('[data-hb-top]'); if (t) t.click(); return !!t; })()`);
- if (kind === 'loop') await evaluate(`(() => { const p = document.querySelector('[data-hb-pause]'); if (p && p.getAttribute('data-state') !== 'paused') p.click(); })()`);
- }
- // A plays-once page is tried with Loop off at every setup, so each play ends; a do-it page from rest, with Reset where it has
- // one. Whatever still runs then (the last play, the run on arrival, a result that goes back on a timer) is waited for.
- if (kind === 'once') await evaluate(`(() => { const l = document.querySelector('[data-hb-loop]'); if (l && l.checked) l.click(); })()`);
- if (kind === 'do') await evaluate(`(() => { const r = document.querySelector('[data-hb-reset]'); if (r) r.click(); })()`);
- if ((kind === 'once' || kind === 'do') && !(await waitForRun())) problems.push('the demo does not come to rest before the modes are tried (a timer or an animation of the page keeps going for 12 s)');
- // A scroll page is tried with its box at the middle of its range: there a scroll-driven effect shows something, a mode change
- // that sends the box back to the top or draws for the top is seen, and Compare shows its difference in the screenshot.
- if (pictures && kind === 'scroll') await evaluate(`(() => { const b = ${BOX}; b.scrollTo({ top: (b.scrollHeight - b.clientHeight) / 2, behavior: 'instant' }); })()`);
- // A press must not scroll the page or the box, or move keyboard focus (the box is only watched where it is at rest).
- const unmoved = (label, now) => {
- if (now.page) problems.push(`${label}: the page scrolled`);
- if (pictures && now.box) problems.push(`${label}: the box scrolled`);
- if (now.focus) problems.push(`${label}: keyboard focus moved to ${now.focus}`);
- };
- // The first picture is the stage at rest. A stage that never comes to rest is said so, and then no picture is compared with it.
- let first = null;
- if (pictures) {
- const rest = await restShot();
- if (rest.still) first = rest.shot;
- else problems.push('the stage does not come to rest before the modes are tried');
- restTop = await evaluate(`(() => { const b = ${BOX}; return b ? b.scrollTop : 0; })()`);
- }
- // Normal before any press: the box's size and where the player bar starts below it. No mode may change either (ruling 4: the
- // box keeps its size and nothing under it moves); a stage that grows with its text (hb-grow) is left out.
- const normal = await look();
- const sized = (label, now) => {
- if (normal.grow) return;
- if (now.stageH !== normal.stageH) problems.push(`${label}: the box changes size (${now.stageH}px, not ${normal.stageH}px)`);
- else if (now.barTop !== normal.barTop) problems.push(`${label}: the player bar moves (${now.barTop}px below the top of the box, not ${normal.barTop}px)`);
- };
- const shots = {}, named = {};
- for (const mode of ['inside', 'compare']) {
- const label = labels[mode];
- await settleBox();
- if (!(await press(mode))) continue;
- await sleep(700);
- const now = await look();
- if (now.mode !== mode) problems.push(`${label}: the stage is not marked data-hb-mode="${mode}"`);
- if (now.overflow) problems.push(`${label}: horizontal overflow`);
- if (!now.notes.includes(mode)) problems.push(`${label}: its note is not shown`);
- if (now.notes.some(n => n !== mode)) problems.push(`${label}: the other note is still shown`);
- unmoved(label, now);
- sized(label, now);
- if (runs && !(await waitForRun())) problems.push(`${label}: the run it started does not end within 12 s`);
- if (pictures || runs) {
- const rest = await restShot();
- if (!rest.still) problems.push(`the stage does not come to rest in ${label}`);
- else if (pictures) {
- shots[mode] = rest.shot;
- if (first && await samePicture(rest.shot, first)) problems.push(`${label} does not change the stage`);
- }
- }
- problems.push(...await captionProblems(label));
- named[mode] = await pictureName();
- await capture(mode, shots[mode]);
- }
- if (shots.inside && shots.compare && await samePicture(shots.inside, shots.compare)) problems.push('See inside and Compare show the same picture');
- await settleBox();
- if (await press('normal')) {
- // Only the pictures need the wait; the marks, the notes and the overflow are there at once.
- if (pictures) await sleep(700);
- const now = await look();
- if (now.mode !== 'normal') problems.push('Normal: the stage is not marked data-hb-mode="normal"');
- if (now.overflow) problems.push('Normal: horizontal overflow');
- if (now.notes.length) problems.push('Normal: a note is still shown');
- unmoved('Normal', now);
- sized('Normal', now);
- if (pictures) {
- const rest = await restShot();
- if (!rest.still) problems.push('the stage does not come to rest in Normal');
- else if (first && !(await samePicture(rest.shot, first))) problems.push('Normal does not bring the first picture back');
- }
- problems.push(...await captionProblems('Normal'));
- named.normal = await pictureName();
- }
- // Where the page names its picture, each mode names it differently, so a screen reader hears what each one shows.
- if (typeof named.normal === 'string') {
- for (const [a, b] of [['normal', 'inside'], ['normal', 'compare'], ['inside', 'compare']]) {
- if (typeof named[a] === 'string' && named[a] === named[b]) problems.push(`the picture's name is the same in ${labels[a]} and ${labels[b]}: "${named[a]}"`);
- }
- }
- // Play keeps scrolling when the mode changes (Play still works under reduced motion, so this runs there too).
- if (deep && kind === 'scroll') {
- const have = await evaluate(`({ play: !!document.querySelector('[data-hb-autoscroll]'), top: !!document.querySelector('[data-hb-top]') })`);
- if (!have.play) problems.push('no Play button');
- if (!have.top) problems.push('no Back to top button');
- if (have.play && have.top) {
- // From the top, so that Play has its whole run ahead of it while the mode changes.
- await evaluate(`document.querySelector('[data-hb-top]').click()`);
- await evaluate(`document.querySelector('[data-hb-autoscroll]').click()`);
- await sleep(400);
- if (await press('inside')) {
- const before = await evaluate(`${BOX}.scrollTop`);
- await sleep(500);
- if (await evaluate(`${BOX}.scrollTop`) <= before) problems.push('changing the mode stops Play');
- }
- await evaluate(`document.querySelector('[data-hb-top]').click()`);
- await press('normal');
- }
- }
- return problems;
-```
-
-(f) In the main block, **before** `await send('Page.addScriptToEvaluateOnNewDocument', { source: RECORD });` add (not after it: Famous effects changes the `STARS` line that follows it):
-
-```js
- await send('Page.addScriptToEvaluateOnNewDocument', { source: TIMERS });
-```
-
-Check: `node --check tools/check-pages.mjs` prints nothing; `grep -n "settledShot\|stillShot" tools/check-pages.mjs` prints nothing.
-Then the merge with the other projects' checks, each on its own (Git for Windows' `git.exe` cannot read `<(…)` paths, and the working file has CRLF, so LF copies in the scratch folder): `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; S=$RUN/scratch/sic-00c; cd $REPO/.claude/worktrees/sic-00c && tr -d '\r' < tools/check-pages.mjs > $S/ours.mjs; git show d3e1786:tools/check-pages.mjs > $S/base.mjs; for b in fx/check fx/frame af/check; do git rev-parse -q --verify $b > /dev/null || continue; git show $b:tools/check-pages.mjs > $S/theirs.mjs; git merge-file -p $S/ours.mjs $S/base.mjs $S/theirs.mjs > /dev/null; echo "$b $?"; done`
-Expected: `fx/check 0`, `fx/frame 0`, `af/check 0` (no conflict; a branch already merged and deleted prints nothing).
-
-- [ ] **Step 5: Run the fixtures with the new check and compare with the expected table**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cp $REPO/.claude/worktrees/sic-00c/tools/check-pages.mjs $RUN/scratch/sic-00c/sicfx/tools/`
-Then start these four runs, each as a background command of its own (`<c>` is `90-ok`, `91-old`, `92-wave-a` and `93-phase0` in turn):
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; S=$RUN/scratch/sic-00c; node $RUN/slot.mjs run sic-00c-<c> -- node $S/sicfx/tools/check-pages.mjs --base http://127.0.0.1:8809 --out $S/out-<c> animations/<c> > $S/<c>.log 2>&1`
-When the four have ended (each log's last line is `Screenshots: …`), run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; S=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare/scratch/sic-00c; for c in 90-ok 91-old 92-wave-a 93-phase0; do echo "$c: $(grep -c '^ok' $S/$c.log) ok, $(grep -c '^FAIL' $S/$c.log) FAIL"; done; grep '^FAIL' $S/93-phase0.log | cut -c1-140`
-Expected:
-
-| Category | Lines | Expected |
-|---|---|---|
-| `90-ok` | 60 | 60 `ok`, 0 `FAIL` |
-| `91-old` | 48 | 15 `ok`, 33 `FAIL`: `bad-marks`, `bad-normal`, `bad-notlearn` (`What it is is missing`), `bad-othernote` (6 each); `bad-small` (`phone`, `phone-reduced`, `phone-small`: `small targets:` two footer links 24px tall); `bad-pictures`, `bad-same`, `bad-playstops` (`desktop`, `phone-reduced`) |
-| `92-wave-a` | 54 | 16 `ok`, 38 `FAIL`: `bad-clipnote`, `bad-focus`, `bad-nobutton-a`, `bad-nobutton-b`, `bad-scrollspage` (6 each); `bad-scrollsbox`, `bad-scroll-nobuttons`, `bad-neverrest-compare`, `bad-neverrest-always` (`desktop`, `phone-reduced`) |
-| `93-phase0` | 90 | 37 `ok`, 53 `FAIL`: `ok-do-revert`, `ok-loop-resize`, `ok-snap`, `ok-captions`, `ok-glyph-name` all `ok`; `bad-caption-small` (`See inside: the label "Tiny label" is drawn at 10.0px (at least 12px)`), `bad-caption-outside` (`See inside: the label "Outside label" is not inside the stage`), `bad-caption-overlap` (`See inside: the labels "First label" and "Second label" overlap`), `bad-dup-id` (`Compare: ids used twice: dup`), `bad-label-same` (`the picture's name is the same in Normal and See inside: "A fixture picture"`), `bad-name` (`See inside: the control "Start now" is named "Open the menu", which leaves out its visible words`), `bad-do-endless` (`the demo does not come to rest before the modes are tried (…)`), `bad-box-size` (`Compare: the box changes size (300px, not 240px)`): 6 each; `bad-caption-many` at `phone`, `phone-reduced`, `phone-small` (`See inside: 5 labels (at most 4 here)`); `bad-snap-relayout` at `desktop`, `phone-reduced` (`See inside: the box scrolled`) |
-
-Every page of `90-ok`, `91-old` and `92-wave-a` passes or fails at exactly the setups the pilot's README gives for its faA, faB and faC (its Learn page aside). If a line differs, fix the check, not the fixture, unless the fixture is plainly wrong (then say so in the report). Stop the fixture server when done.
-
-- [ ] **Step 6: Real pages**
-
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00c && python -m http.server 8803 --bind 127.0.0.1`
-Run, as a background command: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-00c && node $RUN/slot.mjs run sic-00c -- node tools/check-pages.mjs --base http://127.0.0.1:8803 --out $RUN/checks/sic-00c animations/01-scroll-based/parallax-scrolling animations/02-entrance-and-exit/fade-in-out animations/03-page-transitions/overlay-wipe animations/04-micro-interactions/magnetic-button animations/07-ambient-background/flow-field home > $RUN/checks/sic-00c.log 2>&1`
-When it has ended: `grep -cE "^ok" $RUN/checks/sic-00c.log` prints `36` and `grep -c "^FAIL" $RUN/checks/sic-00c.log` prints `0`. Expected: 36 `ok` lines (Parallax runs the new mode code; the others run `restShot` in `movementProblems` and the `TIMERS` wrapper, which must change nothing). Stop the server.
-
-- [ ] **Step 7: The fixtures' README**
-
-In `$FX/README.md`, after its first line (the title), add:
-
-```markdown
-
-## 0. The rollout's fixture site (Phase 0, Task 3): `sic-gen.mjs`
-`node sic-gen.mjs <root to build> <worktree with tools/check-pages.mjs>` builds one site root: a copy of that worktree's
-`tools/check-pages.mjs` and four fixture categories under `animations/` (the check no longer has the `learn` target, so the
-fixtures are pages of categories now). Serve the root (`python -m http.server <port> --bind 127.0.0.1`) and run the root's own
-copy of the check on each category, through the slot pool:
-
- node <run folder>/slot.mjs run fixtures -- node <root>/tools/check-pages.mjs --base http://127.0.0.1:<port> --out <folder> animations/90-ok
-
-After changing the check script, copy it into `<root>/tools/` (or build the root again while no server runs in it). Each page's
-inline script stands in for the shared script, ruling 1 included: after See inside or Compare it presses Replay on a plays-once
-page and Show me on a do-it page, not under reduced motion.
-
-Expected with the check of Phase 0 Task 3 (six lines per page, one per setup):
-
-| Category | Pages | Expected |
-|---|---|---|
-| `90-ok` | the ten pages of faA | 60 ok |
-| `91-old` | the eight pages of faB (`bad-small` now has small footer links; `bad-notlearn` is now a page without What it is) | 33 FAIL: `bad-marks`, `bad-normal`, `bad-notlearn`, `bad-othernote` (6 each); `bad-small` (3 phones); `bad-pictures`, `bad-same`, `bad-playstops` (desktop and phone-reduced) |
-| `92-wave-a` | the nine pages of faC | 38 FAIL: `bad-clipnote`, `bad-focus`, `bad-nobutton-a`, `bad-nobutton-b`, `bad-scrollspage` (6 each); `bad-scrollsbox`, `bad-scroll-nobuttons`, `bad-neverrest-compare`, `bad-neverrest-always` (desktop and phone-reduced) |
-| `93-phase0` | `ok-do-revert` (a do-it page whose run holds still for a second and whose result goes back on a timer), `ok-loop-resize` (a paused loop that redraws on every resize), `ok-snap` (a snapping scroll page), `ok-captions` (labels, names and ids done right), `ok-glyph-name` (a control whose only visible sign is ×, named in words), and ten `bad-*` pages, one rule each | 53 FAIL: `bad-caption-small`, `bad-caption-outside`, `bad-caption-overlap`, `bad-dup-id`, `bad-label-same`, `bad-name`, `bad-do-endless`, `bad-box-size` (6 each); `bad-caption-many` (3 phones); `bad-snap-relayout` (desktop and phone-reduced) |
-
-With the check before Phase 0 (`765521a`), `ok-do-revert` fails at desktop and phone-reduced and the nine new-rule `bad-*` pages
-pass: that is the gap Phase 0 closed. The sections below are the history of the pilot's rounds; their roots (faA, faB, faC) use
-the removed `learn` target and run only with the check of `765521a` or older.
-```
-
-- [ ] **Step 8: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00c
-git add tools/check-pages.mjs
-git commit -m "feat: the page check waits for the run a mode press starts, tries do-it pages from rest, counts rest as 750 ms unchanged, and checks every mode's labels, ids and control names and the picture's name"
-```
-(`$FX/sic-gen.mjs` and `$FX/README.md` are git-ignored: name them in the report and the ledger.)
-
-- [ ] **Step 9: Review and merge (coordinator)**
-
-A fresh reviewer gets spec section 4 items 2 to 4 (the check's part), the pilot's final review part 1 Important 3 and part 3 Minor 5, this task, the diff, the four fixture logs and the `93-before.log` of Step 3; they rerun `90-ok` and `93-phase0` themselves (through the pool, as in Step 5 but into their own `$S/review-<c>.log` and `--out $S/out-review-<c>`), serving `$RUN/scratch/sic-00c/sicfx` on 8809 for the rerun (as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-13-see-inside-compare/scratch/sic-00c/sicfx && python -m http.server 8809 --bind 127.0.0.1`) and stopping it after, and confirm each expected line, that `waitForRun` cannot pass a run that holds on a timer, and that pages without the switch take the old path apart from `restShot` in `movementProblems`. Merge after Task 2 and Task 4: `cd $REPO && git merge --no-ff sic/00c -m "Merge Phase 0, Task 3: the mode check's do-it path, run waits, rest and caption checks"`, tests, worktree and branch removed, a ledger line.
-
----
-### Task 4: Switch tests on every page that has the switch, the final gate, and Parallax's notes in two sentences
-
-**Files:**
-- Modify: `tests/pages.test.js` (the mode-switch block, lines 309-325 at `03a00d0`: the `MODES` constant and its `for` loop; one new stylesheet test after it)
-- Modify: `animations/01-scroll-based/parallax-scrolling/index.html` (the two notes in the Watch step; the `NOTES` table's `moving` and `movingFlat.inside` and `stillFlat.compare` strings)
-
-**Interfaces:**
-- Consumes: Task 1's merge (Parallax's See inside note is a plain `<p>`).
-- Produces: `const SWITCHED` (the pages the switch tests cover: today the pages with `data-hb-modes`; at integration the marked line becomes `const SWITCHED = steps;`, the final gate). For every page in `SWITCHED`: the existing template test, plus `<slug>: exactly two notes, See inside then Compare, each one or two sentences` and `<slug>: the page's script listens for hb:mode, and its styles mark modes on the stage only`. One stylesheet test: `on phones the mode switch's own rule outranks the rule for choice buttons, so its three buttons share the row equally`. Tasks 7 to 13 turn these tests on for their page by adding the switch.
-
-- [ ] **Step 1: The lane**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/00d $REPO/.claude/worktrees/sic-00d feat/see-inside-compare`
-Work in `$REPO/.claude/worktrees/sic-00d`.
-
-- [ ] **Step 2: Write the failing tests**
-
-In `tests/pages.test.js` replace the block from the comment `// The mode switch (See inside and Compare), exactly as in the template, between the Watch step's heading and its stage, with` down to the closing `}` of its `for` loop with:
-
-```js
-// The pages the switch tests cover. FINAL GATE: while the rollout runs these are the pages that have the switch; at integration
-// this line becomes `const SWITCHED = steps;`, so an animation page without the switch fails
-// (docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md, section 4, item 5).
-const SWITCHED = steps.filter(d => pageOf(d).includes('data-hb-modes'));
-// The mode switch (See inside and Compare), exactly as in the template, between the Watch step's heading and its stage, with
-// a note for See inside and one for Compare after the player bar, both hidden until their mode is pressed.
-const MODES = '<div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes><button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button><button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button><button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button></div>';
-// The notes box exactly: the See inside note, then the Compare note, each a direct child of the box and hidden at first.
-const NOTES_BOX = /<div class="hb-mode-notes" aria-live="polite"><p data-hb-for="inside" hidden>((?:(?!<\/p>)[\s\S])*)<\/p><p data-hb-for="compare" hidden>((?:(?!<\/p>)[\s\S])*)<\/p><\/div>/;
-const sentencesIn = html => decode(html.replace(/<[^>]+>/g, '')).split(/[.!?](?:\s|$)/).filter(s => s.trim()).length;
-// The index of the bracket that closes the one at `at` in a script (round, square and curly brackets counted together),
-// stepping over strings, template text (its ${…} parts are read as code), comments and regular expressions; -1 when it is
-// never closed.
-function closingOf(src, at) {
- let depth = 0;
- for (let i = at; i < src.length; i++) {
- const c = src[i];
- if (c === '"' || c === "'") {
- for (i++; i < src.length && src[i] !== c; i++) if (src[i] === '\\') i++;
- } else if (c === '`') {
- for (i++; i < src.length && src[i] !== '`'; i++) {
- if (src[i] === '\\') i++;
- else if (src[i] === '$' && src[i + 1] === '{') { i = closingOf(src, i + 1); if (i < 0) return -1; }
- }
- } else if (c === '/' && src[i + 1] === '/') {
- i = src.indexOf('\n', i);
- if (i < 0) return -1;
- } else if (c === '/' && src[i + 1] === '*') {
- i = src.indexOf('*/', i + 2) + 1;
- if (i < 1) return -1;
- } else if (c === '/' && /(?:^|[(,=:[!&|?{};])\s*$/.test(src.slice(Math.max(0, i - 80), i))) {
- // a regular expression: up to its closing slash, past escapes and character classes
- for (i++; i < src.length && src[i] !== '/'; i++) {
- if (src[i] === '\\') i++;
- else if (src[i] === '[') while (++i < src.length && src[i] !== ']') if (src[i] === '\\') i++;
- }
- } else if ('([{'.includes(c)) depth++;
- else if (')]}'.includes(c) && --depth === 0) return i;
- }
- return -1;
-}
-for (const d of SWITCHED) {
- test(`${d.slug}: the mode switch is as in the template, before the stage, with a note for See inside and Compare`, () => {
- const html = pageOf(d), flat = html.replace(/>\s+</g, '><');
- assert.equal(count(html, 'data-hb-modes'), 1, 'one mode switch');
- assert.ok(flat.includes(MODES), 'the mode switch is exactly as in the template');
- const watch = between(flat, '<section class="hb-step hb-watch"', '</section>');
- const at = watch.indexOf(MODES);
- const stageAt = watch.search(/<div class="stage[\s"]/);
- assert.ok(stageAt > -1 && at > watch.indexOf('<div class="hb-step-head">') && at < stageAt, 'between the heading and the stage');
- const notes = between(watch, '<div class="hb-mode-notes" aria-live="polite">', '</div>');
- assert.ok(notes && watch.indexOf(notes) > watch.indexOf('<div class="hb-player">'), 'the notes come after the player bar');
- for (const mode of ['inside', 'compare']) assert.equal(count(notes, `<p data-hb-for="${mode}" hidden>`), 1, `one ${mode} note, hidden at first`);
- for (const [, href] of notes.matchAll(/<a href="([^"]+)"/g)) assert.ok(isDemoDir(path.resolve(d.dir, href)), `note link ${href}`);
- });
-
- test(`${d.slug}: exactly two notes, See inside then Compare, each one or two sentences`, () => {
- const flat = pageOf(d).replace(/>\s+</g, '><');
- const box = between(flat, '<section class="hb-step hb-watch"', '</section>').match(NOTES_BOX);
- assert.ok(box, 'the notes box holds the See inside note and then the Compare note, each a direct child, and nothing else');
- for (const [i, name] of [[1, 'See inside'], [2, 'Compare']]) {
- const n = sentencesIn(box[i]);
- assert.ok(n >= 1 && n <= 2, `the ${name} note has ${n} sentences`);
- }
- });
-
- test(`${d.slug}: the page's script listens for hb:mode, and its styles mark modes on the stage only`, () => {
- const html = pageOf(d);
- const script = [...html.matchAll(/<script>([\s\S]*?)<\/script>/g)].map(m => m[1]).join('\n');
- assert.match(script, /document\.addEventListener\(\s*['"]hb:mode['"]/, 'the page script listens for hb:mode on document');
- // The listener is in place once the script has run: no load or DOMContentLoaded handler holds it, whether written in the call
- // or as a named function (a load listener for something else, such as Scrollspy Navigation's remeasure, is fine)
- const listen = script.search(/document\.addEventListener\(\s*['"]hb:mode['"]/);
- for (const m of script.matchAll(/addEventListener\(\s*['"](?:DOMContentLoaded|load)['"]\s*,\s*([A-Za-z_$][\w$]*)?\s*(\(|=>)?/g)) {
- const name = m[1] && !m[2] && !/^(?:function|async)$/.test(m[1]) ? m[1].replace(/\$/g, '\\$') : '';
- const def = name ? script.search(new RegExp(`function\\s+${name}\\s*\\(|\\b(?:const|let|var)\\s+${name}\\s*=`)) : -1;
- const from = name ? (def > -1 ? script.indexOf('{', def) : -1) : m.index + m[0].indexOf('(');
- if (from < 0) continue;
- const to = closingOf(script, from);
- assert.ok(!(listen > from && listen < (to < 0 ? script.length : to)),
- `the hb:mode listener is not in place at the top level: it waits for the page to load (${m[0].trim()}…)`);
- }
- const style = [...html.matchAll(/<style>([\s\S]*?)<\/style>/g)].map(m => m[1]).join('\n');
- const marked = cssRules(style).flatMap(r => r.selector.split(',').map(s => s.trim())).filter(s => s.includes('data-hb-mode'));
- for (const sel of marked) {
- assert.ok(!/data-hb-mode=["']?normal/.test(sel), `no rule for Normal: ${sel}`);
- assert.match(sel, /\.stage\[data-hb-mode="(?:inside|compare)"\]/, `a mode rule names the stage: ${sel}`);
- }
- });
-}
-
-test("on phones the mode switch's own rule outranks the rule for choice buttons, so its three buttons share the row equally", () => {
- const bare = read(path.join(ROOT, 'assets', 'css', 'demo-page.css')).replace(/\/\*[\s\S]*?\*\//g, '');
- const modes = cssRules(blockOf(bare, '@media(max-width:760px){')).find(r => r.selector === '.hb-page .seg.hb-modes button');
- const seg = cssRules(blockOf(bare, '@media(max-width:600px){')).find(r => r.selector === '.hb-page .seg button');
- assert.ok(modes && /(^|;)\s*flex:\s*1 1 0\s*(;|$)/.test(modes.body), 'up to 760px the mode buttons share their row equally (flex: 1 1 0)');
- assert.ok(seg && /(^|;)\s*flex:/.test(seg.body), 'the phone rule for choice buttons sets flex too');
- assert.ok(outranks(specificity(modes.selector), specificity(seg.selector)), `${modes.selector} must outrank ${seg.selector}`);
-});
-```
-
-- [ ] **Step 3: Run them and see them fail**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00d && node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -E "^✖ |AssertionError"`
-Expected: one failure, `✖ parallax-scrolling: exactly two notes, See inside then Compare, each one or two sentences` (named again under `✖ failing tests:`), with `AssertionError [ERR_ASSERTION]: the See inside note has 3 sentences`. The phone-rule test passes at once (it pins the specificity fix of the pilot); see it fail once by mutation: in `assets/css/demo-page.css` change `.hb-page .seg.hb-modes button{flex:1 1 0;padding:0 6px}` to `.hb-modes button{flex:1 1 0;padding:0 6px}`, run the same command (it fails: `✖ on phones the mode switch's own rule outranks …` with `.hb-modes button must outrank .hb-page .seg button`, or the rule is not found), and undo the change (`git checkout -- assets/css/demo-page.css`).
-
-- [ ] **Step 4: Parallax Scrolling's notes in two sentences, its Compare note naming the halves**
-
-In `animations/01-scroll-based/parallax-scrolling/index.html` replace the two notes with:
-
-```html
- <p data-hb-for="inside" hidden>Inside, the picture is four flat layers: as the box scrolls, the far layers move least and the near grass moves most. Scroll the box or press Play to watch.</p>
- <p data-hb-for="compare" hidden>Without parallax (left), every layer moves the same and the picture looks flat; with parallax (right), each moves its own amount and it looks deep. Scroll the box or press Play to watch.</p>
-```
-
-In the script's `NOTES` table replace `moving` with the same two strings, `movingFlat.inside` and `stillFlat.compare` with two-sentence versions:
-
-```js
- moving: {
- inside: 'Inside, the picture is four flat layers: as the box scrolls, the far layers move least and the near grass moves most. Scroll the box or press Play to watch.',
- compare: 'Without parallax (left), every layer moves the same and the picture looks flat; with parallax (right), each moves its own amount and it looks deep. Scroll the box or press Play to watch.',
- },
-```
-```js
- inside: 'Inside, the picture is four flat layers; Depth is set to Flat, so they all move the same and the picture looks flat. Scroll the box or press Play to watch.',
-```
-(that is `movingFlat.inside`)
-```js
- compare: 'Both sides are shown still, as they stand halfway down the box; Depth is set to Flat, so they match. Pick another Depth in Try it to see the difference.',
-```
-(that is `stillFlat.compare`). The script overwrites the markup at load with `NOTES.moving` (or a variant), so the markup and `NOTES.moving` stay word for word the same.
-
-- [ ] **Step 5: Run all tests**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00d && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)|^✔ parallax-scrolling: (the mode switch is as in the template|exactly two notes|the page's script listens)"`
-Expected: the three switch tests' `✔` lines for Parallax and `ℹ fail 0`.
-
-- [ ] **Step 6: Page check**
-
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00d && python -m http.server 8804 --bind 127.0.0.1`
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-00d && node $RUN/slot.mjs run sic-00d -- node tools/check-pages.mjs --base http://127.0.0.1:8804 --out $RUN/checks/sic-00d animations/01-scroll-based/parallax-scrolling`
-Expected: six `ok` lines; in `01-parallax-scrolling-desktop-compare.png` the note under the stage reads the new Compare sentence. Stop the server.
-
-- [ ] **Step 7: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00d
-git add tests/pages.test.js animations/01-scroll-based/parallax-scrolling/index.html
-git commit -m "test: every page with the switch has two notes of one or two sentences, listens for hb:mode and marks modes on the stage only, behind one final-gate line; Parallax Scrolling's notes now say each view in two sentences"
-```
-
-- [ ] **Step 8: Review and merge (coordinator)**
-
-A fresh reviewer gets spec section 4 item 5, this task and the diff; they confirm the final-gate line is the only switch between "pages with the switch" and "every page", and that each new test fails for the right reason: in the lane worktree they break Parallax's page one way at a time (a third `<p data-hb-for="inside" hidden>` note; a three-sentence Compare note; a rule `.stage[data-hb-mode="normal"] .layer{}`; a rule `[data-hb-mode="inside"] .layer{}`; the `hb:mode` listener wrapped in `document.addEventListener('DOMContentLoaded', () => { … })`), run `node --test tests/pages.test.js`, read the failure, and undo it with `git checkout -- animations/01-scroll-based/parallax-scrolling/index.html`. One change must pass, since the load rule is narrow (Scrollspy Navigation listens for `load` to measure again): `addEventListener('load', () => {});` added after the `hb:mode` listener; undo it the same way. They also confirm Parallax's notes still say what the visitor sees. Then `cd $REPO && git merge --no-ff sic/00d -m "Merge Phase 0, Task 4: the switch tests and the final gate"`, tests, worktree and branch removed, a ledger line.
-
----
-### Task 5: The review kit for any list of pages: stills, clips, Normal before and after, galleries
-
-**Files (all outside the repository, in `$KIT` = `.superpowers/sdd/2026-10-13-learn-pilot/review-kit/`):**
-- Create: `$KIT/kit-lib.mjs` (pure helpers), `$KIT/record.test.mjs` (their tests)
-- Rename: `$KIT/record.mjs` → `$KIT/record-pilot.mjs` (the pilot's kit, kept as it is; its md5 is `16954e07f433b77042dc5702b72dd26a`)
-- Create: `$KIT/record.mjs` (the new kit), assembled from new code and four unchanged slices of `record-pilot.mjs`: lines 81-94 (settings), 110-293 (small helpers, ffmpeg and Chrome, the browser), 397-503 (recording and encoding a clip) and 605-617 (`runClip`)
-- Modify: `$KIT/README.md` (a new section at the top)
-
-**Interfaces:**
-- Consumes: the slot pool (Task 0), the before-pictures server on 8800 (Task 0), `$RUN/first-batch-rulings.json` (Task 0). Ruling 1 as Task 2 builds it (the kit only presses the mode button; on pages of the first batch the shared script plays the demo).
-- Produces: `node $KIT/record.mjs --base <url> [--before <url>] [--out <dir>] [--rulings <file>] [--only stills|clips|before] [--gallery] [--press <selector>]… [--clean] [--timed] [--keep-frames] <page or category folder>…`. `--press` (any number of times) presses those controls in order once each page has loaded, so a run pictures the views under another setting (acceptance line 7); it does not apply to the `--before` comparison. Outputs in `--out`: `stills/<NN>-<slug>-<mode>-<1280|375|375-reduced>.png`, `clips/<NN>-<slug>-clip-<mode>.mp4` and `.webp` (or `.gif`), `before/<NN>-<slug>-<1280|375>-main.png`, `-branch.png`, `-diff.png`, `index.html` (or `gallery-<NN>.html` with `--gallery`), `manifest.json`. Log lines a builder reads: `ok <NN>-<slug>-before-1280 <any> of <total> pixels differ (<visible> visibly)`. Exit code 0 when the run finished (skips are not failures), 1 when an item failed twice, 2 for a bad argument or a site that does not answer.
-
-- [ ] **Step 1: Write the failing tests of the kit's pure helpers**
-
-Create `$KIT/record.test.mjs`:
-
-```js
-// Tests of the review kit's pure helpers: node --test record.test.mjs (from the kit's folder)
-import test from 'node:test';
-import assert from 'node:assert/strict';
-import { fileURLToPath } from 'node:url';
-import { expandPages, shortName, clipPlan, clipCaption, rulingsFor, countDiff, RULINGS } from './kit-lib.mjs';
-
-const ROOT = fileURLToPath(new URL('../../../../', import.meta.url)); // the repository root
-
-test('expandPages takes page and category folders in the order given, each page once', () => {
- const pages = expandPages(ROOT, ['animations/02-entrance-and-exit/fade-in-out', 'animations\\07-ambient-background',
- './animations/02-entrance-and-exit/fade-in-out/index.html']);
- assert.equal(pages[0], 'animations/02-entrance-and-exit/fade-in-out/');
- assert.ok(pages.includes('animations/07-ambient-background/flow-field/'));
- assert.equal(pages.filter(p => p.endsWith('/fade-in-out/')).length, 1);
- assert.deepEqual(pages.slice(1), [...pages.slice(1)].sort(), 'a category folder gives its pages in order');
- assert.throws(() => expandPages(ROOT, ['animations/99-nothing']), /not a page or a category folder/);
-});
-
-test('shortName names a page by its category number and slug', () => {
- assert.equal(shortName('animations/05-text-typography/marquee-ticker/'), '05-marquee-ticker');
-});
-
-test('clipPlan: Normal plays the demo its own way; a mode press plays plays-once and do-it pages by itself; a scroll page then gets Play', () => {
- assert.deepEqual(clipPlan('once', 'normal'), { mode: null, then: 'Replay' });
- assert.deepEqual(clipPlan('do', 'normal'), { mode: null, then: 'Show me' });
- assert.deepEqual(clipPlan('scroll', 'normal'), { mode: null, then: 'Play' });
- assert.deepEqual(clipPlan('loop', 'normal'), { mode: null, then: null });
- assert.deepEqual(clipPlan('once', 'inside'), { mode: 'inside', then: null });
- assert.deepEqual(clipPlan('do', 'compare'), { mode: 'compare', then: null });
- assert.deepEqual(clipPlan('scroll', 'compare'), { mode: 'compare', then: 'Play' });
- assert.match(clipCaption('do', 'inside'), /"See inside" is pressed, and the demo plays once by itself/);
-});
-
-test('rulingsFor names each ruling beside the picture or clip that shows it', () => {
- const flags = { shrinks: ['animations/01-scroll-based/parallax-scrolling/'], mistakes: ['animations/05-text-typography/marquee-ticker/'] };
- const fade = 'animations/02-entrance-and-exit/fade-in-out/', parallax = 'animations/01-scroll-based/parallax-scrolling/', marquee = 'animations/05-text-typography/marquee-ticker/';
- assert.deepEqual(rulingsFor(fade, 'once', 'clip', 'inside', 1280, flags), [1]);
- assert.deepEqual(rulingsFor(fade, 'once', 'clip', 'normal', 1280, flags), []);
- assert.deepEqual(rulingsFor(parallax, 'scroll', 'clip', 'inside', 1280, flags), [2]);
- assert.deepEqual(rulingsFor(marquee, 'loop', 'clip', 'compare', 1280, flags), [3]);
- assert.deepEqual(rulingsFor(marquee, 'loop', 'still', 'compare', 375, flags), [3, 4]);
- for (const n of [1, 2, 3, 4]) assert.match(RULINGS[n], new RegExp(`^Ruling ${n}: `));
-});
-
-test('countDiff counts the pixels that differ at all and those that differ visibly', () => {
- const a = new Uint8ClampedArray([0, 0, 0, 255, 10, 10, 10, 255, 100, 100, 100, 255]);
- const b = new Uint8ClampedArray([0, 0, 0, 255, 12, 10, 10, 255, 200, 100, 100, 255]);
- assert.deepEqual(countDiff(a, b), { any: 2, visible: 1, total: 3 });
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; cd $KIT && node --test record.test.mjs`
-Expected: `Error [ERR_MODULE_NOT_FOUND]: Cannot find module '…kit-lib.mjs'`, then `✖ record.test.mjs` and `ℹ fail 1`.
-
-- [ ] **Step 3: Write the pure helpers**
-
-Create `$KIT/kit-lib.mjs`:
-
-```js
-// Pure helpers of the review kit (record.mjs), kept apart so record.test.mjs can test them without Chrome.
-import { existsSync, readdirSync } from 'node:fs';
-import { join } from 'node:path';
-
-// The pages to picture, as "animations/<category>/<slug>/", from page folders and category folders (a folder with no index.html
-// of its own stands for the page folders in it, sorted), in the order given, each page once.
-export function expandPages(root, args) {
- const out = [];
- for (const arg of args) {
- const p = arg.replace(/\\/g, '/').replace(/^\.?\//, '').replace(/\/?(index\.html)?$/, '/');
- if (existsSync(join(root, p, 'index.html'))) { if (!out.includes(p)) out.push(p); continue; }
- const inside = existsSync(join(root, p)) ? readdirSync(join(root, p), { withFileTypes: true })
- .filter(d => d.isDirectory() && existsSync(join(root, p, d.name, 'index.html'))).map(d => `${p}${d.name}/`).sort() : [];
- if (!inside.length) throw new Error(`${arg} is not a page or a category folder`);
- for (const q of inside) if (!out.includes(q)) out.push(q);
- }
- return out;
-}
-
-// "05-marquee-ticker" for animations/05-text-typography/marquee-ticker/
-export function shortName(page) {
- const [, cat, slug] = page.replace(/\/$/, '').split('/');
- return `${cat.slice(0, 2)}-${slug}`;
-}
-
-// What a clip presses after its moment at rest. Normal: what plays the demo in Normal (Replay, Show me or Play; nothing for a
-// loop, which moves by itself). See inside and Compare: the mode button, which plays a plays-once or do-it page once by itself
-// (ruling 1); a scroll page then gets Play.
-export function clipPlan(kind, mode) {
- const own = { once: 'Replay', do: 'Show me', scroll: 'Play' }[kind] || null;
- if (mode === 'normal') return { mode: null, then: own };
- return { mode, then: kind === 'scroll' ? 'Play' : null };
-}
-export function clipCaption(kind, mode) {
- const label = { inside: 'See inside', compare: 'Compare' }[mode];
- if (mode === 'normal') {
- return { once: 'Replay is pressed: the demo plays once.', do: 'Show me is pressed: the demo plays one example.',
- scroll: 'Play is pressed, and the box scrolls down by itself.', loop: 'It moves by itself.' }[kind] || 'The page as it is.';
- }
- if (kind === 'once' || kind === 'do') return `"${label}" is pressed, and the demo plays once by itself.`;
- if (kind === 'scroll') return `"${label}" is pressed, then Play, and the box scrolls down by itself.`;
- return `"${label}" is pressed, and it goes on moving.`;
-}
-
-export const RULINGS = {
- 1: 'Ruling 1: pressing See inside or Compare plays the animation once by itself (never under reduced motion).',
- 2: 'Ruling 2: where See inside shrinks a movement, a faint outline marks where each moving part started.',
- 3: 'Ruling 3: Compare shows a common mistake beside the right way.',
- 4: 'Ruling 4: on phones the box keeps its size in every mode, Compare included.'
-};
-// The rulings to name beside a picture or clip. what is "clip" or "still", mode its mode, width 1280 or 375; flags
-// { shrinks: [pages], mistakes: [pages] } come from --rulings.
-export function rulingsFor(page, kind, what, mode, width, flags = {}) {
- const out = [];
- if (what === 'clip' && mode !== 'normal' && (kind === 'once' || kind === 'do')) out.push(1);
- if (mode === 'inside' && (flags.shrinks || []).includes(page)) out.push(2);
- if (mode === 'compare' && (flags.mistakes || []).includes(page)) out.push(3);
- if (what === 'still' && mode === 'compare' && width === 375) out.push(4);
- return out;
-}
-
-// How many pixels of two RGBA arrays of the same size differ at all, and how many visibly (by more than 64, summed over red,
-// green and blue, as the page check counts them). record.mjs also runs it inside Chrome, as text.
-export function countDiff(a, b) {
- let any = 0, visible = 0;
- for (let i = 0; i < a.length; i += 4) {
- const d = Math.abs(a[i] - b[i]) + Math.abs(a[i + 1] - b[i + 1]) + Math.abs(a[i + 2] - b[i + 2]);
- if (d > 0) any++;
- if (d > 64) visible++;
- }
- return { any, visible, total: a.length / 4 };
-}
-
-export const KIND_WORDS = { once: 'plays once', do: 'the visitor acts', scroll: 'scroll', loop: 'moves by itself' };
-```
-
-- [ ] **Step 4: Run the tests and see them pass**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; cd $KIT && node --test record.test.mjs`
-Expected: `ℹ tests 5`, `ℹ pass 5`, `ℹ fail 0`.
-
-- [ ] **Step 5: Keep the pilot's kit and write the new parts**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; cd $KIT && md5sum record.mjs && mv record.mjs record-pilot.mjs`
-Expected: `16954e07f433b77042dc5702b72dd26a`. (If it differs, the slices below no longer match: stop and tell the coordinator.)
-
-Create `$KIT/new-a.mjs` (the head):
-
-```js
-#!/usr/bin/env node
-// Review kit: pictures and short clips of any handbook pages for the owner's review, Normal compared with the same page on
-// main, and galleries for the final look. A development tool, not part of the site; it writes only inside its output folder and
-// in the system temp folder (a Chrome profile hb-kit-chrome-* and frame folders hb-kit-frames-*, removed at the end).
-//
-// node record.mjs --base http://127.0.0.1:8731 [--before http://127.0.0.1:8800] [--out DIR] [--rulings FILE] [--clean]
-// [--only stills|clips|before] [--gallery] [--timed] [--keep-frames] <page or category folder>...
-//
-// For each page (its kind is read from its file): nine pictures (Normal, See inside and Compare at 1280x800, at 375x812 and at
-// 375x812 with reduce motion on), each of the Watch step brought into view once the demo has come to rest; three clips at
-// 1280x800 of about seven seconds (a moment at rest, then: Normal plays the demo its own way, with Replay, Show me or Play, or a
-// loop just goes on; See inside and Compare press the mode, which plays a plays-once or do-it page once by itself, and a scroll
-// page then gets Play). With --before (a server of main's pages), Normal at rest on both sites at 1280 and 375, the number of
-// pixels that differ, and the two pictures with the differences painted red. With --gallery, only pictures: Normal, See inside
-// and Compare at 1280 and 375 for every page, one gallery file per category (gallery-NN.html). --rulings names a JSON file
-// { "shrinks": [pages], "mistakes": [pages] } that says beside which pictures and clips rulings 2 and 3 are named. --press
-// <selector>, any number of times, presses those controls in order once each page has loaded (a setting's choice, a switch), to
-// picture the views under another setting; it does not apply to the --before comparison. index.html shows everything with plain
-// captions; manifest.json holds the same as data. Both open from disk.
-// Needs Node 22 or later, the local Chrome (CHROME sets its path) and, for clips, ffmpeg (FFMPEG sets its path; else Python's
-// imageio_ffmpeg, else the PATH). Run it through the slot pool: node <run folder>/slot.mjs run kit -- node record.mjs …
-import { execFileSync, spawn } from 'node:child_process';
-import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { dirname, join, resolve } from 'node:path';
-import { fileURLToPath } from 'node:url';
-import { expandPages, shortName, clipPlan, clipCaption, rulingsFor, countDiff, RULINGS, KIND_WORDS } from './kit-lib.mjs';
-
-const HERE = dirname(fileURLToPath(import.meta.url));
-const ROOT = resolve(HERE, '../../../..');
-const args = process.argv.slice(2);
-function flag(name) {
- const i = args.indexOf(name);
- if (i < 0) return false;
- args.splice(i, 1);
- return true;
-}
-function option(name, fallback) {
- const i = args.indexOf(name);
- if (i < 0) return fallback;
- const value = args[i + 1];
- if (value === undefined || value.startsWith('--')) usage(`${name} needs a value`);
- args.splice(i, 2);
- return value;
-}
-function usage(problem) {
- const text = [
- 'Usage: node record.mjs [--base URL] [--before URL] [--out DIR] [--rulings FILE] [--only stills|clips|before] [--gallery] [--clean] [--timed] [--keep-frames] <page or category folder>...',
- ' --base the served branch to picture (default http://127.0.0.1:8731)',
- ' --before the served main to compare Normal with (python -m http.server 8800 in a detached checkout of main)',
- ' --out where everything goes (default: the out folder next to this script)',
- ' --rulings a JSON file { "shrinks": [pages], "mistakes": [pages] } for the captions of rulings 2 and 3',
- ' --only make only the pictures (stills), the clips, or the Normal comparison (before)',
- ' --gallery only pictures: Normal, See inside and Compare at 1280 and 375, one gallery file per category',
- ' --press SEL press this control once the page has loaded (repeatable, in order), e.g. --press "#speed-seg [data-ms=\'1000\']"',
- ' --clean first remove stills/, clips/, before/, index.html, the galleries and manifest.json from the output folder',
- ' --timed record clips with timed screenshots instead of the screencast',
- ' --keep-frames keep the frame folder of each clip, to find out why a clip looks wrong',
- ' Needs the local Chrome (CHROME sets its path) and, for clips, ffmpeg (FFMPEG sets its path).',
- ].join('\n');
- if (problem) { console.error(`${problem}\n${text}`); process.exit(2); }
- console.log(text);
- process.exit(0);
-}
-if (flag('--help') || flag('-h')) usage();
-const BASE = option('--base', 'http://127.0.0.1:8731').replace(/\/+$/, '');
-const BEFORE = option('--before', '').replace(/\/+$/, '');
-const OUT = resolve(option('--out', join(HERE, 'out')));
-const ONLY = option('--only', '');
-const RULINGS_FILE = option('--rulings', '');
-const GALLERY = flag('--gallery');
-const CLEAN = flag('--clean');
-const FORCE_TIMED = flag('--timed');
-const KEEP_FRAMES = flag('--keep-frames');
-// --press <selector>, any number of times: the controls to press, in order, once a page has loaded
-const PRESSES = [];
-for (let i = args.indexOf('--press'); i >= 0; i = args.indexOf('--press')) {
- if (args[i + 1] === undefined) usage('--press needs a selector');
- PRESSES.push(args[i + 1]);
- args.splice(i, 2);
-}
-const PRESS_NOTE = PRESSES.length ? ` · after pressing ${PRESSES.join(', then ')}` : '';
-if (ONLY && !['stills', 'clips', 'before'].includes(ONLY)) usage('--only is stills, clips or before');
-if (ONLY === 'before' && !BEFORE) usage('--only before needs --before');
-const unknown = args.filter(a => a.startsWith('-'));
-if (unknown.length) usage(`Unknown option: ${unknown.join(' ')}`);
-let PAGES = [];
-try { PAGES = expandPages(ROOT, args); } catch (err) { usage(err.message); }
-if (!PAGES.length) usage('Name at least one page or category folder');
-const FLAGS = RULINGS_FILE ? JSON.parse(readFileSync(RULINGS_FILE, 'utf8')) : {};
-const WANT_STILLS = GALLERY || !ONLY || ONLY === 'stills';
-const WANT_CLIPS = !GALLERY && (!ONLY || ONLY === 'clips');
-const WANT_BEFORE = !GALLERY && !!BEFORE && (!ONLY || ONLY === 'before');
-
-```
-
-Create `$KIT/new-b.mjs` (setups and what the kit looks for; it follows the settings slice):
-
-```js
-
-// ---------- the screen setups and what the kit looks for -------------------------------------------------------------------
-const DESKTOP = { key: '1280', width: 1280, height: 800, scale: 1, mobile: false, reduce: false, short: 'Computer, 1280 wide' };
-const PHONE = { key: '375', width: 375, height: 812, scale: 2, mobile: true, reduce: false, short: 'Phone, 375 wide' };
-const PHONE_REDUCED = { key: '375-reduced', width: 375, height: 812, scale: 2, mobile: true, reduce: true, short: 'Phone, 375 wide, reduce motion on' };
-const MODES = ['normal', 'inside', 'compare'];
-const MODE_LABEL = { normal: 'Normal', inside: 'See inside', compare: 'Compare' };
-// The box that scrolls on a scroll page: the page's marked scroller, else its stage (as the shared page script reads it).
-const BOX = `(document.querySelector('[data-hb-scroller]') || document.querySelector('.hb-page .stage'))`;
-const CLIP_MS = 7000; // a clip lasts about this long; a scroll page's lasts until its box has reached the end
-// Runs at the start of every document: counts the page's timers that are still waiting (as the page check does), so the kit can
-// tell when a run has ended.
-const TIMERS = `(() => {
- const waiting = new Set(), set = window.setTimeout, clear = window.clearTimeout, clearI = window.clearInterval;
- window.setTimeout = function (fn, ms, ...rest) {
- if (typeof fn !== 'function') return set.apply(window, arguments);
- const id = set.call(window, function () { waiting.delete(id); return fn.apply(this, arguments); }, ms, ...rest);
- if (!(ms > 6000)) waiting.add(id);
- return id;
- };
- window.clearTimeout = function (id) { waiting.delete(id); return clear.call(window, id); };
- window.clearInterval = function (id) { waiting.delete(id); return clearI.call(window, id); };
- window.__hbWaiting = () => waiting.size;
-})()`;
-// A page's kind and title, read from its file in this checkout (the same on main and on the branch)
-const fileOf = path => readFileSync(join(ROOT, path, 'index.html'), 'utf8');
-const kindOf = path => (fileOf(path).match(/data-hb-kind="(\w+)"/) || [])[1] || '';
-const titleOf = path => ((fileOf(path).match(/<h1>([^<]*)<\/h1>/) || [])[1] || path).replace(/&amp;/g, '&');
-
-```
-
-Create `$KIT/new-c.mjs` (looking at a page, and what to make; it follows the browser slice):
-
-```js
-
-// ---------- looking at a page --------------------------------------------------------------------------------------------
-// The page must be on the site: ask for its index.html (a folder with no index.html can still answer with a file list).
-const known = new Map();
-async function requirePage(base, path) {
- const key = `${base}/${path}`;
- if (!known.has(key)) {
- known.set(key, (async () => {
- const url = `${base}/${path}index.html`;
- let res = await fetch(url, { method: 'HEAD' });
- if (res.status === 405 || res.status === 501) res = await fetch(url);
- return res.ok ? '' : `the page is not on the site (${url} answers ${res.status})`;
- })().catch(err => `the site did not answer for ${key} (${err.message})`));
- }
- const problem = await known.get(key);
- if (problem) throw new Skip(problem);
-}
-// Opens a page at a screen setup and waits until it has loaded, with its fonts. The timer count runs in every document.
-async function openPage(base, path, setup) {
- const page = await getPage();
- if (!page.timers) { await page.send('Page.addScriptToEvaluateOnNewDocument', { source: TIMERS }); page.timers = true; }
- await page.send('Emulation.setDeviceMetricsOverride', { width: setup.width, height: setup.height, deviceScaleFactor: setup.scale, mobile: setup.mobile });
- await page.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-reduced-motion', value: setup.reduce ? 'reduce' : 'no-preference' }] });
- let off = () => {};
- const loaded = new Promise(done => { off = page.on(msg => { if (msg.method === 'Page.loadEventFired') done(); }); });
- try {
- const nav = await page.send('Page.navigate', { url: `${base}/${path}` });
- if (nav.errorText) throw new Error(`could not open ${base}/${path}: ${nav.errorText}`);
- await withTimeout(loaded, 25000, 'Loading the page');
- } finally { off(); }
- await page.evaluate('document.fonts && document.fonts.ready ? document.fonts.ready.then(() => true) : true');
- if (!(await page.evaluate(`!!document.querySelector('.hb-page')`))) throw new Skip(`the address opened, but it is not a handbook page (${base}/${path})`);
- return page;
-}
-const press = (page, selector) => page.evaluate(`(() => { const el = document.querySelector(${JSON.stringify(selector)}); if (!el) return false; el.click(); return true; })()`);
-const has = (page, selector) => page.evaluate(`!!document.querySelector(${JSON.stringify(selector)})`);
-// Waits until no timer of the page (6 s or less) is waiting and no finite animation on the stage runs, three looks in a row
-// 100 ms apart, for up to 12 s: the end of a run, holds and all.
-async function runEnded(page) {
- let quiet = 0;
- for (const end = Date.now() + 12000; Date.now() < end; await sleep(100)) {
- const calm = await page.evaluate(`(() => {
- const stage = document.querySelector('.hb-page .stage');
- const busy = !!stage && document.getAnimations().some(a => {
- const t = a.effect && a.effect.target;
- return a.playState === 'running' && t && stage.contains(t) && a.effect.getComputedTiming().endTime !== Infinity;
- });
- return !busy && (window.__hbWaiting ? window.__hbWaiting() : 0) === 0;
- })()`);
- quiet = calm ? quiet + 1 : 0;
- if (quiet === 3) return true;
- }
- return false;
-}
-// The stage's rectangle as a PNG (base64)
-async function stageShot(page) {
- const box = await page.evaluate(`(() => { const b = document.querySelector('.hb-page .stage').getBoundingClientRect();
- return { x: b.left + scrollX, y: b.top + scrollY, width: b.width, height: b.height }; })()`);
- return (await page.send('Page.captureScreenshot', { format: 'png', clip: { ...box, scale: 1 } })).data;
-}
-// Waits until the stage has looked the same for 750 ms (four captures 250 ms apart), for up to 10 s; says whether it did
-async function rest(page) {
- let last = await stageShot(page), same = 0;
- for (const end = Date.now() + 10000; Date.now() < end;) {
- await sleep(250);
- const now = await stageShot(page);
- if (now !== last) { last = now; same = 0; continue; }
- if (++same === 3) return true;
- }
- return false;
-}
-// Waits until the box has scrolled to its end (or the time is up); says whether it moved at all.
-async function scrollEnded(page, ms) {
- let moved = false;
- for (const end = Date.now() + ms; Date.now() < end;) {
- const { top, max } = await page.evaluate(`(() => { const b = ${BOX}; return { top: b.scrollTop, max: b.scrollHeight - b.clientHeight }; })()`);
- if (top > 0) moved = true;
- if (moved && top >= max - 2) return { moved, done: true };
- await sleep(100);
- }
- return { moved, done: false };
-}
-async function scrollBox(page, fraction) {
- await page.evaluate(`(() => { const b = ${BOX}; b.scrollTo({ top: Math.round((b.scrollHeight - b.clientHeight) * ${fraction}), behavior: 'instant' }); })()`);
-}
-// Brings the demo to rest the same way on every site and in every mode, by its kind: a scroll page stopped with Back to top
-// (once its run on arrival has begun) and its box at the middle; a plays-once page with Loop off and its play over; a do-it page
-// after its run on arrival, with Reset where it has one; a loop paused (it starts paused under reduce motion). Says whether the
-// stage came to rest.
-async function ready(page, setup, kind) {
- if (kind === 'scroll') {
- if (setup.reduce) await sleep(600);
- else for (let i = 0; i < 40 && !(await page.evaluate(`${BOX}.scrollTop > 0`)); i++) await sleep(100);
- for (let attempt = 0; attempt < 3; attempt++) {
- if (!(await press(page, '[data-hb-top]'))) { await scrollEnded(page, 10000); break; }
- await sleep(500);
- if (await page.evaluate(`${BOX}.scrollTop === 0`)) break;
- }
- await scrollBox(page, 0.5);
- } else if (kind === 'once') {
- await sleep(900);
- await page.evaluate(`(() => { const l = document.querySelector('[data-hb-loop]'); if (l && l.checked) l.click(); })()`);
- } else if (kind === 'do') {
- await sleep(setup.reduce ? 900 : 4500);
- await press(page, '[data-hb-reset]');
- } else {
- await sleep(900);
- await page.evaluate(`(() => { const p = document.querySelector('[data-hb-pause]'); if (p && p.getAttribute('data-state') !== 'paused') p.click(); })()`);
- }
- await runEnded(page);
- return rest(page);
-}
-// Says (by skipping) when the page has no button for the mode; Normal needs none, as every page starts in it.
-async function requireMode(page, mode) {
- if (mode !== 'normal' && !(await has(page, `.hb-modes [data-hb-mode="${mode}"]`))) throw new Skip(`the page has no "${MODE_LABEL[mode]}" button yet`);
-}
-// Brings the Watch step into view, its top just under the pinned top bar, so a picture of the screen shows the switch, the
-// stage, the player bar and the note under it
-async function stepIntoView(page) {
- await page.evaluate(`(async () => {
- const step = document.querySelector('.hb-watch'), bar = document.querySelector('.hb-bar');
- const top = step.getBoundingClientRect().top + scrollY - (bar ? bar.getBoundingClientRect().height : 0) - 8;
- scrollTo({ top: Math.max(0, top), behavior: 'instant' });
- await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)));
- })()`);
-}
-async function capture(page, file) {
- const shot = await page.send('Page.captureScreenshot', { format: 'png' });
- writeFileSync(file, Buffer.from(shot.data, 'base64'));
-}
-
-// The controls named with --press, pressed in order once the page has loaded (on a plays-once page the shared script replays it
-// after a setting changes; ready() then waits for that run)
-async function pressAll(ctx, page) {
- for (const sel of PRESSES) {
- if (!(await press(page, sel))) ctx.note(`Nothing on the page matches --press ${sel}.`);
- await sleep(300);
- }
-}
-
-// ---------- what to make, in the order it is shown --------------------------------------------------------------------------
-const items = [];
-// A picture of one page in one mode at one setup, the demo at rest
-async function pageStill(ctx, path, mode, setup, file) {
- await requirePage(BASE, path);
- const page = await openPage(BASE, path, setup);
- await requireMode(page, mode);
- await pressAll(ctx, page);
- if (!(await ready(page, setup, kindOf(path)))) ctx.note('The stage did not come to rest before the button was pressed.');
- if (mode !== 'normal') {
- await press(page, `.hb-modes [data-hb-mode="${mode}"]`);
- await sleep(AFTER_MODE_MS);
- const marked = await page.evaluate(`document.querySelector('.hb-page .stage').getAttribute('data-hb-mode')`);
- if (marked !== mode) ctx.note(`After pressing "${MODE_LABEL[mode]}" the box is marked "${marked || 'nothing'}".`);
- await runEnded(page);
- if (!(await rest(page))) ctx.note('The stage did not come to rest in this mode.');
- }
- await stepIntoView(page);
- await capture(page, join(OUT, file));
-}
-// A clip of one page in one mode at 1280x800 (see clipPlan)
-async function pageClip(ctx, path, mode, how) {
- await requirePage(BASE, path);
- const kind = kindOf(path);
- const page = await openPage(BASE, path, DESKTOP);
- await requireMode(page, mode);
- await pressAll(ctx, page);
- await ready(page, DESKTOP, kind);
- if (kind === 'scroll') await press(page, '[data-hb-top]'); // a scroll page's clip starts with the box at the top
- if (kind === 'loop') await page.evaluate(`(() => { const p = document.querySelector('[data-hb-pause]'); if (p && p.getAttribute('data-state') === 'paused') p.click(); })()`);
- await stepIntoView(page);
- const plan = clipPlan(kind, mode);
- return recordClip(page, DESKTOP, how, async () => {
- const start = Date.now();
- await sleep(LEAD_MS);
- if (plan.mode) { await press(page, `.hb-modes [data-hb-mode="${plan.mode}"]`); await sleep(AFTER_MODE_MS); }
- if (plan.then === 'Replay') await press(page, '[data-hb-replay]');
- if (plan.then === 'Show me') await press(page, '[data-hb-demo]');
- if (plan.then === 'Play') {
- await press(page, '[data-hb-autoscroll]');
- const end = await scrollEnded(page, 12000);
- if (!end.moved) ctx.note('Play did not scroll the box.');
- }
- const left = CLIP_MS - (Date.now() - start);
- if (left > 0) await sleep(left);
- await sleep(HOLD_MS);
- });
-}
-// Normal at rest on main (--before) and on the branch (--base) at one setup, and how many pixels differ. A loop is pictured with
-// reduce motion on, so it stands paused at its first frame on both sites.
-async function beforeAfter(ctx, path, setup, item) {
- const kind = kindOf(path), use = kind === 'loop' ? { ...setup, reduce: true } : setup, pics = {};
- for (const [side, base] of [['before', BEFORE], ['after', BASE]]) {
- await requirePage(base, path);
- const page = await openPage(base, path, use);
- if (!(await ready(page, use, kind))) ctx.note(`On ${side === 'before' ? 'main' : 'this branch'} the stage did not come to rest.`);
- pics[side] = await stageShot(page);
- writeFileSync(join(OUT, item.files[side]), Buffer.from(pics[side], 'base64'));
- }
- const page = await getPage();
- const result = await page.evaluate(`new Promise(done => {
- const countDiff = ${countDiff.toString()};
- const load = src => new Promise(r => { const i = new Image(); i.onload = () => r(i); i.src = 'data:image/png;base64,' + src; });
- Promise.all([load(${JSON.stringify(pics.before)}), load(${JSON.stringify(pics.after)})]).then(([x, y]) => {
- if (x.width !== y.width || x.height !== y.height) { done({ size: [x.width, x.height, y.width, y.height] }); return; }
- const read = img => { const c = document.createElement('canvas'); c.width = img.width; c.height = img.height; const g = c.getContext('2d'); g.drawImage(img, 0, 0); return g.getImageData(0, 0, c.width, c.height).data; };
- const p = read(x), q = read(y), counts = countDiff(p, q);
- // the pixels that differ, painted red over a faint copy of the branch's picture
- const c = document.createElement('canvas'); c.width = y.width; c.height = y.height; const g = c.getContext('2d');
- g.globalAlpha = .35; g.drawImage(y, 0, 0); g.globalAlpha = 1;
- const red = g.getImageData(0, 0, c.width, c.height);
- for (let i = 0; i < p.length; i += 4) if (p[i] !== q[i] || p[i + 1] !== q[i + 1] || p[i + 2] !== q[i + 2]) { red.data[i] = 255; red.data[i + 1] = 0; red.data[i + 2] = 0; red.data[i + 3] = 255; }
- g.putImageData(red, 0, 0);
- done({ ...counts, png: c.toDataURL('image/png').split(',')[1] });
- });
- })`);
- if (result.size) throw new Error(`the stage is ${result.size[0]}x${result.size[1]} on main and ${result.size[2]}x${result.size[3]} on this branch`);
- writeFileSync(join(OUT, item.files.diff), Buffer.from(result.png, 'base64'));
- item.info = { any: result.any, visible: result.visible, total: result.total };
-}
-// What an item makes, so a file left by an earlier run is not left beside an item that is not made this time.
-function removeOutputs(item) {
- const files = item.type === 'clip' ? ['mp4', 'webp', 'gif'].map(ext => `clips/${item.id}.${ext}`) : Object.values(item.files || { file: item.file });
- for (const file of files) {
- try { rmSync(join(OUT, file), { force: true }); } catch { /* a file another program holds is left as it is */ }
- }
-}
-for (const path of PAGES) {
- const id = shortName(path), kind = kindOf(path), title = titleOf(path);
- const base = { page: path, pageId: id, kind, title, status: 'todo' };
- if (WANT_STILLS) {
- for (const mode of MODES) {
- for (const setup of GALLERY ? [DESKTOP, PHONE] : [DESKTOP, PHONE, PHONE_REDUCED]) {
- const file = `stills/${id}-${mode}-${setup.key}.png`;
- items.push({ ...base, notes: [], type: 'still', id: `${id}-${mode}-${setup.key}`, mode, setup: setup.key, file,
- caption: `${MODE_LABEL[mode]} · ${setup.short}${PRESS_NOTE}`, rulings: rulingsFor(path, kind, 'still', mode, setup.width, FLAGS),
- make: ctx => pageStill(ctx, path, mode, setup, file) });
- }
- }
- }
- if (WANT_CLIPS) {
- for (const mode of MODES) {
- items.push({ ...base, notes: [], type: 'clip', id: `${id}-clip-${mode}`, mode, caption: `${MODE_LABEL[mode]} · ${clipCaption(kind, mode)}${PRESS_NOTE}`,
- rulings: rulingsFor(path, kind, 'clip', mode, 1280, FLAGS), record: (ctx, how) => pageClip(ctx, path, mode, how) });
- }
- }
- if (WANT_BEFORE) {
- for (const setup of [DESKTOP, PHONE]) {
- const item = { ...base, notes: [], type: 'before', id: `${id}-before-${setup.key}`, setup: setup.key,
- caption: `Normal at rest, main beside this branch · ${setup.short}${kind === 'loop' ? ' (reduce motion on, so the loop stands still)' : ''}`,
- files: { before: `before/${id}-${setup.key}-main.png`, after: `before/${id}-${setup.key}-branch.png`, diff: `before/${id}-${setup.key}-diff.png` } };
- item.make = ctx => beforeAfter(ctx, path, setup, item);
- items.push(item);
- }
- }
-}
-
-```
-
-Create `$KIT/new-d.mjs` (the index, the galleries and the run; it follows the `runClip` slice):
-
-```js
-
-// ---------- the index page and the galleries ------------------------------------------------------------------------------
-const PAGE_CSS = `
- :root{--ink:#1c1d21;--muted:#575b66;--line:#d6d9e0;--bg:#f4f5f7;--card:#fff;--accent:#2a56d4;--warn:#8a4300;--gap:#e9ebf0;--rule:#0b5d3b}
- *{box-sizing:border-box}
- body{margin:0;background:var(--bg);color:var(--ink);font:17px/1.55 "Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif}
- .wrap{max-width:1280px;margin:0 auto;padding:28px 20px 72px}
- h1{font-size:30px;line-height:1.2;margin:0 0 6px}
- h2{font-size:25px;margin:56px 0 6px;padding-top:26px;border-top:2px solid var(--line)}
- h3{font-size:19px;margin:30px 0 10px}
- h4{font-size:17px;margin:18px 0 8px}
- p{margin:0 0 12px}
- .lede{color:var(--muted);max-width:75ch}
- .made{color:var(--muted);font-size:15px}
- a{color:var(--accent)}
- .toc{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 4px;padding:0;list-style:none}
- .toc a{display:inline-block;padding:8px 14px;border:1px solid var(--line);border-radius:999px;background:var(--card);color:var(--ink);text-decoration:none}
- .gaps{margin:14px 0;padding:10px 14px;border:1px solid var(--line);border-radius:10px;background:var(--card);font-size:15px}
- .gaps ul{margin:8px 0 0;padding-left:20px}
- figure{margin:0;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:12px;min-width:0}
- figure img,figure video{display:block;width:100%;height:auto;border-radius:6px;background:#0b0b0d}
- figcaption{margin-top:10px;font-size:15px}
- .meta,.warn,.rule{display:block;margin-top:3px;font-size:14px}
- .meta{color:var(--muted)}
- .warn{color:var(--warn)}
- .rule{color:var(--rule);font-weight:600}
- .clips{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,560px),1fr));gap:16px}
- .row{display:flex;flex-wrap:wrap;gap:16px;align-items:flex-start}
- .row .wide{flex:2 1 480px}
- .row .narrow{flex:0 1 240px}
- .gap .empty{display:flex;flex-direction:column;justify-content:center;gap:4px;min-height:150px;padding:14px;border-radius:6px;background:var(--gap);color:var(--muted);font-size:15px}
- .gap .empty b{color:var(--ink)}
- .pair{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
- .count{display:block;font-size:16px;font-weight:600}
-`;
-function figure(item, cls = '') {
- const notes = item.notes.map(n => `<span class="warn">${esc(n)}</span>`).join('');
- const rules = (item.rulings || []).map(n => `<span class="rule">${esc(RULINGS[n])}</span>`).join('');
- if (item.status !== 'ok') {
- const word = item.status === 'skipped' ? 'Not made' : item.status === 'failed' ? 'Failed' : 'Not part of this run';
- return `<figure class="gap ${cls}"><div class="empty"><b>${word}</b>${item.reason ? `<span>${esc(item.reason)}</span>` : ''}</div><figcaption>${esc(item.caption)}</figcaption></figure>`;
- }
- if (item.type === 'still') {
- return `<figure class="${cls}"><a href="${item.file}" target="_blank" rel="noopener"><img src="${item.file}" alt="${esc(item.caption)}" loading="lazy"></a><figcaption>${esc(item.caption)}${rules}${notes}</figcaption></figure>`;
- }
- if (item.type === 'before') {
- const i = item.info, share = (100 * i.any / i.total).toFixed(2);
- const pics = ['before', 'after', 'diff'].map(k => `<a href="${item.files[k]}" target="_blank" rel="noopener"><img src="${item.files[k]}" alt="${k}" loading="lazy"></a>`).join('');
- return `<figure class="${cls}"><div class="pair">${pics}</div><figcaption><span class="count">${i.any} of ${i.total} pixels differ (${share}%), ${i.visible} of them visibly</span>${esc(item.caption)}. Left: main; middle: this branch; right: the differences in red.${notes}</figcaption></figure>`;
- }
- const i = item.info;
- const links = `<a href="${item.files.mp4}">MP4 video (${size(i.mp4Bytes)})</a> · <a href="${item.files.small}" target="_blank" rel="noopener">animated ${i.smallKind} picture (${size(i.smallBytes)})</a>`;
- return `<figure class="clip ${cls}"><video controls loop muted playsinline preload="auto"><source src="${item.files.mp4}" type="video/mp4"><img src="${item.files.small}" alt="${esc(item.caption)}"></video>` +
- `<figcaption>${esc(item.caption)}<span class="meta">${i.seconds} seconds · ${links}</span>${rules}${notes}</figcaption></figure>`;
-}
-function framePage(title, lede, toc, body) {
- return `<!doctype html>
-<html lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width, initial-scale=1">
-<title>${esc(title)}</title>
-<style>${PAGE_CSS}</style>
-</head>
-<body>
-<div class="wrap">
-<h1>${esc(title)}</h1>
-<p class="lede">${esc(lede)}</p>
-<p class="made">Made ${esc(new Date().toLocaleString('en-GB'))} from ${esc(BASE)}${BEFORE ? ` (main: ${esc(BEFORE)})` : ''}</p>
-${toc}
-${body}
-</div>
-<script>
- // Clips play while they are on screen and stop when they are not.
- (function () {
- var videos = document.querySelectorAll('video');
- if (!('IntersectionObserver' in window)) return;
- var watcher = new IntersectionObserver(function (entries) {
- entries.forEach(function (e) { if (e.isIntersecting) { var p = e.target.play(); if (p && p.catch) p.catch(function () {}); } else e.target.pause(); });
- }, { threshold: 0.5 });
- videos.forEach(function (v) { watcher.observe(v); });
- })();
-</script>
-</body>
-</html>
-`;
-}
-function pageSection(path) {
- const mine = items.filter(it => it.page === path && it.status !== 'omitted');
- if (!mine.length) return '';
- const { pageId, title, kind } = mine[0];
- let html = `<section id="${pageId}"><h2>${esc(title)}</h2><p class="lede">${esc(path)} · ${esc(KIND_WORDS[kind] || 'kind not read')}</p>`;
- const clips = mine.filter(it => it.type === 'clip');
- if (clips.length) html += `<h3>Clips</h3><div class="clips">${clips.map(c => figure(c)).join('')}</div>`;
- const stills = mine.filter(it => it.type === 'still');
- if (stills.length) {
- html += '<h3>Pictures</h3><p class="lede">The Watch step after each button was pressed and the demo had come to rest. The last column has reduce motion on, so every mode must be a still picture there.</p>';
- for (const mode of MODES) {
- const row = stills.filter(s => s.mode === mode);
- if (row.length) html += `<h4>${MODE_LABEL[mode]}</h4><div class="row">${row.map(s => figure(s, s.setup === '1280' ? 'wide' : 'narrow')).join('')}</div>`;
- }
- }
- const befores = mine.filter(it => it.type === 'before');
- if (befores.length) html += `<h3>Normal before and after</h3><div class="row">${befores.map(b => figure(b, 'wide')).join('')}</div>`;
- return html + '</section>';
-}
-function renderIndex() {
- const gaps = items.filter(it => it.status === 'skipped' || it.status === 'failed');
- const toc = `<ul class="toc">${PAGES.filter(p => items.some(it => it.page === p)).map(p => `<li><a href="#${shortName(p)}">${esc(titleOf(p))}</a></li>`).join('')}</ul>` +
- (gaps.length ? `<details class="gaps" open><summary>${gaps.length} not made</summary><ul>${gaps.map(it => `<li><b>${esc(it.id)}</b>: ${esc(it.reason)}</li>`).join('')}</ul></details>` : '');
- return framePage('See inside and Compare: pictures and clips',
- 'For each page: three clips (Normal, See inside, Compare), then each button pictured on a computer, a phone, and a phone with reduce motion on, then Normal on main beside Normal on this branch. Green lines name the ruling a picture or clip shows. Click a picture to open it full size.',
- toc, PAGES.map(pageSection).join('\n'));
-}
-function renderGallery(cat) {
- const body = PAGES.filter(p => p.split('/')[1] === cat).map(path => {
- const row = items.filter(it => it.page === path && it.type === 'still');
- return `<section id="${shortName(path)}"><h2>${esc(titleOf(path))}</h2><div class="row">${row.map(s => figure(s, s.setup === '1280' ? 'wide' : 'narrow')).join('')}</div></section>`;
- }).join('\n');
- return framePage(`Gallery: ${cat}`, 'Every page of the category: Normal, See inside and Compare on a computer and on a phone.', '', body);
-}
-
-// ---------- the run --------------------------------------------------------------------------------------------------------
-let cleaning = null;
-function cleanUp() {
- cleaning ??= (async () => {
- if (browser) await browser.close().catch(() => {});
- for (const dir of [...tempDirs]) removeDir(dir);
- })();
- return cleaning;
-}
-async function abort(why) {
- console.error(why);
- await cleanUp().catch(() => {});
- process.exit(1);
-}
-for (const signal of ['SIGINT', 'SIGTERM', 'SIGBREAK', 'SIGHUP']) process.on(signal, () => abort(`Interrupted (${signal}).`));
-process.on('uncaughtException', err => abort(err?.stack || String(err)));
-process.on('unhandledRejection', err => abort(err?.stack || String(err)));
-
-const CATS = [...new Set(PAGES.map(p => p.split('/')[1]))];
-let failures = 0;
-try {
- for (const [name, base] of [['--base', BASE], ...(BEFORE ? [['--before', BEFORE]] : [])]) {
- const answer = await fetch(`${base}/`).catch(() => null);
- if (!answer || !answer.ok) { console.error(`The site does not answer at ${base}/ (${name}). Serve it first: python -m http.server <port> --bind 127.0.0.1`); process.exit(2); }
- }
- if (!CHROME) { console.error('Chrome was not found. Set the CHROME variable to its path.'); process.exit(2); }
- if (WANT_CLIPS && !FFMPEG) log('warn', 'ffmpeg was not found: the clips will be skipped (set FFMPEG to its path, or install the Python package imageio-ffmpeg)');
- if (CLEAN) {
- for (const name of ['stills', 'clips', 'before', 'index.html', 'manifest.json', ...CATS.map(c => `gallery-${c.slice(0, 2)}.html`)]) {
- try { rmSync(join(OUT, name), { recursive: true, force: true }); } catch (err) { log('warn', `could not remove ${name} from the output folder (${err.code || err.message})`); }
- }
- }
- for (const dir of ['stills', 'clips', 'before']) mkdirSync(join(OUT, dir), { recursive: true });
- log('info', `${PAGES.length} pages, ${items.length} items, from ${BASE} into ${OUT}`);
- for (const item of items) {
- const ctx = { note: text => { item.notes.push(text); log('note', `${item.id}: ${text}`); } };
- // A try that fails (Chrome crashed, the computer was too busy) is made once more with a fresh Chrome before it counts as failed.
- for (let attempt = 1; ; attempt++) {
- item.notes.length = 0;
- try {
- if (item.type === 'clip') {
- await withTimeout(runClip(item, ctx), CLIP_TIMEOUT_MS, 'The clip');
- log('ok', `${item.id} ${item.info.seconds} s, ${item.info.recordedFrames} frames (${item.info.recordedHow}), MP4 ${size(item.info.mp4Bytes)}, ${item.info.smallKind} ${size(item.info.smallBytes)}`);
- } else if (item.type === 'before') {
- await withTimeout(item.make(ctx), STILL_TIMEOUT_MS, 'The comparison');
- log('ok', `${item.id} ${item.info.any} of ${item.info.total} pixels differ (${item.info.visible} visibly)`);
- } else {
- await withTimeout(item.make(ctx), STILL_TIMEOUT_MS, 'The picture');
- item.info = { bytes: statSync(join(OUT, item.file)).size };
- log('ok', `${item.id}.png ${size(item.info.bytes)}`);
- }
- item.status = 'ok';
- break;
- } catch (err) {
- removeOutputs(item);
- if (err instanceof Skip) { item.status = 'skipped'; item.reason = err.message; log('skip', `${item.id}: ${err.message}`); break; }
- if (browser) { await browser.close().catch(() => {}); browser = null; }
- if (attempt === 1) { log('retry', `${item.id}: ${err.message}; trying once more`); continue; }
- item.status = 'failed';
- item.reason = err.message;
- failures++;
- log('FAIL', `${item.id}: ${err.message}`);
- break;
- }
- }
- }
- if (GALLERY) {
- for (const cat of CATS) {
- writeFileSync(join(OUT, `gallery-${cat.slice(0, 2)}.html`), renderGallery(cat));
- console.log(`Open ${join(OUT, `gallery-${cat.slice(0, 2)}.html`)}`);
- }
- } else {
- writeFileSync(join(OUT, 'index.html'), renderIndex());
- console.log(`Open ${join(OUT, 'index.html')}`);
- }
- writeFileSync(join(OUT, 'manifest.json'), JSON.stringify({ made: new Date().toISOString(), base: BASE, before: BEFORE || null, pages: PAGES,
- items: items.map(({ make, record, ...rest }) => rest) }, null, 1));
- const n = (type, status) => items.filter(it => it.type === type && it.status === status).length;
- log('done', `${n('still', 'ok')} pictures, ${n('clip', 'ok')} clips and ${n('before', 'ok')} comparisons made, ${items.filter(it => it.status === 'skipped').length} skipped, ${failures} failed`);
-} catch (err) {
- console.error(err?.stack || String(err));
- failures++;
-} finally {
- await cleanUp();
-}
-process.exit(failures ? 1 : 0);
-```
-
-- [ ] **Step 6: Assemble the new kit**
-
-Run:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $KIT && { cat new-a.mjs; sed -n '81,94p' record-pilot.mjs; cat new-b.mjs; sed -n '110,293p' record-pilot.mjs; cat new-c.mjs; sed -n '397,503p' record-pilot.mjs; echo; sed -n '605,617p' record-pilot.mjs; cat new-d.mjs; } > record.mjs && rm new-a.mjs new-b.mjs new-c.mjs new-d.mjs
-node --check record.mjs && node record.mjs --help | head -2 && node --test --test-reporter=spec record.test.mjs 2>&1 | grep -E "^ℹ (pass|fail)"
-```
-Expected: no syntax error; the usage's first line; `ℹ pass 5` and `ℹ fail 0`. `sed -n '81,94p' record-pilot.mjs | head -1` is the `// ---------- settings you may want to change` line and `sed -n '605p' record-pilot.mjs` is `async function runClip(item, ctx) {`.
-
-- [ ] **Step 7: A real run**
-
-This step waits for the merge of Task 3 (the last merge of step 0-C), and its runs end before Task 6 is merged, so the served tree does not change while the kit runs and holds the shared script whose ruling 1 the kit relies on. Write in the ledger which merge it saw (`git -C /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook log --oneline -1`).
-Start, as a background command (it serves the main checkout, which then holds the merges of Tasks 1, 2, 4 and 3): `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook && python -m http.server 8805 --bind 127.0.0.1`
-Run, as a background command:
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run kit-test -- node $KIT/record.mjs --base http://127.0.0.1:8805 --before http://127.0.0.1:8800 --rulings $RUN/first-batch-rulings.json --out $RUN/scratch/kit-test --clean animations/01-scroll-based/parallax-scrolling animations/02-entrance-and-exit/fade-in-out > $RUN/scratch/kit-test.log 2>&1`
-When it has ended, `tail -3 $RUN/scratch/kit-test.log`. Expected: `12 pictures, 4 clips and 4 comparisons made, 8 skipped, 0 failed` (Parallax: 9 pictures, 3 clips; Fade In / Fade Out has no switch yet: its 3 Normal pictures and its Normal clip are made, its 6 mode pictures and 2 mode clips are skipped with `the page has no "See inside" button yet` or `"Compare"`); the four comparison lines say `0 of … pixels differ (0 visibly)` or a handful of pixels at Parallax's rounded corners. Open `$RUN/scratch/kit-test/index.html` and three of its pictures with the Read tool: the Parallax clips carry the green ruling 2 line beside See inside, Fade In's Normal clip shows Replay playing the card, each comparison shows main, branch and an all-gray difference picture.
-Then the gallery path: `node $RUN/slot.mjs run kit-test -- node $KIT/record.mjs --base http://127.0.0.1:8805 --out $RUN/scratch/kit-gallery --gallery animations/01-scroll-based/parallax-scrolling` (foreground, about a minute): `gallery-01.html` with six pictures. And `--press`: `node $RUN/slot.mjs run kit-test -- node $KIT/record.mjs --base http://127.0.0.1:8805 --out $RUN/scratch/kit-press --only stills --press "#depth-seg [data-depth='flat']" animations/01-scroll-based/parallax-scrolling`: nine pictures whose captions end `after pressing #depth-seg [data-depth='flat']`, the Compare ones with both halves alike and the note saying Depth is set to Flat. Stop the server.
-
-- [ ] **Step 8: The kit's README**
-
-In `$KIT/README.md`, after its first line (the title), add:
-
-```markdown
-
-## The rollout's kit (record.mjs, from Phase 0 of the See inside and Compare rollout)
-`record.mjs` now takes any list of pages and category folders and reads each page's kind. The pilot's kit, which made the Parallax and
-Learn pictures, is kept as `record-pilot.mjs`. Run it through the slot pool:
-
- node <run folder>/slot.mjs run kit -- node record.mjs --base http://127.0.0.1:8731 --before http://127.0.0.1:8800 \
- --rulings <run folder>/first-batch-rulings.json --out <folder> --clean <page or category folder>...
-
-For each page: nine pictures (Normal, See inside, Compare at 1280x800, 375x812, and 375x812 with reduce motion on, each after the
-demo has come to rest), three clips at 1280x800 (Normal plays the demo its own way; See inside and Compare press the mode, which plays
-a plays-once or do-it page once by itself; a scroll page then gets Play), and with `--before` Normal at rest on main beside this
-branch at 1280 and 375 with the number of pixels that differ and a picture of them in red. `--only before` makes only the comparison
-(what a builder runs for acceptance line 3); `--press "<selector>"` (any number of times) presses a setting's choice or a switch once
-each page has loaded, so `--only stills` then pictures the views under that setting (acceptance line 7); `--gallery` makes only
-pictures, one `gallery-NN.html` per category, for the owner's final look. `kit-lib.mjs` holds the pure helpers, tested by
-`node --test record.test.mjs`.
-```
-
-- [ ] **Step 9: No commit; review**
-
-Nothing here is in the repository. A fresh reviewer runs `node --test record.test.mjs`, reads `record.mjs` (the new parts and the seams between the slices), opens the Step 7 `index.html`, and confirms spec section 3 ("What the owner sees") and section 4 item 8 are met: nine stills and three clips per page, the kind read per page, Normal before and after with the count, captions naming rulings 1 to 4 where they show, `--gallery` with one file per category. A ledger line names the files.
-
----
-### Task 6: One bump to `?v=10`, the whole-site check, and the shared files frozen
-
-**Files:**
-- Modify: the version line of every tracked `animations/*/*/index.html` (166 pages: both the stylesheet and the script link) and of `index.html` (the home page links only the script): `?v=9` → `?v=10`
-
-**Interfaces:**
-- Consumes: Tasks 1 to 4 merged into `feat/see-inside-compare` (Task 5 is outside the repository). The test `every guided-steps page and the home page link the same version of the shared files`.
-- Produces: every page and the home page at `?v=10`; from the merge of this task on, `assets/css/demo-page.css`, `assets/js/demo-page.js`, `tests/demo-page.test.js`, `tools/check-pages.mjs` and `tests/pages.test.js` are frozen for the first batch. The ledger line `Phase 0 done at <merge hash>; shared files frozen at v=10`.
-
-- [ ] **Step 1: The lane**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO log --oneline -8 feat/see-inside-compare; git -C $REPO worktree add -b sic/00e $REPO/.claude/worktrees/sic-00e feat/see-inside-compare`
-Expected: the merges of Tasks 1, 2, 4 and 3 at the top. Work in `$REPO/.claude/worktrees/sic-00e`.
-
-- [ ] **Step 2: See what has to change**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00e && git ls-files -- 'animations/*/*/index.html' index.html | wc -l; git grep -l 'demo-page\.\(css\|js\)?v=9' -- 'animations/*/*/index.html' index.html | wc -l; git grep -l 'demo-page\.\(css\|js\)?v=10' -- '*.html' | wc -l; git ls-files --eol -- index.html animations/02-entrance-and-exit/fade-in-out/index.html`
-Expected: `167`, `167`, `0`, and `i/lf w/crlf` for both files (the line endings to keep).
-
-- [ ] **Step 3: Bump, on tracked files only, keeping line endings**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00e
-git ls-files -- 'animations/*/*/index.html' index.html | xargs sed -b -i 's/demo-page\.css?v=9"/demo-page.css?v=10"/; s/demo-page\.js?v=9"/demo-page.js?v=10"/'
-```
-
-- [ ] **Step 4: Check the bump**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00e && git grep -l 'v=9"' -- 'animations/*/*/index.html' index.html | wc -l; git grep -l 'demo-page\.css?v=10"' -- '*.html' | wc -l; git grep -l 'demo-page\.js?v=10"' -- '*.html' | wc -l; git diff --shortstat; git ls-files --eol -- index.html animations/02-entrance-and-exit/fade-in-out/index.html; git ls-files --eol -- 'animations/*/*/index.html' index.html | grep -vc 'w/crlf'`
-Expected: `0`; `166`; `167`; `167 files changed, 333 insertions(+), 333 deletions(-)`; `i/lf w/crlf` for both; `0` (no page lost its CRLF line endings in the working tree). Then `node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"`: `ℹ fail 0`. Then `node tools/make-skill.mjs && git status --short -- skills llms.txt`: no output (the skill and `llms.txt` are unchanged).
-
-- [ ] **Step 5: The whole-site check**
-
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00e && python -m http.server 8806 --bind 127.0.0.1`
-Start eight runs, each as a background command of its own, with `<target>` and `<log>` taken in turn from: `animations/01-scroll-based` and `01`, `animations/02-entrance-and-exit` and `02`, `animations/03-page-transitions` and `03`, `animations/04-micro-interactions` and `04`, `animations/05-text-typography` and `05`, `animations/06-3d-advanced` and `06`, `animations/07-ambient-background` and `07`, `home` and `home`:
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-00e && node $RUN/slot.mjs run site-<log> -- node tools/check-pages.mjs --base http://127.0.0.1:8806 --out $RUN/checks/site-<log> <target> > $RUN/checks/site-<log>.log 2>&1; echo "EXIT=$?" >> $RUN/checks/site-<log>.log`
-When all eight logs end with `EXIT=…` (about 30 minutes; the pool runs at most eight at once, so other projects' checks may make some wait), run: `RUN=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-13-see-inside-compare; cat $RUN/checks/site-*.log | grep -c "^ok"; cat $RUN/checks/site-*.log | grep "^FAIL"; grep -h "EXIT=" $RUN/checks/site-*.log`
-Expected: `1002` (166 pages and the home page, six setups each), no `FAIL` line, eight `EXIT=0`. A `FAIL` on a page without the switch can only come from `restShot` in `movementProblems` or from the `TIMERS` wrapper: find which with the page's log line, fix it in Task 3's code (a new commit on this lane, reviewed), and run that category again. Stop the server.
-
-- [ ] **Step 6: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00e
-git add -u -- animations index.html
-git commit -m "chore: the shared files are at version 10 on all 166 animation pages and the home page"
-```
-
-- [ ] **Step 7: Review, merge, freeze (coordinator)**
-
-A fresh reviewer checks by script that every changed file differs from its parent only in the version strings (`git diff feat/see-inside-compare...sic/00e -U0 | grep '^[-+][^-+]' | grep -v 'demo-page\.\(css\|js\)?v=' | wc -l` prints `0`) and that the whole-site logs show 1002 `ok` and no `FAIL`. Then:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && git merge --no-ff sic/00e -m "Merge Phase 0, Task 6: the shared files at version 10 everywhere; Phase 0 is done"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-git worktree remove .claude/worktrees/sic-00e && git branch -d sic/00e
-git worktree list | grep sic-00
-```
-Expected: `ℹ fail 0`; the last command prints nothing (every Phase 0 lane is gone). Ledger: `Phase 0 done at <merge hash>; shared files frozen at v=10`. From here until Task 14 asks for one, no agent changes `assets/css/demo-page.css`, `assets/js/demo-page.js`, `tests/demo-page.test.js`, `tools/check-pages.mjs` or `tests/pages.test.js`; a lane that thinks one needs a change writes it in its ledger and tells the coordinator.
-
----
-## The first batch
-
-Every page task below follows the same order: the brief (written by the lane lead during Phase 0, step 0-C), the slot (after Task 6), the failing check, the build, the tests, the page check with its screenshots and the tuning, Normal before and after, one commit, then a fresh reviewer and the lane's merge into `sic/cat-NN`. Each task repeats its own commands so it can be read alone. The starting code below is a first draft for the builder: the brief and the acceptance govern, and a clearer picture wins (the report says why).
-
-### Task 7: 01.02 Parallax Scrolling: start outlines in See inside (ruling 2) and the final review's small fixes
-
-**Files:**
-- Modify: `animations/01-scroll-based/parallax-scrolling/index.html`: the `<style>` block (the See inside rules), the layers in `#main` (a start outline before each), the four `.tag` spans and the `p.side` (caption marks), the See inside note, and in the script the twin's clean-up line, the comment above `const k`, and the `NOTES` table.
-
-**Interfaces:**
-- Consumes: Task 1 (no lesson parts; the script writes the See inside note through `insideNote`), Task 4 (notes in two sentences; Compare's note names the halves), Task 3 (the caption, id and name checks), Task 5 (`record.mjs --only before`), Task 6 (`?v=10`).
-- Produces: the category 01 reference, and the reference for ruling 2 (every page that shrinks a movement): `span.start.s1` … `.s4`, one before each layer, drawn only in See inside, at the layer's place in the fan without its scroll movement.
-
-- [ ] **Step 1: The brief** (the 01 lane lead, during Phase 0)
-
-Write `$RUN/briefs/01.02-parallax-scrolling.md`:
-
-```markdown
-# 01.02 Parallax Scrolling: brief (first batch)
-Kind: scroll (Play, Back to top). See inside (the four layers fanned out, each labeled with words and a bar) and Compare
-("Without parallax" / "With parallax") exist from the pilot; this round adds ruling 2 and the final review's small fixes.
-1. Ruling 2: in See inside each layer moves about a fifth as far as in Normal. Draw a faint dashed outline of each layer's card at
- its place with the box at the top, just behind the card, so the gap that opens as the box scrolls shows how far it moved.
- Under reduced motion nothing moves, so each outline sits under its card.
-2. Labels drawn sharp in See inside (no will-change there).
-3. Notes: one or two sentences each, naming the halves "Without parallax" and "With parallax"; the reduced-motion Compare note
- says "each layer has moved its own amount"; the See inside note mentions the outlines.
-4. The comment at the See inside factor says it moves layers about a fifth as far on screen.
-5. data-hb-caption on the four layer labels and the two half names.
-Pitfalls: the Compare copy loses the outlines; no outline crosses a label's words; every card and outline stays inside the box at
-every Depth and scroll position; Normal pixel-identical.
-Survey row: rollout-survey-01-03.md, 01.02. Reference for the PULL-APART pages and for every page that shrinks a movement.
-```
-
-- [ ] **Step 2: The slot** (after Task 6)
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/01a $REPO/.claude/worktrees/sic-01a feat/see-inside-compare`
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-01a && python -m http.server 8801 --bind 127.0.0.1`
-The lane's ledger is `$RUN/lanes/01.md`; write a line there at every step that changes something.
-
-- [ ] **Step 3: See the gaps (the failing check)**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-01a && F=animations/01-scroll-based/parallax-scrolling/index.html; grep -c 'data-hb-caption' $F; grep -c 'class="start' $F; grep -c 'will-change:auto}' $F; grep -c 'each its own amount' $F`
-Expected: `0`, `0`, `1` (only the reduced-motion rule at the end of the style block), `1`. After the build: `5` (four labels and one half name; the copy's half name is cloned at load), `4`, `2`, `0`.
-
-- [ ] **Step 4: Styles**
-
-In the `<style>` block replace ` .twin,.tag,.side{display:none}` with ` .twin,.tag,.side,.start{display:none}`, and replace the See inside block from its comment `/* See inside: the four layers fanned out from the far sky at the top left to the near grass at the bottom right, each` through the rule `.stage[data-hb-mode="inside"] #l4{translate:20% 22.6%}` with:
-
-```css
- /* See inside: the four layers fanned out from the far sky at the top left to the near grass at the bottom right, each
- outlined and labeled with how far it moves. Each step down is taller than a label, so no layer hides the label of the
- one behind it, even on a phone, and the fan sits high enough that the near grass, which moves most, stays inside the
- box to the end of the scroll. The labels are drawn at 34px and the outline at 4px, and they shrink with their layer to
- about 13px and 1.5px; the layers lose will-change here, so the labels are drawn at their size and stay sharp.
- Behind each layer a faint dashed outline marks where that layer stood with the box at the top: the script moves the
- layer from there as the box scrolls, so the gap that opens shows how far it went (ruling 2). */
- .stage[data-hb-mode="inside"] .layers{overflow:visible;background:none}
- /* Each layer reads as a sheet: a faint fill behind its drawing */
- .stage[data-hb-mode="inside"] .layer{outline:4px solid rgba(244,244,242,.6);outline-offset:-4px;scale:.375;
- background:rgba(255,255,255,.08);will-change:auto}
- .stage[data-hb-mode="inside"] .start{display:block;position:absolute;top:0;left:0;width:100%;height:100%;scale:.375;
- outline:4px dashed rgba(244,244,242,.42);outline-offset:-4px;pointer-events:none}
- .stage[data-hb-mode="inside"] #l1,.stage[data-hb-mode="inside"] .s1{translate:-20% -29.6%}
- .stage[data-hb-mode="inside"] #l2,.stage[data-hb-mode="inside"] .s2{translate:-6.67% -12.2%}
- .stage[data-hb-mode="inside"] #l3,.stage[data-hb-mode="inside"] .s3{translate:6.67% 5.2%}
- .stage[data-hb-mode="inside"] #l4,.stage[data-hb-mode="inside"] .s4{translate:20% 22.6%}
-```
-
-- [ ] **Step 5: Markup**
-
-In `#main`: change `<p class="side">With parallax</p>` to `<p class="side" data-hb-caption>With parallax</p>`; put `<span class="start s1" aria-hidden="true"></span>` on its own line right before `<div class="layer" id="l1">`, and likewise `s2` before `#l2`, `s3` before `#l3`, `s4` before `#l4`; change each `<span class="tag">` to `<span class="tag" data-hb-caption>`.
-
-Replace the See inside note with:
-```html
- <p data-hb-for="inside" hidden>Inside, the picture is four flat layers, each with a faint outline where it started: the far ones move least and the near grass most. Scroll the box or press Play to watch.</p>
-```
-
-- [ ] **Step 6: Script**
-
-Replace ` twin.querySelectorAll('.tag').forEach(t => t.remove());` with:
-```js
- twin.querySelectorAll('.tag, .start').forEach(t => t.remove());
-```
-and the comment line just above it, `// Compare's left side: a copy of the scene without parallax, named "Without parallax". The copy loses its ids (its sky` / `// gradient gets one of its own) and its labels.`, keeps its words with `and its labels` changed to `its labels and its start outlines`.
-
-Replace the comment ` // See inside moves every layer half as far, so the moves keep their proportions and the near grass stays in the box` with:
-```js
- // See inside moves each layer half as far within its card, and the card is drawn at three eighths of its size, so on
- // screen a layer moves about a fifth as far as in Normal: every move keeps its proportion, the near grass stays inside the
- // box, and the start outlines show how far each layer has gone
-```
-
-In `NOTES` set:
-```js
- moving: {
- inside: 'Inside, the picture is four flat layers, each with a faint outline where it started: the far ones move least and the near grass most. Scroll the box or press Play to watch.',
- compare: 'Without parallax (left), every layer moves the same and the picture looks flat; with parallax (right), each moves its own amount and it looks deep. Scroll the box or press Play to watch.',
- },
- movingFlat: {
- inside: 'Inside, the picture is four flat layers; Depth is set to Flat, so they all move the same and the picture looks flat. Scroll the box or press Play to watch.',
- compare: 'Depth is set to Flat, so Without parallax and With parallax move the same. Pick another Depth in Try it, then scroll the box or press Play to watch.',
- },
- still: {
- inside: 'Inside, the picture is four flat layers, shown still. Each bar shows how far that layer would move: least for the far sky, most for the near grass.',
- compare: 'Both sides are shown still, as they stand halfway down the box: without parallax every layer has moved the same, with parallax each layer has moved its own amount.',
- },
- stillFlat: {
- inside: 'Inside, the picture is four flat layers, shown still. Depth is set to Flat, so every bar is the same: the layers would all move together and the picture would look flat.',
- compare: 'Both sides are shown still, halfway down the box; Depth is set to Flat, so Without parallax and With parallax match. Pick another Depth in Try it to see the difference.',
- },
-```
-
-- [ ] **Step 7: Tests**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-01a && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"` and the Step 3 greps.
-Expected: `ℹ fail 0`; greps `5`, `4`, `2`, `0`.
-
-- [ ] **Step 8: Page check, screenshots, tuning**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-01a && node $RUN/slot.mjs run sic-01a -- node tools/check-pages.mjs --base http://127.0.0.1:8801 --out $RUN/checks/01-parallax-scrolling/1 animations/01-scroll-based/parallax-scrolling`
-Expected: six `ok` lines. Open with the Read tool, in `$RUN/checks/01-parallax-scrolling/1/`: `01-parallax-scrolling-desktop-inside.png`, `-phone-inside.png`, `-phone-reduced-inside.png`, `-desktop-compare.png`, `-phone-compare.png`, `-phone-reduced-compare.png` (at desktop and phone-reduced the mode screenshots are taken with the box at the middle of its range; at phone the box stands wherever the arrival's Play left it). Tune the outline's dash and alpha (`rgba(244,244,242,.42)`, `4px dashed`) until, at 1280 and at 375: the gaps between the outlines and their cards grow from the sky (hardly any) to the grass (largest), no outline crosses a label's words, and under reduced motion each outline sits under its card. Zoom on the Hills label at 1280 (Read the screenshot and look closely): its letters are as crisp as the Normal step heading's. Run the page check again after every change (a new round folder `…/2`, `…/3`); it must stay at six `ok`.
-
-- [ ] **Step 9: Normal before and after**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-01a -- node $KIT/record.mjs --base http://127.0.0.1:8801 --before http://127.0.0.1:8800 --only before --out $RUN/kit/01-parallax-scrolling --clean animations/01-scroll-based/parallax-scrolling`
-Expected: two `ok` lines `01-parallax-scrolling-before-1280 0 of … pixels differ (0 visibly)` and the same for `375`, or a few pixels at the stage's rounded corners (0 visibly). More than that: Normal changed; find out why before going on.
-
-- [ ] **Step 10: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-01a
-git add animations/01-scroll-based/parallax-scrolling/index.html
-git commit -m "feat: Parallax Scrolling's See inside outlines where each layer started and draws its labels sharp, and its notes name the halves"
-```
-
-- [ ] **Step 11: Review, fix rounds, merge into `sic/cat-01`**
-
-The lane lead dispatches a fresh reviewer (never the builder) with: the brief, `git -C $REPO/.claude/worktrees/sic-01a diff feat/see-inside-compare...sic/01a`, the newest `$RUN/checks/01-parallax-scrolling/<round>/` (screenshots and the check's output), `$RUN/kit/01-parallax-scrolling/index.html`, and the 12 acceptance lines of the Global Constraints. The reviewer confirms each line (1: outlines show the gap at 1280 and 375; 3: the before-and-after count; 6: labels at 12px or more, sharp; and the others), checks what the page check cannot (the outlines follow the layers' fan at every Depth: one kit run per Depth, `node $RUN/slot.mjs run review-01 -- node $KIT/record.mjs --base http://127.0.0.1:8801 --only stills --press "#depth-seg [data-depth='deep']" --out $RUN/kit/01-parallax-deep animations/01-scroll-based/parallax-scrolling`, and the same for `flat` and `shallow`; those stills stand at mid-scroll, so also: at Flat on a phone, Back to top, then Play to the end, and look at the Sky and Hills labels. If the next layer's start outline crosses them, `.stage[data-hb-mode="inside"] .start{z-index:-1}` paints every outline under every card (the sticky frame holds them), at the cost of the part of each gap that the card above covers: that is the builder's call, stated in the report), and answers Approved or Changes needed with a list. The builder fixes (at most three rounds, each a new commit and a new check round). When approved:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare
-cd $REPO/.claude/worktrees/sic-01a && git switch -c sic/cat-01 feat/see-inside-compare && git merge --no-ff sic/01a -m "Merge slot 01a: Parallax Scrolling's start outlines and fixes"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)" # ℹ fail 0
-```
-Then, as a background command, the category's page check: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-01a && node $RUN/slot.mjs run cat-01 -- node tools/check-pages.mjs --base http://127.0.0.1:8801 --out $RUN/checks/cat-01 animations/01-scroll-based > $RUN/checks/cat-01.log 2>&1`. When it has ended (the log's last line is `Screenshots: …`): `grep -c '^ok' $RUN/checks/cat-01.log` prints `162` and `grep -c '^FAIL' $RUN/checks/cat-01.log` prints `0`. Only then `git switch sic/01a` (the slot keeps its own branch for later pages), stop the server, and tell the coordinator `sic/cat-01` is ready (ledger line).
-
----
-
-### Task 8: 02.01 Fade In / Fade Out: a graph of how solid the card is (See inside), "Appears at once" beside "Fades in" (Compare)
-
-**Files:**
-- Modify: `animations/02-entrance-and-exit/fade-in-out/index.html`: the `<style>` block (lines 23-34 at `03a00d0`), the stage (lines 56-62), the notes after the player bar (new, after line 67), the switch before the stage (new, after line 55), the `<script>` (lines 135-180).
-
-**Interfaces:**
-- Consumes: Task 2 (a press of See inside or Compare presses Replay), Task 3 (run waits; captions), Task 4 (switch tests), Task 6 (`?v=10`).
-- Produces: the category 02 reference and the reference for the CURVE and TIMELINE pictures (24 pages) and for "between plays the halves rest on a posed moment".
-
-- [ ] **Step 1: The brief** (the 02 lane lead, during Phase 0)
-
-Write `$RUN/briefs/02.01-fade-in-out.md`:
-
-```markdown
-# 02.01 Fade In / Fade Out: brief (first batch)
-Kind: plays once (Replay, Loop, Slow motion; the page slows its own fades). Category reference for 02; reference for CURVE/TIMELINE.
-See inside: the card beside a graph of how solid it is over time (below it on phones). The line rises with the fade in in the
-shape of the Feel's own curve, stays at the top for the hold, and with Loop on falls with the fade out; a dot rides it with the
-card (across with the time since the play began, up with the card's real opacity). Labels: "Solid", "See-through",
-"Fades in, about half a second" (words from Speed and Slow motion), "Stays", "Fades out" (Loop on only).
-Compare: "Appears at once" (a copy with no fade, left) / "Fades in" (the card itself, right). Replay, Loop and Slow motion reach both
-(one class on both cards). With Loop off, between plays the right card rests a fifth of a second into its fade ("A fifth of a second
-in"), so Speed, Feel and Slow motion change the still too; with Loop on (the state after arrival) it fades in and out with the copy,
-so the Compare note says the rest comes with Loop off.
-Reduced motion: See inside still, the dot where the fade in ends; Compare posed as above; both notes say "shown still".
-Phones: See inside stacks a compact card over the graph (four labels at most: "Stays" hidden); Compare side by side (each half
-about 165px), cards compact.
-Pitfalls: the copy must not take the reduced-motion 300 ms fade (!important beats it); the posed rule must start .stage[data-hb-mode="compare"];
-Normal unchanged (the stage gains position:relative only); a Replay run holds its pauses with setTimeout, not inside a frame loop
-(the page check's run wait sees only setTimeout timers and animations).
-Survey row: rollout-survey-01-03.md, 02.01. This page is the reference for its kind of picture.
-```
-
-- [ ] **Step 2: The slot** (after Task 6)
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/02a $REPO/.claude/worktrees/sic-02a feat/see-inside-compare`
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-02a && python -m http.server 8804 --bind 127.0.0.1`
-Ledger: `$RUN/lanes/02.md`.
-
-- [ ] **Step 3: Turn on the switch tests for this page (the failing test)**
-
-In `animations/02-entrance-and-exit/fade-in-out/index.html`, between `</div>` of `div.hb-step-head` and `<div class="stage hb-dots">`, add:
-
-```html
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
-```
-
-After `</div>` of `div.hb-player`, add:
-
-```html
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>The graph shows how solid the card is over time: it fades in, then stays, and with Loop on it fades out too. The dot rides the line as the card plays.</p>
- <p data-hb-for="compare" hidden>On the left, Appears at once: the card is simply there. On the right, Fades in: it turns from see-through to solid, and with Loop off it rests a fifth of a second in.</p>
- </div>
-```
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-02a && node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -E "^✖ |AssertionError"`
-Expected: `✖ fade-in-out: the page's script listens for hb:mode, and its styles mark modes on the stage only` (named again under `✖ failing tests:`), with `AssertionError [ERR_ASSERTION]: the page script listens for hb:mode on document`.
-
-- [ ] **Step 4: Styles**
-
-Replace the whole `<style>` block with:
-
-```html
- <style>
- :root{--ui-accent:#5fd88a;--ui-muted:#8a8a92;--dur:600ms;--ease:ease-out}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{position:relative;display:flex;align-items:center;justify-content:center;background:#0b0b0d}
- .card{background:#161b22;border:1px solid #30363d;border-radius:12px;padding:clamp(28px,5vw,48px);text-align:center;max-width:320px;
- opacity:0;transition:opacity var(--dur) var(--ease);will-change:opacity}
- .card.in{opacity:1}
- .card-icon{font-size:32px;margin-bottom:14px;opacity:.6}
- .card-title{font-size:clamp(17px,2.5vw,22px);font-weight:bold;margin-bottom:8px}
- .card-sub{font-size:11px;color:var(--ui-muted);line-height:1.65}
- /* See inside and Compare. Their labels are plain words on a dark backing. */
- .twin,.graph,.side,.when{display:none}
- .lbl{position:absolute;padding:3px 7px;border-radius:5px;background:rgba(11,11,13,.88);color:#f4f4f2;font:600 13px/1.2 var(--hb-font);white-space:nowrap}
- /* See inside: the card beside a graph of how solid it is over time (below it on phones). The line rises with the fade in, in
- the shape of the Feel, stays at the top while the card stays, and with Loop on falls with the fade out; the dot rides it as
- the card plays: across with the time, up with how solid the card is. */
- .stage[data-hb-mode="inside"]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);align-items:center;
- gap:clamp(12px,3vw,32px);padding:clamp(12px,3vw,32px)}
- .stage[data-hb-mode="inside"] .card{justify-self:center}
- .stage[data-hb-mode="inside"] .graph{display:block}
- .graph{position:relative;width:100%;max-width:460px;aspect-ratio:300/170;justify-self:center}
- .graph svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
- .graph .axis{fill:none;stroke:rgba(244,244,242,.5);stroke-width:1.5}
- .graph .curve{fill:none;stroke:var(--ui-accent);stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
- .graph .dot{fill:#f4f4f2}
- .graph .lbl{transform:translateX(-50%)}
- .graph .y1,.graph .y0{left:0;transform:none}
- .graph .y1{top:0}
- .graph .y0{top:70%}
- .graph .xin,.graph .xout{top:86%}
- .graph .xstay{top:-6%}
- /* Compare: the card twice. On the left a copy that appears at once (no fade); on the right the card itself, which fades. Between
- plays the right card is held a fifth of a second into its fade, so the still picture shows the difference too. */
- .stage[data-hb-mode="compare"]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:center;justify-items:center;
- gap:2px;padding:48px clamp(8px,2vw,24px) 40px}
- .stage[data-hb-mode="compare"] .twin,.stage[data-hb-mode="compare"] .side{display:block}
- .stage[data-hb-mode="compare"] .card{max-width:100%}
- .card.twin{transition:none!important}
- .side{top:12px}
- .side.first{left:12px}
- .side.second{left:calc(50% + 12px)}
- .when{right:12px;bottom:10px}
- .stage[data-hb-mode="compare"].posed .when{display:block}
- .stage[data-hb-mode="compare"].posed .card:not(.twin){opacity:var(--posed,.5)!important;transition:none!important}
- @media(max-width:600px){
- .stage[data-hb-mode="inside"]{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);gap:8px}
- .stage[data-hb-mode="inside"] .card,.stage[data-hb-mode="compare"] .card{padding:14px 16px}
- .stage[data-hb-mode="inside"] .card-sub,.stage[data-hb-mode="compare"] .card-sub{display:none}
- .stage[data-hb-mode="inside"] .card-icon,.stage[data-hb-mode="compare"] .card-icon{font-size:22px;margin-bottom:6px}
- .graph .xstay{display:none}
- .when{left:calc(50% + 8px);right:8px;white-space:normal;text-align:center}
- }
- @media(prefers-reduced-motion:reduce){.card{transition:opacity 300ms linear!important}}
- </style>
-```
-
-- [ ] **Step 5: Markup**
-
-Replace the stage (from `<div class="stage hb-dots">` to its closing `</div>`) with:
-
-```html
- <div class="stage hb-dots">
- <div class="card" id="card">
- <div class="card-icon">◈</div>
- <div class="card-title">Fade In</div>
- <div class="card-sub">Nothing moves or changes size; it only goes from see-through to solid.</div>
- </div>
- <div class="graph" aria-hidden="true">
- <svg viewBox="0 0 300 170">
- <path class="axis" d="M70 16V140H290"/>
- <path class="curve" id="curve" d="M70 140"/>
- <circle class="dot" id="dot" r="6"/>
- </svg>
- <span class="lbl y1" data-hb-caption>Solid</span>
- <span class="lbl y0" data-hb-caption>See-through</span>
- <span class="lbl xin" id="lbl-in" data-hb-caption>Fades in</span>
- <span class="lbl xstay" id="lbl-stay" data-hb-caption>Stays</span>
- <span class="lbl xout" id="lbl-out" data-hb-caption>Fades out</span>
- </div>
- <p class="lbl side first" aria-hidden="true" data-hb-caption>Appears at once</p>
- <p class="lbl side second" aria-hidden="true" data-hb-caption>Fades in</p>
- <p class="lbl when" aria-hidden="true" data-hb-caption>A fifth of a second in</p>
- </div>
-```
-
-- [ ] **Step 6: Script**
-
-Replace the whole `<script>` (from `<script>` after the footer to `</script>`) with:
-
-```html
-<script>
- const card=document.getElementById('card');
- const stage=card.parentElement;
- const vars=document.documentElement.style;
- const loopTog=document.getElementById('loop-tog'),slowTog=document.getElementById('slow-tog');
- const motionOk=!window.matchMedia('(prefers-reduced-motion:reduce)').matches;
- let ms=600,ease='ease-out',timers=[];
- // See inside and Compare. The Feel choices as the four numbers of their speed curves (the browser's own), the page's hold before
- // a fade out and wait before the next play with Loop on, where the graph's line runs (in the drawing's units), and the moment
- // Compare holds between plays.
- const CURVES={'ease-out':[0,0,.58,1],'ease-in-out':[.42,0,.58,1],linear:[0,0,1,1]};
- const HOLD=800,WAIT=300,X0=70,X1=290,YT=16,YB=140,POSE_MS=200;
- const curve=document.getElementById('curve'),dot=document.getElementById('dot');
- const lblIn=document.getElementById('lbl-in'),lblStay=document.getElementById('lbl-stay'),lblOut=document.getElementById('lbl-out');
- // Compare's first card: a copy that appears and leaves at once (no fade), out of reach of the keyboard and screen readers
- const twin=card.cloneNode(true);
- twin.removeAttribute('id');twin.classList.add('twin');twin.inert=true;twin.setAttribute('aria-hidden','true');
- card.before(twin);
- // Under reduced motion both views are still pictures, and their notes say so
- if(!motionOk){
- document.querySelector('[data-hb-for="inside"]').textContent='The graph shows how solid the card gets over time, shown still: the dot sits where the fade in ends.';
- document.querySelector('[data-hb-for="compare"]').textContent='Shown still, a fifth of a second in: on the left, Appears at once, the card is fully there; on the right, Fades in, it is only part of the way.';
- }
- let mode='normal',cycleStart=-1e9,dotRaf=0;
-
- function dur(){return slowTog.checked?ms*3:ms}
- function apply(){
- vars.setProperty('--dur',dur()+'ms');
- vars.setProperty('--ease',ease);
- }
- function later(fn,wait){timers.push(setTimeout(fn,wait))}
- function setIn(on){card.classList.toggle('in',on);twin.classList.toggle('in',on)}
- function fadeIn(){
- cycleStart=performance.now();
- // snap back to fully transparent without a transition so every play restarts from invisible
- card.style.setProperty('transition','none','important');
- setIn(false);void card.offsetWidth;
- card.style.removeProperty('transition');
- setIn(true);
- if(mode==='inside')ride();
- }
- // One play fades in. While Loop is on it then holds, fades out, waits and plays again;
- // switching Loop off lets the card finish visible. Slow motion stretches the fades, not the waits.
- // In Compare a play lifts the pose, and once it is over the right card is held at its moment again.
- function cycle(){
- apply();
- if(motionOk)pose(false);
- fadeIn();
- if(!loopTog.checked||!motionOk){
- if(motionOk&&mode==='compare')later(()=>pose(true),dur()+700);
- return;
- }
- later(()=>{
- if(!loopTog.checked)return;
- setIn(false);
- later(cycle,dur()+300);
- },dur()+800);
- }
- function play(){timers.forEach(clearTimeout);timers=[];cycle()}
-
- // The value of a speed curve at a share x of its time: the curve's own t for x found by halving, then its height there
- function curveAt([a,b,c,e],x){
- const at=(p,q,t)=>3*p*t*(1-t)*(1-t)+3*q*t*t*(1-t)+t*t*t;
- let lo=0,hi=1,t=x;
- for(let i=0;i<30;i++){t=(lo+hi)/2;if(at(a,c,t)<x)lo=t;else hi=t}
- return at(b,e,t);
- }
- // A play's parts in ms: the fade in and the hold, and with Loop on the fade out and the wait
- function parts(){const d=dur();return loopTog.checked&&motionOk?[d,HOLD,d,WAIT]:[d,HOLD]}
- function words(t){return t<=400?'about a third of a second':t<=700?'about half a second':t<=1200?'about a second':t<=2000?'about two seconds':'about three seconds'}
- // The graph: across is time, up is how solid the card is; each fade is drawn with the Feel's own curve
- function drawGraph(){
- const p=parts(),total=p.reduce((s,v)=>s+v,0),[a,b,c,e]=CURVES[ease],h=YB-YT;
- const x=t=>(X0+(X1-X0)*t/total).toFixed(1);
- let d=`M${X0} ${YB}C${x(p[0]*a)} ${YB-h*b} ${x(p[0]*c)} ${YB-h*e} ${x(p[0])} ${YT}H${x(p[0]+p[1])}`;
- if(p.length>2){
- const o=p[0]+p[1];
- d+=`C${x(o+p[2]*a)} ${YT+h*b} ${x(o+p[2]*c)} ${YT+h*e} ${x(o+p[2])} ${YB}H${X1}`;
- }
- curve.setAttribute('d',d);
- const at=(el,t)=>{el.style.left=(100*x(t)/300).toFixed(1)+'%'};
- lblIn.textContent='Fades in, '+words(p[0]);
- at(lblIn,p[0]/2);at(lblStay,p[0]+p[1]/2);
- lblOut.hidden=p.length<3;
- if(p.length>2)at(lblOut,p[0]+p[1]+p[2]/2);
- }
- // The dot: across with the time since the play began, up with how solid the card is right now (still: where the fade in ends)
- function placeDot(){
- const p=parts(),total=p.reduce((s,v)=>s+v,0);
- const t=motionOk?Math.min(Math.max(performance.now()-cycleStart,0),total):p[0];
- const solid=motionOk?parseFloat(getComputedStyle(card).opacity):1;
- dot.style.transform=`translate(${X0+(X1-X0)*t/total}px,${YB-(YB-YT)*solid}px)`;
- return t<total;
- }
- function ride(){
- cancelAnimationFrame(dotRaf);
- const step=()=>{dotRaf=placeDot()&&mode==='inside'&&motionOk?requestAnimationFrame(step):0};
- step();
- }
- // Compare's still moment: a fifth of a second into the fade, the right card as solid as its fade has made it by then
- function pose(on){
- stage.classList.toggle('posed',on);
- if(on)stage.style.setProperty('--posed',curveAt(CURVES[ease],Math.min(1,POSE_MS/dur())).toFixed(3));
- }
- function refresh(){
- drawGraph();
- if(mode==='inside')placeDot();
- if(stage.classList.contains('posed'))pose(true);
- }
-
- // The mode switch: draws the mode at once. The shared script then presses Replay (not under reduced motion), which plays it.
- document.addEventListener('hb:mode',e=>{
- const was=mode;mode=e.detail.mode;
- // Leaving Compare's held moment shows the card as it now is, at once, with no fade
- if(was==='compare'&&mode!=='compare'){card.style.setProperty('transition','none','important');pose(false);void card.offsetWidth;card.style.removeProperty('transition');}
- pose(mode==='compare'&&!(loopTog.checked&&motionOk));
- refresh();
- if(mode==='inside'&&motionOk)ride();
- });
-
- document.getElementById('btn-play').addEventListener('click',play);
- loopTog.addEventListener('change',()=>{
- if(loopTog.checked)play();
- else if(mode==='compare')later(()=>pose(true),dur()+700);
- refresh();
- });
- slowTog.addEventListener('change',refresh);
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);
- refresh();
- }));
- }
- choices('speed-seg',d=>{ms=+d.ms});
- choices('feel-seg',d=>{ease=d.ease});
- apply();
- drawGraph();
-</script>
-```
-
-- [ ] **Step 7: Tests**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-02a && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)|^✔ fade-in-out: (the mode switch is as in the template|exactly two notes|the page's script listens)"`
-Expected: the three switch tests' `✔` lines for `fade-in-out` and `ℹ fail 0`.
-
-- [ ] **Step 8: Page check, screenshots, tuning**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-02a && node $RUN/slot.mjs run sic-02a -- node tools/check-pages.mjs --base http://127.0.0.1:8804 --out $RUN/checks/02-fade-in-out/1 animations/02-entrance-and-exit/fade-in-out`
-Expected: six `ok` lines (the check turns Loop off, presses See inside, waits for the Replay the shared script presses, and so on). Open `02-fade-in-out-desktop-inside.png`, `-phone-inside.png`, `-phone-reduced-inside.png`, `-desktop-compare.png`, `-phone-compare.png`, `-phone-reduced-compare.png` in `$RUN/checks/02-fade-in-out/1/`. Tune (sizes, label places, the graph's plot area `X0`, `X1`, `YT`, `YB` and the label `top` values) until, at 1280 and at 375: the graph reads as "rises, stays" at a glance; every label is clear of the line's start, of the dot and of the others; the card and the graph both fit with room; in Compare the right card is visibly fainter than the left one and the "A fifth of a second in" label sits by it; under reduced motion both are still pictures that teach. Then look at the motion, which the screenshots cannot show: run `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-02a -- node $KIT/record.mjs --base http://127.0.0.1:8804 --only clips --keep-frames --out $RUN/kit/02-fade-in-out-clips animations/02-entrance-and-exit/fade-in-out` and Read three frames from the middle of the See inside clip's kept frame folder (the log names it): the dot sits on the line in each. In the Compare clip's frames the left card is solid while the right one is part way. Acceptance 7 by eye, one kit run per other choice: `node $RUN/slot.mjs run sic-02a -- node $KIT/record.mjs --base http://127.0.0.1:8804 --only stills --press "#speed-seg [data-ms='1000']" --out $RUN/kit/02-fade-in-out-slow animations/02-entrance-and-exit/fade-in-out`, then the same with `"#speed-seg [data-ms='350']"` (`…-fast`), `"#feel-seg [data-ease='ease-in-out']"` (`…-gentle`) and `"#feel-seg [data-ease='linear']"` (`…-even`); in each, See inside's curve or words and Compare's right card differ from the default run's. Rerun the page check after every change (a new round folder); six `ok` each time.
-
-- [ ] **Step 9: Normal before and after**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-02a -- node $KIT/record.mjs --base http://127.0.0.1:8804 --before http://127.0.0.1:8800 --only before --out $RUN/kit/02-fade-in-out --clean animations/02-entrance-and-exit/fade-in-out`
-Expected: `0 of … pixels differ (0 visibly)` at 1280 and at 375.
-
-- [ ] **Step 10: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-02a
-git add animations/02-entrance-and-exit/fade-in-out/index.html
-git commit -m "feat: Fade In / Fade Out shows a graph of how solid the card is over time (See inside) and the card appearing at once beside the card fading in (Compare)"
-```
-
-- [ ] **Step 11: Review, fix rounds, merge into `sic/cat-02`**
-
-The lane lead dispatches a fresh reviewer with: the brief, `git -C $REPO/.claude/worktrees/sic-02a diff feat/see-inside-compare...sic/02a`, the newest check round folder and output, `$RUN/kit/02-fade-in-out/index.html` and the clips, and the 12 acceptance lines. Beyond the check, the reviewer confirms the per-frame work (the dot's loop runs only in See inside while a play lasts, moves by time, and stops; the copy never takes a transition), that a Replay run holds its pauses with `setTimeout`, not inside a frame loop, that Replay, Loop and Slow motion reach both cards, that every Speed and Feel changes See inside and Compare, and that the notes match what shows; verdict Approved or Changes needed. At most three fix rounds. When approved:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO/.claude/worktrees/sic-02a && git switch -c sic/cat-02 feat/see-inside-compare && git merge --no-ff sic/02a -m "Merge slot 02a: Fade In / Fade Out's See inside and Compare"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)" # ℹ fail 0
-```
-Then, as a background command: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-02a && node $RUN/slot.mjs run cat-02 -- node tools/check-pages.mjs --base http://127.0.0.1:8804 --out $RUN/checks/cat-02 animations/02-entrance-and-exit > $RUN/checks/cat-02.log 2>&1`. When it has ended (the log's last line is `Screenshots: …`): `grep -c '^ok' $RUN/checks/cat-02.log` prints `84` and `grep -c '^FAIL' $RUN/checks/cat-02.log` prints `0`. Only then `git switch sic/02a`, stop the server, ledger line, tell the coordinator `sic/cat-02` is ready.
-
----
-### Task 9: 03.14 Overlay Wipe: the change's three steps with the panel see-through (See inside), "Switches at once" beside "Panel sweeps over" (Compare)
-
-**Files:**
-- Modify: `animations/03-page-transitions/overlay-wipe/index.html`: the `<style>` block (the `.stage` rule, line 26; new rules before `</style>`, line 53), the switch before the stage (after line 74), the stage (lines 75-80), the notes after the player bar (after line 85), the `<script>` (lines 173-297: new constants and functions, and small changes to `showPage`, `finish`, `settle`, `navigate`, the `hb:input` listener and `choices`).
-
-**Interfaces:**
-- Consumes: Task 2 (a press of See inside or Compare presses Show me), Task 3 (Reset and the run wait before the pictures; captions), Task 4 (switch tests), Task 6 (`?v=10`).
-- Produces: the category 03 reference (the fourteen small-site transitions): a copy of the small site (`div.box.twin`) that follows `current` at the moment a change starts; numbered bars on a time line with a marker (the cover, swap, uncover picture: Curtain Reveal and Flash / Light Leak draw their own versions); a posed panel at rest (See inside: covering, see-through; Compare: half way); the reduced-motion posed still.
-
-- [ ] **Step 1: The brief** (the 03 lane lead, during Phase 0)
-
-Write `$RUN/briefs/03.14-overlay-wipe.md`:
-
-```markdown
-# 03.14 Overlay Wipe: brief (first batch)
-Kind: do-it, click (Show me visits the next page, holds 1.2 s and comes back; Reset; the page slows itself). Category reference for 03.
-See inside: the panel see-through, so the page changing behind it shows; under the page area a strip of numbered bars on one time
-line: 1 the panel comes in, 2 the page changes behind it (the covered stay), 3 the panel leaves (with Two stacked panels a lighter
-bar leads in and trails out); a marker moves through them during a change. Key: "1 Panel comes in", "2 Page changes behind it",
-"3 Panel leaves" (+ "Light bar: the second panel"). The strip stands for 1.6 s (4.8 in slow motion), so Speed changes the bars.
-At rest the panel stands over the page (see-through, the next page's name on it) with the marker at bar 2.
-Compare: "Switches at once" (a copy of the small site, inert, that changes page the moment the real one starts to) / "Panel sweeps
-over" (the real site). Clicks, Show me and Reset reach both (the copy follows the real site). At rest the real panel stands half
-way across (with Two stacked panels the light one a quarter further in, so the setting shows). The half names sit at the bottom of
-each half, not at its top as spec section 1 has them, because the top of each half holds the small site's nav.
-Reduced motion (the page fades instead): both views are posed stills (the same poses); notes say "shown still".
-Phones: Compare side by side (about 170px each: nav buttons tighter, page text cut to the eyebrow and heading); stacked at 360px
-and below. The real nav buttons stay 44px (check by hand).
-Pitfalls: the copy has no ids and no buttons (spans); the pose is lifted the moment a change starts and comes back only when no
-change or way back is pending; Normal unchanged (the nav and page area are wrapped in div.box, which lays out as before); a Show me
-run holds its pauses with setTimeout, not inside a frame loop (the page check's run wait sees only setTimeout timers and animations).
-Survey row: rollout-survey-01-03.md, 03.14. Twins in look: Curtain Reveal (02.06) and Flash (03.07) draw their own pictures.
-```
-
-- [ ] **Step 2: The slot** (after Task 6)
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/03a $REPO/.claude/worktrees/sic-03a feat/see-inside-compare`
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-03a && python -m http.server 8806 --bind 127.0.0.1`
-Ledger: `$RUN/lanes/03.md`.
-
-- [ ] **Step 3: Turn on the switch tests for this page (the failing test)**
-
-In `animations/03-page-transitions/overlay-wipe/index.html`, between `</div>` of `div.hb-step-head` and `<div class="stage">`, add:
-
-```html
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
-```
-
-After `</div>` of `div.hb-player`, add:
-
-```html
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, the panel is see-through, so the page changing behind it shows; the bars are the change's three steps, and the marker moves through them. Click Work or About, or press Show me.</p>
- <p data-hb-for="compare" hidden>Switches at once: the page simply changes; Panel sweeps over: a panel covers it while it changes. Click Work or About, or press Show me.</p>
- </div>
-```
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-03a && node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -E "^✖ |AssertionError"`
-Expected: `✖ overlay-wipe: the page's script listens for hb:mode, and its styles mark modes on the stage only` (named again under `✖ failing tests:`), with `AssertionError [ERR_ASSERTION]: the page script listens for hb:mode on document`.
-
-- [ ] **Step 4: Styles**
-
-Replace ` .stage{display:flex;flex-direction:column;overflow:hidden;background:var(--bg);color:var(--ui-text)}` with:
-```css
- .stage{position:relative;display:flex;flex-direction:column;overflow:hidden;background:var(--bg);color:var(--ui-text)}
-```
-
-Before ` </style>` add:
-
-```css
- /* The small site: its nav row over its page area. In Compare a copy of it, the twin, sits beside it. */
- .box{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0}
- .twin,.steps,.lbl{display:none}
- .twin .nav-btn{display:inline-flex;align-items:center}
- .lbl{padding:2px 7px;border-radius:5px;background:#111114;color:#f4f4f2;font:600 12px/1.25 var(--hb-font);white-space:nowrap}
- /* See inside: the panel see-through, so the page changing behind it shows, and under the page area the change's three steps
- as numbered bars on one time line, with a marker that moves through them while a change runs. At rest the panel stands
- over the page, with the marker where the page changes. */
- .stage[data-hb-mode="inside"] .panel{opacity:.55}
- .stage[data-hb-mode="inside"].posed .wipe{display:block}
- .stage[data-hb-mode="inside"] .steps{display:block}
- .stage[data-hb-mode="inside"] .steps .lbl{display:inline-block}
- .steps{flex:none;padding:8px 14px 10px;background:#111114;border-top:1px solid var(--ui-border)}
- .bars{position:relative;height:30px}
- .bar{position:absolute;top:8px;height:18px;border-radius:4px;background:var(--panel);color:#0b0b0d;font:700 12px/18px var(--hb-font);
- text-align:center;overflow:hidden}
- .bar.swap{background:repeating-linear-gradient(135deg,var(--panel) 0 5px,color-mix(in srgb,var(--panel) 35%,#111114) 5px 9px)}
- /* The "2" sits on a chip of the panel's own color, so it reads as well as the "1" and the "3" over the dark stripes */
- .bar .chip{display:inline-block;padding:0 4px;border-radius:3px;line-height:14px;background:var(--panel)}
- .bar.lead{top:0;height:6px;background:color-mix(in srgb,var(--panel) 45%,#fff)}
- .mark{position:absolute;left:0;top:0;width:2px;height:30px;background:#f4f4f2}
- .key{display:flex;flex-wrap:wrap;gap:6px 12px;margin-top:6px}
- /* Compare: on the left the copy, which changes page at once; on the right the real site, whose panel sweeps over. At rest the
- real site's panel stands half way across, so the still picture shows the sweep; with two panels the light one stands a
- quarter further in, so it shows beside the front one. */
- .stage[data-hb-mode="compare"]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px;background:#2a2a30}
- .stage[data-hb-mode="compare"] .twin{display:flex}
- .stage[data-hb-mode="compare"] .side{display:block}
- .stage[data-hb-mode="compare"].posed .box:not(.twin) .wipe{display:block}
- .stage[data-hb-mode="compare"].posed .box:not(.twin) .panel{transform:var(--half)}
- .stage[data-hb-mode="compare"].posed .box:not(.twin) .panel.back{transform:var(--lead)}
- .side{position:absolute;bottom:10px}
- .side.first{left:10px}
- .side.second{left:calc(50% + 10px)}
- @media(max-width:600px){
- .stage[data-hb-mode="compare"] .mini-nav{gap:4px;padding:6px}
- .stage[data-hb-mode="compare"] .nav-btn{padding:0 6px;font-size:12px}
- .stage[data-hb-mode="compare"] .pc{padding:12px;gap:6px}
- .stage[data-hb-mode="compare"] .ph{font-size:16px}
- .stage[data-hb-mode="compare"] .pp,.stage[data-hb-mode="compare"] .pgrid,.stage[data-hb-mode="compare"] .pstat{display:none}
- }
- @media(max-width:360px){
- .stage[data-hb-mode="compare"]{grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(2,minmax(0,1fr))}
- .stage[data-hb-mode="compare"] .side.first{bottom:calc(50% + 10px)}
- .stage[data-hb-mode="compare"] .side.second{left:10px}
- }
-```
-
-- [ ] **Step 5: Markup**
-
-Replace the stage (from `<div class="stage">` to its closing `</div>`) with:
-
-```html
- <div class="stage">
- <div class="box" id="box">
- <nav class="mini-nav" id="nav" aria-label="Demo pages"></nav>
- <div class="page-area" id="page-area">
- <div class="wipe" id="wipe" aria-hidden="true"><span class="panel back" id="back"></span><span class="panel front" id="front"><b class="pname" id="pname"></b></span></div>
- </div>
- </div>
- <div class="steps" aria-hidden="true">
- <div class="bars"><span class="bar lead" id="b-lead-in"></span><span class="bar lead" id="b-lead-out"></span><span class="bar" id="b-in">1</span><span class="bar swap" id="b-swap"><span class="chip">2</span></span><span class="bar" id="b-out">3</span><span class="mark" id="mark"></span></div>
- <p class="key"><span class="lbl k" data-hb-caption>1 Panel comes in</span><span class="lbl k" data-hb-caption>2 Page changes behind it</span><span class="lbl k" data-hb-caption>3 Panel leaves</span><span class="lbl k" id="l-lead" data-hb-caption hidden>Light bar: the second panel</span></p>
- </div>
- <p class="lbl side first" aria-hidden="true" data-hb-caption>Switches at once</p>
- <p class="lbl side second" aria-hidden="true" data-hb-caption>Panel sweeps over</p>
- </div>
-```
-
-- [ ] **Step 6: Script**
-
-(a) Replace the line ` const nav=document.getElementById('nav'),area=document.getElementById('page-area'),wipe=document.getElementById('wipe');` with:
-```js
- const box=document.getElementById('box'),stage=box.parentElement;
- const nav=document.getElementById('nav'),area=document.getElementById('page-area'),wipe=document.getElementById('wipe');
-```
-
-(b) After the line ` const TO={ltr:'translateX(100%)',rtl:'translateX(-100%)',btt:'translateY(-100%)',ttb:'translateY(100%)'};` add:
-```js
- // Half way in, for each direction: where Compare's still picture holds the panel; with two panels the light one, which leads,
- // stands a quarter further in
- const HALF={ltr:'translateX(-50%)',rtl:'translateX(50%)',btt:'translateY(50%)',ttb:'translateY(-50%)'};
- const LEAD={ltr:'translateX(-25%)',rtl:'translateX(25%)',btt:'translateY(25%)',ttb:'translateY(-25%)'};
-```
-
-(c) After the `PAGES.forEach((p,i)=>{ … });` block add:
-```js
- // Compare's first half: the same small site, changing page at once. A copy built from the same pages, with no ids and no
- // buttons, out of the Tab order and hidden from screen readers; it changes page the moment a change of the real site starts (a
- // click, Show me, Reset), so one input drives both halves.
- const twin=document.createElement('div');
- twin.className='box twin';twin.inert=true;twin.setAttribute('aria-hidden','true');
- twin.innerHTML=`<div class="mini-nav">${PAGES.map(p=>`<span class="nav-btn">${p.name}</span>`).join('')}</div>`+
- `<div class="page-area">${PAGES.map(p=>`<div class="page" style="background:${p.bg}">${p.html}</div>`).join('')}</div>`;
- box.before(twin);
- const twinPages=[...twin.querySelectorAll('.page')],twinNav=[...twin.querySelectorAll('.nav-btn')];
- function showTwin(n){twinPages.forEach((el,i)=>el.classList.toggle('active',i===n));twinNav.forEach((b,i)=>b.classList.toggle('active',i===n))}
- // See inside's bars, on a time line of 1.6 seconds (three times that in slow motion), and its marker
- const mark=document.getElementById('mark'),bars=mark.parentElement,lblLead=document.getElementById('l-lead');
- const B={in:'b-in',swap:'b-swap',out:'b-out',leadIn:'b-lead-in',leadOut:'b-lead-out'};
- Object.keys(B).forEach(k=>{B[k]=document.getElementById(B[k])});
- const SPAN=1600;
- let mode='normal',changeAt=0,markRaf=0;
- // Under reduced motion both views are still pictures, and their notes say so
- if(!motionOk){
- document.querySelector('[data-hb-for="inside"]').textContent='Inside, shown still: the see-through panel covers the page while it changes, and the bars are the three steps of the change.';
- document.querySelector('[data-hb-for="compare"]').textContent='Shown still: Switches at once has simply changed page; Panel sweeps over has its panel caught half way across.';
- }
-```
-
-(d) In `showPage(n)` add ` showTwin(n);` after ` updateNav(n);`. In `finish()` add ` pose();` as its last line (after `if(then)then();`). In `settle()` add ` pose();` as its last line (after `showPage(current);`).
-
-(e) In `navigate(next,then)`, right after ` const prev=current;current=next;updateNav(next);` add:
-```js
- // The copy changes page at once; the pose goes, and the marker starts with the change
- showTwin(next);stage.classList.remove('posed');changeAt=performance.now();
- if(mode==='inside'&&motionOk)rideMark();
-```
-
-(f) Replace ` document.addEventListener('hb:input',()=>{afterMove=null;cancel(wayBack);wayBack=0});` with:
-```js
- document.addEventListener('hb:input',()=>{afterMove=null;cancel(wayBack);wayBack=0;pose()});
-```
-
-(g) Before ` function choices(id,pick){` add:
-```js
- // One change, in ms, as navigate() runs it: the front panel comes in after the lead, the page is covered for the stay (it changes
- // at the start of it), then the front panel leaves; with two panels the lighter one comes in first and leaves last
- function plan(){
- const ms=sweepMs*(slowTog.checked?3:1),stay=ms/4,lead=twoTog.checked?ms/4:0;
- return{ms,stay,lead,total:2*ms+stay+2*lead};
- }
- function drawSteps(){
- const p=plan(),span=SPAN*(slowTog.checked?3:1);
- const set=(el,from,len)=>{el.style.left=(100*from/span).toFixed(2)+'%';el.style.width=(100*len/span).toFixed(2)+'%'};
- set(B.in,p.lead,p.ms);set(B.swap,p.lead+p.ms,p.stay);set(B.out,p.lead+p.ms+p.stay,p.ms);
- set(B.leadIn,0,p.ms);set(B.leadOut,2*p.lead+p.ms+p.stay,p.ms);
- B.leadIn.hidden=B.leadOut.hidden=lblLead.hidden=!twoTog.checked;
- }
- // The marker at time t of a change, on the bars' time line
- function placeMark(t){
- const span=SPAN*(slowTog.checked?3:1);
- mark.style.transform=`translateX(${(bars.clientWidth*Math.min(t,span)/span).toFixed(1)}px)`;
- }
- function rideMark(){
- cancelAnimationFrame(markRaf);
- const step=()=>{const t=performance.now()-changeAt;placeMark(t);markRaf=t<plan().total&&mode==='inside'?requestAnimationFrame(step):0};
- step();
- }
- // At rest in See inside and Compare the panel stands still at a telling moment: in See inside over the page, see-through,
- // with the marker where the page changes; in Compare half way across the real site. A change lifts the pose.
- function pose(){
- const on=mode!=='normal'&&!animating&&!wayBack;
- stage.classList.toggle('posed',on);
- if(!on)return;
- nameEl.textContent=PAGES[(current+1)%PAGES.length].name;
- back.hidden=!twoTog.checked;
- stage.style.setProperty('--half',HALF[dir]);stage.style.setProperty('--lead',LEAD[dir]);
- const p=plan();placeMark(p.lead+p.ms);
- }
- // The mode switch: draws the mode at once. The shared script then presses Show me (not under reduced motion), which plays it.
- document.addEventListener('hb:mode',e=>{
- mode=e.detail.mode;
- drawSteps();
- pose();
- });
- // The posed marker is placed in pixels, so a new size of the window (a phone turned) places it again
- addEventListener('resize',()=>{if(mode==='inside'&&!animating&&!wayBack)pose()});
-
-```
-
-(h) In `choices`, after ` pick(b.dataset);` add ` drawSteps();pose();`. After the three `choices(…)` calls add:
-```js
- twoTog.addEventListener('change',()=>{drawSteps();pose()});
- slowTog.addEventListener('change',()=>{drawSteps();pose()});
-```
-and after the final ` showPage(0);` add ` drawSteps();`.
-
-- [ ] **Step 7: Tests**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-03a && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"`
-Expected: `ℹ fail 0`.
-
-- [ ] **Step 8: Page check, screenshots, tuning**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-03a && node $RUN/slot.mjs run sic-03a -- node tools/check-pages.mjs --base http://127.0.0.1:8806 --out $RUN/checks/03-overlay-wipe/1 animations/03-page-transitions/overlay-wipe`
-Expected: six `ok` lines (before the modes the check presses Reset and waits; each mode press starts Show me, about 3.3 s with its hold, which the check waits for). Open `03-overlay-wipe-desktop-inside.png`, `-phone-inside.png`, `-phone-reduced-inside.png`, `-desktop-compare.png`, `-phone-compare.png`, `-phone-reduced-compare.png`, and `03-overlay-wipe-phone-small-inside.png` and `-phone-small-compare.png` (the setup's own `03-overlay-wipe-phone-small.png` shows Normal). Tune (the strip's height and padding, the key's gap, the bars' height, the see-through `.55`, the Compare text cuts) until: the page's heading reads through the see-through panel; the three numbered bars and the key read at 1280 and 375; in Compare the right half's panel stands half across with "Switches at once" and "Panel sweeps over" clear of the page text; at 320 the halves stack and each shows its nav and heading; at 320 each half name sits in its own half; every real nav button is at least 44×44 in Compare at 375 and 320 (measure in the screenshot: 44 CSS px are 88 pixels at scale 2). Motion: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-03a -- node $KIT/record.mjs --base http://127.0.0.1:8806 --only clips --keep-frames --out $RUN/kit/03-overlay-wipe-clips animations/03-page-transitions/overlay-wipe`; in the See inside clip's frames the marker passes bar 1 while the panel comes in, bar 2 while it covers, bar 3 while it leaves; in the Compare clip's frames the left half changes page in one frame while the right half's panel sweeps. Acceptance 7: kit runs with `--only stills --press "#dir-seg [data-dir='btt']"`, `--press "#color-sw [data-c='#3fd6c4']"`, `--press "#two-tog"` and `--press "#speed-seg [data-ms='550']"` (each into its own `--out`): the pose's side, the colors, the light bars and the bar lengths change. Six `ok` after every change.
-
-- [ ] **Step 9: Normal before and after**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-03a -- node $KIT/record.mjs --base http://127.0.0.1:8806 --before http://127.0.0.1:8800 --only before --out $RUN/kit/03-overlay-wipe --clean animations/03-page-transitions/overlay-wipe`
-Expected: `0 of … pixels differ (0 visibly)` at 1280 and at 375.
-
-- [ ] **Step 10: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-03a
-git add animations/03-page-transitions/overlay-wipe/index.html
-git commit -m "feat: Overlay Wipe shows the change's three steps with the panel see-through (See inside) and a page that switches at once beside the sweeping panel (Compare)"
-```
-
-- [ ] **Step 11: Review, fix rounds, merge into `sic/cat-03`**
-
-The lane lead dispatches a fresh reviewer with: the brief, `git -C $REPO/.claude/worktrees/sic-03a diff feat/see-inside-compare...sic/03a`, the newest check round and output, the kit's before-and-after and clips, and the 12 acceptance lines. Beyond the check they confirm: the copy follows every change (a click on Work, Show me, Reset; under reduced motion too), is inert and has no ids or buttons; the pose never shows while a change or its way back is pending; the marker's frame loop runs only during a change in See inside and moves by time; a Show me run holds its pauses with `setTimeout`, not inside a frame loop; Show me's run on a mode press leaves the real site on its first page. Verdict; at most three fix rounds. When approved:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO/.claude/worktrees/sic-03a && git switch -c sic/cat-03 feat/see-inside-compare && git merge --no-ff sic/03a -m "Merge slot 03a: Overlay Wipe's See inside and Compare"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)" # ℹ fail 0
-```
-Then, as a background command: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-03a && node $RUN/slot.mjs run cat-03 -- node tools/check-pages.mjs --base http://127.0.0.1:8806 --out $RUN/checks/cat-03 animations/03-page-transitions > $RUN/checks/cat-03.log 2>&1`. When it has ended (the log's last line is `Screenshots: …`): `grep -c '^ok' $RUN/checks/cat-03.log` prints `96` and `grep -c '^FAIL' $RUN/checks/cat-03.log` prints `0`. Only then `git switch sic/03a`, stop the server, ledger line, tell the coordinator `sic/cat-03` is ready.
-
----
-
-### Task 10: 04.05 Magnetic Button: the pull's reach, rest and lean (See inside), "Stays put" with a ghost pointer beside "Leans toward you" (Compare)
-
-**Files:**
-- Modify: `animations/04-micro-interactions/magnetic-button/index.html`: new rules before `</style>` (line 34), the switch before the stage (after line 55), the stage (lines 56-58), the notes after the player bar (after line 62), and the `<script>` (lines 130-241: the button lookup, `pull`, `home`, the mouse handlers, and new functions, listeners and setting hooks).
-
-**Interfaces:**
-- Consumes: Task 2 (a press of See inside or Compare presses Show me), Task 3 (run waits; captions; the stage's controls' names), Task 4 (switch tests), Task 6 (`?v=10`).
-- Produces: the category 04 reference and the reference for the hover pages (about a dozen): an inert first half (`div.mag.twin`), a ghost pointer that mirrors the real or pretend pointer over it, a pretend pointer parked at rest (`pose()`), arrows and rings drawn from the page's own numbers (`radius`, `strength`).
-
-- [ ] **Step 1: The brief** (the 04 lane lead, during Phase 0)
-
-Write `$RUN/briefs/04.05-magnetic-button.md`:
-
-```markdown
-# 04.05 Magnetic Button: brief (first batch)
-Kind: do-it, hover (Show me moves a pretend pointer to three spots; Slow motion is the shared CSS one). Category reference for 04;
-reference for the hover pages.
-See inside: a dashed ring as big as Reach around the button's resting place ("Pulls inside this ring"); a dashed outline where the
-button rests ("Rests here"); a short arrow over a dark edge (so the button's words stay readable under it) from the resting center
-to where the button is pulled now ("Leans toward the pointer");
-a faint line to the pointer; "Its label moves a little more". At rest a pretend pointer is parked half way to the ring's edge and the
-button leans toward it, so the still picture shows the pull; the visitor's mouse, finger, arrow keys or Show me take over.
-Compare: "Stays put" (an inert copy of the button that never moves, with a ghost of the pointer at the same place relative to it) /
-"Leans toward you" (the real button). Side by side; stacked on phones (the button is too wide for two per row).
-Reduced motion: the views snap to their pose (no glide); Show me is not pressed by a mode press.
-Pitfalls: the script must find the real button as button.mag (the copy is a div.mag that comes first); the pose leans from the
-resting place, not from where the button is mid-glide; the ring at Long reach is bigger than a phone's stage (it may be cut, the
-label stays inside); the four labels must not overlap (the check says so); keyboard: arrows still pull, Escape parks the pose; a Show me
-run holds its pauses with setTimeout, not inside a frame loop (the page check's run wait sees only setTimeout timers and animations).
-Survey row: rollout-survey-04.md, 04.05.
-```
-
-- [ ] **Step 2: The slot** (after Task 6)
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/04a $REPO/.claude/worktrees/sic-04a feat/see-inside-compare`
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-04a && python -m http.server 8808 --bind 127.0.0.1`
-Ledger: `$RUN/lanes/04.md`.
-
-- [ ] **Step 3: Turn on the switch tests for this page (the failing test)**
-
-In `animations/04-micro-interactions/magnetic-button/index.html`, between `</div>` of `div.hb-step-head` and `<div class="stage hb-dots">`, add:
-
-```html
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
-```
-
-After `</div>` of `div.hb-player`, add:
-
-```html
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, the ring shows how far the pull reaches: the button leans part of the way toward the pointer, and its label a little further. Point near it, or press Show me.</p>
- <p data-hb-for="compare" hidden>Stays put: the button ignores the pointer, shown as a ghost. Leans toward you: point near it, or press Show me, and it is pulled toward the pointer.</p>
- </div>
-```
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-04a && node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -E "^✖ |AssertionError"`
-Expected: `✖ magnetic-button: the page's script listens for hb:mode, and its styles mark modes on the stage only` (named again under `✖ failing tests:`), with `AssertionError [ERR_ASSERTION]: the page script listens for hb:mode on document`.
-
-- [ ] **Step 4: Styles**
-
-Before ` </style>` add:
-
-```css
- /* See inside and Compare. Drawn over the stage from the page's own numbers: the ring the pull reaches, the button's resting
- place, the lean (an arrow from where the button rests to where it is pulled, over a dark edge so the button's words stay
- readable under it), a faint line to the pointer, a pretend pointer, and in Compare a ghost of the pointer over the copy
- that stays put. */
- .twin,.views,.lbl{display:none}
- .views{position:absolute;inset:0;pointer-events:none}
- .views svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
- .ring,.rest,.lean-edge,.lean,.toward,.pointer,.ghost{display:none}
- .ring{fill:rgba(255,157,92,.06);stroke:rgba(255,157,92,.75);stroke-width:2;stroke-dasharray:6 6}
- .rest{fill:none;stroke:rgba(244,244,242,.6);stroke-width:2;stroke-dasharray:5 5}
- .lean-edge{fill:none;stroke:#0b0b0d;stroke-width:6;stroke-linecap:round;stroke-linejoin:round}
- .lean{fill:none;stroke:#f4f4f2;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
- .toward{stroke:rgba(244,244,242,.45);stroke-width:1.5;stroke-dasharray:3 5}
- .pointer path,.ghost path{fill:#f4f4f2;stroke:#0b0b0d;stroke-width:1.5;stroke-linejoin:round}
- .ghost{opacity:.7}
- .lbl{position:absolute;padding:3px 7px;border-radius:5px;background:rgba(11,11,13,.88);color:#f4f4f2;font:600 13px/1.2 var(--hb-font);white-space:nowrap}
- .stage[data-hb-mode="inside"] .views,.stage[data-hb-mode="compare"] .views{display:block}
- .stage[data-hb-mode="inside"] .ring,.stage[data-hb-mode="inside"] .rest,.stage[data-hb-mode="inside"] .lean-edge,
- .stage[data-hb-mode="inside"] .lean,.stage[data-hb-mode="inside"] .toward,.stage[data-hb-mode="compare"] .toward{display:inline}
- .stage[data-hb-mode="inside"].pretend .pointer,.stage[data-hb-mode="compare"].pretend .pointer,.stage[data-hb-mode="compare"] .ghost{display:inline}
- .stage[data-hb-mode="inside"] .in-l,.stage[data-hb-mode="compare"] .cmp-l{display:block}
- /* Compare: the button twice, side by side (one above the other on phones): on the left a copy that stays put, on the right
- the real one */
- .stage[data-hb-mode="compare"]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));place-items:center}
- .stage[data-hb-mode="compare"] .twin{display:inline-block;grid-column:1;grid-row:1}
- .stage[data-hb-mode="compare"] .mag:not(.twin){grid-column:2;grid-row:1}
- .cmp-l{top:12px}
- .cmp-l.first{left:12px}
- .cmp-l.second{left:calc(50% + 12px)}
- @media(max-width:600px){
- .stage[data-hb-mode="compare"]{grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(2,minmax(0,1fr))}
- .stage[data-hb-mode="compare"] .mag:not(.twin){grid-column:1;grid-row:2}
- .stage[data-hb-mode="compare"] .cmp-l.second{left:12px;top:calc(50% + 8px)}
- }
- /* Under reduced motion the views take their pose at once, with no glide */
- @media(prefers-reduced-motion:reduce){
- .stage[data-hb-mode="inside"] .mag,.stage[data-hb-mode="inside"] .mag .mag-label,
- .stage[data-hb-mode="compare"] .mag,.stage[data-hb-mode="compare"] .mag .mag-label{transition:none}
- }
-```
-
-- [ ] **Step 5: Markup**
-
-Replace the stage (from `<div class="stage hb-dots">` to its closing `</div>`) with:
-
-```html
- <div class="stage hb-dots">
- <div class="mag twin" aria-hidden="true" inert><span class="mag-label">Get Started</span></div>
- <button class="mag" type="button"><span class="mag-label">Get Started</span></button>
- <div class="views" aria-hidden="true">
- <svg>
- <circle class="ring" id="ring" r="0"/>
- <rect class="rest" id="rest"/>
- <line class="toward" id="toward"/>
- <path class="lean-edge" id="lean-edge"/>
- <path class="lean" id="lean"/>
- <g class="pointer" id="pointer"><path d="M0 0V19L5 14.5L8.5 22L11.5 20.7L8 13.3H14.5Z"/></g>
- <g class="ghost" id="ghost"><path d="M0 0V19L5 14.5L8.5 22L11.5 20.7L8 13.3H14.5Z"/></g>
- </svg>
- <span class="lbl in-l" id="l-reach" data-hb-caption>Pulls inside this ring</span>
- <span class="lbl in-l" id="l-rest" data-hb-caption>Rests here</span>
- <span class="lbl in-l" id="l-lean" data-hb-caption>Leans toward the pointer</span>
- <span class="lbl in-l" id="l-label" data-hb-caption>Its label moves a little more</span>
- <span class="lbl cmp-l first" data-hb-caption>Stays put</span>
- <span class="lbl cmp-l second" data-hb-caption>Leans toward you</span>
- </div>
- </div>
-```
-
-- [ ] **Step 6: Script**
-
-(a) Replace ` const btn=stage.querySelector('.mag');` with:
-```js
- const btn=stage.querySelector('button.mag');
-```
-and after ` const slowTog=document.getElementById('slow-tog');` add:
-```js
- // See inside and Compare: the copy that stays put, the drawn parts and their labels; P is the point pulling now (null at home)
- const twin=stage.querySelector('.mag.twin');
- const $=id=>document.getElementById(id);
- const ring=$('ring'),rest=$('rest'),toward=$('toward'),lean=$('lean'),leanEdge=$('lean-edge'),pointer=$('pointer'),ghost=$('ghost');
- const L={reach:$('l-reach'),rest:$('l-rest'),lean:$('l-lean'),label:$('l-label')};
- let mode='normal',P=null,mouseIn=false;
-```
-
-(b) Replace the functions `pull` and `home` with:
-```js
- // The pull takes a point on the stage (from its top left corner). The mouse, a finger and Show me all call it.
- // It measures from where the button is now, moved or not, and sends the button home when the point is out of reach.
- function pull(px,py){
- P={x:px,y:py};
- const s=stage.getBoundingClientRect(),b=btn.getBoundingClientRect();
- const dx=px-(b.left+b.width/2-s.left),dy=py-(b.top+b.height/2-s.top),dist=Math.hypot(dx,dy);
- if(dist<radius){
- const f=1-dist/radius; // full strength at the button's center, easing to none at the edge of Reach
- const tx=dx*strength*f,ty=dy*strength*f;
- btn.style.setProperty('--tx',tx+'px');btn.style.setProperty('--ty',ty+'px');
- label.style.transform=`translate(${tx*0.35}px,${ty*0.35}px)`;
- drawViews();
- }else home();
- }
- // Home: the button goes back to its place. In See inside and Compare, with nothing else pulling it, the pose takes over.
- function home(){
- btn.style.removeProperty('--tx');btn.style.removeProperty('--ty');label.style.transform='';
- P=null;
- if(mode!=='normal'&&idle())pose();else drawViews();
- }
- // The button's resting center in the pull's frame (the stage's border box): its layout box, which the pull never moves
- function restCenter(){return{x:stage.clientLeft+btn.offsetLeft+btn.offsetWidth/2,y:stage.clientTop+btn.offsetTop+btn.offsetHeight/2}}
- function idle(){return!mouseIn&&touchId===null&&!keyed&&!running()}
- // The pose: a pretend pointer parked half way to the edge of the ring, up and to the right, and the button leaning toward it as
- // the pull would lean it from its resting place
- function pose(){
- if(mode==='normal')return;
- const c=restCenter(),k=radius/2,px=c.x+k*.8,py=c.y-k*.6;
- const tx=(px-c.x)*strength*.5,ty=(py-c.y)*strength*.5;
- btn.style.setProperty('--tx',tx+'px');btn.style.setProperty('--ty',ty+'px');
- label.style.transform=`translate(${tx*0.35}px,${ty*0.35}px)`;
- P={x:px,y:py};
- drawViews();
- }
- // Draws the views for the pull on show (nothing in Normal). The drawing's frame is the stage's padding box.
- function drawViews(){
- if(mode==='normal')return;
- const c=restCenter(),ox=stage.clientLeft,oy=stage.clientTop,cx=c.x-ox,cy=c.y-oy;
- const tx=parseFloat(btn.style.getPropertyValue('--tx'))||0,ty=parseFloat(btn.style.getPropertyValue('--ty'))||0;
- ring.setAttribute('cx',cx);ring.setAttribute('cy',cy);ring.setAttribute('r',radius);
- rest.setAttribute('x',btn.offsetLeft);rest.setAttribute('y',btn.offsetTop);
- rest.setAttribute('width',btn.offsetWidth);rest.setAttribute('height',btn.offsetHeight);rest.setAttribute('rx',btn.offsetHeight/2);
- // The lean as an arrow, from where the button rests to where the pull has taken its center (none while it rests), with two
- // short head strokes, drawn over a dark edge so the button's words stay readable under it
- const len=Math.hypot(tx,ty),ang=Math.atan2(ty,tx),hx=cx+tx,hy=cy+ty,head=Math.min(9,len/2);
- const arrow=len<1?'':`M${cx} ${cy}L${hx} ${hy}M${hx-Math.cos(ang-.6)*head} ${hy-Math.sin(ang-.6)*head}L${hx} ${hy}L${hx-Math.cos(ang+.6)*head} ${hy-Math.sin(ang+.6)*head}`;
- lean.setAttribute('d',arrow);leanEdge.setAttribute('d',arrow);
- stage.classList.toggle('pretend',!!P&&!mouseIn);
- toward.style.display=ghost.style.display=P?'':'none';
- if(P){
- toward.setAttribute('x1',cx);toward.setAttribute('y1',cy);toward.setAttribute('x2',P.x-ox);toward.setAttribute('y2',P.y-oy);
- pointer.setAttribute('transform',`translate(${P.x-ox} ${P.y-oy})`);
- const t={x:twin.offsetLeft+twin.offsetWidth/2,y:twin.offsetTop+twin.offsetHeight/2};
- ghost.setAttribute('transform',`translate(${t.x+P.x-c.x} ${t.y+P.y-c.y})`);
- }
- if(mode==='inside')placeLabels(cx,cy);
- }
- // See inside's four labels, each beside the part it names and kept inside the stage
- function placeLabels(cx,cy){
- const W=stage.clientWidth,H=stage.clientHeight,ox=stage.clientLeft,oy=stage.clientTop;
- const put=(el,x,y)=>{el.style.left=Math.max(6,Math.min(W-el.offsetWidth-6,x))+'px';el.style.top=Math.max(6,Math.min(H-el.offsetHeight-6,y))+'px'};
- const p=P?{x:P.x-ox,y:P.y-oy}:{x:cx,y:cy};
- put(L.reach,cx-L.reach.offsetWidth/2,cy-radius-L.reach.offsetHeight-6);
- put(L.rest,cx-L.rest.offsetWidth/2,btn.offsetTop+btn.offsetHeight+12);
- put(L.label,cx-L.label.offsetWidth/2,btn.offsetTop+btn.offsetHeight+12+L.rest.offsetHeight+6);
- put(L.lean,p.x+20,p.y-L.lean.offsetHeight-6);
- }
-```
-
-(c) Replace the mouse block `if(hasHover){ … }` with:
-```js
- if(hasHover){
- stage.addEventListener('pointerenter',e=>{if(e.pointerType==='mouse')mouseIn=true});
- stage.addEventListener('pointermove',e=>{
- if(e.pointerType!=='mouse')return;
- mouseIn=true;
- if(e.isTrusted&&running())stopRun();
- pointAt(e);
- });
- stage.addEventListener('pointerleave',e=>{if(e.pointerType==='mouse'){mouseIn=false;stopRun()}});
- }
-```
-
-(d) After the line ` document.addEventListener('hb:input',()=>{if(running())stopRun()});` add:
-```js
- // The mode switch: draws the mode at once (in See inside and Compare the pose, in Normal the button at home). The shared script
- // then presses Show me (not under reduced motion), which plays it.
- document.addEventListener('hb:mode',e=>{
- mode=e.detail.mode;
- if(idle())home();else drawViews();
- });
- // A new size of the window moves the button's resting place, so the views are drawn again
- addEventListener('resize',()=>{if(mode!=='normal'){if(idle())pose();else drawViews()}});
-```
-
-(e) In `choices`, after ` pick(b.dataset);` add ` if(mode!=='normal'){if(idle())pose();else drawViews()}`.
-
-- [ ] **Step 7: Tests**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-04a && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"`
-Expected: `ℹ fail 0` (the keyboard test for the pointer pages still passes: the stage holds the real button and the script handles the arrow keys).
-
-- [ ] **Step 8: Page check, screenshots, tuning**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-04a && node $RUN/slot.mjs run sic-04a -- node tools/check-pages.mjs --base http://127.0.0.1:8808 --out $RUN/checks/04-magnetic-button/1 animations/04-micro-interactions/magnetic-button`
-Expected: six `ok` lines. Open `04-magnetic-button-desktop-inside.png`, `-phone-inside.png`, `-phone-reduced-inside.png`, `-desktop-compare.png`, `-phone-compare.png`, `-phone-reduced-compare.png`. Tune (label places in `placeLabels`, the pose's direction and distance, the ring's dash and alpha) until, at 1280 and at 375: the ring, the dashed resting outline, the leaning button and the pretend pointer read as one story; the four labels are apart (the check fails on an overlap) and none covers the button's words; in Compare the copy sits centered in its half with the ghost pointer at the same place relative to it as the pretend pointer to the real button, and the real button visibly leans. Motion: a kit clips run (`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-04a -- node $KIT/record.mjs --base http://127.0.0.1:8808 --only clips --keep-frames --out $RUN/kit/04-magnetic-button-clips animations/04-micro-interactions/magnetic-button`): during Show me the pretend pointer jumps spot to spot and the lean arrow follows each pull; in Compare the ghost moves with it over the still copy. Keyboard and touch by hand in the clips' absence: read the code path (arrow keys call `pull`, Escape and blur call `home`, a finger's `pointerup` calls `home`) and confirm each ends in the pose. Acceptance 7: kit runs with `--only stills --press "#strength-seg [data-strength='0.5']"` and `--press "#reach-seg [data-reach='240']"`: the lean and the ring change in both views. Six `ok` after every change.
-
-- [ ] **Step 9: Normal before and after**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-04a -- node $KIT/record.mjs --base http://127.0.0.1:8808 --before http://127.0.0.1:8800 --only before --out $RUN/kit/04-magnetic-button --clean animations/04-micro-interactions/magnetic-button`
-Expected: `0 of … pixels differ (0 visibly)` at 1280 and at 375.
-
-- [ ] **Step 10: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-04a
-git add animations/04-micro-interactions/magnetic-button/index.html
-git commit -m "feat: Magnetic Button shows how far its pull reaches and how far it leans (See inside) and a button that stays put beside the one that leans toward you (Compare)"
-```
-
-- [ ] **Step 11: Review, fix rounds, merge into `sic/cat-04`**
-
-The lane lead dispatches a fresh reviewer with: the brief, `git -C $REPO/.claude/worktrees/sic-04a diff feat/see-inside-compare...sic/04a`, the newest check round and output, the kit's before-and-after and clips, and the 12 acceptance lines. Beyond the check they confirm: hover, a finger, the arrow keys and Show me all work in both modes as in Normal; the copy is inert, has no button and never moves; the pose leans from the resting place; a Show me run holds its pauses with `setTimeout`, not inside a frame loop; under reduced motion the views snap. Verdict; at most three fix rounds. When approved:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO/.claude/worktrees/sic-04a && git switch -c sic/cat-04 feat/see-inside-compare && git merge --no-ff sic/04a -m "Merge slot 04a: Magnetic Button's See inside and Compare"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)" # ℹ fail 0
-```
-Then, as a background command: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-04a && node $RUN/slot.mjs run cat-04 -- node tools/check-pages.mjs --base http://127.0.0.1:8808 --out $RUN/checks/cat-04 animations/04-micro-interactions > $RUN/checks/cat-04.log 2>&1`. When it has ended (the log's last line is `Screenshots: …`): `grep -c '^ok' $RUN/checks/cat-04.log` prints `246` and `grep -c '^FAIL' $RUN/checks/cat-04.log` prints `0`. Only then `git switch sic/04a`, stop the server, ledger line, tell the coordinator `sic/cat-04` is ready.
-
----
-### Task 11: 05.06 Marquee / Ticker: the strip zoomed out (See inside), "One copy" above "Two copies" (Compare, a common mistake)
-
-**Files:**
-- Modify: `animations/05-text-typography/marquee-ticker/index.html`: the `<style>` block (the `.stage` rule, line 26; new rules before `</style>`, line 39), the switch before the stage (after line 60), the stage (line 61), the notes after the player bar (after line 65), the `<script>` (lines 162-244: the containers, `buildRow`, `rebuild`, the Speed choice, and new functions and a listener).
-
-**Interfaces:**
-- Consumes: Task 3 (paused loops at the deep setups; captions), Task 4 (switch tests), Task 6 (`?v=10`). The shared CSS pause and Slow motion (`data-hb-pause="css"`, `data-hb-slowmo="css"`) reach every animation in the stage, the views' ones included.
-- Produces: the category 05 reference, the reference for the pages whose Your text must feed the copy (19) and for a Compare that shows a common mistake (ruling 3): the rows move into `div.rows` (classes `r1`, `r2`, `r3`), `buildViews()` builds See inside's zoomed strip and Compare's one-copy row from the first row's own numbers on every rebuild.
-
-- [ ] **Step 1: The brief** (the 05 lane lead, during Phase 0)
-
-Write `$RUN/briefs/05.06-marquee-ticker.md`:
-
-```markdown
-# 05.06 Marquee / Ticker: brief (first batch)
-Kind: loop (Pause and Slow motion are the shared CSS ones; pointing at a row, or tapping it, pauses that row). Category reference for
-05; reference for Your text (19 pages) and for a Compare with a common mistake (ruling 3).
-See inside: the first row stays at the top, still moving; below it the same strip zoomed out: the track's two identical copies end
-to end, outlined ("Copy 1", "Copy 2, the same"), and the box as a window sliding over them in time with the row ("In the box"); a
-line where it jumps back ("Jumps back here") and an arrow as long as the slide. The window pauses when the row does.
-Compare (ruling 3): on top "One copy" (the mistake: one copy of the text slides out by its own width, leaves a gap and jumps back);
-below "Two copies" (the first row itself). Pause and Slow motion reach both.
-Reduced motion (starts paused): See inside still, the arrow shows the slide; Compare holds the one copy 70% of the way out, the gap
-plain.
-Every setting and Your text rebuild the rows and the views.
-Pitfalls: never display:none a moving row (its animation would restart, and Normal would not come back): the other two rows are
-taken out of the flow and hidden, not removed; measure from the first row, never from a hidden view; the one-copy row is inert; a
-label that rides a moving part must stay inside the stage at both ends of its travel, at 320.
-Phones: the halves stack (a strip needs the width); the zoomed text is only texture, the labels carry the words.
-Survey row: rollout-survey-05-07.md, 05.06.
-```
-
-- [ ] **Step 2: The slot** (after Task 6)
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/05a $REPO/.claude/worktrees/sic-05a feat/see-inside-compare`
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-05a && python -m http.server 8812 --bind 127.0.0.1`
-Ledger: `$RUN/lanes/05.md`.
-
-- [ ] **Step 3: Turn on the switch tests for this page (the failing test)**
-
-In `animations/05-text-typography/marquee-ticker/index.html`, between `</div>` of `div.hb-step-head` and `<div class="stage hb-dots" id="stage"></div>`, add:
-
-```html
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
-```
-
-After `</div>` of `div.hb-player`, add:
-
-```html
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, the strip is two identical copies end to end and the box is a window sliding over them; it jumps back at the second copy, which looks the same, so the jump never shows.</p>
- <p data-hb-for="compare" hidden>On top, One copy: the text slides out, leaves a gap and jumps back. Below, Two copies: a second copy fills the gap, so the loop has no seam.</p>
- </div>
-```
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-05a && node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -E "^✖ |AssertionError"`
-Expected: `✖ marquee-ticker: the page's script listens for hb:mode, and its styles mark modes on the stage only` (named again under `✖ failing tests:`), with `AssertionError [ERR_ASSERTION]: the page script listens for hb:mode on document`.
-
-- [ ] **Step 4: Styles**
-
-Replace ` .stage{display:flex;flex-direction:column;justify-content:center;background:#08080a}` with:
-```css
- .stage{position:relative;display:flex;flex-direction:column;justify-content:center;background:#08080a}
-```
-
-Before ` </style>` add:
-
-```css
- /* The rows sit in a box of their own, laid out as the stage lays them out */
- .rows{display:flex;flex-direction:column}
- .zoom,.solo,.lbl{display:none}
- .lbl{position:absolute;padding:3px 7px;border-radius:5px;background:rgba(8,8,10,.9);color:#f4f4f2;font:600 13px/1.2 var(--hb-font);white-space:nowrap}
- /* In See inside and Compare the second and third rows stay where they were, unseen and out of the flow but never removed, so
- their movement goes on for Normal */
- .stage[data-hb-mode="inside"],.stage[data-hb-mode="compare"]{justify-content:flex-start}
- .stage[data-hb-mode="inside"] .rows .marq-row:not(.r1),.stage[data-hb-mode="compare"] .rows .marq-row:not(.r1){position:absolute;left:0;right:0;visibility:hidden}
- /* See inside: the first row at the top, still moving; below it the same strip zoomed out: its two identical copies end to end,
- and the box as a window sliding over them. When the window reaches the second copy it jumps back to the first, which looks
- the same, so the jump never shows. */
- .stage[data-hb-mode="inside"] .zoom{display:block}
- .stage[data-hb-mode="inside"] .zoom .lbl{display:block}
- .zoom{position:relative;flex:1;margin:10px clamp(10px,2vw,20px)}
- .ztrack{position:absolute;left:0;display:flex;width:max-content;white-space:nowrap;transform-origin:0 0}
- .zcopy{position:absolute;border:2px solid rgba(244,244,242,.6);border-radius:6px}
- .zwin{position:absolute;left:0;border:3px solid var(--ui-accent);border-radius:6px;animation:zwin linear infinite}
- @keyframes zwin{from{transform:translateX(0)}to{transform:translateX(var(--zgo,0px))}}
- .zwin .lbl{left:0;top:calc(100% + 6px)}
- .zjump{position:absolute;width:2px;background:#f4f4f2}
- .zarrow{position:absolute;left:0;height:3px;border-radius:2px;background:var(--ui-accent)}
- @media(hover:hover){.stage[data-hb-mode="inside"]:has(.r1:hover) .zwin{animation-play-state:paused}}
- .stage[data-hb-mode="inside"]:has(.r1.paused) .zwin{animation-play-state:paused}
- /* Compare: on top the common mistake, a single copy of the text that slides out, leaves a gap and jumps back; below it the
- first row with its two copies, which loops with no seam */
- .stage[data-hb-mode="compare"]{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(2,minmax(0,1fr))}
- .stage[data-hb-mode="compare"] .solo{display:flex;flex-direction:column;justify-content:center;grid-row:1}
- .stage[data-hb-mode="compare"] .rows{grid-row:2;justify-content:center}
- .stage[data-hb-mode="compare"] .side{display:block}
- .side{left:12px}
- .side.first{top:10px}
- .side.second{top:calc(50% + 6px)}
- .solo-track{display:flex;width:max-content;white-space:nowrap;animation:soloL linear infinite}
- @keyframes soloL{from{transform:translateX(0)}to{transform:translateX(-100%)}}
-```
-
-- [ ] **Step 5: Markup**
-
-Replace ` <div class="stage hb-dots" id="stage"></div>` with:
-
-```html
- <div class="stage hb-dots" id="stage">
- <div class="rows" id="rows"></div>
- <div class="zoom" id="zoom" aria-hidden="true" inert></div>
- <div class="solo" id="solo" aria-hidden="true" inert></div>
- <p class="lbl side first" aria-hidden="true" data-hb-caption>One copy</p>
- <p class="lbl side second" aria-hidden="true" data-hb-caption>Two copies</p>
- </div>
-```
-
-- [ ] **Step 6: Script**
-
-(a) After ` const stage=document.getElementById('stage');` add:
-```js
- const rows=document.getElementById('rows'),zoom=document.getElementById('zoom'),solo=document.getElementById('solo');
- const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)');
- // Under reduced motion the loop starts paused, so both views are still pictures, and their notes say so
- if(reduceMQ.matches){
- document.querySelector('[data-hb-for="inside"]').textContent='Inside, shown still: the strip is two identical copies end to end, and the arrow shows how far the box slides before it jumps back to the start.';
- document.querySelector('[data-hb-for="compare"]').textContent='Shown still: on top, One copy, the text has slid most of the way out and left a gap; below, Two copies, the second copy fills it.';
- }
-```
-
-(b) In `buildRow`, replace ` stage.appendChild(row);` with ` rows.appendChild(row);`.
-
-(c) In `rebuild`, replace ` stage.innerHTML='';` with ` rows.innerHTML='';`, replace the three `buildRow(…)` lines with:
-```js
- buildRow(text,separator,false,'r1');
- buildRow(text,separator,true,'accent r2');
- buildRow(text+' '+separator+' '+text,separator,false,'r3');
-```
-and after ` document.querySelectorAll('.marq-track').forEach(t=>updateSpeed(t,frac));` add ` buildViews();`.
-
-(d) Replace ` choices('speed-seg',d=>{spd=+d.spd;refreshSpeeds()});` with ` choices('speed-seg',d=>{spd=+d.spd;refreshSpeeds();buildViews()});`.
-
-(e) Before ` txtIn.addEventListener('input',rebuild);` add:
-```js
- // See inside and Compare are drawn from the first row as it stands (its text, its copies, its width and its speed) and built
- // again with the rows, so every setting and Your text reach them. Sizes come from the first row, which is always shown.
- function buildViews(){
- const row=rows.querySelector('.r1'),track=row&&row.querySelector('.marq-track');
- if(!track)return;
- const copyW=track.scrollWidth/2,rowW=stage.clientWidth,rowH=row.offsetHeight,itemW=track.firstElementChild.offsetWidth;
- const zoomW=Math.max(1,stage.clientWidth-2*Math.min(20,Math.max(10,stage.clientWidth*.02)));
- const k=Math.min(1,zoomW/track.scrollWidth),h=rowH*k,cw=copyW*k;
- zoom.innerHTML='';
- const add=(cls,css,words)=>{
- const el=document.createElement(words===undefined?'div':'span');el.className=cls;
- for(const [p,v] of Object.entries(css))el.style.setProperty(p,v);
- if(words!==undefined){el.textContent=words;el.setAttribute('data-hb-caption','')}
- zoom.appendChild(el);return el;
- };
- // the whole strip, drawn small enough to fit, with its two copies outlined
- const strip=track.cloneNode(true);
- strip.className='ztrack';strip.removeAttribute('aria-live');strip.style.top='26px';strip.style.transform=`scale(${k})`;
- zoom.appendChild(strip);
- add('zcopy',{left:'0px',top:'22px',width:cw+'px',height:h+8+'px'});
- add('zcopy',{left:cw+'px',top:'22px',width:cw+'px',height:h+8+'px'});
- add('lbl',{left:'2px',top:'0px'},'Copy 1');
- add('lbl',{left:cw+2+'px',top:'0px'},'Copy 2, the same');
- // the box as a window over the strip: it slides one copy's width, as long as the row takes, then starts over
- const win=add('zwin',{top:'18px',width:rowW*k+'px',height:h+16+'px','--zgo':cw+'px','animation-duration':track.durMs+'ms'});
- const shows=document.createElement('span');shows.className='lbl';shows.textContent='In the box';shows.setAttribute('data-hb-caption','');
- win.appendChild(shows);
- add('zjump',{left:cw-1+'px',top:'14px',height:h+64+'px'});
- add('zarrow',{top:h+74+'px',width:cw+'px'});
- add('lbl',{left:Math.max(0,cw-150)+'px',top:h+84+'px'},'Jumps back here');
- // Compare's mistake: the same text, but one copy of it, sliding by its own width before it starts over
- solo.innerHTML='';
- const srow=document.createElement('div');srow.className='marq-row solo-row';
- const st=document.createElement('div');st.className='solo-track';
- st.appendChild(makeItem(getContent(),separator,false));
- srow.appendChild(st);solo.appendChild(srow);
- st.style.animationDuration=Math.round(itemW/spd*1000)+'ms';
- syncWindow();
- poseSolo();
- }
- // The window keeps time with the first row: both cover one copy's width in the same time
- function syncWindow(){
- const t=rows.querySelector('.r1 .marq-track'),w=zoom.querySelector('.zwin');
- const a=t&&t.getAnimations()[0],b=w&&w.getAnimations()[0];
- if(a&&b&&a.currentTime!=null)b.currentTime=a.currentTime%t.durMs;
- }
- // Under reduced motion Compare's mistake is held at its telling moment: the one copy most of the way out, the gap plain
- function poseSolo(){
- if(!reduceMQ.matches)return;
- const t=solo.querySelector('.solo-track'),a=t&&t.getAnimations()[0];
- if(a&&a.effect)a.currentTime=.7*a.effect.getComputedTiming().duration;
- }
- // The mode switch: draws the mode at once. A view's animation starts when the view is shown, so the window is set to the first
- // row's place then, and under reduced motion the mistake is posed. Pause and Slow motion reach every animation in the stage.
- document.addEventListener('hb:mode',e=>{
- syncWindow();
- if(e.detail.mode==='compare')poseSolo();
- });
-
-```
-
-- [ ] **Step 7: Tests**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-05a && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"`
-Expected: `ℹ fail 0`.
-
-- [ ] **Step 8: Page check, screenshots, tuning**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-05a && node $RUN/slot.mjs run sic-05a -- node tools/check-pages.mjs --base http://127.0.0.1:8812 --out $RUN/checks/05-marquee-ticker/1 animations/05-text-typography/marquee-ticker`
-Expected: six `ok` lines ("Normal brings the first picture back" holds only if no moving row was restarted: if it fails, a row was hidden with display:none somewhere). Open `05-marquee-ticker-desktop-inside.png`, `-phone-inside.png`, `-phone-reduced-inside.png`, `-desktop-compare.png`, `-phone-compare.png`, `-phone-reduced-compare.png`. Tune (the zoom's vertical places, the label places, the window's border) until, at 1280 and at 375: two outlined copies, the window over the first, the jump line at the second copy's start and the arrow under them read at a glance; the four labels are apart and inside the stage; in Compare the one-copy row shows a plain gap (at rest under reduced motion it is 70% out), and both half names sit clear of the text. Motion: a kit clips run (`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-05a -- node $KIT/record.mjs --base http://127.0.0.1:8812 --only clips --keep-frames --out $RUN/kit/05-marquee-ticker-clips animations/05-text-typography/marquee-ticker`): in See inside's frames the window slides right while the top row slides left, and both start over together; in Compare's frames the top row empties and jumps while the bottom row never shows a gap. Acceptance 7: kit runs with `--only stills --press "#size-seg [data-size='64']"`, `--press "#gap-seg [data-gap='80']"`, `--press "#sep-seg [data-sep='★']"` and `--press "#speed-seg [data-spd='130']"` (the last one changes the motion only: check it in a clips run with the same `--press`). Your text: by hand in a clips run is not possible, so read the code path (`txtIn` input → `rebuild()` → `buildViews()`), and the reviewer confirms. Six `ok` after every change.
-
-- [ ] **Step 9: Normal before and after**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-05a -- node $KIT/record.mjs --base http://127.0.0.1:8812 --before http://127.0.0.1:8800 --only before --out $RUN/kit/05-marquee-ticker --clean animations/05-text-typography/marquee-ticker`
-Expected (the loop is pictured with reduce motion on, standing at its start): `0 of … pixels differ` at 1280 and 375, or a few visibly where a row stood a fraction of a pixel apart; open the three pictures and compare by eye.
-
-- [ ] **Step 10: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-05a
-git add animations/05-text-typography/marquee-ticker/index.html
-git commit -m "feat: Marquee / Ticker shows its strip zoomed out as two copies under a sliding window (See inside) and the one-copy mistake above the two-copy loop (Compare)"
-```
-
-- [ ] **Step 11: Review, fix rounds, merge into `sic/cat-05`**
-
-The lane lead dispatches a fresh reviewer with: the brief, `git -C $REPO/.claude/worktrees/sic-05a diff feat/see-inside-compare...sic/05a`, the newest check round and output, the kit's before-and-after and clips, and the 12 acceptance lines. Beyond the check they confirm: no moving row is ever display:none; Pause holds every row, the window and the one copy at once, Slow motion slows all of them; pointing at the first row pauses the window too; Your text and every setting rebuild both views; in Compare change Text size and type in Your text, then press See inside: the window covers only the box's share of the strip. Verdict; at most three fix rounds. When approved:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO/.claude/worktrees/sic-05a && git switch -c sic/cat-05 feat/see-inside-compare && git merge --no-ff sic/05a -m "Merge slot 05a: Marquee / Ticker's See inside and Compare"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)" # ℹ fail 0
-```
-Then, as a background command: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-05a && node $RUN/slot.mjs run cat-05 -- node tools/check-pages.mjs --base http://127.0.0.1:8812 --out $RUN/checks/cat-05 animations/05-text-typography > $RUN/checks/cat-05.log 2>&1`. When it has ended (the log's last line is `Screenshots: …`): `grep -c '^ok' $RUN/checks/cat-05.log` prints `114` and `grep -c '^FAIL' $RUN/checks/cat-05.log` prints `0`. Only then `git switch sic/05a`, stop the server, ledger line, tell the coordinator `sic/cat-05` is ready.
-
----
-
-### Task 12: 06.05 Fluid / Liquid Simulation: the plain circles and the melt zones (See inside), "Hard circles" beside "Melting" (Compare, one WebGL context)
-
-**Files:**
-- Modify: `animations/06-3d-advanced/fluid-simulation/index.html`: new rules before `</style>` (line 29), the switch before the stage (after line 50), the stage's labels (after line 53), the notes after the player bar (after line 58), and the `<script>` (lines 169-331: the shader `FS`, the uniform list, `render` and a new `view`, `fail`, `aim`, and a new listener).
-
-**Interfaces:**
-- Consumes: Task 3 (paused loops at the deep setups; captions; the picture's name changes with the mode), Task 4 (switch tests), Task 6 (`?v=10`).
-- Produces: the category 06 reference and the WebGL reference (8 pages): one context drawn in two viewports for Compare (`view(x, w, kind, mouseBall)`, uniforms `uOrigin` and `uView`), See inside as a shader pass, labels as page text over the canvas, the canvas's name per mode.
-
-- [ ] **Step 1: The brief** (the 06 lane lead, during Phase 0)
-
-Write `$RUN/briefs/06.05-fluid-simulation.md`:
-
-```markdown
-# 06.05 Fluid / Liquid Simulation: brief (first batch)
-Kind: loop, WebGL (the page pauses and slows itself; one blob follows the pointer or a finger). Category reference for 06; reference
-for the 8 WebGL pages.
-See inside: the liquid dimmed; each blob's own plain circle outlined in white; where the melting adds liquid outside every plain
-circle (the soft necks), shaded gold. A key in the corner: "White rings: each blob's own circle", "Gold: where two melt together".
-Melting changes the gold zones; every other setting changes the blobs as in Normal.
-Compare: one canvas, two viewports of the same context, a thin line between: "Hard circles" (the plain minimum: circles that only
-overlap, sharp corners) / "Melting" (the page as set). Both use the same clock and the same pointer, so the blobs match; the
-pointer is read over the second half only (a pointer over the first half moves nothing).
-Reduced motion: the loop starts paused; a mode change draws one frame at once; the paused frame already shows overlaps.
-The canvas's aria-label says what each mode shows. The no-WebGL message covers every mode (labels hidden then).
-Pitfalls: never a second WebGL context; the phone pixel cap stays; uv must be measured from each viewport's own origin; GLSL
-smoothstep with edge0 >= edge1 is undefined, so new code writes 1.-smoothstep(a,b,x).
-Survey row: rollout-survey-05-07.md, 06.05.
-```
-
-- [ ] **Step 2: The slot** (after Task 6)
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/06a $REPO/.claude/worktrees/sic-06a feat/see-inside-compare`
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-06a && python -m http.server 8814 --bind 127.0.0.1`
-Ledger: `$RUN/lanes/06.md`.
-
-- [ ] **Step 3: Turn on the switch tests for this page (the failing test)**
-
-In `animations/06-3d-advanced/fluid-simulation/index.html`, between `</div>` of `div.hb-step-head` and `<div class="stage" id="stage">`, add:
-
-```html
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
-```
-
-After `</div>` of `div.hb-player`, add:
-
-```html
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, each blob is a plain circle, outlined in white; where two come close, the melting adds liquid between them, shaded gold.</p>
- <p data-hb-for="compare" hidden>On the left, Hard circles: the blobs only overlap, with sharp corners where they meet. On the right, Melting: they flow into one shape with soft necks between them.</p>
- </div>
-```
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-06a && node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -E "^✖ |AssertionError"`
-Expected: `✖ fluid-simulation: the page's script listens for hb:mode, and its styles mark modes on the stage only` (named again under `✖ failing tests:`), with `AssertionError [ERR_ASSERTION]: the page script listens for hb:mode on document`.
-
-- [ ] **Step 4: Styles**
-
-Before ` </style>` add:
-
-```css
- /* See inside and Compare: plain words over the picture (the picture itself is drawn by the shader) */
- .key,.side{display:none}
- .lbl{position:absolute;padding:3px 8px;border-radius:5px;background:rgba(3,8,16,.9);color:#f4f4f2;font:600 13px/1.2 var(--hb-font);white-space:nowrap}
- .key{position:absolute;left:10px;bottom:10px;flex-direction:column;align-items:flex-start;gap:6px}
- .key .lbl{position:static}
- .stage[data-hb-mode="inside"] .key{display:flex}
- .stage[data-hb-mode="compare"] .side{display:block}
- .side{top:10px}
- .side.first{left:10px}
- .side.second{left:calc(50% + 10px)}
- .stage.no-gl .key,.stage.no-gl .side{display:none!important}
-```
-
-- [ ] **Step 5: Markup**
-
-After ` <div class="no-webgl" id="no-webgl">WebGL not available in this browser.</div>` add:
-
-```html
- <div class="key" aria-hidden="true"><span class="lbl k" data-hb-caption>White rings: each blob's own circle</span><span class="lbl k" data-hb-caption>Gold: where two melt together</span></div>
- <p class="lbl side first" aria-hidden="true" data-hb-caption>Hard circles</p>
- <p class="lbl side second" aria-hidden="true" data-hb-caption>Melting</p>
-```
-
-- [ ] **Step 6: Script**
-
-(a) After `let COLOR=[88/255,166/255,255/255];` add:
-```js
-// See inside and Compare: the mode on show, and what the canvas says it shows in each one
-let mode='normal';
-const LABELS={normal:cvs.getAttribute('aria-label'),
- inside:'The blobs dimmed, each one\'s own circle outlined in white and the places where two melt together shaded gold',
- compare:'Two copies of the blobs side by side: hard circles that only overlap on the left, blobs that melt together on the right'};
-```
-
-(b) Replace the whole `FS` string with:
-```js
-const FS=`
-precision mediump float;
-uniform vec2 uRes,uOrigin;uniform float uT;uniform int uBalls,uView;
-uniform float uSmooth,uRad;uniform vec2 uMouse;uniform bool uGlow,uMouseBall;
-uniform vec3 uColor,uBG;
-
-float smin(float a,float b,float k){
- float h=clamp(.5+.5*(b-a)/k,0.,1.);
- return mix(b,a,h)-k*h*(1.-h);
-}
-
-vec2 ball(int i,float t){
- float fi=float(i);
- float s=1.3+fi*.4,o=fi*2.1;
- return vec2(.5+.38*sin(t*s+o),.5+.38*cos(t*s*.7+o*1.3));
-}
-
-void main(){
- // uOrigin is where this picture starts on the canvas: Compare draws two pictures side by side
- vec2 uv=(gl_FragCoord.xy-uOrigin)/uRes;
- uv.y=1.-uv.y;
- float d=10.,hard=10.,edge=10.;
- for(int i=0;i<8;i++){
- if(i>=uBalls)break;
- vec2 c=(i==0&&uMouseBall)?uMouse:ball(i,uT);
- float bd=length((uv-c)*vec2(uRes.x/uRes.y,1.))-uRad;
- d=smin(d,bd,uSmooth);
- hard=min(hard,bd);
- edge=min(edge,abs(bd));
- }
- // Compare's first picture: the plain circles, with no melting between them
- if(uView==2)d=hard;
- float inside=smoothstep(.01,-.01,d);
- vec3 rim=uColor*pow(clamp(1.-abs(d)/.05,0.,1.),3.);
- float glow=uGlow?exp(-max(d,0.)/.08)*.4:0.;
- vec3 col=mix(uBG,uColor,inside)+rim*.5+uColor*glow;
- // See inside: the liquid dimmed; where the melting adds liquid outside every plain circle, gold; each plain circle outlined
- if(uView==1){
- col*=.45;
- float melt=(1.-smoothstep(-.004,.004,d))*smoothstep(0.,.004,hard);
- col=mix(col,vec3(1.,.82,.36),melt*.8);
- col=mix(col,vec3(1.),1.-smoothstep(.002,.007,edge));
- }
- gl_FragColor=vec4(col,1.);
-}`;
-```
-
-(c) In `fail(msg)` add `stage.classList.add('no-gl');` as its first statement.
-
-(d) Replace the uniform list `'uRes uT uBalls uSmooth uRad uMouse uGlow uMouseBall uColor uBG'` with `'uRes uOrigin uT uBalls uView uSmooth uRad uMouse uGlow uMouseBall uColor uBG'`.
-
-(e) In `render(ts)`, replace everything from ` gl.useProgram(prog);` to the end of the function with:
-```js
- gl.useProgram(prog);
- gl.uniform1f(U.uT,simT);
- gl.uniform1i(U.uBalls,BALLS);
- gl.uniform1f(U.uSmooth,SMOOTH);
- gl.uniform1f(U.uRad,RAD);
- gl.uniform2f(U.uMouse,shownX,shownY);
- gl.uniform1i(U.uGlow,GLOW?1:0);
- gl.uniform3fv(U.uColor,COLOR);
- gl.uniform3fv(U.uBG,BG);
- // Compare: one context, two pictures side by side with a thin line between them, the plain circles on the left and the melting
- // blobs on the right; the pointer, read over the right half only, moves the same blob in both, so the blobs match.
- if(mode==='compare'){
- const half=Math.floor(W/2),gap=Math.max(1,Math.round(W/400));
- gl.viewport(0,0,W,H);gl.clearColor(.17,.17,.2,1);gl.clear(gl.COLOR_BUFFER_BIT);
- view(0,half-gap,2,MOUSE_BALL);
- view(half+gap,W-half-gap,0,MOUSE_BALL);
- }else view(0,W,mode==='inside'?1:0,MOUSE_BALL);
-}
-// One picture of the blobs in a part of the canvas, x and w in canvas pixels: kind 0 as it is, 1 See inside, 2 hard circles
-function view(x,w,kind,mouseBall){
- gl.viewport(x,0,w,H);
- gl.uniform2f(U.uOrigin,x,0);
- gl.uniform2f(U.uRes,w,H);
- gl.uniform1i(U.uView,kind);
- gl.uniform1i(U.uMouseBall,mouseBall?1:0);
- gl.drawArrays(gl.TRIANGLE_STRIP,0,4);
-}
-```
-
-(f) Replace `function aim(e){const r=cvs.getBoundingClientRect();mouseX=(e.clientX-r.left)/r.width;mouseY=(e.clientY-r.top)/r.height;}` with:
-```js
-function aim(e){
- const r=cvs.getBoundingClientRect();
- // In Compare the pointer is read over the second picture only (a pointer over the first half moves nothing), and its blob
- // moves in both pictures, so they match
- if(mode==='compare'){const x=e.clientX-r.left-r.width/2;if(x<0)return;mouseX=x/(r.width/2);}
- else mouseX=(e.clientX-r.left)/r.width;
- mouseY=(e.clientY-r.top)/r.height;
-}
-```
-
-(g) After the `hb:pause` listener (it ends `});` after `else start();`) add:
-```js
-// The mode switch: the next frame draws the mode, and while paused one frame is drawn at once. The canvas's name says what it shows.
-document.addEventListener('hb:mode',e=>{
- mode=e.detail.mode;
- cvs.setAttribute('aria-label',LABELS[mode]);
- redraw();
-});
-```
-
-- [ ] **Step 7: Tests**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-06a && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"`
-Expected: `ℹ fail 0`.
-
-- [ ] **Step 8: Page check, screenshots, tuning**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-06a && node $RUN/slot.mjs run sic-06a -- node tools/check-pages.mjs --base http://127.0.0.1:8814 --out $RUN/checks/06-fluid-simulation/1 animations/06-3d-advanced/fluid-simulation`
-Expected: six `ok` lines (the canvas's name differs in each mode; no console warning from the shader). If the shader fails to compile, the page shows its message and the console holds the log: fix the shader. Open `06-fluid-simulation-desktop-inside.png`, `-phone-inside.png`, `-phone-reduced-inside.png`, `-desktop-compare.png`, `-phone-compare.png`, `-phone-reduced-compare.png`. Tune (the dimming `.45`, the gold, the outline width `.002`/`.007`, the melt band `.004`) until, at 1280 and at 375: every blob's white ring reads, the gold necks show between blobs that are close and nowhere else, the key reads; in Compare both pictures show the same blobs at the same places, the left with sharp corners where circles overlap, the right melted, and the line between them is thin. If the paused frame under reduced motion shows no two blobs close enough to differ, say so: the still is then posed at a telling time of the views' own (under reduced motion See inside and Compare hand that time to `uT` in place of `simT`), never by changing `simT`, from which Normal's reduced-motion frame is drawn (Step 9 compares it pixel for pixel); a builder's call written in the report. Motion: a kit clips run (`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-06a -- node $KIT/record.mjs --base http://127.0.0.1:8814 --only clips --keep-frames --out $RUN/kit/06-fluid-simulation-clips animations/06-3d-advanced/fluid-simulation`); Read three frames from the middle of each mode clip's kept frame folder (the log names it): both halves move together, their blobs at the same places. Acceptance 7: kit runs with `--only stills --press "#melt-seg [data-smooth='0.15']"`, `--press "#count-seg [data-balls='8']"`, `--press "#size-seg [data-rad='0.2']"` and `--press "#glow-tog"`: each changes both views (Melting the gold zones and the right half only). Six `ok` after every change.
-
-- [ ] **Step 9: Normal before and after**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-06a -- node $KIT/record.mjs --base http://127.0.0.1:8814 --before http://127.0.0.1:8800 --only before --out $RUN/kit/06-fluid-simulation --clean animations/06-3d-advanced/fluid-simulation`
-Expected (the loop is pictured with reduce motion on, paused at its first frame): `0 of … pixels differ (0 visibly)` at 1280 and 375.
-
-- [ ] **Step 10: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-06a
-git add animations/06-3d-advanced/fluid-simulation/index.html
-git commit -m "feat: Fluid / Liquid Simulation outlines each blob's plain circle and shades where two melt (See inside), and shows hard circles beside melting blobs from one WebGL context (Compare)"
-```
-
-- [ ] **Step 11: Review, fix rounds, merge into `sic/cat-06`**
-
-The lane lead dispatches a fresh reviewer with: the brief, `git -C $REPO/.claude/worktrees/sic-06a diff feat/see-inside-compare...sic/06a`, the newest check round and output, the kit's before-and-after and clips, and the 12 acceptance lines. Beyond the check they confirm: one `getContext('webgl')` call (no second context); the phone pixel cap untouched; the context-lost path re-reads the new uniforms (`init()` builds `U` from the list); `uOrigin` makes both halves draw the same blobs; Normal's shader output is unchanged (uView 0, uOrigin 0); in Compare the pointer, read over the second half only, moves the same blob in both halves; a reduced-motion pose, if any, never changes `simT`. Verdict; at most three fix rounds. When approved:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO/.claude/worktrees/sic-06a && git switch -c sic/cat-06 feat/see-inside-compare && git merge --no-ff sic/06a -m "Merge slot 06a: Fluid / Liquid Simulation's See inside and Compare"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)" # ℹ fail 0
-```
-Then, as a background command: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-06a && node $RUN/slot.mjs run cat-06 -- node tools/check-pages.mjs --base http://127.0.0.1:8814 --out $RUN/checks/cat-06 animations/06-3d-advanced > $RUN/checks/cat-06.log 2>&1`. When it has ended (the log's last line is `Screenshots: …`): `grep -c '^ok' $RUN/checks/cat-06.log` prints `156` and `grep -c '^FAIL' $RUN/checks/cat-06.log` prints `0`. Only then `git switch sic/06a`, stop the server, ledger line, tell the coordinator `sic/cat-06` is ready.
-
----
-
-### Task 13: 07.14 Flow Field: the hidden current as arrows (See inside), "Random each step" beside "Follows the current" (Compare, a common mistake, one canvas)
-
-**Files:**
-- Modify: `animations/07-ambient-background/flow-field/index.html`: new rules before `</style>` (line 28), the switch before the stage (after line 49), the stage's arrow canvas and labels (after line 51), the notes after the player bar (after line 56), and the `<script>` (lines 157-271: new constants, `init`, `colorFor`, `frame` and a new `move`, a new `drawField`, `changed` and the comment above it, `resize`, the Speed choice, and a new listener).
-
-**Interfaces:**
-- Consumes: Task 3 (paused loops at the deep setups; "Normal brings the first picture back"), Task 4 (switch tests), Task 6 (`?v=10`).
-- Produces: the category 07 reference and the canvas reference (33 pages): See inside drawn on a second 2D canvas over the first, in the page's own frame step; Compare as one canvas split in two (each half clipped, half the particles each, its own trails); Normal's picture and particles kept while Compare shows and put back after it.
-
-- [ ] **Step 1: The brief** (the 07 lane lead, during Phase 0)
-
-Write `$RUN/briefs/07.14-flow-field.md`:
-
-```markdown
-# 07.14 Flow Field: brief (first batch)
-Kind: loop, canvas 2D (the page pauses and slows itself; reduced motion starts on a settled picture). Category reference for 07;
-reference for the 33 canvas pages and for a Compare with a common mistake (ruling 3).
-See inside: small arrows on a grid (one per 36px square) for the invisible current at each spot, turning slowly with the field;
-the particles ride them. Labels: "Arrows: the hidden current", "Each particle follows the arrow under it". The arrows are drawn
-on a second canvas over the picture, in the page's own frame step; Speed lengthens them, Swirl size changes their pattern.
-Compare (ruling 3): one canvas split down the middle, each half clipped, half the particles each with its own trails: "Random each
-step" (each particle takes a new random direction every step: it scribbles in place) / "Follows the current" (the page as set).
-Normal's picture and particles are kept while Compare shows and put back when it is left (or drawn again if a setting changed).
-Reduced motion: paused; a mode change draws a settled picture of that mode at once (arrows over the trails; the split scribbles).
-Phones: each half gets half the phone's 500 particles.
-Pitfalls: Normal's step must stay exactly the old one (same order, same respawn); the arrows never go on the trail canvas (they would
-smear); a setting changed in Compare drops the kept Normal picture.
-Survey row: rollout-survey-05-07.md, 07.14.
-```
-
-- [ ] **Step 2: The slot** (after Task 6)
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/07a $REPO/.claude/worktrees/sic-07a feat/see-inside-compare`
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-07a && python -m http.server 8818 --bind 127.0.0.1`
-Ledger: `$RUN/lanes/07.md`.
-
-- [ ] **Step 3: Turn on the switch tests for this page (the failing test)**
-
-In `animations/07-ambient-background/flow-field/index.html`, between `</div>` of `div.hb-step-head` and `<div class="stage">`, add:
-
-```html
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
-```
-
-After `</div>` of `div.hb-player`, add:
-
-```html
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, the arrows show the invisible current: at every spot it points one way and turns slowly over time, and each particle follows the arrow under it.</p>
- <p data-hb-for="compare" hidden>On the left, Random each step: each particle picks a new direction every step, so it only scribbles in place. On the right, Follows the current: the particles ride smooth streams.</p>
- </div>
-```
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-07a && node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -E "^✖ |AssertionError"`
-Expected: `✖ flow-field: the page's script listens for hb:mode, and its styles mark modes on the stage only` (named again under `✖ failing tests:`), with `AssertionError [ERR_ASSERTION]: the page script listens for hb:mode on document`.
-
-- [ ] **Step 4: Styles**
-
-Before ` </style>` add:
-
-```css
- /* See inside and Compare: a second canvas over the picture for the current's arrows, and plain words over the picture */
- .field,.lbl{display:none}
- .field{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
- .lbl{position:absolute;padding:4px 9px;border-radius:999px;background:rgba(5,6,10,.88);color:#f4f4f2;font:600 13px/1.2 var(--hb-font);white-space:nowrap}
- .stage[data-hb-mode="inside"] .field,.stage[data-hb-mode="inside"] .fl,.stage[data-hb-mode="compare"] .side{display:block}
- .fl.what{left:10px;top:10px}
- .fl.how{left:10px;bottom:10px}
- .side{top:10px}
- .side.first{left:10px}
- .side.second{left:calc(50% + 10px)}
- @media(max-width:360px){.lbl{font-size:12px;padding:3px 7px}.side.second{left:calc(50% + 6px)}}
-```
-
-- [ ] **Step 5: Markup**
-
-After ` <canvas id="cvs" aria-hidden="true"></canvas>` add:
-
-```html
- <canvas class="field" id="field" aria-hidden="true"></canvas>
- <p class="lbl fl what" aria-hidden="true" data-hb-caption>Arrows: the hidden current</p>
- <p class="lbl fl how" aria-hidden="true" data-hb-caption>Each particle follows the arrow under it</p>
- <p class="lbl side first" aria-hidden="true" data-hb-caption>Random each step</p>
- <p class="lbl side second" aria-hidden="true" data-hb-caption>Follows the current</p>
-```
-
-- [ ] **Step 6: Script**
-
-(a) After ` let parts=[];` add:
-```js
- // See inside and Compare: the arrows' canvas, a copy of Normal's picture kept while Compare shows, and one arrow per 36px square
- const field=document.getElementById('field'),fctx=field.getContext('2d');
- const keep=document.createElement('canvas'),kctx=keep.getContext('2d');
- const GRID=36;
- let mode='normal',kept=null;
-```
-
-(b) Replace `function init(){parts=Array.from({length:phone.matches?Math.min(COUNT,PHONE_PARTS):COUNT},()=>({x:Math.random()*W,y:Math.random()*H}));}` with:
-```js
- // In Compare the particles split in two: the first half lives in the left half of the canvas and the second in the right (on
- // phones each half gets half the phone's particles). Elsewhere every particle may go anywhere, as before.
- function init(){
- const n=phone.matches?Math.min(COUNT,PHONE_PARTS):COUNT,split=mode==='compare';
- parts=Array.from({length:n},(_,i)=>{
- const side=split&&i>=n/2?1:0,x0=split?side*W/2:0,w=split?W/2:W;
- return{x:x0+Math.random()*w,y:Math.random()*H,side};
- });
- }
-```
-
-(c) Replace the whole `frame(s,nf)` function (from its comment `// One frame: dim the canvas nf times, …` to its closing `}`) with:
-```js
- // One frame: dim the canvas nf times, then move every particle one step along the field and draw that step. s is how many
- // 60 Hz frames it stands for; k is s, or a third of it in slow motion, and shrinks the step and the field's time but not the dim.
- // Compare: each half draws only inside itself; the first half's particles take a random direction every step (the common
- // mistake), the second half's follow the field. See inside draws the arrows after the step.
- function frame(s,nf){
- const k=s*(slowTog.checked?1/3:1);
- ctx.fillStyle=`rgba(5,6,10,${TRAIL})`;
- for(let i=0;i<nf;i++)ctx.fillRect(0,0,W,H);
- if(mode==='compare'){
- const half=W/2;
- for(const side of [0,1]){
- ctx.save();ctx.beginPath();ctx.rect(side*half,0,half,H);ctx.clip();
- for(const p of parts)if(p.side===side)move(p,side?angleAt(p.x,p.y,t):Math.random()*Math.PI*2,k,side*half,half);
- ctx.restore();
- }
- ctx.fillStyle='#2a2b33';ctx.fillRect(half-1,0,2,H);
- }else for(const p of parts)move(p,angleAt(p.x,p.y,t),k,0,W);
- t+=0.01*k;
- if(mode==='inside')drawField();
- }
- // One step of one particle in direction a, drawn; one that leaves its part of the canvas (x0 to x0 + w) starts again somewhere in it
- function move(p,a,k,x0,w){
- const nx=p.x+Math.cos(a)*SPD*k,ny=p.y+Math.sin(a)*SPD*k;
- ctx.strokeStyle=colorFor(p,x0,w);ctx.lineWidth=1;
- ctx.beginPath();ctx.moveTo(p.x,p.y);ctx.lineTo(nx,ny);ctx.stroke();
- p.x=nx;p.y=ny;
- if(p.x<x0||p.x>x0+w||p.y<0||p.y>H){p.x=x0+Math.random()*w;p.y=Math.random()*H;}
- }
- // See inside: the current at the middle of every grid square, as a small arrow pointing where the field points there now (it is
- // longer at a higher Speed), on its own canvas over the picture
- function drawField(){
- if(field.width!==W||field.height!==H){field.width=W;field.height=H;}
- fctx.clearRect(0,0,W,H);
- fctx.strokeStyle='rgba(244,244,242,.8)';fctx.lineWidth=1.5;fctx.lineCap='round';
- const len=8+5*SPD;
- fctx.beginPath();
- for(let y=GRID/2;y<H;y+=GRID)for(let x=GRID/2;x<W;x+=GRID){
- const a=angleAt(x,y,t),dx=Math.cos(a)*len/2,dy=Math.sin(a)*len/2;
- fctx.moveTo(x-dx,y-dy);fctx.lineTo(x+dx,y+dy);
- fctx.lineTo(x+dx-Math.cos(a-.6)*5,y+dy-Math.sin(a-.6)*5);
- fctx.moveTo(x+dx,y+dy);fctx.lineTo(x+dx-Math.cos(a+.6)*5,y+dy-Math.sin(a+.6)*5);
- }
- fctx.stroke();
- }
-```
-
-(d) Replace ` function changed(){if(paused)prerender();else unseen=true;}` with:
-```js
- function changed(){kept=null;if(paused)prerender();else unseen=true;} // a kept Normal picture would show the old setting
-```
-
-(e) In `resize()`, after ` W=cvs.width=w;H=cvs.height=h;` add ` kept=null;`.
-
-(f) After the `visibilitychange` listener add:
-```js
- // The mode switch draws the mode at once. Compare keeps Normal's picture and particles, splits the particles into its two halves
- // and draws a settled picture of them; leaving Compare puts Normal's back (or draws it again after a setting or size change).
- // See inside draws the arrows over the picture: every frame while it plays, at once while paused.
- document.addEventListener('hb:mode',e=>{
- const was=mode;mode=e.detail.mode;
- if(mode==='compare'&&was!=='compare'){keep.width=W;keep.height=H;kctx.drawImage(cvs,0,0);kept=parts;init();prerender();}
- else if(was==='compare'&&mode!=='compare'){
- if(kept&&keep.width===W&&keep.height===H){ctx.drawImage(keep,0,0);parts=kept;}else{init();prerender();}
- kept=null;
- }
- if(mode==='inside')drawField();else fctx.clearRect(0,0,field.width,field.height);
- });
-```
-
-(g) Replace ` choices('speed-seg',d=>{SPD=+d.spd;});` with:
-```js
- choices('speed-seg',d=>{SPD=+d.spd;if(mode==='inside'&&paused)drawField();}); // See inside's arrows follow Speed at once, paused too
-```
-and, in the comment above `changed()`, `Speed changes no picture: it keeps the one on screen.` with `Speed changes no picture in Normal: it keeps the one on screen.`
-
-(h) Rainbow's colors run across the part of the canvas a particle lives in, so in Compare both halves take the same band (with `x0` 0 and `w` the canvas's width, Normal's colors are exactly as before). Replace ` function colorFor(p){` with:
-```js
- function colorFor(p,x0=0,w=W){ // x0 and w: the part of the canvas the particle lives in (in Compare, its half)
-```
-and ` return HUES[Math.floor((p.x/W*120+t*20)%360)];` with:
-```js
- return HUES[Math.floor(((p.x-x0)/w*120+t*20)%360)];
-```
-
-- [ ] **Step 7: Tests**
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-07a && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"`
-Expected: `ℹ fail 0`.
-
-- [ ] **Step 8: Page check, screenshots, tuning**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-07a && node $RUN/slot.mjs run sic-07a -- node tools/check-pages.mjs --base http://127.0.0.1:8818 --out $RUN/checks/07-flow-field/1 animations/07-ambient-background/flow-field`
-Expected: six `ok` lines ("Normal brings the first picture back" passes because Compare puts Normal's kept picture back). Open `07-flow-field-desktop-inside.png`, `-phone-inside.png`, `-phone-reduced-inside.png`, `-desktop-compare.png`, `-phone-compare.png`, `-phone-reduced-compare.png`. Tune (`GRID`, the arrows' length, width and alpha, the head's size) until, at 1280 and at 375: the arrows read as a smooth field (neighbors point alike), the trails run along them, the two labels sit clear; in Compare the left half is plainly fuzzy dots and the right half plainly streams, with a thin line between them, at both widths and under reduced motion. Motion: a kit clips run (`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-07a -- node $KIT/record.mjs --base http://127.0.0.1:8818 --only clips --keep-frames --out $RUN/kit/07-flow-field-clips animations/07-ambient-background/flow-field`); Read three frames from the middle of each mode clip's kept frame folder (the log names it): the arrows turn slowly and the particles follow them. Acceptance 7: kit runs with `--only stills --press "#scale-seg [data-px='60']"`, `--press "#trail-seg [data-fade='0.04']"`, `--press "#speed-seg [data-spd='1.6']"`, `--press "#count-seg [data-n='1500']"` and `--press "#color-seg [data-col='spectrum']"`: each changes both views (Speed: longer arrows; the rest: the field's pattern, the trails, the density, the colors). Six `ok` after every change.
-
-- [ ] **Step 9: Normal before and after**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run sic-07a -- node $KIT/record.mjs --base http://127.0.0.1:8818 --before http://127.0.0.1:8800 --only before --out $RUN/kit/07-flow-field --clean animations/07-ambient-background/flow-field`
-Expected: many pixels differ (the particles start at random places on both sites): this page is compared by eye. Open the three pictures: the same kind of picture (density, trail length, colors), no arrows, no line down the middle.
-
-- [ ] **Step 10: Commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-07a
-git add animations/07-ambient-background/flow-field/index.html
-git commit -m "feat: Flow Field draws its hidden current as arrows (See inside) and shows particles that pick a random direction each step beside particles that follow the current (Compare)"
-```
-
-- [ ] **Step 11: Review, fix rounds, merge into `sic/cat-07`**
-
-The lane lead dispatches a fresh reviewer with: the brief, `git -C $REPO/.claude/worktrees/sic-07a diff feat/see-inside-compare...sic/07a`, the newest check round and output, the kit's before-and-after and clips, and the 12 acceptance lines. Beyond the check they confirm: Normal's step is the old step exactly (same order of drawing, same respawn); the frame loop still moves by elapsed time with the dim once per 60th; the arrows' canvas is cleared and redrawn each frame (no smear) and only in See inside; each Compare half is clipped and has half the particles (phones 250 each); a setting changed in Compare leaves Normal correct afterwards; Pause, press See inside, press Fast: the arrows lengthen at once. Verdict; at most three fix rounds. When approved:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO/.claude/worktrees/sic-07a && git switch -c sic/cat-07 feat/see-inside-compare && git merge --no-ff sic/07a -m "Merge slot 07a: Flow Field's See inside and Compare"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)" # ℹ fail 0
-```
-Then, as a background command: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-07a && node $RUN/slot.mjs run cat-07 -- node tools/check-pages.mjs --base http://127.0.0.1:8818 --out $RUN/checks/cat-07 animations/07-ambient-background > $RUN/checks/cat-07.log 2>&1`. When it has ended (the log's last line is `Screenshots: …`): `grep -c '^ok' $RUN/checks/cat-07.log` prints `138` and `grep -c '^FAIL' $RUN/checks/cat-07.log` prints `0`. Only then `git switch sic/07a`, stop the server, ledger line, tell the coordinator `sic/cat-07` is ready.
-
----
-### Task 14: The batch on the branch, the review kit's run, and the owner's review (coordinator)
-
-**Files:**
-- Merge into `feat/see-inside-compare`: `sic/cat-01` … `sic/cat-07` (one page each).
-- Create (outside the repository): `$RUN/kit/first-batch/` (the kit's stills, clips, comparisons, `index.html`, `manifest.json`).
-
-**Interfaces:**
-- Consumes: the seven approved categories (Tasks 7 to 13: each lane's ledger has the reviewer's Approved and a category check with no `FAIL`), the kit (Task 5), the before-pictures server (Task 0), `$RUN/first-batch-rulings.json`.
-- Produces: the first batch on `feat/see-inside-compare`; the owner's verdict in `$RUN/ledger.md` (approved, or the list of changes and who makes them).
-
-- [ ] **Step 1: Merge the seven categories, one at a time**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && git status --short && git branch --show-current
-for n in 01 02 03 04 05 06 07; do git merge --no-ff sic/cat-$n -m "Merge category $n of the first batch of See inside and Compare" || break; node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"; done
-```
-Expected: an empty status, `feat/see-inside-compare`, then seven merges with no conflict (each category changed one page) and `ℹ fail 0` after each. Then `node tools/make-skill.mjs && git status --short`: nothing (the prompts and settings did not change).
-
-- [ ] **Step 2: The owner's preview**
-
-Start the preview of the main checkout (Claude Browser `preview_start` with the name `static-site`: `python -m http.server 8731` from `.claude/launch.json`; it opens the browser pane, which is where the owner looks). Check: `curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8731/animations/02-entrance-and-exit/fade-in-out/` prints `200`.
-
-- [ ] **Step 3: The kit run on the seven pages**
-
-Run, as a background command (about fifteen minutes):
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node $RUN/slot.mjs run kit-batch -- node $KIT/record.mjs --base http://127.0.0.1:8731 --before http://127.0.0.1:8800 --rulings $RUN/first-batch-rulings.json --out $RUN/kit/first-batch --clean --keep-frames animations/01-scroll-based/parallax-scrolling animations/02-entrance-and-exit/fade-in-out animations/03-page-transitions/overlay-wipe animations/04-micro-interactions/magnetic-button animations/05-text-typography/marquee-ticker animations/06-3d-advanced/fluid-simulation animations/07-ambient-background/flow-field > $RUN/kit/first-batch.log 2>&1`
-When it has ended: `tail -2 $RUN/kit/first-batch.log`. Expected: `63 pictures, 21 clips and 21 comparisons made, 0 skipped, 0 failed` (three sizes per page since the kit's round 3: 1280, 375 and 320, each the stage and Try it). The comparisons say `0 of … pixels differ` for Parallax, Fade In, Overlay Wipe, Magnetic Button and Fluid (a few corner pixels at most), a few for Marquee and many for Flow Field (random particles: by eye).
-
-- [ ] **Step 4: The coordinator looks first**
-
-Open `$RUN/kit/first-batch/index.html` and, with the Read tool, the 1280 and 375 See inside and Compare pictures of each page and one frame from the middle of each mode clip, from its kept frame folder (the log names it) (the clips' captions name ruling 1 beside the See inside and Compare clips of Fade In, Overlay Wipe and Magnetic Button, ruling 2 beside Parallax's See inside, ruling 3 beside the Compare of Marquee and Flow Field, ruling 4 beside every 375 Compare picture). Anything that does not read from the picture alone goes back to its lane as a fix round before the owner sees it (ledger line).
-
-- [ ] **Step 5: Show the owner**
-
-Navigate the browser pane to each page in turn, starting with `/animations/02-entrance-and-exit/fade-in-out/`, and leave it on Parallax Scrolling. Send the owner, in very short plain words: the path of `$RUN/kit/first-batch/index.html` (it opens from disk: clips first, then pictures, then Normal before and after), that the seven pages are open in the browser pane, what each ruling looks like where it shows (pressing See inside or Compare plays it once; Parallax's faint start outlines; Marquee's and Flow Field's mistakes; phones keep the box's size), and one question: "Roll these out to the other 159 pages as they are, or change something first?" Nothing is pushed or merged into `main`.
-
-- [ ] **Step 6: The owner's answer**
-
-Write the answer in `$RUN/ledger.md`. A change to one page goes back to its lane as a fix round: the lane merges `feat/see-inside-compare` into the slot branch first (a merge the coordinator allows for this; it brings the owner's other changes, `?v=11` if any), the same builder fixes, a new reviewer pass, then `git switch sic/cat-NN && git merge --no-ff sic/NNa` (the category branch exists already, so no `-c`), the category check again, and the coordinator merges `sic/cat-NN` into `feat/see-inside-compare` again. A change to a shared file (`assets/css/demo-page.css`, `assets/js/demo-page.js`, `tools/check-pages.mjs`) is made by the coordinator in one lane `sic/00f` from the head of `feat/see-inside-compare`, with its own test first, reviewed, merged, and followed by one more bump to `?v=11` on every animation page and the home page (as Task 6, tracked files only, line endings kept) before any of the 159 pages starts. Then the owner sees the changed pages (Steps 3 to 5 again, for those pages only) until they approve. The ledger's last line: `First batch approved by the owner on <date>; shared files at v=<N>`.
-
----
-
-## After this plan: the other 159 pages
-
-They get a plan of their own, written once the owner has approved the batch. While the owner looks (Task 14), the lane leads may already write the 159 briefs (no code), in the format of Step 1 of Tasks 7 to 13, each from its survey row, its page and its README's How it works, naming the closest first-batch page. That plan will need:
-
-- **The owner's verdict on the batch** and every change it brought, applied (with `?v=11` if a shared file changed), so the seven references are final before anyone copies them.
-- **Every existing slot `a` branch and `sic/cat-NN` first takes the head of `feat/see-inside-compare`** (the owner's changes, `?v=11` if any) before its next page.
-- **The 159 briefs**, with the spec's hard cases written into the briefs they concern: the 41 canvas and WebGL pages (one canvas split, one WebGL context in two viewports), the seven second-world pages (Cloth / Soft-Body Simulation, 2D Physics, Flocking, Fireworks, GPGPU Particle System, Liquid Glass, Abstract Geometric Motion, Elastic Transition's live spring: same fixed steps from one accumulator, first in their slots), the 62 do-it pages (hover, press, drag and form rules), the about 55 pages whose Compare reduced motion erases (posed stills), the random-piece pages, the pages with a "Shows the …" switch or a "Without" setting, the 19 pages with Your text, Snap Scrolling, the flash safety rule, the twins (different pictures, one slot each pair) and the weak views of spec section 2 (the rows marked \* show a mistake or a made-up scene).
-- **Slots:** the 20 slots of spec section 7 (01: three, 02: two, 03: two, 04: four, 05: two, 06: four, 07: three; ports 8801 to 8820 as in this plan's Global Constraints), each with its ordered list of pages (hard and heavy first), the category merges done in slot `a`'s worktree as in Tasks 7 to 13.
-- **Known risks this plan surfaced:** nine plays-once or do-it pages run an endless CSS animation (`typewriter-effect`, `letter-by-letter-stagger`, `button-loading-states`, `checkmark-draw`, `dynamic-island`, `progress-animation`, `pull-to-refresh`, `skeleton-loader`, `holographic-card`): the run wait ignores endless animations, but a blinking caret still changes the picture, so the 750 ms rest can fail; decide per page before its slot starts (the page holds the caret still in See inside and Compare, or the check learns an exception). A do-it page with a timer that runs while idle fails the run wait (timers of 6 s or less count). A Show me or Replay run that holds its pauses inside a frame loop or a setInterval is seen only as a moving stage, so a pause of 750 ms or more passes for rest: every such brief says to hold them with setTimeout. A snapping page re-snaps if a mode changes the scrolling content. At most four labels on phones. Forty-nine pages are already past 300 lines.
-- **Integration (the end of the rollout):** the final gate flipped (`const SWITCHED = steps;`), the docs of spec section 6 (CLAUDE.md, CONTRIBUTING.md, the PR template, README step 2, a CHANGELOG line), `node tools/update-sitemap.mjs`, `node tools/make-skill.mjs` (no change), the whole site in seven runs plus `home` (and `famous` once it exists), the final review in eight parts, the gallery (`record.mjs --gallery` on every category), the owner's final look, the leftover `hb-chrome-*` and `hb-kit-*` temp folders removed with the owner's OK, the slot worktrees removed, and the release by the coordination file's rules.
-
-## Self-review
-
-**Spec coverage (Phase 0 and the first batch):**
-
-| Spec requirement | Task |
-|---|---|
-| §4.1 fix wave A, round 2 (plain-clip screenshots, the stage checked in them, pointer parked; the note guard and its test) | already merged at `765521a`; Task 0 Step 1 confirms it |
-| §4.2 the do-it path: Reset, then rest; rest = unchanged for 750 ms (one helper for `stillShot` and `settledShot`); wait after each press; new fixtures (a timed revert, a paused loop that redraws on resize, scroll snapping); old fixtures as before | Task 3 (`restShot`, `waitForRun`, `TIMERS`, `sic-gen.mjs` with `ok-do-revert`, `ok-loop-resize`, `ok-snap`, `bad-snap-relayout`; categories 90 to 92 keep the old results) |
-| §4.3 captions inside the stage, 12px, apart; no id twice; the stage's name changes with the mode; a control's name contains its visible words | Task 3 (`captionProblems`, `pictureName`; `ok-captions`, `ok-glyph-name` and the `bad-caption-*`, `bad-dup-id`, `bad-label-same`, `bad-name` fixtures) |
-| §4.4 `setUpCopy` only with a prompt; the comment on pressing the pressed mode; a test that the buttons, notes and mark change before `hb:mode`; ruling 1 with a test per case; the mode check waits for that run | Task 2 (code and six tests), Task 3 (`runs`, `waitForRun`) |
-| §4.5 two notes, direct children, one or two sentences; listens for `hb:mode`; no Normal rule, mode rules name `.stage`; the switch's phone rule outranks `.seg`'s; the final gate line | Task 4 |
-| §4.6 / §5 the clean-up: `learn/`, `tests/learn.test.js`, Parallax's lesson line, nav and link, the lesson CSS (block, hover rules, 601px block, phone rules), the `learn` target and `hb-learn` exceptions and touch-target selectors, the stylesheet test's lesson selectors, 601px assertion and title; kept: the boot without a prompt and its renamed test, the header comment without "(the idea lessons)", the note link rule and test; added: the guard test; one commit | Task 1 |
-| §4.7 one bump to `?v=10`, tracked files only, line endings kept; then frozen; a later shared change takes the next number | Task 6; Task 14 Step 6 (`?v=11`) |
-| §4.8 the review kit: any pages, kind read, nine stills and three clips, `--before` with the count, `--gallery` | Task 5 |
-| §3 the six first-batch pages with the pictures and halves of the table | Tasks 8 to 13 |
-| §3 Parallax: start outlines (ruling 2), labels sharp (no `will-change`), the reduced-motion Compare note, the comment, `data-hb-caption` | Task 7 |
-| §3 what the owner sees (stills, clips, Normal before and after, rulings named, pages in the pane; changes applied, a shared one with one more bump) | Task 14 |
-| §1 the switch, notes, listener rules, copies, captions, reduced motion, phones, the 12 acceptance lines | Global Constraints; each page task's code, Step 8 tuning and Step 11 review; ruling 4's box size also in Task 3 (`look`, the `bad-box-size` fixture) |
-| §2 the brief from the survey row, the builder's freedom, tuning from the mode screenshots, Normal before and after | Step 1, Step 8 and Step 9 of each page task |
-| §7 roles, one builder and one fresh reviewer, at most three fix rounds, slots and ports, `sic/cat-NN`, the eight-check pool, headless only, no `git stash`, one server and scratch folder per lane | Global Constraints, Phases, Task 0, each page task's Steps 2 and 11 |
-| Coordination: branches and ports, the pool for every project, `main` untouched (before-pictures from a detached checkout), versions, merges with `--no-ff` | Global Constraints, Task 0 Step 6, Task 6, Task 14 |
-| §6 docs, sitemap, `make-skill` | at integration (next plan); `make-skill` unchanged is checked in Tasks 6 and 14; the pilot spec's status line is in Task 1 |
-
-**Placeholder scan:** every code step shows its code; the starting code for each page's views is a complete draft with the acceptance and the screenshots to tune against; the few steps that say "tune" name the values to move and the picture each must give.
-
-**Names used across tasks:** `SWITCHED`, `NOTES_BOX` (Task 4); `restShot`, `waitForRun`, `captionProblems`, `pictureName`, `TIMERS`, `window.__hbWaiting` (Task 3; `TIMERS` also in the kit); `playOnce` inside `setUpModes`, `visitorActed` (Task 2); `slot.mjs` `take`, `free`, `list`, `sweep`, `run` (Task 0); `record.mjs` with `--base`, `--before`, `--rulings`, `--only`, `--gallery`, `--press`, and `kit-lib.mjs` `expandPages`, `shortName`, `clipPlan`, `clipCaption`, `rulingsFor`, `countDiff`, `RULINGS`, `KIND_WORDS` (Task 5); `data-hb-caption`, `.stage[data-hb-mode="inside"|"compare"]`, `hb:mode`, `posed` (pages). The run folder `$RUN`, the kit `$KIT` and the fixtures `$FX` are the same paths in every task.
diff --git a/docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md b/docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md
deleted file mode 100644
index 825cccd9..00000000
--- a/docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md
+++ /dev/null
@@ -1,2772 +0,0 @@
-# See Inside and Compare: the Other 159 Pages Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Give the 159 animation pages that the first batch left out their See inside and Compare views, page by page (each built in its own page code by one builder and approved by a reviewer who did not build it), then integrate (taking in the ten new animations, built beside this plan on `feat/ten-animations`), review the whole in nine parts and put all 176 pages in front of the owner, ready to publish together on the owner's word.
-
-**Architecture:** The page code is not in this plan: each page's requirements are its brief (`briefs/<NN>-<slug>.md`, written by twelve brief lanes), its model is the closest first-batch page, and this plan defines the process exactly. Twenty slots (worktree, branch, port) each build an ordered list of pages, hard and heavy pages first, one writer at a time; every page goes builder → own checks → one commit → fresh reviewer → at most three fix rounds. The coordinator (the main session) plays the seven lane leads: a small tracker in the run folder (`pages.mjs`) keeps every page's state, decides what starts next within the 20 agents the app allows, fills the prompt templates of Tasks 7 and 8, and says up to which commit a slot's approved pages can be merged into their category branch. Chrome runs go through the machine-wide pool of eight. A finished category gets its whole page check and lands on `feat/see-inside-compare`, where its part of the final review starts at once; integration (which first merges in `feat/ten-animations`), the eighth and ninth review parts and the owner's final look follow.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript in the pages (no build, no packages); Node 22+ (`node --test`, built-in `fetch` and `WebSocket`) for the tests, the page check, the review kit and the run-folder tools; headless Chrome over the DevTools protocol (`tools/check-pages.mjs`, `record.mjs`); Python's `http.server` for local serving; git worktrees.
-
-**Spec and inputs:** `docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md` (all of it) and `docs/superpowers/specs/2026-10-13-next-projects-coordination.md` (where the two differ, the coordination file wins). The previous plan, `docs/superpowers/plans/2026-10-13-see-inside-compare-phase0-first-batch.md`, builds Phase 0 (the shared fixes, the page check's mode path, the review kit `record.mjs`, the slot pool `slot.mjs`, version 10) and the first batch (Tasks 7 to 13: Parallax Scrolling, Fade In / Fade Out, Overlay Wipe, Magnetic Button, Marquee / Ticker, Fluid / Liquid Simulation, Flow Field), and ends with the owner's look (its Task 14). This plan starts where that one ends. The page surveys: `.superpowers/sdd/2026-10-13-learn-pilot/rollout-survey-01-03.md`, `-04.md`, `-05-07.md`. The briefs' format: `.superpowers/sdd/2026-10-13-see-inside-compare/briefs/HOW-TO-WRITE.md`. The coordinator's rulings given while the briefs were written: `briefs/RULINGS.md` (seven general rulings), `briefs/OPEN-QUESTIONS.md` (rulings across lanes) and the `RULED:` cells of the twelve `briefs/summary-<lane>.md` (the lanes `01a`, `01b`, `02`, `03`, `04a`, `04b`, `04c`, `05`, `06a`, `06b`, `07a`, `07b`; a page's row starts `| <NN>-<slug> |`).
-
-**State when this plan was fixed (2026-10-15):** Phase 0 Tasks 0, 1, 2 and 4 and its review kit are done (the branch at b5db0fa; the kit's rounds 3 and 4, Normal compared region by region at three sizes and the `--short` run, are done and tested, and their review is part of Task 5), its page check (Task 3) is in review and its bump (Task 6) still to come; the first batch is being built from b5db0fa (owner: speed); all 159 briefs are written, the twelve brief lanes are done and every open question is ruled (`briefs/OPEN-QUESTIONS.md`); the Animation finder and Famous effects are near their last tasks; the owner has said the ten new animations start right after Phase 0, so they run beside the first batch and this plan, on `feat/ten-animations`, and share its seats and Chrome pool (where their pages land: "What waits for the owner's verdict").
-
-## Global Constraints
-
-- **Checkout and branch:** the main checkout `C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook` stays on `feat/see-inside-compare` for the whole run; it is never switched. Nothing is pushed and nothing is merged into `main` before Task 15, and then only on the owner's word.
-- **Merges:** `git merge --no-ff` only; never rebase, squash, cherry-pick or amend. One undo is allowed: `git reset --hard ORIG_HEAD` in a category worktree, right after its own merge failed the tests (Task 10, Step 2). Only the coordinator merges: a slot's approved pages into `sic/cat-NN` (in `.claude/worktrees/sic-cat-NN`), a finished category into `feat/see-inside-compare` (in the main checkout), lanes into `feat/see-inside-compare`, `feat/ten-animations` into `feat/see-inside-compare` (Task 12, Step 1), and, for a page fix after Task 12 has merged anything, `feat/see-inside-compare` into that page's slot first.
-- **Places (worktrees under `.claude/worktrees/`, ports on 127.0.0.1):**
-
- | What | Worktree | Branch | Port |
- |---|---|---|---|
- | The 20 slots (table in "The slots") | `sic-<NN><x>` | `sic/<NN><x>` | 8801–8820 |
- | Re-cut slots (Task 9, Step 7) | `sic-<NN><next letter>` | `sic/<NN><next letter>` | 8821–8827, in order |
- | The probe (Task 4) | `sic-probe` | detached | 8828 |
- | The owner's shared changes (Task 1) | `sic-00f` | `sic/00f` | 8829 |
- | The kit hold's fixture site (Task 5) | — (the folder `$RUN/scratch/kit-hold/site`) | — | 8840 |
- | Category merges and checks | `sic-cat-01` … `sic-cat-07` | `sic/cat-01` … `sic/cat-07` | 8831–8837 |
- | A check fix in mid-run (Task 9, Step 8) | `sic-00h` | `sic/00h` | 8838 |
- | Integration's shared changes (Task 12) | `sic-00i` | `sic/00i` | 8839 |
- | Final review's frozen checkouts | `fr-01` … `fr-08` | detached | 8841–8848 |
- | Integration (Task 12) | `sic-int` | `sic/int` | 8850 |
- | Normal's before-pictures (exists) | `sic-before` | detached at `main` | 8800 |
- | The owner's preview of the main checkout | — | `feat/see-inside-compare` | 8731 |
- | Releases (Task 15) | `release` | `main` | 8990 |
-
- Never 8901–8909 (finder), 8931–8939 (Famous effects), 8961–8970 (ten new animations).
-- **Run folder:** `.superpowers/sdd/2026-10-13-see-inside-compare/` (git-ignored, in the main checkout): `ledger.md` (one line per event), `pages.json` and `pages.mjs` (the tracker), `slots.json`, `prompts/`, `reports/<NN>-<slug>/`, `briefs/`, `checks/`, `kit/`, `final/`, `lessons.md`, `brief-rulings.md`, `rulings-159.md`, `shared-wishes.md`, `agents.md`, the slot pool `slots/` and `slot.mjs`, and the small tools `wait-log.mjs`, `check-slots.mjs`, `extract-prompts.mjs`, `probe.mjs`.
-- **Shell variables:** every Bash call that uses them starts with `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; FX=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/fixtures` (each Bash call starts in a fresh shell). Git Bash hands a `/c/…` argument to `node` as a Windows path, but not a path written inside a `node -e` script: such a script runs from `$RUN` with paths relative to it.
-- **Agents:** the app runs at most 20 agents at once, for every project together. Page work gets the seats left after the other projects' running agents and one spare (Task 9, Step 1); reviews start before fixes, fixes before new pages. Every builder, reviewer, fixer, brief checker and final reviewer runs on the strongest model (`model: "opus"`); the purely mechanical jobs (Task 2's files, Task 4's probe runs) may run on `sonnet`. A page has one builder, who also does its fix rounds, and one reviewer, who never built it; at most three fix rounds, then the coordinator decides (Task 9, Step 5). Agents start no agents of their own and never open the browser pane.
-- **Machine:** at most eight Chrome runs at once for every project, each through `node $RUN/slot.mjs run <who> -- <command>`. An agent runs one Chrome job at a time, started as a background command with its output in a log that ends with a line `EXIT=<code>`, and waits for it with `node $RUN/wait-log.mjs <log>` (it waits up to nine minutes per call; call again while it says "still running"). `<who>` names: `b-<NN.MM>` builder, `r-<NN.MM>` reviewer, `f-<NN.MM>` fixer, `cat-<NN>-<k>` category check part, `probe-<NN>-<k>`, `fr-<NN>`, `site-<NN>-<k>`, `kit-<what>`. Headless Chrome only. One server per worktree, started and stopped by the coordinator (`python -m http.server <port> --bind 127.0.0.1` from the worktree root, as a background command). No `git stash` (every worktree shares it): to compare versions, `git show <rev>:<path> > <scratch file>`. Leftover temp folders (`hb-chrome-*`, `hb-kit-*`, and the tests' `sic-run-*`, `sic-repo-*` and `sic-pool-*`) are removed at the end with the owner's OK.
-- **Version and frozen files:** the shared files stay at the number Task 1 leaves (10, or 11 if the owner asked for a shared change). From Task 6 to Task 12, `assets/css/demo-page.css`, `assets/js/demo-page.js`, `tests/demo-page.test.js`, `tests/pages.test.js` and `tools/check-pages.mjs` are frozen; the one way to change the check in mid-run is lane `sic/00h` (Task 9, Step 8). A page that needs a shared change gets one line in `$RUN/shared-wishes.md`; Task 12 applies them all, with the next version number on every animation page and the home page (tracked files only, line endings kept).
-- **Pages:** a page's build and fix commits touch only `animations/<category>/<slug>/index.html`, and its `README.md` only where a ruling for the page says so (Zoom Transition's reduced-motion sentence, made true to the code: `briefs/summary-03.md`; the one exception to spec section 6's "No change: the 166 page READMEs"; the builder then runs `node tools/make-skill.mjs` and commits what it writes only if it changed): no other README, home page, `CATS`, prompt, setting, chip or tag changes, and `node tools/make-skill.mjs` writes identical files. A page's requirements are its brief; the coordinator's rulings: `$RUN/briefs/RULINGS.md`, `$RUN/briefs/OPEN-QUESTIONS.md`, the page's row in the brief lane's summary that lists it (`$RUN/briefs/summary-<lane>.md`, after `RULED:`) and `$RUN/brief-rulings.md`; and `$RUN/rulings-159.md` (the owner's rulings from the first batch). Every builder, reviewer and checker reads them beside the brief. Where they differ, a ruling wins over the brief and over these Global Constraints for its page, and the owner's (`rulings-159.md`) over the coordinator's; where the builder finds a clearer picture than the brief's, it builds it and says why.
-- **Names:** never `hb-view` anywhere in a page. The switch and the notes box are exactly as on Parallax Scrolling. Every page CSS selector part that contains `data-hb-mode` starts its stage part with `.stage[data-hb-mode="inside"]` or `.stage[data-hb-mode="compare"]`; no rule on `[data-hb-mode="normal"]`. No element's class is exactly `lbl` (a label class always has a second name).
-- **The page's `hb:mode` listener (spec section 1):** `document.addEventListener('hb:mode', …)` at the top level of the page's inline script; hears every press, never one at boot; draws the current state at once; safe to run twice; never scrolls, moves focus, presses a control, stops Play or changes Pause. The shared script, not the page, plays the demo once after See inside or Compare (ruling 1).
-- **Copies:** made once (at load or on first entry); ids removed or renamed (gradients, masks, filters, `for`); `inert`; `aria-hidden="true"`; not rendered outside Compare. A canvas page splits one canvas; a WebGL page draws one context in two viewports, never a second context; a second world (spec section 2) takes the same fixed steps as the first from one accumulator.
-- **Captions:** every label and half name carries `data-hb-caption`; at least 12px as drawn; 4.5:1 against its own backing; inside the stage; covering neither the part it names nor another caption; at most six (four on phones); amounts as a beginner says them, never ms, px, deg or CSS names.
-- **Notes:** exactly two, `p[data-hb-for="inside"]` then `p[data-hb-for="compare"]`, direct children of `div.hb-mode-notes`; one or two plain sentences, at most 35 words, on what the visitor sees; the Compare note names the halves by their labels; a note says left and right only on a page whose halves never stack; when the stage looks like Normal until the visitor acts, the note ends with what to do; a note the script rewrites (a setting, reduced motion) uses the markup's own words for the default state.
-- **Motion:** only transform and opacity animate (a copy may animate exactly what its page's own Normal animates, nothing in layout: `briefs/OPEN-QUESTIONS.md`, lane 05); a frame loop moves by elapsed time (`FRAME = 1000 / 60`, `dt = lastT === null ? 0 : Math.min(ts - lastT, 50)`, each step × `dt / FRAME`, × 1/3 in Slow motion); a Replay or Show me run holds its pauses with `setTimeout`, never inside a frame loop or a `setInterval`; on phones each Compare half gets half the budget (particles, dots, tiles); a blur is never doubled.
-- **Reduced motion:** every mode is a still picture that still teaches; no mode adds movement; the shared script presses nothing.
-- **Phones:** the box keeps its size in every mode, Compare included (ruling 4); halves side by side while each keeps about 160px of scene, else stacked; anything a mode adds that can be pressed is at least 44×44px (checked by hand: the page check skips the stage); hover and drag keep their touch equivalents.
-- **Words and size:** no code on the page; American spelling; no hype; about 300 lines for the demo plus about 150 for its two views (a page already past 300 adds about 150 at most).
-- **Checks:** the tests are `node --test "tests/*.test.js"` from the worktree root: all pass. The page check is `node tools/check-pages.mjs --base http://127.0.0.1:<port> --out <folder> <page folders>`: six `ok` lines per page. The kit (`record.mjs`) gives the motion (clips), the settings (`--press`), Normal before and after (`--before http://127.0.0.1:8800`: the stage and Try it, each pictured on the screen and clipped to its own box, at 1280, 375 and 320; Phase 0's kit round 3) and the short stages (`--short`: the page check's two place rules for labels and half names (inside the stage, none overlapping) at 667×375, 812×375, 844×390, 932×430, 1024×600, 1280×600, 1366×630 and 1440×620, and 812×375 with reduced motion, in every mode; one line per size and mode, a last line `27 short-screen pictures checked, <n> with labels cut or overlapping, <s> skipped, <f> failed`, exit 1 on a problem; added by Phase 0's kit round 4 and reviewed in Task 5, which then appends `Kit short: done: record.mjs --short, reviewed` to `$RUN/ledger.md`: the line Task 6 waits for, beside Task 5's `Kit hold: done`).
-- **Acceptance for each page (spec section 1), confirmed line by line by a reviewer who is never the builder:** (1) clear from the picture alone in the mode screenshots at 1280 and 375, start outlines where a movement is shrunk; (2) every mode still under reduced motion and still teaching; (3) Normal at rest pixel-identical to before (a few antialiased corner pixels aside; random pages by eye), Try it, chips and prompt unchanged; (4) a mode change never scrolls the page or the box, moves focus, stops Play or changes Pause, shows the current state at once, then plays once on plays-once and do-it pages (not under reduced motion); (5) notes as above; (6) captions as above; (7) every setting visibly changes See inside and Compare; (8) phones as above; (9) the keyboard works in every mode as in Normal, copies inert and hidden from screen readers, a named picture names each mode, a control's name contains its visible words; (10) light enough, as above; (11) tests pass and six `ok` lines; (12) words and size as above.
-- **Commits:** a build is one commit, `feat: <Title> shows <the See inside picture> (See inside) and <the first half> beside <the second half> (Compare)`; a fix round adds commits `fix: <Title>: <what changed>`; merge commits say what they bring. `{{…}}` in a prompt template is a value the tracker fills in (Task 2).
-- **Reports:** every agent writes its report file, whose first line is its RESULT line (Tasks 7 and 8), and replies with at most three lines. The coordinator reads RESULT lines through the tracker, not whole reports.
-
-## What waits for the owner's verdict on the first batch, and what starts now
-
-**Starts now, beside the first batch and the owner's look (no page code):**
-- Task 0: this plan committed and the coordination file brought up to date, before Task 2, Step 8 extracts the prompts.
-- Task 2: the tracker, the slot table, the prompt templates and the run files.
-- Task 3: the 159 briefs (all written, their open questions ruled) checked, each lane's by a fresh agent.
-- Task 4: the rest-and-run probe of every page, once Phase 0 is merged (the previous plan's Task 6) and the first batch's last check before the owner's look has ended (so it never slows those checks), which finds before any build the pages whose stage never rests, whose runs never end, or whose runs scroll or move focus. Task 6 may start before it ends (Task 6, Step 1).
-- Task 5: the review kit holds endless animations at rest as the page check does, and kit rounds 3 and 4 are reviewed, once Phase 0's page check is merged and the kit's round 4 is done.
-
-**Waits for the verdict:**
-- Task 1, which applies it: fix rounds on first-batch pages, a shared change with `?v=11` if the owner asks for one, the owner's rules written for every builder and into the briefs they change, and the owner's answer on each Compare that shows a mistake beyond the spec's list (the list goes to the owner with the first-batch look: Task 1, Step 1).
-- Every page build, and therefore Tasks 6 to 15: every slot starts from the branch with the verdict's changes in it.
-
-**Why the pages wait:** the seven first-batch pages are the models every builder copies, and the owner's answer can change a rule every page follows; building first would mean building twice. The spec says it too (section 3: "then the rest starts").
-
-**The ten new animations** are built beside this plan by their own plan, on `feat/ten-animations` (ports 8961–8970, the same seats and Chrome pool). Their pages land on `feat/see-inside-compare` only at the start of integration, when Task 12, Step 1 merges `feat/ten-animations` in; before that they land on no `sic/` slot or category branch and not on `feat/see-inside-compare`, unless the owner says otherwise. So the tracker, the slot table and every count up to Task 11 stay at 166 pages; from Task 12 on, the whole-site check, the final review (its part 9 is theirs: Task 13), the gallery and the owner's final look cover all 176 pages, and both projects go live together on the owner's word (Task 15). Task 0 writes this change of order into the coordination file.
-
-## Phases
-
-| Step | Tasks | Starts when | Runs beside |
-|---|---|---|---|
-| 0 | 0, then 2, 3, 4 and 5 | now (Task 0 before Task 2, Step 8); Task 4 once Phase 0 is merged and the first batch's last check has ended; Task 5 once Phase 0's page check is merged and the kit's round 4 is done | the first batch, the owner's look, the finder, Famous effects, the ten new animations |
-| 1 | 1 | the owner's verdict | Task 4, if it has not ended |
-| 2 | 6 | Tasks 1, 2, 3 and 5 done, with the kit's `--short` (Phase 0's kit round 4, reviewed in Task 5) (Task 4 may still run: Task 6, Step 1) | Task 4, if it has not ended |
-| 3 | 7, 8, 9, 10: the 159 pages in 20 slots | Task 6 | each other |
-| 4 | 11: final review parts 1 to 7 | each category as it lands | step 3 |
-| 5 | 12: integration, starting with `feat/ten-animations` merged in | every category landed, parts 1 to 7 clear, the ten new animations reviewed by their own plan | — |
-| 6 | 13: final review parts 8 (shared files, tools, docs) and 9 (the ten new pages) | Task 12's lane committed and checked | — |
-| 7 | 14: the owner's final look | Task 13 merged | — |
-| 8 | 15: release, clean-up | the owner's word | — |
-
-## The slots
-
-Each slot builds its pages in this order. Letters: X a second world (spec section 2), H hard, M medium, E easy (from the surveys and the briefs' summaries); the tracker weighs them 4, 3, 2, 1 to start the slot with the most work left first. Hard and heavy pages come first; every second-world page is first in its slot except 2D Physics, second in 06a after Cloth. Twins share a slot, one after the other, the second built after the first is committed so its builder can make a different picture: Stacking Cards → Section Wipe (01a), Pin Animation → Sticky Section (01b), Split Text Reveal → Letter-by-Letter Stagger → Word-by-Word Reveal (02a), Portal / Tunnel Zoom → Circle Reveal (03b). Curtain Reveal (02b) and Flash / Light Leak Transition (03b) each draw their own cover-swap-uncover picture, not a copy of Overlay Wipe's.
-
-| Slot | Port | Pages, in build order | Weight |
-|---|---|---|---|
-| 01a | 8801 | 01.20 scroll-image-sequence H · 01.06 stacking-cards M · 01.18 section-wipe M · 01.04 cover-card-to-fixed-header M · 01.23 scroll-velocity-skew M · 01.14 horizontal-scroll M · 01.17 progress-bar M · 01.26 scroll-background-color M · 01.22 text-fill-on-scroll E | 18 |
-| 01b | 8802 | 01.21 smooth-scroll H · 01.09 pin-animation M · 01.15 sticky-section M · 01.07 scroll-trigger M · 01.12 reveal-on-scroll M · 01.11 scrollytelling M · 01.16 counter-animation M · 01.25 scrollspy-nav M · 01.03 reverse-scrolling-columns M | 19 |
-| 01c | 8803 | 01.10 snap-scrolling H · 01.01 parallax-depth-of-field M · 01.27 hide-on-scroll-header M · 01.13 stagger-reveal M · 01.08 scrub-animation M · 01.24 svg-line-draw M · 01.05 fly-in-fly-out-contact-list M · 01.19 zoom-into-image M | 17 |
-| 02a | 8804 | 02.14 shatter-effect H · 02.07 split-text-reveal M · 02.08 letter-by-letter-stagger M · 02.09 word-by-word-reveal M · 02.11 flip-in E · 02.13 rotate-in E | 11 |
-| 02b | 8805 | 02.06 curtain-reveal M · 02.12 bounce-in M · 02.05 clip-path-reveal M · 02.10 blur-in E · 02.02 slide-in E · 02.04 scale-in E · 02.03 slide-up-reveal E | 10 |
-| 03a | 8806 | 03.09 elastic-transition X · 03.01 view-transitions-api H · 03.11 dissolve M · 03.02 shared-element-transition M · 03.04 crossfade M · 03.06 zoom-transition M · 03.08 blur-transition M | 17 |
-| 03b | 8807 | 03.15 page-curl H · 03.10 portal-zoom M · 03.13 circle-reveal M · 03.12 flip-technique M · 03.07 flash-transition M · 03.03 morph-transition M · 03.16 cube-transition M · 03.05 slide-transition M | 17 |
-| 04a | 8808 | 04.40 gooey-menu H · 04.33 drag-to-reorder H · 04.22 swipe-to-dismiss H · 04.17 drawer-slide M · 04.18 modal-expand M · 04.19 accordion M · 04.28 segmented-control M · 04.06 toggle-switch E · 04.24 theme-toggle-morph E | 19 |
-| 04b | 8809 | 04.07 heart-burst H · 04.08 success-confetti H · 04.39 image-trail H · 04.13 checkmark-draw M · 04.12 progress-animation M · 04.09 skeleton-loader M · 04.34 rolling-numbers M · 04.11 loading-spinner E · 04.15 badge-pulse E | 19 |
-| 04c | 8810 | 04.27 toast-notification H · 04.29 pull-to-refresh H · 04.41 dynamic-island M · 04.36 hold-to-confirm M · 04.21 error-shake M · 04.14 form-field-morph M · 04.37 expanding-search M · 04.23 hamburger-menu-toggle M · 04.25 copy-to-clipboard E · 04.03 focus-ring E | 20 |
-| 04d | 8811 | 04.20 cursor-follower H · 04.31 spotlight-hover M · 04.16 tooltip-reveal M · 04.26 star-rating M · 04.38 button-loading-states M · 04.32 add-to-cart-fly M · 04.04 button-press-scale M · 04.01 hover-state E · 04.02 click-ripple E · 04.10 shimmer-effect E · 04.30 gradient-border E · 04.35 typing-indicator E | 20 |
-| 05a | 8812 | 05.19 text-particles H · 05.16 split-flap-board M · 05.02 typewriter-effect M · 05.03 scramble-text M · 05.12 glitch-text M · 05.17 neon-flicker M · 05.09 outline-to-fill M · 05.14 wavy-text M · 05.15 highlighter-sweep M | 19 |
-| 05b | 8813 | 05.01 kinetic-typography M · 05.10 enter-exit-typography M · 05.18 handwriting-draw M · 05.13 text-on-path M · 05.08 text-gradient-animation M · 05.11 rotate-word-carousel M · 05.07 text-morphing M · 05.04 variable-font-morph M · 05.05 text-clip-path-reveal M | 18 |
-| 06a | 8814 | 06.15 cloth-simulation X · 06.23 physics-2d X · 06.04 canvas-particle-effect H · 06.26 infinite-zoom H · 06.11 2-5d-pseudo-3d M · 06.02 scroll-driven-3d-rotation M | 18 |
-| 06b | 8815 | 06.13 gpgpu-particle-system X · 06.01 3d-model-orbit H · 06.07 webgl-shader-animation H · 06.12 ray-marching-sdf H · 06.06 glassmorphism-animated M · 06.10 chromatic-aberration M | 17 |
-| 06c | 8816 | 06.21 flocking X · 06.16 volumetric-smoke H · 06.14 image-distortion-hover H · 06.20 depth-map-photo H · 06.17 morphing-blob M · 06.09 svg-path-animation M | 17 |
-| 06d | 8817 | 06.24 liquid-glass X · 06.08 noise-based-motion H · 06.22 ascii-halftone H · 06.25 holographic-card M · 06.18 flip-card-3d M · 06.19 carousel-3d M · 06.03 parallax-3d-tilt M | 18 |
-| 07a | 8818 | 07.12 abstract-geometric-motion X · 07.07 starfield H · 07.19 snow-rain H · 07.15 synthwave-grid H · 07.11 grid-dot-pattern-parallax M · 07.18 wave-layers M · 07.10 floating-elements M | 19 |
-| 07b | 8819 | 07.20 fireworks X · 07.09 ambient-ripple H · 07.13 particle-constellation H · 07.23 game-of-life H · 07.08 breathing-glow M · 07.06 light-leak M · 07.05 scanline M | 19 |
-| 07c | 8820 | 07.16 matrix-rain H · 07.17 plasma H · 07.21 topographic-lines H · 07.22 light-rays H · 07.01 animated-gradient-background M · 07.02 mesh-gradient M · 07.03 aurora M · 07.04 grain-overlay M | 20 |
-
-159 pages: 26 in 01, 13 in 02, 15 in 03, 40 in 04, 18 in 05, 25 in 06, 22 in 07. The two 02 slots carry about half the others' work: they finish first and are re-cut for the category with the most pages left (Task 9, Step 7). The order inside a slot may change before a page starts (a brief's summary rates it harder than the survey did): the coordinator edits `slots.json` before Task 6, or uses `pages.mjs move` afterwards, never splitting twins.
-
-## Agents and Chrome: how the work queues
-
-**Agents.** The coordinator is the only one who starts agents. Before each dispatch it counts the agents running for every project (it started them all) and gives page work the rest, less one spare kept for its own short jobs: `seats = 20 − running − 1` (with a higher cap set by the owner, that cap). `node pages.mjs dispatch <seats>` then picks, in this order: (1) reviews and re-reviews of committed pages, oldest first; (2) fix rounds, oldest first, each only when its slot has no writer; (3) new pages, the next one of each slot that has no writer and no page waiting for a fix, the slot with the most work left first. A slot has one writer at a time (a build or a fix round), so the tests and the files a writer sees are its own; its next page may be built while the last one is reviewed. With 20 seats and about one review for every three builds, about 14 to 15 builders and 5 reviewers run at once; all 20 slots are busy only when the cap allows about 26 agents.
-
-**Chrome.** Every page check and kit run takes one of the pool's eight slots (`slot.mjs run`), for every project at once. An agent holds at most one: it starts the run in the background, with its log, and waits with `wait-log.mjs`, so a full pool only makes it wait (up to an hour, the pool's own limit; then it starts the run again). The coordinator's category checks run at most two parts at once while page work goes on, and up to seven once it is over (Task 12). Builders use Chrome about a quarter of their time and reviewers about a third, so they alone keep about six of the eight busy on average; the category-check parts, the final review's galleries, the probe (four parts at once while it runs) and the other projects' runs (the ten new animations' page checks and their slowed-CPU frame-time runs among them) come on top. So the pool, not the seats, sets the pace: an agent waiting for a slot holds its seat. When the pool has been full for 20 minutes with runs waiting, the coordinator starts no new build that round, and reviews and fix rounds keep their turn (Task 9, Step 1).
-
-## Who touches which file
-
-| File | Task |
-|---|---|
-| Each of the 159 `animations/*/*/index.html` | its builder (Task 7) and fix rounds (Task 8), in its slot, its own file only (and its `README.md` where a ruling says so: Zoom Transition's) |
-| The seven first-batch pages | Task 1 (fix rounds asked by the owner, by the previous plan's Task 14, Step 6) |
-| The version line of every animation page and of `index.html` | Task 1 (`?v=11`, only for a shared change the owner asks for), Task 12 (the higher number of the two branches after `feat/ten-animations` is merged in; the next number, only for shared wishes) |
-| `assets/css/demo-page.css`, `assets/js/demo-page.js`, `tests/demo-page.test.js` | Task 1 (lane `sic/00f`), Task 12 (lane `sic/00i`) |
-| `tools/check-pages.mjs` | Task 1 (lane `sic/00f`, only for a shared change the owner asks for), Task 9, Step 8 (lane `sic/00h`), Task 12 (lane `sic/00i`) |
-| `tests/pages.test.js` | Task 1 (lane `sic/00f`, a test of the owner's shared change), Task 12 (the final gate and the learning path's guard, lane `sic/int`; shared wishes, lane `sic/00i`) |
-| `CLAUDE.md`, `CONTRIBUTING.md`, `.github/pull_request_template.md`, `README.md`, `CHANGELOG.md`, `sitemap.xml` | Task 12 (lane `sic/int`) |
-| This plan (committed) and `docs/superpowers/specs/2026-10-13-next-projects-coordination.md` (its Order and Branches rows) | Task 0 |
-| What `feat/ten-animations` brings (the ten new pages, the Next link on five last pages, the home page's cards, the counts, its tests and generated files) | the ten new animations' own plan; merged here by Task 12, Step 1 |
-| Outside the repository: the run folder's files | Tasks 2, 3, 4, 5, 9 to 14 |
-| Outside the repository: `$KIT/record.mjs`, `$KIT/README.md` | Task 5 |
-
-## Time
-
-Running time, as far as it can be known before the briefs are all written (the owner's looks come on top):
-
-| Step | Time |
-|---|---|
-| Tasks 2 to 5 | about 3 hours, while the first batch is built and the owner looks: they delay nothing |
-| Task 1 | minutes if the owner approves as is; about 2 hours with page changes; about 4 with a shared change (its version bump and whole-site check) |
-| Task 6 | about 20 minutes |
-| The 159 pages, all 20 slots busy (Tasks 7 to 10) | about 19 hours: a medium page takes about 1.5 hours to build and 0.5 to review and fix, a hard one about 2.5, a second world about 4; the busiest slot holds about 18 hours of building, and re-cut slots shorten the tail; 16 hours at best, about 30 with usage-limit stops, outages or extra rounds; the Chrome pool, shared with the other projects, sets this pace more than the seats do ("Agents and Chrome") |
-| The last category's final review part and its fixes (Task 11) | about 2 hours after it lands (the other six run during the pages) |
-| Integration, the whole-site check, parts 8 and 9 (Tasks 12, 13) | about 5 hours |
-
-From the owner's verdict to the owner's final look: **about 26 hours with all 20 slots busy**. Under today's cap of 20 agents for every project, the reviews take seats the slots would use: about 24 hours for the pages, about 31 in all; if the ten new animations run at the same time they share the seats too: add about 4 hours.
-
----
-### Task 0: The plan committed, and the coordination file brought up to date (coordinator)
-
-**Files:**
-- Modify: `docs/superpowers/specs/2026-10-13-next-projects-coordination.md` (under "Order", item 3; under "Branches and places", the Rollout row's ports and the Ten new row's "Cut from").
-- Commit (main checkout, `feat/see-inside-compare`): this plan, untracked until now, and that change.
-
-**Interfaces:**
-- Consumes: this plan with its pre-flight review's fixes (`$RUN/plan159-review.md`, `$RUN/plan159-fixes.md`).
-- Produces: the plan tracked, so Task 2, Step 8 extracts the prompt templates from committed text and the empty status that Task 6, Step 1 and Task 10, Step 5 expect holds; the coordination file (which wins where it and this plan differ) saying what this plan does: the ten new animations run beside it and are merged in at its integration, and its places use ports 8821–8850 beside 8800–8820.
-
-- [ ] **Step 1: The coordination file**
-
-In `docs/superpowers/specs/2026-10-13-next-projects-coordination.md`, under "## Order", replace
-
-```text
-3. **The ten new animations,** once the rollout is integrated; built without the new tabs. Live after the rollout, or with
- it if the owner says so.
-```
-with
-```text
-3. **The ten new animations,** right after the rollout's Phase 0 (owner, 2026-10-14), beside the first batch and the other
- 159 pages, on their own branch; built without the new tabs. Their branch is merged into the rollout's at the start of the
- rollout's integration, so its final review, gallery and final look cover all 176 pages, and both go live together on the
- owner's word.
-```
-In the table under "## Branches and places", in the Rollout row replace `8800 (before-pictures), 8801–8820` with `8800 (before-pictures), 8801–8820 (slots), 8821–8850 (re-cut slots, the probe, lanes, category checks, final review, integration)`, and in the Ten new row replace `` `feat/see-inside-compare` once integrated, main merged in; `main` if the rollout is live by then `` with `` `feat/see-inside-compare` once Phase 0 is merged (owner, 2026-10-14); merged back into it at the start of the rollout's integration ``.
-
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook && git diff --stat -- docs/superpowers/specs/2026-10-13-next-projects-coordination.md`
-Expected: `1 file changed, 6 insertions(+), 4 deletions(-)`.
-
-- [ ] **Step 2: Two commits, before Task 2, Step 8**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-git status --short -- docs
-git add docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md
-git commit -m "docs: the plan for See inside and Compare on the other 159 pages" -- docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md
-git commit -m "docs: the coordination file: the ten new animations run beside the rollout and join it at its integration; the rollout's ports up to 8850" -- docs/superpowers/specs/2026-10-13-next-projects-coordination.md
-git status --short -- docs
-git log --oneline -2
-```
-Expected: the first status lists `?? docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md` and ` M docs/superpowers/specs/2026-10-13-next-projects-coordination.md` (another project's untracked plan, if one is there, stays out of these commits); the second lists neither file; the two commits on top, as 5cf70b3 was for the previous plan. Task 2, Step 9's ledger section names their hashes.
-
----
-### Task 1: The owner's verdict on the first batch, applied (coordinator)
-
-**Files:**
-- Modify (only if the owner asks): the first-batch pages, by the previous plan's Task 14, Step 6.
-- Modify (lane `sic/00f`, only for a shared change the owner asks for): the shared file the change needs and its test; then the version line of every tracked `animations/*/*/index.html` and of `index.html` (`?v=10` → `?v=11`).
-- Create (outside the repository): `$RUN/rulings-159.md` (replacing Task 2's placeholder file), `$RUN/briefs/owner-amendments.md`. Modify: `$RUN/lessons.md`, `$RUN/ledger.md`, the briefs an owner's rule changes.
-
-**Interfaces:**
-- Consumes: the previous plan's Task 14 (the seven pages on `feat/see-inside-compare`, the kit's first-batch run, the owner's answer written in `$RUN/ledger.md` by its Step 6, with the answer on each listed Compare); Task 2's `lessons.md`; Task 3's checked briefs (for Step 5).
-- Produces: `$RUN/rulings-159.md`, which every builder and reviewer reads with the brief; the ledger's gate line `First batch approved by the owner on <date>; shared files at v=<N>; rulings-159.md: <K> rules`, which Task 6 waits for.
-
-- [ ] **Step 1: Read the verdict**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; grep -n -i "owner" $RUN/ledger.md | tail -20`
-Expected: the owner's answer to "Roll these out to the other 159 pages as they are, or change something first?" (the previous plan's Task 14, Step 6). If the answer is not written there yet, nothing in this task starts.
-
-The first-batch look message (the previous plan's Task 14, Step 5) also carried, added by the coordinator, the list of Compare halves that show a mistake beyond the spec's list (`briefs/RULINGS.md`, item 2: each such page is listed for the owner's first-batch look), one line per page with its two half names: 01.11 scrollytelling, 02.13 rotate-in, 03.03 morph-transition, 04.10 shimmer-effect, 04.18 modal-expand, 04.34 rolling-numbers, 05.01 kinetic-typography, 05.08 text-gradient-animation, 05.11 rotate-word-carousel, 06.10 chromatic-aberration, 06.12 ray-marching-sdf, 06.18 flip-card-3d, 06.26 infinite-zoom, 07.06 light-leak, 07.12 abstract-geometric-motion, 07.13 particle-constellation, 07.21 topographic-lines and 07.22 light-rays (from `briefs/OPEN-QUESTIONS.md` and the summaries' "listed for the owner's look" cells; each brief names its pair and, where it has one, its fallback). Expected too: the owner's answer on each listed page, keep it or not, written with the verdict. If that answer is not there, ask the owner for it (the same list) before Step 2.
-
-- [ ] **Step 2: Sort the answer and write `rulings-159.md`**
-
-Sort every item of the answer into one of three lists: **P**, a change to one first-batch page; **S**, a change to a shared file (`assets/css/demo-page.css`, `assets/js/demo-page.js`, `tools/check-pages.mjs`); **R**, a rule every page follows (for example "labels a little bigger", "Compare always stacked on phones", "notes shorter"). An R item that also changes first-batch pages is both R and P. Each listed Compare the owner did not keep is an R item of its own, `NN.MM slug: Compare uses <the brief's fallback pair, or else the plain pair: the scene without the effect beside the page as set> (acceptance line 1)`, applied to that brief in Step 5. Write `$RUN/rulings-159.md`:
-
-```markdown
-# The owner's rulings from the first batch (<date>), for every page
-
-Builders and reviewers read this file with the page's brief. Each rule says what to do and which acceptance line it changes.
-
-R1. <the rule, in a builder's words> (acceptance line <n>)
-R2. …
-
-First-batch pages changed for these rules: <the list, or "none">.
-```
-
-If the owner approved the batch as it is and kept every listed Compare, the file says only: `None: the owner approved the first batch as it is on <date>.` and Steps 3 to 6 are skipped (with only listed Compares declined, Steps 3, 4 and 6 are skipped and Step 5 runs).
-
-- [ ] **Step 3: P items, by the previous plan's Task 14, Step 6**
-
-Each page change goes back to its first-batch lane as a fix round, exactly as the previous plan's Task 14, Step 6 says (the slot takes `feat/see-inside-compare` first, the same builder fixes, a new reviewer pass, `git switch sic/cat-NN && git merge --no-ff sic/NNa`, the category check, the coordinator's merge into `feat/see-inside-compare`). A ledger line per page. When both P and S items apply, Step 4 merges first; Step 3's slots then take `feat/see-inside-compare`, so each page fix is checked with the new shared files and `?v=11`.
-
-- [ ] **Step 4: S items: lane `sic/00f`, its test first, then `?v=11`**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree add -b sic/00f $REPO/.claude/worktrees/sic-00f feat/see-inside-compare`
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00f && python -m http.server 8829 --bind 127.0.0.1`
-
-An agent (opus) makes each change test first: a test that pins it in `tests/demo-page.test.js` (the shared script), `tests/pages.test.js` (the stylesheet: the existing stylesheet tests read the rules with `cssRules`) or a fixture page of `$FX/sic-gen.mjs` (the page check); it runs the test file and sees the new test fail for the reason the change fixes; then the change; then `cd $REPO/.claude/worktrees/sic-00f && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"` gives `ℹ fail 0`. Then the seven first-batch pages, through the pool, as a background command:
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-00f && node $RUN/slot.mjs run kit-00f -- node tools/check-pages.mjs --base http://127.0.0.1:8829 --out $RUN/checks/sic-00f animations/01-scroll-based/parallax-scrolling animations/02-entrance-and-exit/fade-in-out animations/03-page-transitions/overlay-wipe animations/04-micro-interactions/magnetic-button animations/05-text-typography/marquee-ticker animations/06-3d-advanced/fluid-simulation animations/07-ambient-background/flow-field > $RUN/checks/sic-00f.log 2>&1; echo "EXIT=$?" >> $RUN/checks/sic-00f.log`
-then `cd $RUN && node wait-log.mjs checks/sic-00f.log` until it ends. Expected: `grep -c '^ok' $RUN/checks/sic-00f.log` prints `42`, no `FAIL`. Commit: `git add <the changed files> && git commit -m "feat: <the owner's change, in plain words>"`.
-
-The bump, in the same lane (tracked files only, line endings kept):
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-00f
-git ls-files -- 'animations/*/*/index.html' index.html | xargs sed -b -i 's/demo-page\.css?v=10"/demo-page.css?v=11"/; s/demo-page\.js?v=10"/demo-page.js?v=11"/'
-git grep -l 'v=10"' -- 'animations/*/*/index.html' index.html | wc -l
-git grep -l 'demo-page\.css?v=11"' -- '*.html' | wc -l
-git grep -l 'demo-page\.js?v=11"' -- '*.html' | wc -l
-git ls-files --eol -- 'animations/*/*/index.html' index.html | grep -vc 'w/crlf'
-```
-Expected: `0`; the number of animation pages (`git ls-files -- 'animations/*/*/index.html' | wc -l`, 166 today); that number plus one (the home page links only the script); `0`. Then the tests (`ℹ fail 0`) and the whole site in parts, as Task 12, Step 7 runs it, but from this lane (`cd $REPO/.claude/worktrees/sic-00f`), with `--base http://127.0.0.1:8829`, `--out $RUN/checks/v11` and logs `$RUN/checks/v11-<NN>-<k>.log` and `v11-home.log`: every page six `ok`, no `FAIL`, and `home` six `ok`. Commit: `git add -u -- animations index.html && git commit -m "chore: the shared files are at version 11 on every animation page and the home page"`.
-
-A fresh reviewer (opus) gets the owner's words, `git -C $REPO/.claude/worktrees/sic-00f diff feat/see-inside-compare...sic/00f` and the logs; confirms the test pins the change and failed before it, the bump commit changes only version strings (`git -C $REPO/.claude/worktrees/sic-00f diff HEAD~1 HEAD -U0 | grep '^[-+][^-+]' | grep -v 'demo-page\.\(css\|js\)?v=' | wc -l` prints `0`), and the whole-site logs. Then:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && git merge --no-ff sic/00f -m "Merge the owner's first-batch change: <what>, and the shared files at version 11"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-git worktree remove .claude/worktrees/sic-00f && git branch -d sic/00f
-```
-Expected: `ℹ fail 0`. Stop the 8829 server. A ledger line.
-
-- [ ] **Step 5: R items: lessons and the briefs**
-
-Append each R item to `$RUN/lessons.md` as `Owner (first batch) R<k>: <the rule>`. Dispatch one fresh agent (opus) with this prompt: "Read `$RUN/rulings-159.md` and the 159 briefs in `$RUN/briefs/` (the files named `NN-slug.md`). Where a rule changes what a brief asks for, add under the part it changes one line `Owner's ruling R<k>: <what changes for this page>`; change nothing else. List every brief you changed, with the rule, in `$RUN/briefs/owner-amendments.md`. Change no repository file. Reply in three lines." The coordinator reads three of the changed briefs and the list.
-
-- [ ] **Step 6: The owner looks again, where pages changed**
-
-For the first-batch pages changed in Steps 3 and 4: the previous plan's Task 14, Steps 3 to 5, for those pages only, until the owner approves.
-
-- [ ] **Step 7: The gate line**
-
-Append to `$RUN/ledger.md`: `First batch approved by the owner on <date>; shared files at v=<10 or 11>; rulings-159.md: <K> rules`. Task 6 may start.
-
----
-
-### Task 2: The tracker, the slot table, the prompt templates and the run files
-
-**Files (all outside the repository, in `$RUN`):**
-- Create: `pages.test.mjs`, `pages.mjs`, `slots.json`, `check-slots.mjs`, `wait-log.mjs`, `extract-prompts.mjs`, `prompts/build.md`, `prompts/review.md`, `prompts/rereview.md`, `prompts/fix.md` (written by `extract-prompts.mjs` from Tasks 7 and 8), `lessons.md`, `brief-rulings.md`, `rulings-159.md` (a placeholder until Task 1), `shared-wishes.md`, folders `reports/` and `final/`.
-- Modify: `ledger.md` (a section for this plan), `agents.md` (a section for this plan's agents).
-
-**Interfaces:**
-- Consumes: `slot.mjs` and the pool `slots/` (previous plan, Task 0); the repository's pages (read only).
-- Produces: `node pages.mjs init | show [slot|NN] | dispatch <seats> | started <num> <id> | done <num> | set <num> key=value… | addslot <slot> <port> | move <num> <slot> | mergeable <slot> | merged <num>… | reopen <num> <file> | parts <NN> [size] | running | servers | rulings` (run from `$RUN`); `node wait-log.mjs <log> [seconds]` (exit 0 when the log has its `EXIT=` line, 3 while still running); `node check-slots.mjs <slots.json> <repository> [<briefs folder>]` (exit 0 and `no problem`); `node extract-prompts.mjs <plan> <run folder>`; the four prompt templates with the `{{NUM}}`, `{{SLUG}}`, `{{NN}}`, `{{CAT}}`, `{{SLOT}}`, `{{PORT}}`, `{{TITLE}}`, `{{REPO}}`, `{{RUN}}`, `{{WT}}`, `{{PAGE}}`, `{{FILE}}`, `{{BRIEF}}`, `{{CHECKS}}`, `{{KIT}}`, `{{REPORTS}}`, `{{N}}`, `{{COMMITS}}`, `{{FROM}}`, `{{TO}}`, `{{BUILDER}}`, `{{REVIEWER}}` the tracker fills. Report file names: `reports/<NN>-<slug>/build.md`, `review-<n>.md`, `fix-<n>.md`, each beside its `…-prompt.md`.
-
-This task is mechanical: an agent on `sonnet` may do it; a fresh agent reviews it (Step 11).
-
-- [ ] **Step 1: Write the failing tests of the tracker**
-
-Create `$RUN/pages.test.mjs`:
-
-```js
-// Tests of pages.mjs: node --test pages.test.mjs (from the run folder). They use a run folder and a small git repository of
-// their own in the temp folder, never the real ones.
-import test from 'node:test';
-import assert from 'node:assert/strict';
-import { mkdtempSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { join } from 'node:path';
-import { execFileSync } from 'node:child_process';
-
-const RUNDIR = mkdtempSync(join(tmpdir(), 'sic-run-')), REPODIR = mkdtempSync(join(tmpdir(), 'sic-repo-'));
-process.env.SIC_RUN = RUNDIR;
-process.env.SIC_REPO = REPODIR;
-const T = await import('./pages.mjs');
-const g = (...args) => execFileSync('git', ['-C', REPODIR, ...args], { encoding: 'utf8' }).trim();
-const PAGE = slug => join(REPODIR, 'animations', '01-scroll-based', slug, 'index.html');
-function writePage(slug, body) {
- mkdirSync(join(REPODIR, 'animations', '01-scroll-based', slug), { recursive: true });
- writeFileSync(PAGE(slug), `<h1>${slug.toUpperCase()}</h1>\n${body}\n`);
-}
-const report = (slug, file, text) => {
- mkdirSync(join(RUNDIR, 'reports', `01-${slug}`), { recursive: true });
- writeFileSync(join(RUNDIR, 'reports', `01-${slug}`, file), text);
-};
-
-// Two slots of category 01: 01a has a hard page and a medium one, 01b a medium page and an easy one.
-writeFileSync(join(RUNDIR, 'slots.json'), JSON.stringify({
- ports: { '01a': 8801, '01b': 8802 },
- slots: { '01a': ['01.20 aaa H', '01.06 bbb M'], '01b': ['01.10 ccc M', '01.22 ddd E'] }
-}));
-mkdirSync(join(RUNDIR, 'prompts'));
-for (const step of ['build', 'review', 'rereview', 'fix']) writeFileSync(join(RUNDIR, 'prompts', `${step}.md`), `${step} {{NUM}} {{TITLE}} {{WT}} {{PORT}} {{N}} {{FROM}} {{TO}}\n`);
-for (const slug of ['aaa', 'bbb', 'ccc', 'ddd']) writePage(slug, 'v0');
-g('init', '-q', '-b', 'main');
-g('config', 'user.email', 't@t');
-g('config', 'user.name', 't');
-g('config', 'core.autocrlf', 'false');
-g('add', '.');
-g('commit', '-q', '-m', 'pages');
-g('branch', 'sic/cat-01');
-g('branch', 'sic/01a');
-const commitOn = (branch, slug, body, files = [slug]) => {
- g('checkout', '-q', branch);
- for (const f of files) writePage(f, body);
- g('add', '.');
- g('commit', '-q', '-m', `${slug} ${body}`);
- const h = g('rev-parse', 'HEAD');
- g('checkout', '-q', 'main');
- return h;
-};
-const steps = lines => lines.map(l => l.split(' ').slice(0, 2).join(' '));
-
-test('init makes one queued page per line and keeps the state of pages already there', () => {
- let pages = T.init();
- assert.equal(pages.length, 4);
- assert.deepEqual(pages.map(p => [p.num, p.slot, p.order, p.units, p.state]),
- [['01.20', '01a', 1, 3, 'queued'], ['01.06', '01a', 2, 2, 'queued'], ['01.10', '01b', 1, 2, 'queued'], ['01.22', '01b', 2, 1, 'queued']]);
- pages[0].state = 'built';
- T.save(pages);
- pages = T.init();
- assert.equal(pages[0].state, 'built');
- pages[0].state = 'queued';
- T.save(pages);
-});
-
-test('dispatch starts the next page of each slot, the slot with the most work left first, and one writer per slot', () => {
- const pages = T.load();
- assert.deepEqual(steps(T.dispatch(pages, 1)), ['build 01.20']);
- assert.deepEqual(steps(T.dispatch(pages, 5)), ['build 01.10'], 'slot 01a has its writer');
- assert.deepEqual(T.plan(pages, 5), [], 'both slots have a writer');
- const prompt = readFileSync(join(RUNDIR, 'reports', '01-aaa', 'build-prompt.md'), 'utf8');
- assert.match(prompt, /^build 01\.20 AAA [A-Za-z]:\/\S*\/\.claude\/worktrees\/sic-01a 8801 1 none none$/m);
- T.started(pages, '01.20', 'agent-b1');
- T.save(pages);
-});
-
-test('done moves a page on from its report, reviews come before builds, and a fix comes before the slot\'s next page', () => {
- const pages = T.load();
- report('aaa', 'build.md', 'RESULT: built abc1234\nSHRINKS: yes\nMISTAKE: no\n');
- assert.equal(T.done(pages, '01.20').state, 'built');
- assert.deepEqual(pages[0].commits, ['abc1234']);
- assert.equal(pages[0].shrinks, true);
- assert.equal(pages[0].mistake, false);
- assert.deepEqual(steps(T.dispatch(pages, 1)), ['review 01.20'], 'the review first');
- T.started(pages, '01.20', 'agent-r1');
- assert.deepEqual(steps(T.dispatch(pages, 1)), ['build 01.06'], 'slot 01a is free again');
- report('aaa', 'review-1.md', 'RESULT: changes 2\n');
- assert.equal(T.done(pages, '01.20').state, 'changes');
- assert.deepEqual(T.plan(pages, 5), [], 'the fix waits for the writer of 01a (01.06 is building)');
- report('bbb', 'build.md', 'RESULT: built def5678\nSHRINKS: no\nMISTAKE: yes\n');
- T.done(pages, '01.06');
- const next = T.plan(pages, 5).map(a => `${a.step} ${a.p.num} ${a.how}`);
- assert.deepEqual(next, ['review 01.06 new', 'fix 01.20 resume agent-b1'], 'the review, then the fix by the same builder; no new page in 01a');
- T.save(pages);
-});
-
-test('a fix round, its re-review by the same reviewer, and three rounds at most', () => {
- const pages = T.load(), p = pages[0];
- T.dispatch(pages, 2);
- assert.equal(p.state, 'fixing');
- assert.equal(p.rounds, 1);
- assert.match(readFileSync(join(RUNDIR, 'reports', '01-aaa', 'fix-1-prompt.md'), 'utf8'), /^fix 01\.20 AAA .* 1 abc1234\^ abc1234$/m);
- report('aaa', 'fix-1.md', 'RESULT: fixed 1111111 2222222\n');
- assert.equal(T.done(pages, '01.20').state, 'fixed');
- assert.deepEqual(p.commits, ['abc1234', '1111111', '2222222']);
- assert.equal(T.plan(pages, 9).find(a => a.p === p).how, 'resume agent-r1');
- for (const round of [2, 3]) {
- T.dispatch(pages, 9);
- report('aaa', `review-${round}.md`, 'RESULT: changes 1\n');
- assert.equal(T.done(pages, '01.20').state, 'changes');
- T.dispatch(pages, 9);
- report('aaa', `fix-${round}.md`, `RESULT: fixed ${round}${round}${round}${round}${round}${round}${round}\n`);
- T.done(pages, '01.20');
- }
- T.dispatch(pages, 9);
- report('aaa', 'review-4.md', 'RESULT: changes 1\n');
- assert.equal(T.done(pages, '01.20').state, 'blocked');
- assert.match(p.note, /after 3 fix rounds/);
- T.set(pages, '01.20', ['state=changes', 'builder=none', 'limit=6', 'note=second builder']);
- assert.equal(T.plan(pages, 9).find(a => a.p === p).how, 'new', 'a second builder');
- T.set(pages, '01.20', ['state=approved', 'note=']);
- T.save(pages);
-});
-
-test('a bad report line is refused, and stuck blocks the page', () => {
- const pages = T.load(), p = pages.find(q => q.num === '01.10');
- report('ccc', 'build.md', 'Built it.\n');
- assert.throws(() => T.done(pages, '01.10'), /not a RESULT line/);
- report('ccc', 'build.md', 'RESULT: stuck the brief asks for a second WebGL context\n');
- assert.equal(T.done(pages, '01.10').state, 'blocked');
- assert.match(p.note, /second WebGL context/);
-});
-
-test('a re-review whose reviewer is gone goes to a fresh reviewer with the whole review\'s prompt', () => {
- const pages = T.load(), p = pages.find(q => q.num === '01.10');
- T.set(pages, '01.10', ['state=fixed', 'reviewer=none']);
- const [line] = T.dispatch(pages, 1);
- assert.match(line, /^rereview 01\.10 ccc slot 01b new prompt /);
- assert.match(readFileSync(join(RUNDIR, 'reports', '01-ccc', `review-${p.reviews}-prompt.md`), 'utf8'), /^review 01\.10 /);
- T.set(pages, '01.10', ['state=blocked']);
- T.save(pages);
-});
-
-test('a fix round that changes nothing ends "RESULT: fixed none": the page goes to its re-review with no commit added', () => {
- const pages = T.load(), p = pages.find(q => q.num === '01.10');
- T.set(pages, '01.10', ['state=fixing', 'builder=agent-b9', 'rounds=1']);
- const before = [...p.commits];
- report('ccc', 'fix-1.md', 'RESULT: fixed none\n1. The label stays where it is: the item was a question, answered in the report.\n');
- assert.equal(T.done(pages, '01.10').state, 'fixed');
- assert.deepEqual(p.commits, before);
- T.set(pages, '01.10', ['state=fixing']);
- report('ccc', 'fix-1.md', 'RESULT: fixed\n');
- assert.throws(() => T.done(pages, '01.10'), /should start "RESULT: fixed <commit>"/);
- T.set(pages, '01.10', ['state=blocked', 'builder=none', 'rounds=0']);
- T.save(pages);
-});
-
-test('fill refuses a name it does not know', () => {
- assert.throws(() => T.fill('{{NOPE}}', { NUM: '1' }), /does not know/);
- assert.equal(T.fill('{{NUM}}-{{NUM}}', { NUM: '7' }), '7-7');
-});
-
-test('mergeable stops at the first page not approved and never cuts a page in two', () => {
- const pages = T.load();
- const a = pages.find(p => p.num === '01.20'), b = pages.find(p => p.num === '01.06');
- const c1 = commitOn('sic/01a', 'aaa', 'build');
- const c2 = commitOn('sic/01a', 'bbb', 'build');
- const c3 = commitOn('sic/01a', 'aaa', 'fix');
- a.commits = [c1, c3]; b.commits = [c2];
- a.state = 'approved'; b.state = 'reviewing';
- assert.deepEqual(T.mergeable(pages, '01a'), { commit: null, pages: [], problem: '' }, 'aaa\'s fix lies beyond bbb, which is not approved');
- b.state = 'approved';
- assert.deepEqual(T.mergeable(pages, '01a'), { commit: c3, pages: ['01.20', '01.06'], problem: '' });
- commitOn('sic/01a', 'two', 'pages', ['aaa', 'bbb']);
- assert.match(T.mergeable(pages, '01a').problem, /not one page of this slot/);
-});
-
-test('mergeable follows the slot\'s own line: a merge of another branch into the slot passes as one commit', () => {
- const pages = T.load();
- const a = pages.find(p => p.num === '01.20');
- g('checkout', '-q', 'sic/01a');
- g('reset', '-q', '--hard', 'sic/cat-01');
- g('checkout', '-q', 'main');
- const c1 = commitOn('sic/01a', 'aaa', 'build again');
- const other = commitOn('main', 'ccc', 'another slot');
- g('checkout', '-q', 'sic/01a');
- g('merge', '-q', '--no-ff', 'main', '-m', 'Merge main into the slot');
- g('checkout', '-q', 'main');
- const c2 = commitOn('sic/01a', 'aaa', 'final fix');
- a.commits = [c1, c2];
- a.state = 'merged';
- const m = T.mergeable(pages, '01a');
- assert.equal(m.problem, '');
- assert.equal(m.commit, c2);
- assert.deepEqual(m.pages, ['01.20']);
- assert.ok(other);
-});
-
-test('mergeable passes a page commit that also touches the page\'s README and the skill files (where a ruling says so), never another file', () => {
- const pages = T.load();
- const a = pages.find(p => p.num === '01.20');
- g('checkout', '-q', 'sic/01a');
- g('reset', '-q', '--hard', 'sic/cat-01');
- writePage('aaa', 'with its README');
- writeFileSync(join(REPODIR, 'animations', '01-scroll-based', 'aaa', 'README.md'), 'Reduced motion switches at once.\n');
- writeFileSync(join(REPODIR, 'llms.txt'), 'aaa\n');
- g('add', '.');
- g('commit', '-q', '-m', 'aaa with its README');
- const c1 = g('rev-parse', 'HEAD');
- g('checkout', '-q', 'main');
- a.commits = [c1];
- a.state = 'approved';
- assert.deepEqual(T.mergeable(pages, '01a'), { commit: c1, pages: ['01.20'], problem: '' });
- g('checkout', '-q', 'sic/01a');
- writePage('aaa', 'and a stray file');
- writeFileSync(join(REPODIR, 'stray.txt'), 'x\n');
- g('add', '.');
- g('commit', '-q', '-m', 'aaa and a stray file');
- g('checkout', '-q', 'main');
- assert.match(T.mergeable(pages, '01a').problem, /touches .*stray\.txt, not one page of this slot/);
-});
-
-test('reopen sends an approved or merged page back for a fix round with the given findings as its next review', () => {
- const pages = T.load(), p = pages.find(q => q.num === '01.06');
- p.state = 'merged';
- const before = p.reviews;
- const file = join(RUNDIR, 'finding.md');
- writeFileSync(file, 'Found a problem.\n');
- assert.throws(() => T.reopen(pages, '01.06', file), /must start/);
- writeFileSync(file, 'RESULT: changes 1\n1. [Important] The Compare label covers the card.\n');
- T.reopen(pages, '01.06', file);
- assert.equal(p.state, 'changes');
- assert.equal(p.reviews, before + 1);
- assert.match(readFileSync(join(RUNDIR, 'reports', '01-bbb', `review-${p.reviews}.md`), 'utf8'), /covers the card/);
- assert.throws(() => T.reopen(pages, '01.06', file), /only an approved or merged page/);
-});
-
-test('parts lists the category\'s page folders a few to a line', () => {
- assert.deepEqual(T.parts('01', 3), ['animations/01-scroll-based/aaa animations/01-scroll-based/bbb animations/01-scroll-based/ccc',
- 'animations/01-scroll-based/ddd']);
-});
-
-test('rulings adds the pages that shrink a movement or show a mistake to the first batch\'s', () => {
- writeFileSync(join(RUNDIR, 'first-batch-rulings.json'), JSON.stringify({ shrinks: ['animations/01-scroll-based/parallax-scrolling/'], mistakes: [] }));
- const pages = T.load();
- pages.find(p => p.num === '01.20').shrinks = true;
- pages.find(p => p.num === '01.06').mistake = true;
- assert.deepEqual(T.rulings(pages), { shrinks: ['animations/01-scroll-based/parallax-scrolling/', 'animations/01-scroll-based/aaa/'],
- mistakes: ['animations/01-scroll-based/bbb/'] });
-});
-
-test('move takes a queued page to the end of another slot of its category; addslot adds a re-cut slot', () => {
- T.addslot('01c', 8821);
- assert.throws(() => T.addslot('01d', 8821), /taken/);
- const pages = T.load();
- const d = pages.find(p => p.num === '01.22');
- T.move(pages, '01.22', '01c');
- assert.deepEqual([d.slot, d.order], ['01c', 1]);
- assert.throws(() => T.move(pages, '01.20', '01c'), /only a page not yet started/);
-});
-```
-
-- [ ] **Step 2: Run them and see them fail**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node --test pages.test.mjs`
-Expected: `Error [ERR_MODULE_NOT_FOUND]: Cannot find module '…pages.mjs'`, then `✖ pages.test.mjs` and `ℹ fail 1`.
-
-- [ ] **Step 3: Write the tracker**
-
-Create `$RUN/pages.mjs`:
-
-```js
-#!/usr/bin/env node
-// The page tracker of the See inside and Compare rollout's other 159 pages (Task 2 of
-// docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md). Not part of the repository. Only the coordinator runs
-// it, so pages.json has one writer. It keeps every page's state, says what to start next within the seats there are, fills
-// the prompt templates of prompts/ into one prompt file per step, reads the first lines of the agents' reports, and says up
-// to which commit a slot's approved pages can be merged into their category branch.
-// node pages.mjs init pages.json from slots.json (a page already there keeps its state)
-// node pages.mjs show [<slot>|<NN>] the pages, slot by slot: state, rounds, reviews, agents, note
-// node pages.mjs dispatch <seats> starts up to <seats> steps; one line each: step, page, slot, "new" or
-// "resume <agent id>", and the prompt file to hand the agent
-// node pages.mjs started <num> <agent id> the agent that took the page's current step
-// node pages.mjs done <num> reads the report of the page's current step and moves the page on
-// node pages.mjs set <num> <key>=<value>… a field by hand (state, note, builder, reviewer, rounds, limit: the most fix
-// rounds before the page is blocked, 3 unless set; "none" empties one)
-// node pages.mjs addslot <slot> <port> a re-cut slot (its category is the slot's first two digits)
-// node pages.mjs move <num> <slot> a queued page to the end of another slot of its category
-// node pages.mjs mergeable <slot> the last commit of the slot up to which every page is approved, and its pages
-// node pages.mjs merged <num>… those pages are in their category branch
-// node pages.mjs reopen <num> <file> an approved or merged page goes back for a fix round: <file> (it starts
-// "RESULT: changes <count>", from a category check, a final review or the
-// whole-site check) becomes its next review report
-// node pages.mjs parts <NN> [<size>] the category's page folders, <size> to a line (default 8), for the page check
-// node pages.mjs running the agents at work, by step (they hold seats)
-// node pages.mjs servers the slots whose server does not answer
-// node pages.mjs rulings {"shrinks": [...], "mistakes": [...]} for the review kit's --rulings
-// SIC_RUN sets the run folder (default: this file's folder), SIC_REPO the repository (default: three folders up).
-import { execFileSync } from 'node:child_process';
-import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from 'node:fs';
-import { basename, dirname, join, resolve } from 'node:path';
-import { fileURLToPath } from 'node:url';
-
-const HERE = dirname(fileURLToPath(import.meta.url));
-export const RUN = resolve(process.env.SIC_RUN || HERE);
-export const REPO = resolve(process.env.SIC_REPO || join(RUN, '..', '..', '..'));
-const CATS = { '01': '01-scroll-based', '02': '02-entrance-and-exit', '03': '03-page-transitions', '04': '04-micro-interactions',
- '05': '05-text-typography', '06': '06-3d-advanced', '07': '07-ambient-background' };
-const UNITS = { E: 1, M: 2, H: 3, X: 4 };
-export const STATES = ['queued', 'building', 'built', 'reviewing', 'changes', 'fixing', 'fixed', 'rereviewing', 'approved',
- 'merged', 'blocked'];
-// The step each working state stands for, and the template and report it uses
-const STEP = { building: 'build', reviewing: 'review', rereviewing: 'rereview', fixing: 'fix' };
-
-// A path with forward slashes (C:\a\b becomes C:/a/b): Git Bash, node and the Read tool all take it, so the prompts use it
-export const slash = p => p.replace(/\\/g, '/');
-const json = file => JSON.parse(readFileSync(join(RUN, file), 'utf8'));
-const now = () => new Date().toISOString();
-export function load() { return existsSync(join(RUN, 'pages.json')) ? json('pages.json') : []; }
-export function save(pages) {
- const tmp = join(RUN, 'pages.json.tmp');
- writeFileSync(tmp, JSON.stringify(pages, null, 1) + '\n');
- renameSync(tmp, join(RUN, 'pages.json'));
-}
-const find = (pages, num) => {
- const p = pages.find(q => q.num === num);
- if (!p) throw new Error(`no page ${num}`);
- return p;
-};
-const folder = p => `${p.nn}-${p.slug}`;
-const git = (...args) => execFileSync('git', ['-C', REPO, ...args], { encoding: 'utf8' }).trim();
-
-// pages.json from slots.json: { "ports": { "<slot>": port }, "slots": { "<slot>": ["NN.MM slug E|M|H|X", ...] } }
-export function init() {
- const { slots } = json('slots.json'), pages = load();
- for (const [slot, list] of Object.entries(slots)) {
- list.forEach((line, i) => {
- const [num, slug, size] = line.trim().split(/\s+/);
- if (!/^\d\d\.\d\d$/.test(num) || !slug || !UNITS[size]) throw new Error(`slots.json, ${slot}: "${line}"`);
- if (pages.some(p => p.num === num)) return;
- const nn = num.slice(0, 2);
- pages.push({ num, slug, nn, cat: CATS[nn], slot, order: i + 1, units: UNITS[size], state: 'queued', since: now(),
- builder: null, reviewer: null, rounds: 0, reviews: 0, commits: [], shrinks: null, mistake: null, note: '' });
- });
- }
- save(pages);
- return pages;
-}
-
-// What can start now, most urgent first, at most `seats` steps: (1) reviews and re-reviews, oldest first; (2) fix rounds,
-// oldest first, one writer per slot; (3) new pages, the next one of each slot that has no writer and no page waiting for a
-// fix, the slot with the most work left first. A slot's worktree has one writer at a time: a build or a fix round.
-export function plan(pages, seats) {
- const out = [], writer = new Set(pages.filter(p => p.state === 'building' || p.state === 'fixing').map(p => p.slot));
- const byAge = list => [...list].sort((a, b) => a.since.localeCompare(b.since) || a.num.localeCompare(b.num));
- for (const p of byAge(pages.filter(p => p.state === 'built' || p.state === 'fixed'))) {
- out.push({ step: p.state === 'built' ? 'review' : 'rereview', p, how: p.state === 'fixed' && p.reviewer ? `resume ${p.reviewer}` : 'new' });
- }
- const waiting = new Set();
- for (const p of byAge(pages.filter(p => p.state === 'changes'))) {
- waiting.add(p.slot);
- if (writer.has(p.slot)) continue;
- writer.add(p.slot);
- out.push({ step: 'fix', p, how: p.builder ? `resume ${p.builder}` : 'new' });
- }
- const slots = [...new Set(pages.map(p => p.slot))].filter(s => !writer.has(s) && !waiting.has(s)).map(s => {
- const queued = pages.filter(p => p.slot === s && p.state === 'queued').sort((a, b) => a.order - b.order);
- return { s, next: queued[0], left: queued.reduce((n, p) => n + p.units, 0) };
- }).filter(x => x.next).sort((a, b) => b.left - a.left || a.s.localeCompare(b.s));
- for (const x of slots) out.push({ step: 'build', p: x.next, how: 'new' });
- return out.slice(0, Math.max(0, seats));
-}
-
-// The values a prompt template names as {{KEY}}
-export function values(p, n) {
- const ports = json('slots.json').ports;
- const file = `animations/${p.cat}/${p.slug}/index.html`;
- const page = existsSync(join(REPO, file)) ? readFileSync(join(REPO, file), 'utf8') : '';
- const h1 = (page.match(/<h1[^>]*>([^<]+)<\/h1>/) || [])[1] || p.slug;
- return {
- NUM: p.num, SLUG: p.slug, NN: p.nn, CAT: p.cat, SLOT: p.slot, PORT: String(ports[p.slot]), TITLE: h1.trim(),
- REPO: slash(REPO), RUN: slash(RUN), WT: slash(join(REPO, '.claude', 'worktrees', `sic-${p.slot}`)),
- PAGE: `animations/${p.cat}/${p.slug}`, FILE: file, BRIEF: slash(join(RUN, 'briefs', `${folder(p)}.md`)),
- CHECKS: slash(join(RUN, 'checks', folder(p))), KIT: slash(join(RUN, 'kit', folder(p))), REPORTS: slash(join(RUN, 'reports', folder(p))),
- N: String(n), COMMITS: p.commits.join(' ') || 'none', FROM: p.commits.length ? `${p.commits[0]}^` : 'none',
- TO: p.commits[p.commits.length - 1] || 'none', BUILDER: p.builder || 'none', REVIEWER: p.reviewer || 'none'
- };
-}
-export function fill(template, vals) {
- return template.replace(/\{\{([A-Z]+)\}\}/g, (m, key) => {
- if (!(key in vals)) throw new Error(`the template names {{${key}}}, which the tracker does not know`);
- return vals[key];
- });
-}
-// The report file of a page's step, and the file its prompt is written to
-const reportOf = (p, step) => join(RUN, 'reports', folder(p),
- step === 'build' ? 'build.md' : step === 'fix' ? `fix-${p.rounds}.md` : `review-${p.reviews}.md`);
-const promptOf = (p, step) => reportOf(p, step).replace(/\.md$/, '-prompt.md');
-
-export function dispatch(pages, seats) {
- const lines = [];
- for (const { step, p, how } of plan(pages, seats)) {
- if (step === 'review' || step === 'rereview') p.reviews += 1;
- if (step === 'fix') p.rounds += 1;
- p.state = { build: 'building', review: 'reviewing', rereview: 'rereviewing', fix: 'fixing' }[step];
- p.since = now();
- const n = step === 'fix' ? p.rounds : step === 'build' ? 1 : p.reviews;
- // A re-review by a reviewer who did not write the last review is a whole review
- const template = step === 'rereview' && how === 'new' ? 'review' : step;
- const text = fill(readFileSync(join(RUN, 'prompts', `${template}.md`), 'utf8'), values(p, n));
- mkdirSync(join(RUN, 'reports', folder(p)), { recursive: true });
- writeFileSync(promptOf(p, step), text);
- lines.push(`${step} ${p.num} ${p.slug} slot ${p.slot} ${how} prompt ${slash(promptOf(p, step))}`);
- }
- return lines;
-}
-
-export function started(pages, num, id) {
- const p = find(pages, num);
- if (p.state === 'building' || p.state === 'fixing') p.builder = id;
- else if (p.state === 'reviewing' || p.state === 'rereviewing') p.reviewer = id;
- else throw new Error(`${num} is ${p.state}: no step is running`);
-}
-
-// The report's first line says how the step ended: "RESULT: built <commit>", "RESULT: fixed <commit> [<commit>…]" (or
-// "RESULT: fixed none": a fix round that answered every item without a change), "RESULT: approved", "RESULT: changes
-// <count>" or "RESULT: stuck <why>". A build report also says "SHRINKS: yes|no" and "MISTAKE: yes|no". A review that still
-// asks for changes after the last fix round (three, or the page's own limit) blocks the page for the coordinator.
-export function done(pages, num) {
- const p = find(pages, num), step = STEP[p.state];
- if (!step) throw new Error(`${num} is ${p.state}: no step is running`);
- const file = reportOf(p, step);
- if (!existsSync(file)) throw new Error(`no report yet: ${slash(file)}`);
- const text = readFileSync(file, 'utf8'), first = text.split(/\r?\n/)[0].trim();
- const m = first.match(/^RESULT:\s*(built|fixed|approved|changes|stuck)\b\s*(.*)$/);
- if (!m) throw new Error(`the first line of ${slash(file)} is not a RESULT line: "${first}"`);
- const [, result, rest] = m;
- p.since = now();
- if (result === 'stuck') { p.state = 'blocked'; p.note = `${step} stuck: ${rest}`; return p; }
- if (step === 'build' || step === 'fix') {
- const want = step === 'build' ? 'built' : 'fixed';
- const hashes = rest.split(/\s+/).filter(h => /^[0-9a-f]{7,40}$/.test(h));
- // A fix round may answer every item without a change, "RESULT: fixed none": no commit is added, the reviewer decides
- const none = step === 'fix' && rest.trim() === 'none';
- if (result !== want || (!hashes.length && !none)) throw new Error(`${slash(file)} should start "RESULT: ${want} <commit>"${step === 'fix' ? ' (or "RESULT: fixed none")' : ''}`);
- p.commits.push(...hashes);
- p.state = want;
- if (step === 'build') {
- const flag = name => { const f = text.match(new RegExp(`^${name}:\\s*(yes|no)`, 'mi')); return f ? f[1].toLowerCase() === 'yes' : null; };
- p.shrinks = flag('SHRINKS');
- p.mistake = flag('MISTAKE');
- }
- return p;
- }
- if (result === 'approved') { p.state = 'approved'; return p; }
- if (result !== 'changes') throw new Error(`${slash(file)} should start "RESULT: approved" or "RESULT: changes <count>"`);
- const limit = p.limit || 3;
- if (p.rounds >= limit) { p.state = 'blocked'; p.note = `changes asked after ${limit} fix rounds: the coordinator decides`; }
- else p.state = 'changes';
- return p;
-}
-
-export function set(pages, num, pairs) {
- const p = find(pages, num);
- for (const pair of pairs) {
- const at = pair.indexOf('=');
- const key = pair.slice(0, at), value = pair.slice(at + 1);
- if (!['state', 'note', 'builder', 'reviewer', 'rounds', 'limit'].includes(key)) throw new Error(`cannot set ${key}`);
- if (key === 'state' && !STATES.includes(value)) throw new Error(`no state ${value}`);
- if ((key === 'rounds' || key === 'limit') && !/^\d$/.test(value)) throw new Error(`${key} is a number of fix rounds, not ${value}`);
- p[key] = key === 'rounds' || key === 'limit' ? Number(value) : value === 'none' ? null : value;
- }
- p.since = now();
-}
-
-export function reopen(pages, num, file) {
- const p = find(pages, num);
- if (p.state !== 'approved' && p.state !== 'merged') throw new Error(`${num} is ${p.state}: only an approved or merged page is reopened`);
- const text = readFileSync(file, 'utf8');
- if (!/^RESULT:\s*changes\b/.test(text)) throw new Error(`${slash(file)} must start "RESULT: changes <count>"`);
- p.reviews += 1;
- mkdirSync(join(RUN, 'reports', folder(p)), { recursive: true });
- writeFileSync(join(RUN, 'reports', folder(p), `review-${p.reviews}.md`), text);
- p.state = 'changes';
- p.since = now();
- p.note = `reopened by ${basename(file)}`;
-}
-
-export function addslot(slot, port) {
- if (!/^\d\d[a-z]$/.test(slot) || !CATS[slot.slice(0, 2)]) throw new Error(`not a slot name: ${slot}`);
- const all = json('slots.json');
- if (all.slots[slot]) throw new Error(`${slot} is there already`);
- if (Object.values(all.ports).includes(Number(port))) throw new Error(`port ${port} is taken`);
- all.slots[slot] = [];
- all.ports[slot] = Number(port);
- writeFileSync(join(RUN, 'slots.json'), JSON.stringify(all, null, 1) + '\n');
-}
-export function move(pages, num, slot) {
- const p = find(pages, num), ports = json('slots.json').ports;
- if (p.state !== 'queued') throw new Error(`${num} is ${p.state}: only a page not yet started moves`);
- if (slot.slice(0, 2) !== p.nn || !ports[slot]) throw new Error(`${slot} is not a slot of category ${p.nn}`);
- p.order = Math.max(0, ...pages.filter(q => q.slot === slot).map(q => q.order)) + 1;
- p.slot = slot;
- p.since = now();
-}
-
-// Up to which commit slot <slot> can be merged into sic/cat-NN: its commits not yet in the category branch, oldest first,
-// as far as each one touches only the page of an approved (or merged) page of this slot (its index.html and, where a ruling
-// says so, its README.md and the skill files make-skill then writes, llms.txt and skills/; a merge commit, such as
-// feat/see-inside-compare merged into the slot for the final review's fixes, passes), and no page is cut in two: a page
-// whose later commit lies beyond the end ends the merge before its first commit.
-export function mergeable(pages, slot) {
- const br = `sic/${slot}`, cat = `sic/cat-${slot.slice(0, 2)}`;
- // The slot's own line only (first parents): a merge of feat/see-inside-compare into the slot is one commit here, not the
- // other slots' commits it brings
- const list = git('rev-list', '--reverse', '--first-parent', `${cat}..${br}`).split('\n').filter(Boolean);
- const items = list.map(c => {
- const merge = git('rev-list', '--parents', '-n', '1', c).split(' ').length > 2;
- const files = merge ? [] : git('diff-tree', '--no-commit-id', '--name-only', '-r', c).split('\n').filter(Boolean);
- const own = files.map(f => f.match(/^animations\/(\d\d)-[^/]+\/([^/]+)\/(?:index\.html|README\.md)$/));
- const others = files.filter((f, i) => !own[i] && f !== 'llms.txt' && !f.startsWith('skills/'));
- const one = new Set(own.filter(Boolean).map(x => `${x[1]}/${x[2]}`)).size === 1 && !others.length;
- const m = one ? own.find(Boolean) : null;
- const p = m ? pages.find(q => q.nn === m[1] && q.slug === m[2]) : null;
- return { c, merge, files, p };
- });
- let end = 0, problem = '';
- for (const it of items) {
- if (it.merge) { end++; continue; }
- if (!it.p || it.p.slot !== slot) { problem = `commit ${it.c.slice(0, 9)} touches ${it.files.join(', ') || 'nothing'}, not one page of this slot`; break; }
- if (it.p.state !== 'approved' && it.p.state !== 'merged') break;
- end++;
- }
- for (let again = true; again;) {
- again = false;
- for (let i = 0; i < end; i++) {
- const p = items[i].p;
- if (p && items.some((it, k) => k >= end && it.p === p)) { end = items.findIndex(it => it.p === p); again = true; break; }
- }
- }
- const inside = items.slice(0, end), pagesIn = [...new Set(inside.map(it => it.p).filter(Boolean))];
- return { commit: end ? inside[end - 1].c : null, pages: pagesIn.map(p => p.num), problem };
-}
-
-export function parts(nn, size = 8) {
- const cat = CATS[nn];
- if (!cat) throw new Error(`no category ${nn}`);
- const dirs = readdirSync(join(REPO, 'animations', cat), { withFileTypes: true })
- .filter(d => d.isDirectory() && existsSync(join(REPO, 'animations', cat, d.name, 'index.html')))
- .map(d => `animations/${cat}/${d.name}`).sort();
- const out = [];
- for (let i = 0; i < dirs.length; i += size) out.push(dirs.slice(i, i + size).join(' '));
- return out;
-}
-
-export function rulings(pages) {
- const base = existsSync(join(RUN, 'first-batch-rulings.json')) ? json('first-batch-rulings.json') : { shrinks: [], mistakes: [] };
- const path = p => `animations/${p.cat}/${p.slug}/`;
- const add = (list, more) => [...new Set([...list, ...more])];
- return { shrinks: add(base.shrinks || [], pages.filter(p => p.shrinks).map(path)), mistakes: add(base.mistakes || [], pages.filter(p => p.mistake).map(path)) };
-}
-
-function show(pages, which) {
- const rows = pages.filter(p => !which || p.slot === which || p.nn === which)
- .sort((a, b) => a.slot.localeCompare(b.slot) || a.order - b.order);
- for (const p of rows) {
- console.log([p.slot, String(p.order).padStart(2), p.num, p.slug.padEnd(30), p.state.padEnd(11), `r${p.rounds}`, `v${p.reviews}`,
- `b:${p.builder || '-'}`, `v:${p.reviewer || '-'}`, p.note].join(' ').trimEnd());
- }
- const count = {};
- for (const p of rows) count[p.state] = (count[p.state] || 0) + 1;
- console.log(Object.entries(count).map(([s, n]) => `${s} ${n}`).join(' · '));
-}
-
-async function main(argv) {
- const [cmd, ...rest] = argv;
- if (cmd === 'init') { console.log(`${init().length} pages`); return 0; }
- const pages = load();
- if (cmd === 'show') { show(pages, rest[0]); return 0; }
- if (cmd === 'dispatch' && rest[0]) { const lines = dispatch(pages, Number(rest[0])); save(pages); console.log(lines.join('\n') || 'nothing to start'); return 0; }
- if (cmd === 'started' && rest[1]) { started(pages, rest[0], rest[1]); save(pages); return 0; }
- if (cmd === 'done' && rest[0]) { const p = done(pages, rest[0]); save(pages); console.log(`${p.num} ${p.slug}: ${p.state}${p.note ? ' (' + p.note + ')' : ''}`); return 0; }
- if (cmd === 'set' && rest[1]) { set(pages, rest[0], rest.slice(1)); save(pages); return 0; }
- if (cmd === 'addslot' && rest[1]) { addslot(rest[0], rest[1]); return 0; }
- if (cmd === 'move' && rest[1]) { move(pages, rest[0], rest[1]); save(pages); return 0; }
- if (cmd === 'mergeable' && rest[0]) {
- const m = mergeable(pages, rest[0]);
- console.log(m.commit ? `${m.commit} ${m.pages.join(' ')}` : 'nothing to merge');
- if (m.problem) console.log(`PROBLEM: ${m.problem}`);
- return 0;
- }
- if (cmd === 'reopen' && rest[1]) { reopen(pages, rest[0], rest[1]); save(pages); return 0; }
- if (cmd === 'merged' && rest[0]) {
- for (const num of rest) { const p = find(pages, num); if (p.state !== 'approved' && p.state !== 'merged') throw new Error(`${num} is ${p.state}`); p.state = 'merged'; p.since = now(); }
- save(pages);
- return 0;
- }
- if (cmd === 'parts' && rest[0]) { console.log(parts(rest[0], rest[1] ? Number(rest[1]) : 8).join('\n')); return 0; }
- if (cmd === 'running') {
- const n = {};
- for (const p of pages) if (STEP[p.state]) n[STEP[p.state]] = (n[STEP[p.state]] || 0) + 1;
- console.log(`${Object.values(n).reduce((a, b) => a + b, 0)} agents: ${Object.entries(n).map(([s, k]) => `${s} ${k}`).join(', ') || 'none'}`);
- return 0;
- }
- if (cmd === 'servers') {
- const { ports } = json('slots.json');
- const live = new Set(pages.filter(p => p.state !== 'merged').map(p => p.slot));
- for (const [slot, port] of Object.entries(ports)) {
- if (!live.has(slot)) continue;
- const ok = await fetch(`http://127.0.0.1:${port}/`).then(r => r.ok, () => false);
- if (!ok) console.log(`${slot} ${port} down`);
- }
- return 0;
- }
- if (cmd === 'rulings') { console.log(JSON.stringify(rulings(pages), null, 1)); return 0; }
- console.error('usage: node pages.mjs init | show [slot|NN] | dispatch <seats> | started <num> <id> | done <num> | set <num> k=v… |'
- + ' addslot <slot> <port> | move <num> <slot> | mergeable <slot> | merged <num>… | reopen <num> <file> | parts <NN> [size] |'
- + ' running | servers | rulings');
- return 2;
-}
-if (resolve(process.argv[1] || '').toLowerCase() === fileURLToPath(import.meta.url).toLowerCase()) {
- main(process.argv.slice(2)).then(code => { process.exitCode = code; }, err => { console.error(err.message); process.exitCode = 1; }); // exitCode, not exit(): process.exit() right after a fetch aborts on Windows (libuv assertion)
-}
-```
-
-- [ ] **Step 4: Run the tests and see them pass**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node --test --test-reporter=spec pages.test.mjs 2>&1 | grep -E "^(✔|✖)|^ℹ (pass|fail)"`
-Expected: fifteen `✔` lines, `ℹ pass 15`, `ℹ fail 0`.
-
-- [ ] **Step 5: The slot table**
-
-Create `$RUN/slots.json` (the table of "The slots", word for word):
-
-```json
-{
- "ports": { "01a": 8801, "01b": 8802, "01c": 8803, "02a": 8804, "02b": 8805, "03a": 8806, "03b": 8807, "04a": 8808, "04b": 8809,
- "04c": 8810, "04d": 8811, "05a": 8812, "05b": 8813, "06a": 8814, "06b": 8815, "06c": 8816, "06d": 8817, "07a": 8818, "07b": 8819,
- "07c": 8820 },
- "slots": {
- "01a": ["01.20 scroll-image-sequence H", "01.06 stacking-cards M", "01.18 section-wipe M", "01.04 cover-card-to-fixed-header M",
- "01.23 scroll-velocity-skew M", "01.14 horizontal-scroll M", "01.17 progress-bar M", "01.26 scroll-background-color M",
- "01.22 text-fill-on-scroll E"],
- "01b": ["01.21 smooth-scroll H", "01.09 pin-animation M", "01.15 sticky-section M", "01.07 scroll-trigger M", "01.12 reveal-on-scroll M",
- "01.11 scrollytelling M", "01.16 counter-animation M", "01.25 scrollspy-nav M", "01.03 reverse-scrolling-columns M"],
- "01c": ["01.10 snap-scrolling H", "01.01 parallax-depth-of-field M", "01.27 hide-on-scroll-header M", "01.13 stagger-reveal M",
- "01.08 scrub-animation M", "01.24 svg-line-draw M", "01.05 fly-in-fly-out-contact-list M", "01.19 zoom-into-image M"],
- "02a": ["02.14 shatter-effect H", "02.07 split-text-reveal M", "02.08 letter-by-letter-stagger M", "02.09 word-by-word-reveal M",
- "02.11 flip-in E", "02.13 rotate-in E"],
- "02b": ["02.06 curtain-reveal M", "02.12 bounce-in M", "02.05 clip-path-reveal M", "02.10 blur-in E", "02.02 slide-in E",
- "02.04 scale-in E", "02.03 slide-up-reveal E"],
- "03a": ["03.09 elastic-transition X", "03.01 view-transitions-api H", "03.11 dissolve M", "03.02 shared-element-transition M",
- "03.04 crossfade M", "03.06 zoom-transition M", "03.08 blur-transition M"],
- "03b": ["03.15 page-curl H", "03.10 portal-zoom M", "03.13 circle-reveal M", "03.12 flip-technique M", "03.07 flash-transition M",
- "03.03 morph-transition M", "03.16 cube-transition M", "03.05 slide-transition M"],
- "04a": ["04.40 gooey-menu H", "04.33 drag-to-reorder H", "04.22 swipe-to-dismiss H", "04.17 drawer-slide M", "04.18 modal-expand M",
- "04.19 accordion M", "04.28 segmented-control M", "04.06 toggle-switch E", "04.24 theme-toggle-morph E"],
- "04b": ["04.07 heart-burst H", "04.08 success-confetti H", "04.39 image-trail H", "04.13 checkmark-draw M", "04.12 progress-animation M",
- "04.09 skeleton-loader M", "04.34 rolling-numbers M", "04.11 loading-spinner E", "04.15 badge-pulse E"],
- "04c": ["04.27 toast-notification H", "04.29 pull-to-refresh H", "04.41 dynamic-island M", "04.36 hold-to-confirm M", "04.21 error-shake M",
- "04.14 form-field-morph M", "04.37 expanding-search M", "04.23 hamburger-menu-toggle M", "04.25 copy-to-clipboard E",
- "04.03 focus-ring E"],
- "04d": ["04.20 cursor-follower H", "04.31 spotlight-hover M", "04.16 tooltip-reveal M", "04.26 star-rating M",
- "04.38 button-loading-states M", "04.32 add-to-cart-fly M", "04.04 button-press-scale M", "04.01 hover-state E", "04.02 click-ripple E",
- "04.10 shimmer-effect E", "04.30 gradient-border E", "04.35 typing-indicator E"],
- "05a": ["05.19 text-particles H", "05.16 split-flap-board M", "05.02 typewriter-effect M", "05.03 scramble-text M", "05.12 glitch-text M",
- "05.17 neon-flicker M", "05.09 outline-to-fill M", "05.14 wavy-text M", "05.15 highlighter-sweep M"],
- "05b": ["05.01 kinetic-typography M", "05.10 enter-exit-typography M", "05.18 handwriting-draw M", "05.13 text-on-path M",
- "05.08 text-gradient-animation M", "05.11 rotate-word-carousel M", "05.07 text-morphing M", "05.04 variable-font-morph M",
- "05.05 text-clip-path-reveal M"],
- "06a": ["06.15 cloth-simulation X", "06.23 physics-2d X", "06.04 canvas-particle-effect H", "06.26 infinite-zoom H",
- "06.11 2-5d-pseudo-3d M", "06.02 scroll-driven-3d-rotation M"],
- "06b": ["06.13 gpgpu-particle-system X", "06.01 3d-model-orbit H", "06.07 webgl-shader-animation H", "06.12 ray-marching-sdf H",
- "06.06 glassmorphism-animated M", "06.10 chromatic-aberration M"],
- "06c": ["06.21 flocking X", "06.16 volumetric-smoke H", "06.14 image-distortion-hover H", "06.20 depth-map-photo H",
- "06.17 morphing-blob M", "06.09 svg-path-animation M"],
- "06d": ["06.24 liquid-glass X", "06.08 noise-based-motion H", "06.22 ascii-halftone H", "06.25 holographic-card M", "06.18 flip-card-3d M",
- "06.19 carousel-3d M", "06.03 parallax-3d-tilt M"],
- "07a": ["07.12 abstract-geometric-motion X", "07.07 starfield H", "07.19 snow-rain H", "07.15 synthwave-grid H",
- "07.11 grid-dot-pattern-parallax M", "07.18 wave-layers M", "07.10 floating-elements M"],
- "07b": ["07.20 fireworks X", "07.09 ambient-ripple H", "07.13 particle-constellation H", "07.23 game-of-life H", "07.08 breathing-glow M",
- "07.06 light-leak M", "07.05 scanline M"],
- "07c": ["07.16 matrix-rain H", "07.17 plasma H", "07.21 topographic-lines H", "07.22 light-rays H", "07.01 animated-gradient-background M",
- "07.02 mesh-gradient M", "07.03 aurora M", "07.04 grain-overlay M"]
- }
-}
-```
-
-- [ ] **Step 6: The slot table's check, and the briefs' (used again in Task 3)**
-
-Create `$RUN/check-slots.mjs`:
-
-```js
-#!/usr/bin/env node
-// Checks slots.json against the repository (Task 2 of docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md):
-// every animation page but the first batch's seven is in one slot of its own category, under the number and slug the page
-// itself shows; the twins sit in one slot, one after the other; ports 8801-8820 are used once each; and, given the briefs
-// folder, every page has a brief whose first line is "# NN.MM <Title>: brief" and which has every part.
-// node check-slots.mjs <slots.json> <repository> [<briefs folder>]
-import { existsSync, readFileSync, readdirSync } from 'node:fs';
-import { join } from 'node:path';
-
-const [slotsFile, repo, briefs] = process.argv.slice(2);
-if (!slotsFile || !repo) { console.error('usage: node check-slots.mjs <slots.json> <repository> [<briefs folder>]'); process.exit(2); }
-const { ports, slots } = JSON.parse(readFileSync(slotsFile, 'utf8'));
-const FIRST = ['01.02', '02.01', '03.14', '04.05', '05.06', '06.05', '07.14'];
-const TWINS = [['01.06', '01.18'], ['01.09', '01.15'], ['02.07', '02.08', '02.09'], ['03.10', '03.13']];
-// The parts every brief has (briefs/HOW-TO-WRITE.md), found by these words in any case
-const PARTS = ['see inside', 'compare', 'note', 'setting', 'hard case', 'pitfall', 'closest first-batch page', 'how to check'];
-const problems = [], seen = new Map(), units = {}, pages = new Map();
-for (const cat of readdirSync(join(repo, 'animations')).filter(d => /^\d\d-/.test(d))) {
- for (const slug of readdirSync(join(repo, 'animations', cat))) {
- const f = join(repo, 'animations', cat, slug, 'index.html');
- if (!existsSync(f)) continue;
- const num = (readFileSync(f, 'utf8').match(/class="hb-cat"[^>]*>\s*(\d\d\.\d\d)/) || [])[1];
- pages.set(num, slug);
- }
-}
-for (const [slot, list] of Object.entries(slots)) {
- if (!ports[slot]) problems.push(`${slot} has no port`);
- units[slot] = 0;
- list.forEach((line, i) => {
- const [num, slug, size] = line.split(' ');
- units[slot] += { E: 1, M: 2, H: 3, X: 4 }[size] || NaN;
- if (num.slice(0, 2) !== slot.slice(0, 2)) problems.push(`${num} is in ${slot}, a slot of another category`);
- if (pages.get(num) !== slug) problems.push(`${num} is ${pages.get(num)} on the site, not ${slug}`);
- if (seen.has(num)) problems.push(`${num} is listed twice`);
- seen.set(num, [slot, i]);
- if (briefs) {
- const file = join(briefs, `${num.slice(0, 2)}-${slug}.md`);
- if (!existsSync(file)) { problems.push(`${num} ${slug} has no brief`); return; }
- const text = readFileSync(file, 'utf8'), low = text.toLowerCase();
- if (!new RegExp(`^# ${num.replace('.', '\\.')} .+: brief`).test(text)) problems.push(`${num} ${slug}: the brief's first line is not "# ${num} <Title>: brief"`);
- const missing = PARTS.filter(w => !low.includes(w));
- if (missing.length) problems.push(`${num} ${slug}: the brief has no ${missing.join(', ')}`);
- }
- });
-}
-for (const [num, slug] of pages) if (!FIRST.includes(num) && !seen.has(num)) problems.push(`${num} ${slug} is in no slot`);
-for (const num of FIRST) if (seen.has(num)) problems.push(`${num} is a first-batch page`);
-for (const group of TWINS) {
- const at = group.map(n => seen.get(n));
- if (at.some(a => !a) || new Set(at.map(a => a[0])).size !== 1) problems.push(`twins ${group.join(', ')} are not in one slot`);
- else if (at.some((a, k) => k && a[1] !== at[k - 1][1] + 1)) problems.push(`twins ${group.join(', ')} are not one after the other`);
-}
-const used = Object.values(ports).filter(p => p <= 8820);
-if (new Set(used).size !== 20 || Math.min(...used) !== 8801 || Math.max(...used) !== 8820) problems.push('ports 8801-8820 are not used once each');
-console.log(`${seen.size} pages in ${Object.keys(slots).length} slots; units ${Object.entries(units).map(([s, u]) => `${s} ${u}`).join(', ')}`);
-console.log(problems.length ? problems.join('\n') : 'no problem');
-process.exit(problems.length ? 1 : 0);
-```
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node check-slots.mjs slots.json $REPO`
-Expected: `159 pages in 20 slots; units 01a 18, 01b 19, 01c 17, 02a 11, 02b 10, 03a 17, 03b 17, 04a 19, 04b 19, 04c 20, 04d 20, 05a 19, 05b 18, 06a 18, 06b 17, 06c 17, 06d 18, 07a 19, 07b 19, 07c 20` and `no problem`. See it fail once: change `"01.18 section-wipe M"` to `"01.18 section-wipe-x M"` in a scratch copy (`cp slots.json scratch/slots-bad.json`, edit it, `node check-slots.mjs scratch/slots-bad.json $REPO`): `01.18 is section-wipe on the site, not section-wipe-x`, exit 1; delete the copy.
-
-- [ ] **Step 7: The log waiter**
-
-Create `$RUN/wait-log.mjs`:
-
-```js
-#!/usr/bin/env node
-// Waits for a background command's log to end with a line "EXIT=<code>" (Task 2 of
-// docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md). Not part of the repository. A page check or a kit run
-// waits in the slot pool for as long as the pool is full, which can be longer than one foreground command may last, so agents
-// start it in the background with its output in a log and wait for the log here.
-// node wait-log.mjs <log> [<seconds>] waits up to <seconds> (default 540) for the EXIT line, then prints the log's last
-// 40 lines and "ended with code N" (exit 0), or "still running" (exit 3: call it again)
-import { existsSync, readFileSync } from 'node:fs';
-
-const [log, secs = '540'] = process.argv.slice(2);
-if (!log) { console.error('usage: node wait-log.mjs <log> [<seconds>]'); process.exit(2); }
-const end = Date.now() + Number(secs) * 1000;
-const tail = text => text.split(/\r?\n/).slice(-41).join('\n').trimEnd();
-(function look() {
- const text = existsSync(log) ? readFileSync(log, 'utf8') : '';
- const m = text.match(/^EXIT=(\d+)\s*$/m);
- if (m) { console.log(tail(text)); console.log(`ended with code ${m[1]}`); process.exit(0); }
- if (Date.now() >= end) { console.log(tail(text)); console.log('still running: run wait-log.mjs again'); process.exit(3); }
- setTimeout(look, 2000);
-})();
-```
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && mkdir -p scratch/wait && printf 'ok 01-a desktop\nEXIT=0\n' > scratch/wait/1.log && node wait-log.mjs scratch/wait/1.log 5; echo "code=$?"; printf 'ok 01-a desktop\n' > scratch/wait/2.log && node wait-log.mjs scratch/wait/2.log 1; echo "code=$?"`
-Expected: `ended with code 0` and `code=0`; then `still running: run wait-log.mjs again` and `code=3`. Delete `scratch/wait`.
-
-- [ ] **Step 8: The prompt templates, out of this plan**
-
-Create `$RUN/extract-prompts.mjs`:
-
-```js
-#!/usr/bin/env node
-// Writes the prompt templates out of the plan (Task 2 of docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md),
-// so the files are the plan's text word for word. Not part of the repository. Each template in the plan is a ````markdown block
-// right under a line "File `$RUN/prompts/<name>.md`:". Run it again whenever the plan's templates change.
-// node extract-prompts.mjs <plan> <run folder>
-import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
-import { join } from 'node:path';
-
-const [plan, run] = process.argv.slice(2);
-if (!plan || !run) { console.error('usage: node extract-prompts.mjs <plan> <run folder>'); process.exit(2); }
-const text = readFileSync(plan, 'utf8').replace(/\r\n/g, '\n');
-const re = /^File `\$RUN\/(prompts\/[a-z-]+\.md)`:\n\n?````markdown\n([\s\S]*?)\n````$/gm;
-mkdirSync(join(run, 'prompts'), { recursive: true });
-const names = [];
-for (let m; (m = re.exec(text));) {
- writeFileSync(join(run, m[1]), m[2] + '\n');
- names.push(m[1]);
-}
-console.log(`${names.length} prompts: ${names.join(', ')}`);
-process.exit(names.length ? 0 : 1);
-```
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node extract-prompts.mjs ../../../docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md . && grep -c "{{" prompts/build.md prompts/review.md prompts/rereview.md prompts/fix.md`
-Expected: `4 prompts: prompts/build.md, prompts/review.md, prompts/rereview.md, prompts/fix.md`, and a count above 0 for each file (the tracker fills them).
-
-- [ ] **Step 9: The run files**
-
-Create `$RUN/lessons.md`:
-
-```markdown
-# Lessons for builders and reviewers
-
-Read this before you start and again before you commit. The coordinator adds a line when a review finds a mistake that
-could be on other pages (with the page it came from), and each of the owner's rules from the first batch (Task 1).
-
-1. A Replay or Show me run holds its pauses with setTimeout, never inside a frame loop or a setInterval: the page check sees
- only setTimeout timers and animations, so a pause inside a frame loop passes for rest and the pictures come out mid-run.
-2. A timer of 6 s or less that runs while the page is idle keeps the run wait from ending; your brief's "Probe:" line says if
- your page has one, and brief-rulings.md says what to do.
-3. The page check holds every endless CSS animation in the stage (a blinking caret, a loader) while it judges rest and takes
- the mode screenshots, so it cannot see a mode that adds endless movement: never add one; reviewers look for it in the
- reduced-motion stills and the clips.
-4. A scroll page with snapping: no mode changes the size or place of the scrolling content, or the browser re-snaps the box.
-5. At most four labels on phones and six elsewhere, each 12px or more as drawn, inside the box, clear of each other.
-6. A label drawn on a layer shrunk with scale comes out soft: draw it at its size, or drop will-change in that mode.
-7. A flat diagonal fan reads better than a 3D tilt at 375px.
-8. Keep every part inside the box at every setting and every scroll position.
-9. In Chrome a frame loop that reads matchMedia(...).matches every frame never gets the query's change event: read the query
- inside the loop.
-10. git stash is shared by every worktree: never use it; compare versions with git show <rev>:<path> > <scratch file>.
-11. The kit keeps frame folders with --keep-frames: read the frames you need, then delete the folders the log names.
-12. Every mode fits a 260px-tall stage from 601 to 1440px wide (phones held sideways such as 812×375, short laptop windows
- such as 1280×600), which the page check's six setups never show: the kit's `--short` run measures the captions and half
- names there, and its last line says `0 with labels cut or overlapping` (Fade In / Fade Out, Overlay Wipe).
-13. Leaving a mode in the middle of a run never pops the picture to the run's end: snap only what the mode posed (Fade In /
- Fade Out).
-14. When the halves stack on phones, everything a half draws (ghost pointers, spots, outlines, arrows) stays inside that
- half and clear of its name, during the run a mode press plays too (Magnetic Button).
-15. A copy or a label never wraps where its twin does not: measure at 320, 360 and 375, and give it `white-space:nowrap`
- or a max-content width (Magnetic Button).
-16. Words that describe a state stay true after every press: under reduced motion a note that says "Shown still" changes
- after Play and back after Pause (Marquee / Ticker).
-17. The two halves of a Compare differ in one thing only (the same strip, timing, text and size), so the picture shows that
- one difference (Marquee / Ticker).
-18. A canvas page keeps all of Normal's changing state, its time included, while a mode shows, and puts it back exactly
- (RULINGS 7; Flow Field).
-19. Random spread in a frame loop moves by elapsed time too: fixed steps of a 60th from an accumulator, so it spreads the
- same at 60, 90, 120 and 144 Hz (Flow Field).
-20. A caption points at something a still picture shows; a move of a few pixels needs none (Magnetic Button).
-21. Forty-nine pages are already past 300 lines: add about 150 at most.
-
-From reviews and from the owner:
-```
-
-Create `$RUN/brief-rulings.md`:
-
-```markdown
-# The coordinator's rulings on the briefs
-
-Builders and reviewers read the general rulings and the line for their page. The owner's own rules from the first batch are
-in rulings-159.md. The rulings given while the briefs were written stand as they are, and every builder, reviewer and
-checker reads them too: briefs/RULINGS.md, briefs/OPEN-QUESTIONS.md and the RULED: cells of briefs/summary-<lane>.md. This
-file holds what is ruled from now on.
-
-General:
-G1. Acceptance 7 for a setting that changes only timing (speed, delay, how long something lasts or waits) or a shared rule
- (briefs/OPEN-QUESTIONS.md, lane 04b), and for the settings the rulings name (Cover Card to Fixed Header's two settings,
- Scrub Animation's Even and Gentle pair, Accordion's Several open at once, Badge Pulse's Stops after three): it is seen in
- motion, in a kit clips run with that setting pressed (--only clips --press …) or live, and the build report names the
- run; a still needs no extra bar or label for it.
-G2. A brief may replace the survey's idea with a clearer one, and a builder may replace the brief's, saying why in the
- report. The reviewer judges the picture against the acceptance lines, not against the survey or the brief's wording.
-G3. A "Shows the …" switch on the page is never flipped by a mode; a view may reuse its drawing. A "without" that is already
- a setting stays a setting, and Compare still shows both at once.
-G4. Compare rests on a posed moment wherever the difference needs movement; the pose lifts while a run plays and comes back
- when nothing is pending; Normal at rest is never posed.
-G5. A page that the probe (Task 4) found never resting, or never ending its run, gets its answer in its own line below.
-
-Per page (NN.MM slug: ruling):
-```
-
-Create `$RUN/rulings-159.md` with the one line `Waiting for the owner's verdict on the first batch (Task 1 replaces this file).`, `$RUN/shared-wishes.md` with the line `# Shared changes wished by page builders, for integration (Task 12): one line each, page, file, what and why`, and the folders `$RUN/reports` and `$RUN/final`.
-
-Append to `$RUN/ledger.md`:
-
-```markdown
-
-## The other 159 pages: docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md
-
-Tracker: cd $RUN && node pages.mjs show | running | dispatch <seats>. Slots 8801-8820, categories sic-cat-NN 8831-8837.
-Task 0: the plan committed at <hash>; the coordination file's Order and ports at <hash>.
-Departure from the spec (section 7, "Who"): the coordinator plays the seven lane leads, with the tracker (agents start no agents).
-Departure from the spec and the coordination file: this plan's places use ports 8821-8850 beside 8800-8820 (free: no other project or listener uses them); Task 0 wrote them into the coordination file's ports.
-Departure from the spec (section 6, "No change: the 166 page READMEs"): Zoom Transition's page commit also makes its README's reduced-motion sentence true to the code (briefs/summary-03.md), the one page README this rollout changes.
-Task 2: tracker (15 tests), slots.json (159 pages, 20 slots), check-slots, wait-log, extract-prompts (4 prompts), run files.
-```
-
-Append to `$RUN/agents.md` the line `## The other 159 pages (page agents are in pages.json: builder and reviewer per page)`.
-
-- [ ] **Step 10: A dry run in a scratch copy**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; rm -rf $RUN/scratch/dry && mkdir -p $RUN/scratch/dry && cp -r $RUN/pages.mjs $RUN/slots.json $RUN/prompts $RUN/scratch/dry/ && cd $RUN/scratch/dry && SIC_REPO=../../../../.. node pages.mjs init && SIC_REPO=../../../../.. node pages.mjs dispatch 3 && grep -c "{{" reports/*/build-prompt.md; grep -h "^# Build" reports/*/build-prompt.md`
-Expected: `159 pages`; three lines `build 04.27 toast-notification slot 04c new prompt …`, `build 04.20 cursor-follower slot 04d new prompt …`, `build 07.16 matrix-rain slot 07c new prompt …` (the three slots with the most weight); each prompt file `:0` (nothing left unfilled); three title lines naming the pages with their real titles (`Toast Notification`, `Cursor Follower`, `Matrix Rain`). Delete `$RUN/scratch/dry`. Nothing here touches the real `pages.json` (`ls $RUN/pages.json` fails: Task 6 makes it).
-
-- [ ] **Step 11: Review (a fresh agent)**
-
-A fresh reviewer (opus) gets this task and "Agents and Chrome: how the work queues", reads the five tools, reruns Step 4's tests and Step 6's check, and confirms: a slot never gets two writers; a fix comes before the slot's next page; reviews come first; `mergeable` never passes an unapproved page's commit, never cuts a page in two, and passes a README or skill file only in a commit of its own page; `done` refuses a report without its RESULT line and takes `RESULT: fixed none` from a fix round; the prompt files are the plan's blocks word for word (`cd $RUN && cp -r prompts scratch/prompts-copy && node extract-prompts.mjs ../../../docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md . && diff -r scratch/prompts-copy prompts && echo same` prints `same`; then `rm -rf scratch/prompts-copy`). Findings fixed before Task 6; a ledger line.
-
----
-
-### Task 3: The 159 briefs, complete, checked, and their questions ruled
-
-**Files (outside the repository):**
-- Modify: `$RUN/briefs/<NN>-<slug>.md` (completed by the twelve brief lanes; gaps filled by the checkers), `$RUN/brief-rulings.md` (the per-page rulings).
-- Create: `$RUN/briefs/check-<lane>.md` (one per brief lane: `01a`, `01b`, `02`, `03`, `04a`, `04b`, `04c`, `05`, `06a`, `06b`, `07a`, `07b`), `$RUN/briefs/check-twins.md`.
-
-**Interfaces:**
-- Consumes: the twelve brief lanes (done: every brief written, every summary saved) and their `briefs/summary-<lane>.md`, with `briefs/RULINGS.md` and `briefs/OPEN-QUESTIONS.md`; Task 2's `check-slots.mjs` and `brief-rulings.md`.
-- Produces: 159 briefs that pass `check-slots.mjs` with the briefs folder; the rulings already given left as they are, every question still open ruled in `brief-rulings.md`, and a line there for each page `briefs/RULINGS.md` item 6 names; a ledger line `Briefs: 159 complete and checked; <K> per-page rulings`.
-
-- [ ] **Step 1: Every brief is there, with every part**
-
-The twelve lanes have reported. Run the check once: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node check-slots.mjs slots.json $REPO briefs`
-Expected: `no problem`; go on. (A `has no brief` or `the brief has no …` line: the lanes are done, so a fresh agent (opus) with `briefs/HOW-TO-WRITE.md` and the page completes that brief; then the check again.)
-
-- [ ] **Step 2: The open questions: copy nothing, re-rule nothing**
-
-The answers given while the briefs were written stand as they are: `briefs/RULINGS.md`, `briefs/OPEN-QUESTIONS.md` and every `RULED:` cell of the summaries. Every builder, reviewer and checker reads them beside the brief (Global Constraints, Pages), so they are not copied here. Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN/briefs && cat summary-*.md | grep '^| [0-9]' | awk -F'|' '{q=$7; gsub(/^ +| +$/, "", q); if (q != "-" && q != "") print $2 "|" q}' | grep -v 'RULED'`
-Expected: the cells not marked `RULED:`: the twins' "one slot" (the slot table settles them), the pages "listed for the owner's look" and the four of lane 07b that `briefs/OPEN-QUESTIONS.md` lists for that look (both go to the owner with the first batch; Task 1 applies the answer), and Gradient Border's note on the weak-views table (nothing to rule). Only a question still open after that, or one a checker raises in Step 3, is ruled now, under "Per page" in `$RUN/brief-rulings.md` as `NN.MM slug: <the ruling, in plain words>` (a question already covered by G1 to G4 gets `see G<k>`). The coordinator decides; where a question is really the owner's design choice, it takes the brief's best option and adds the page to a list at the end of the file, `For the owner's final look: <page>: <the choice made>`, so the owner judges it on the built page (owner's rule: decide, then let the owner judge the result). That list holds only choices made after the first-batch look message went out.
-
-Then one line for each page `briefs/RULINGS.md` item 6 names (six of their briefs never mention it): `NN.MM slug: RULINGS 6 applies: <what the flag set in the hb:mode listener guards here>`, for 04.13 checkmark-draw, 04.38 button-loading-states, 04.41 dynamic-island, 04.37 expanding-search, 04.36 hold-to-confirm, 04.39 image-trail, 06.23 physics-2d, 04.21 error-shake, 04.03 focus-ring and 04.14 form-field-morph.
-
-- [ ] **Step 3: Each brief lane checked by a fresh agent**
-
-Dispatch one fresh agent (opus) per brief lane, as seats allow (twelve in all), with this prompt, `<lane>` filled in:
-
-```text
-You check the page briefs of brief lane <lane> of the Animation Handbook's See inside and Compare rollout: the pages listed
-in .superpowers/sdd/2026-10-13-see-inside-compare/briefs/summary-<lane>.md (the main checkout is
-C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook, branch feat/see-inside-compare; never switch it). Change no
-repository file and start no agents. Read first: CLAUDE.md; docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md
-sections 1 and 2 (the acceptance list, the hard cases, the weak-views table, the twins); the run folder's brief-rulings.md;
-briefs/HOW-TO-WRITE.md; the coordinator's rulings briefs/RULINGS.md and briefs/OPEN-QUESTIONS.md, and the RULED: cells of
-briefs/summary-<lane>.md (a ruling stands: never undo one, and where a brief says "see the open question" or waits for the
-coordinator's answer, the answer is in these files). For each brief: read it, the page's index.html (its stage, settings and
-script) and its row in .superpowers/sdd/2026-10-13-learn-pilot/rollout-survey-*.md, and check:
- 1. the kind and today's movement are the page's;
- 2. See inside shows the hidden working from the page's own numbers, with at most six labels (four on phones) in a
- beginner's amounts, and a faint start outline for every moving part where a movement is scaled down (ruling 2);
- 3. Compare: two halves at the same size and time, each named in one to three words; the first half is the scene without
- the effect or, for a row marked * in the spec's weak-views table, the mistake or made-up scene that row gives, or a
- mistake ruled for this page (briefs/RULINGS.md item 2 with briefs/OPEN-QUESTIONS.md, the page's RULED: cell or its line
- in brief-rulings.md); how every input reaches both halves (the spec's do-it rules: hover, press, drag, forms); a posed
- rest where the difference needs movement;
- 4. reduced motion: a still for each view that still teaches; a posed still where reduced motion erases the difference;
- 5. phones: halves side by side while each keeps about 160px of scene, else stacked; the box keeps its size;
- 6. the two notes: one or two sentences each, at most 35 words, the halves named by their labels, ending with what to
- do when the stage looks like Normal until the visitor acts;
- 7. every setting changes both views (a setting that changes only timing or a shared rule, or one a ruling names, in
- motion: G1);
- 8. each hard case the page has, with the spec's rule: one canvas split; one WebGL context in two viewports with the no-WebGL
- and lost-context messages covering every mode; a second world on one accumulator with fixed-seed stills; random pieces
- drawn from the plan the current play uses, stills from a fixed plan; a "Shows the …" switch reused, never flipped; your
- text followed by the copy; snapping (no mode changes the scrolling content); flash safety (an outline, never a flash);
- runs that hold their pauses with setTimeout; an endless animation or an idle timer named;
- 9. the pitfalls and "how to check it" are this page's own, the closest first-batch page is named, and no shared building
- block is asked for.
-Fill a gap in place in the brief's own words and format (design text only, no code). Write
-.superpowers/sdd/2026-10-13-see-inside-compare/briefs/check-<lane>.md: for each page "OK", or the changes you made, and the
-questions you could not settle for the coordinator. Reply with three lines: pages checked, pages changed, questions.
-```
-
-Also one fresh agent (opus) for the twins and the cover-swap-uncover pictures, with this prompt: "Read `briefs/RULINGS.md` and `briefs/OPEN-QUESTIONS.md` (rulings that stand), then the briefs of Stacking Cards and Section Wipe (`01-stacking-cards.md`, `01-section-wipe.md`), Pin Animation and Sticky Section, Split Text Reveal, Letter-by-Letter Stagger and Word-by-Word Reveal, Portal / Tunnel Zoom and Circle Reveal, and Curtain Reveal and Flash / Light Leak Transition beside Overlay Wipe's first-batch brief (`03.14-overlay-wipe.md`), with spec section 2's twins paragraph. Each group must draw different pictures (each page stresses its own part: the spec says which); change the briefs where two would look alike, and write `briefs/check-twins.md`: the groups, what each page's picture stresses, what you changed. Change no repository file; start no agents; reply in three lines."
-
-Each checker's questions are ruled in `brief-rulings.md` as in Step 2.
-
-- [ ] **Step 4: Check again, and the ledger**
-
-Run Step 1's command again: `no problem`. Append to `$RUN/ledger.md`: `Briefs: 159 complete and checked (check-*.md); <K> per-page rulings; <L> pages for the owner's final look`.
-
----
-### Task 4: The rest-and-run probe of every page
-
-**Files:**
-- Create (outside the repository): `$RUN/probe.test.mjs`, `$RUN/probe.mjs`, `$RUN/probe-summary.md`, logs `$RUN/checks/probe-<NN>-<k>.log`.
-- Create and remove: worktree `.claude/worktrees/sic-probe` (detached; its pages get a switch that is never committed).
-- Modify (outside the repository): the briefs of the pages the probe flags (a `Probe:` paragraph), `$RUN/brief-rulings.md` (per-page lines).
-
-**Interfaces:**
-- Consumes: Phase 0 merged into `feat/see-inside-compare` (the previous plan's Task 6: the shared script plays a plays-once or do-it page once after a mode press; the page check's mode path with `waitForRun`, `restShot` and the hold of endless CSS animations); the first batch's last Chrome run before the owner's look ended (the previous plan's Task 14, Step 3); Task 2's `pages.mjs parts`, `wait-log.mjs`.
-- Produces: `$RUN/probe-summary.md` (each page whose stage never comes to rest, whose run never ends, or whose run scrolls or moves focus, with the setups and the check's own words); a line in `brief-rulings.md` and a `Probe:` paragraph in the brief of each flagged page; ledger line `Probe: <n> pages flagged: …`.
-
-Why: with a switch and a view that draws nothing, a page goes through the check's real mode path, so the hazards the previous plan named that the check does not absorb (movement a script keeps up at rest, idle timers, runs held inside a frame loop or longer than 30 s, a Show me that scrolls or moves focus) show up for every page at once, before 159 builders meet them one by one. Endless CSS animations no longer show: the check holds them while it judges rest.
-
-- [ ] **Step 1: Phase 0 is in, and the first batch's checks are over**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; grep -c "Phase 0 done at" $RUN/ledger.md; grep -c "comparisons made" $RUN/kit/first-batch.log`
-Expected: `1` and `1` (the second: the kit's run for the owner's look, the previous plan's Task 14, Step 3, has ended, so the probe's runs never slow the first batch's checks). Otherwise this task waits; it then runs during the owner's look, at most four parts at once (Step 5).
-
-- [ ] **Step 2: Write the failing tests of the probe**
-
-Create `$RUN/probe.test.mjs`:
-
-```js
-// Tests of probe.mjs: node --test probe.test.mjs (from the run folder)
-import test from 'node:test';
-import assert from 'node:assert/strict';
-import { addSwitch, problems } from './probe.mjs';
-
-const PAGE = '<body class="hb">\n <section class="hb-step hb-watch" aria-labelledby="t">\n <div class="hb-step-head"><h2 id="t">Watch it</h2></div>\n'
- + ' <div class="stage hb-dots"><div class="card"></div></div>\n <div class="hb-player"><button data-hb-replay>Replay</button></div>\n </section>\n'
- + '<script>const x = 1;</script>\n</body>\n</html>\n';
-// The switch and the notes box as the tests pin them (tests/pages.test.js), with the space between tags taken out
-const MODES = '<div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes><button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button><button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button><button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button></div>';
-const NOTES_BOX = /<div class="hb-mode-notes" aria-live="polite"><p data-hb-for="inside" hidden>[^<]*<\/p><p data-hb-for="compare" hidden>[^<]*<\/p><\/div>/;
-
-test('addSwitch puts the switch before the stage, the notes after the player bar and an empty listener before </body>', () => {
- const html = addSwitch(PAGE), flat = html.replace(/>\s+</g, '><');
- const watch = flat.slice(flat.indexOf('<section class="hb-step hb-watch"'), flat.indexOf('</section>'));
- assert.ok(watch.indexOf(MODES) > watch.indexOf('hb-step-head') && watch.indexOf(MODES) < watch.indexOf('<div class="stage'));
- assert.ok(NOTES_BOX.test(watch) && watch.search(NOTES_BOX) > watch.indexOf('<div class="hb-player">'));
- assert.match(html, /<script>document\.addEventListener\('hb:mode', function \(\) \{\}\);<\/script>\n<\/body>/);
- assert.equal(addSwitch(html), html, 'a page with the switch is left as it is');
- assert.throws(() => addSwitch('<body></body>'), /no Watch step/);
-});
-
-test('problems keeps each page\'s real problems and drops what an empty view always gets', () => {
- const log = ['ok 02-slide-in desktop',
- 'FAIL 05-typewriter-effect desktop — See inside does not change the stage; the stage does not come to rest before the modes are tried',
- 'FAIL 05-typewriter-effect phone-reduced — See inside does not change the stage; See inside and Compare show the same picture',
- 'FAIL 06-flocking desktop — the picture\'s name is the same in Normal and See inside: "Flock"',
- 'FAIL 04-toast-notification desktop — Compare: keyboard focus moved to button#send'].join('\n');
- assert.deepEqual([...problems(log)], [
- ['05-typewriter-effect', ['desktop: the stage does not come to rest before the modes are tried']],
- ['04-toast-notification', ['desktop: Compare: keyboard focus moved to button#send']]]);
-});
-```
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node --test probe.test.mjs`
-Expected: `Error [ERR_MODULE_NOT_FOUND]: Cannot find module '…probe.mjs'` and `ℹ fail 1`.
-
-- [ ] **Step 3: Write the probe**
-
-Create `$RUN/probe.mjs`:
-
-```js
-#!/usr/bin/env node
-// The rest-and-run probe (Task 4 of docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md). Not part of the
-// repository. In a scratch worktree it gives pages the mode switch and the notes box exactly as the template has them, and a
-// listener that draws nothing, so the page check runs its mode path on each page as it is today: the shared script plays a
-// plays-once or do-it page once after See inside or Compare, and the check waits for that run and for the stage to rest. The
-// check's lines then show, before any view is built, which pages never come to rest, whose runs never end, or whose run
-// scrolls or moves focus.
-// node probe.mjs add <worktree> <page folder>... adds the switch, the notes and the empty listener (a page that has the
-// switch already is left as it is)
-// node probe.mjs read <log>... prints each page's problems from page-check logs, without the ones an
-// empty view always has (it changes nothing and has no labels)
-import { readFileSync, writeFileSync } from 'node:fs';
-import { join, resolve } from 'node:path';
-import { fileURLToPath } from 'node:url';
-
-const MODES = '<div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>\n'
- + ' <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>\n'
- + ' <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>\n'
- + ' <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>\n'
- + ' </div>\n ';
-const NOTES = ' <div class="hb-mode-notes" aria-live="polite">\n'
- + ' <p data-hb-for="inside" hidden>The probe draws nothing here.</p>\n'
- + ' <p data-hb-for="compare" hidden>The probe draws nothing here.</p>\n'
- + ' </div>\n ';
-const LISTEN = '<script>document.addEventListener(\'hb:mode\', function () {});</script>\n';
-// What an empty view always gets: it changes nothing, so the pictures match, and a page that names its picture names it
-// the same in every mode
-const NOISE = /does not change the stage|show the same picture|Normal does not bring the first picture back|the picture's name is the same/;
-
-// The page with the switch before its stage, the notes box at the end of its Watch step and the listener before </body>
-export function addSwitch(html) {
- if (html.includes('data-hb-modes')) return html;
- const watch = html.indexOf('<section class="hb-step hb-watch"');
- const stage = watch < 0 ? -1 : html.indexOf('<div class="stage', watch);
- const end = stage < 0 ? -1 : html.indexOf('</section>', stage);
- const body = html.lastIndexOf('</body>');
- if (end < 0 || body < end) throw new Error('no Watch step with a stage');
- return html.slice(0, stage) + MODES + html.slice(stage, end) + NOTES + html.slice(end, body) + LISTEN + html.slice(body);
-}
-
-// The problems of each page in page-check output lines ("ok NN-slug setup" or "FAIL NN-slug setup — a; b"), noise left out
-export function problems(text) {
- const out = new Map();
- for (const line of text.split(/\r?\n/)) {
- const m = line.match(/^FAIL (\S+) (\S+) — (.*)$/);
- if (!m) continue;
- const kept = m[3].split('; ').filter(p => !NOISE.test(p));
- if (!kept.length) continue;
- if (!out.has(m[1])) out.set(m[1], []);
- out.get(m[1]).push(`${m[2]}: ${kept.join('; ')}`);
- }
- return out;
-}
-
-if (resolve(process.argv[1] || '').toLowerCase() === fileURLToPath(import.meta.url).toLowerCase()) {
- const [cmd, ...rest] = process.argv.slice(2);
- if (cmd === 'add' && rest.length > 1) {
- const [wt, ...pages] = rest;
- for (const p of pages) {
- const file = join(wt, p.replace(/\/?(index\.html)?$/, ''), 'index.html');
- writeFileSync(file, addSwitch(readFileSync(file, 'utf8')));
- }
- console.log(`${pages.length} pages ready`);
- } else if (cmd === 'read' && rest.length) {
- const all = problems(rest.map(f => readFileSync(f, 'utf8')).join('\n'));
- for (const [page, lines] of [...all].sort()) console.log(`${page}\n ${lines.join('\n ')}`);
- console.log(`${all.size} pages with a problem`);
- } else {
- console.error('usage: node probe.mjs add <worktree> <page folder>... | read <log>...');
- process.exit(2);
- }
-}
-```
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node --test probe.test.mjs 2>&1 | grep -E "^ℹ (pass|fail)"`
-Expected: `ℹ pass 2`, `ℹ fail 0`.
-
-- [ ] **Step 4: The probe's worktree, every page given the empty switch**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare
-git -C $REPO worktree add --detach $REPO/.claude/worktrees/sic-probe feat/see-inside-compare
-cd $RUN && node probe.mjs add $REPO/.claude/worktrees/sic-probe $(for n in 01 02 03 04 05 06 07; do node pages.mjs parts $n 100; done)
-git -C $REPO/.claude/worktrees/sic-probe status --short | wc -l
-```
-Expected: `166 pages ready` and `159` (the first batch is on the branch by Step 1: its seven pages keep their switch and are checked with their real views). Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-probe && python -m http.server 8828 --bind 127.0.0.1`.
-
-- [ ] **Step 5: The check on every page, in parts, through the pool**
-
-For each category `NN` and each line `k` (1, 2, …) of `cd $RUN && node pages.mjs parts NN 8` (24 parts in all: 01 has 4, 02 2, 03 2, 04 6, 05 3, 06 4, 07 3), start a background command, at most four at a time (the pool serves the other projects too):
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-probe && node $RUN/slot.mjs run probe-NN-k -- node tools/check-pages.mjs --base http://127.0.0.1:8828 --out $RUN/checks/probe <that line's folders> > $RUN/checks/probe-NN-k.log 2>&1; echo "EXIT=$?" >> $RUN/checks/probe-NN-k.log`
-and wait for each with `cd $RUN && node wait-log.mjs checks/probe-NN-k.log`. A part takes about 15 to 25 minutes; all of them about two hours.
-Expected when all have ended: `cd $RUN && grep -h "^EXIT=" checks/probe-*.log | wc -l` prints `24`, and `cat checks/probe-*.log | grep -cE "^(ok|FAIL) "` prints `996` (166 pages, six setups each).
-
-- [ ] **Step 6: Read the problems**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node probe.mjs read checks/probe-*.log > probe-summary.md; tail -1 probe-summary.md; grep -cE "^0[0-9]-(parallax-scrolling|fade-in-out|overlay-wipe|magnetic-button|marquee-ticker|fluid-simulation|flow-field)$" probe-summary.md`
-Expected: `<n> pages with a problem` (a few, or none: the check holds endless CSS animations, so what is left is movement a script keeps up at rest, idle timers, runs over 30 s, runs that scroll or move focus, and a control whose name lacks its visible words), and `0` (the first batch's pages, checked with their real views, have no problem).
-
-- [ ] **Step 7: Sort each flagged page, and tell its builder**
-
-This step writes into the briefs only once Task 3, Step 4's ledger line is in (`grep -c "^Briefs: 159 complete" $RUN/ledger.md` prints `1`), so no brief checker is editing them. If Task 6 has started meanwhile, the lines go in before the next dispatch (Task 9, Step 2); a flagged page already started meets the same problem in its own page check. For each page in `probe-summary.md`, read the problem and the page's code, and sort it:
-- (a) **Endless movement the hold cannot see** (a script-driven blink or loop): a line for the page in `brief-rulings.md`, `NN.MM slug: <the part> moves for ever at rest by its script: drive it by a CSS animation, or stop it at rest, Normal's look unchanged`, and a `Probe:` paragraph in its brief with the check's words.
-- (b) **An idle timer:** nothing moves, but the run wait never ends (a `setTimeout` of 6 s or less renewed while the page is idle). Add a line to `brief-rulings.md`: `NN.MM slug: the idle loop (<where>) moves into a frame loop or a setInterval, with Normal's look and timing unchanged; the reviewer confirms Normal before and after and that the run wait now ends.` and the same as a `Probe:` paragraph in the brief.
-- (c) **A run that scrolls, moves focus or changes the box's size:** the page's own Show me or Replay does it; append `Probe: <the check's words>. Fix it in the build: a mode press must never do this (acceptance 4).`
-- (d) **Anything else:** the coordinator reads the probe's screenshots in `$RUN/checks/probe/` and writes a ruling line for the page.
-
-- [ ] **Step 8: Remove the probe's worktree, and the ledger**
-
-Stop the 8828 server. Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; git -C $REPO worktree remove --force $REPO/.claude/worktrees/sic-probe && git -C $REPO worktree list | grep -c sic-probe`
-Expected: `0` (the switches it held were scratch and are gone). Append to `$RUN/ledger.md`: `Probe: <n> pages flagged: endless by script <list>; idle timers <list>; runs that move <list>; other <list>`.
-
----
-
-### Task 5: The review kit holds endless animations at rest as the page check does, and kit rounds 3 and 4 reviewed (before the verdict)
-
-The page-check marker this task used to add (`data-hb-endless`) is not needed: Phase 0's page check (the previous plan's Task 3) holds every endless CSS animation in the stage while it judges rest and takes the mode screenshots, waits out runs of up to 30 s, and skips hidden text when it reads a control's name; and a marker could not help the one case left, a blink driven by a script, which is no CSS animation (Task 4, Step 7 (a) rules such a page). What is left is the review kit (`$KIT/record.mjs`, as its rounds 3 and 4 left it: report `.superpowers/sdd/2026-10-13-see-inside-compare-phase0-first-batch/task-5-report.md`, parts "Fix round 3" and "Round 4"). Round 4 brought the page check's `holdEndless`, `releaseEndless` and `restShot` (as `restHeld`), but only `--short` uses them: `rest()` (which `ready()` uses for the stills, the clips and Normal before and after, and `pageStill` after a mode press), the region pictures of `beforeAfter` and `capture` hold nothing. So on a page whose stage runs an endless animation at rest (Typewriter Effect, Letter-by-Letter Stagger, Checkmark Draw, Button Loading States, Dynamic Island, Progress Animation, Pull to Refresh, Skeleton Loader) every still notes that the stage did not come to rest, and the two Normal pictures can catch the caret at different moments, so Normal before and after can read as changed and send the builder (Task 7, step 7) after a change that is not there. This task makes those three hold with round 4's own code, never declaring anything a second time; it works on a copy of the kit, since every agent's kit run loads `$KIT/record.mjs`, and puts the copy in place in one move after the review. Its fresh reviewer also reviews kit rounds 3 and 4 (the coordinator folded their review into this task).
-
-**Files (outside the repository):**
-- Modify: `$KIT/record.mjs` (on a copy, put in place after the review: the body of `rest()` becomes `return restHeld(page);`; each side's region loop in `beforeAfter`, and `capture`, hold with round 4's `holdEndless` and `releaseEndless`), `$KIT/README.md` (one sentence).
-- Create and remove: `$RUN/scratch/kit-hold/` (a fixture site built by `$FX/sic-gen.mjs`, with the copy of the kit four folders down, so the copy reads the fixture pages as the real kit reads the handbook's; served on 8840) and `$RUN/kit-hold-real/` (the copy again, four folders below the repository, to read a real page).
-
-**Interfaces:**
-- Consumes: Phase 0's page check merged into `feat/see-inside-compare` (its `holdEndless` and `releaseEndless`, which round 4 copied from 193f2ba); the kit as round 4 left it (`record.mjs` 1135 lines, `kit-lib.mjs` 146, `record.test.mjs` 108 with 11 tests, `README.md` 240, md5s in the report's "Files after round 4"; no agent at work on it); `$FX/sic-gen.mjs` and its pages `animations/93-phase0/ok-caret` (a caret that blinks for ever beside a run), `ok-captions` and `bad-caption-outside`; the pool; `wait-log.mjs` (Task 2, Step 7); the before-pictures server (8800).
-- Produces: a kit whose `rest()`, `beforeAfter` region pictures and `capture` hold every running stage animation that never ends at its first frame and let it go after (the clips hold nothing: they show the movement); kit rounds 3 and 4 reviewed; the ledger lines `Kit short: done: …` and `Kit hold: done: …`, which Task 6 counts.
-
-- [ ] **Step 1: Phase 0's page check is in, and the kit is as round 4 left it**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; grep -c "^const holdEndless" $REPO/tools/check-pages.mjs; cd $KIT && grep -c "^const holdEndless\|^const releaseEndless\|^async function restHeld" record.mjs; node --check record.mjs; node --test record.test.mjs 2>&1 | grep -E "^ℹ (pass|fail)"`
-Expected: `1`; `3`; nothing from `node --check`; `ℹ pass 11` and `ℹ fail 0`. If the first is `0`, this task waits for the previous plan's Task 3 to be merged; while an agent of the kit's round 4 (or a fix round of it) is still at work on `record.mjs`, it waits too, so the two never edit the kit at once.
-
-- [ ] **Step 2: The fixture site, and the kit as it is failing on it (the failing test)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; FX=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/fixtures; S=$RUN/scratch/kit-hold
-mkdir -p $S/site/k/i/t/kit && node $FX/sic-gen.mjs $S/site $REPO
-cp $KIT/record.mjs $S/record-before.mjs && cp $KIT/record.mjs $KIT/kit-lib.mjs $S/site/k/i/t/kit/
-```
-Expected: `90-ok: 10 pages`, `91-old: 8 pages`, `92-wave-a: 9 pages`, `93-phase0: 26 pages` (more if Phase 0's review adds fixtures) and `check script from …`. The kit's copy sits four folders below the site, so it reads each page's kind and title from the site, as the real kit reads them from the repository. Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-13-see-inside-compare/scratch/kit-hold/site && python -m http.server 8840 --bind 127.0.0.1`.
-Run, as a background command: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; S=$RUN/scratch/kit-hold; node $RUN/slot.mjs run kit-hold -- node $S/site/k/i/t/kit/record.mjs --base http://127.0.0.1:8840 --before http://127.0.0.1:8840 --only before --out $S/out-0 animations/93-phase0/ok-caret > $S/run-0.log 2>&1; echo "EXIT=$?" >> $S/run-0.log`, and wait with `cd $RUN && node wait-log.mjs scratch/kit-hold/run-0.log`.
-Expected (with `S=$RUN/scratch/kit-hold`): `grep -c "did not come to rest" $S/run-0.log` prints `6` (three comparisons, both sides each: a caret that blinks every half second never lets the stage look the same for 750 ms); three lines `ok 93-ok-caret-before-1280`, `ok 93-ok-caret-before-375` and `ok 93-ok-caret-before-320`, each `the stage: <n> of … pixels differ (<v> visibly); Try it: not on this page` (the caret may be caught at different moments, so `<v>` may be above 0); the line `0 pictures, 0 clips and 3 comparisons made, 0 skipped, 0 failed`.
-
-- [ ] **Step 3: The hold, on the copy**
-
-Edit only the copy, `$RUN/scratch/kit-hold/site/k/i/t/kit/record.mjs`, never `$KIT/record.mjs` (every agent's kit run loads it while this task runs). Round 4 has already declared `holdEndless`, `releaseEndless` and `restHeld` there: use them, declare nothing again.
-
-(a) Replace
-```js
-// Waits until the stage has looked the same for 750 ms (four captures 250 ms apart), for up to 10 s; says whether it did
-async function rest(page) {
- let last = await stageShot(page), same = 0;
- for (const end = Date.now() + 10000; Date.now() < end;) {
- await sleep(250);
- const now = await stageShot(page);
- if (now !== last) { last = now; same = 0; continue; }
- if (++same === 3) return true;
- }
- return false;
-}
-```
-with
-```js
-// Waits until the stage has looked the same for 750 ms (four captures 250 ms apart), for up to 10 s, with every animation in it
-// that never ends held at its first frame, as the page check judges rest (restHeld, below); says whether it did
-async function rest(page) {
- return restHeld(page);
-}
-```
-
-(b) In `beforeAfter`, replace
-```js
- for (const region of REGIONS) {
- const shot = await regionShot(page, region.selector);
- pics[side][region.key] = shot && shot.data;
- if (shot) writeFileSync(join(OUT, item.files[side === 'before' ? `${region.key}Before` : `${region.key}After`]), Buffer.from(shot.data, 'base64'));
- }
-```
-with
-```js
- // the regions pictured with the animations that never end held, so both sites show the same moment of a blinking caret
- try {
- await holdEndless(page);
- for (const region of REGIONS) {
- const shot = await regionShot(page, region.selector);
- pics[side][region.key] = shot && shot.data;
- if (shot) writeFileSync(join(OUT, item.files[side === 'before' ? `${region.key}Before` : `${region.key}After`]), Buffer.from(shot.data, 'base64'));
- }
- } finally {
- await releaseEndless(page);
- }
-```
-
-(c) Replace
-```js
-async function capture(page, file) {
- const shot = await page.send('Page.captureScreenshot', { format: 'png' });
- writeFileSync(file, Buffer.from(shot.data, 'base64'));
-}
-```
-with
-```js
-// A picture of the screen, with the animations that never end held (holdEndless)
-async function capture(page, file) {
- try {
- await holdEndless(page);
- const shot = await page.send('Page.captureScreenshot', { format: 'png' });
- writeFileSync(file, Buffer.from(shot.data, 'base64'));
- } finally {
- await releaseEndless(page);
- }
-}
-```
-
-Where the merged `tools/check-pages.mjs` words `holdEndless` or `releaseEndless` differently from round 4's two declarations (its review may have changed them), change those two declarations in the copy to the merged words, with `evaluate(` written `page.evaluate(`. Then: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; node --check $RUN/scratch/kit-hold/site/k/i/t/kit/record.mjs; grep -c "^const holdEndless" $RUN/scratch/kit-hold/site/k/i/t/kit/record.mjs; cd $KIT && node --test record.test.mjs 2>&1 | grep -E "^ℹ (pass|fail)"`
-Expected: nothing from `node --check` (the parse test: the kit's tests read only `kit-lib.mjs`, which this task does not change); `1` (declared once); `ℹ pass 11` and `ℹ fail 0`.
-
-- [ ] **Step 4: The copy with the hold: the fixture three times, Typewriter Effect, and two short runs**
-
-The copy in the site is now the changed kit. Three runs, one after another, each as a background command, with `k` = 1, 2 and 3:
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; S=$RUN/scratch/kit-hold; node $RUN/slot.mjs run kit-hold -- node $S/site/k/i/t/kit/record.mjs --base http://127.0.0.1:8840 --before http://127.0.0.1:8840 --only before --out $S/out-k animations/93-phase0/ok-caret > $S/run-k.log 2>&1; echo "EXIT=$?" >> $S/run-k.log`
-each waited with `cd $RUN && node wait-log.mjs scratch/kit-hold/run-k.log`.
-Expected, for each: `grep -c "the stage: 0 of [0-9]* pixels differ (0 visibly); Try it: not on this page" $S/run-k.log` prints `3`, `grep -c "did not come to rest" $S/run-k.log` prints `0`, and the log has the line `0 pictures, 0 clips and 3 comparisons made, 0 skipped, 0 failed` and `EXIT=0`.
-Then a real caret page, main's on both sides, through a copy four folders below the repository (so it reads the real pages), as a background command (if 8800 does not answer, start it as Task 6, Step 4 says):
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; S=$RUN/scratch/kit-hold; mkdir -p $RUN/kit-hold-real && cp $S/site/k/i/t/kit/record.mjs $KIT/kit-lib.mjs $RUN/kit-hold-real/ && node $RUN/slot.mjs run kit-hold -- node $RUN/kit-hold-real/record.mjs --base http://127.0.0.1:8800 --before http://127.0.0.1:8800 --only before --out $S/out-real animations/05-text-typography/typewriter-effect > $S/real.log 2>&1; echo "EXIT=$?" >> $S/real.log`
-Expected: `grep -c "the stage: 0 of [0-9]* pixels differ (0 visibly); Try it: 0 of [0-9]* pixels differ (0 visibly)" $S/real.log` prints `3`, `grep -c "did not come to rest" $S/real.log` prints `0` (its caret blinks for ever and is held), and `0 pictures, 0 clips and 3 comparisons made, 0 skipped, 0 failed`. Then `rm -rf /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-13-see-inside-compare/kit-hold-real`.
-Then round 4's `--short` on two fixture pages with the copy, for the review, each as a background command, with `<page>` and `<log>` taken in turn from `ok-captions` and `short-ok`, `bad-caption-outside` and `short-bad`:
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; S=$RUN/scratch/kit-hold; node $RUN/slot.mjs run kit-hold -- node $S/site/k/i/t/kit/record.mjs --base http://127.0.0.1:8840 --short --out $S/out-<log> animations/93-phase0/<page> > $S/<log>.log 2>&1; echo "EXIT=$?" >> $S/<log>.log`
-Expected: `short-ok.log` has `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` and `EXIT=0`; `short-bad.log` has nine `FAIL` lines, one per screen in See inside (`… the label "Outside label" is not inside the stage`), `27 short-screen pictures checked, 9 with labels cut or overlapping, 0 skipped, 0 failed` and `EXIT=1`.
-
-- [ ] **Step 5: Review (a fresh agent): the hold, and kit rounds 3 and 4**
-
-A fresh reviewer (opus) gets this task and reviews two things, then writes a verdict with numbered items:
-- The hold: `diff $RUN/scratch/kit-hold/record-before.mjs $RUN/scratch/kit-hold/site/k/i/t/kit/record.mjs` and the logs `run-0.log` to `run-3.log` and `real.log` in `$RUN/scratch/kit-hold/`. It confirms: the hold is the page check's (round 4's `holdEndless` and `releaseEndless`, declared once, against the merged `tools/check-pages.mjs`: only running stage animations whose iterations are Infinity, each let go in a `finally`); `rest()`, `beforeAfter`'s region pictures and `capture` hold, and the clips do not; `run-0.log` fails as Step 2 says and the others pass as Step 4 says; `node --check` on the copy and the kit's tests (`cd $KIT && node --test record.test.mjs`) pass.
-- Kit rounds 3, 4 and 5 (5 added 1366×630), as the kit has them (the coordinator folded their review into this task): the report's parts "Fix round 3" and "Round 4" and the README's parts of the same names; their code in the copy (`regionShot`, `stageShot`, `PHONE_SMALL`, `REGIONS`, `beforeAfter` and `comparePictures`, the `--short` arguments, `shortCheck`, `CAPTIONS`, `holdEndless`, `releaseEndless`, `restHeld`, and the log and done lines) and in `$KIT/kit-lib.mjs` (`regionPlan`, `captionProblems`, `SHORT_SETUPS`, with their tests in `record.test.mjs`); their outputs in `$RUN/scratch/kit-fix3/` and `$RUN/scratch/kit-fix4/`; and the logs `short-ok.log` and `short-bad.log`. It confirms: each region is pictured on the screen (scrolled 8px under the pinned bar unless it is wholly on the screen) and clipped to its own box; Normal before and after runs at 1280, 375 and 320; the branch's switch row is taken out (style only) only when the stage's place on the page differs, and a note says so; a stage of another size fails, a Try it of another size or on one site only is said and not counted; `--short` takes one page, refuses `--gallery`, `--only` and `--before` (exit 2), rests and measures captions as the page check does (its `restShot` and `captionProblems`, word for word), exits 1 on a problem; and the log lines the plan expects (Task 7, steps 7 and 8, Task 8, Task 14) are the ones the kit prints.
-Findings are fixed on the copy (Steps 3 and 4 again for the hold; for rounds 3 and 4, by the coordinator's choice of agent, on the same copy) and re-checked by the same reviewer.
-
-- [ ] **Step 6: The copy in place, the README, and the gates**
-
-After the reviewer approves:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cp $RUN/scratch/kit-hold/site/k/i/t/kit/record.mjs $KIT/record.new.mjs && node --check $KIT/record.new.mjs && mv $KIT/record.new.mjs $KIT/record.mjs
-node --check $KIT/record.mjs && cmp $KIT/record.mjs $RUN/scratch/kit-hold/site/k/i/t/kit/record.mjs && echo "in place"
-cd $KIT && node --test record.test.mjs 2>&1 | grep -E "^ℹ (pass|fail)"
-```
-Expected: `in place` (the kit swapped in one move, so no run ever loads half a file); `ℹ pass 11` and `ℹ fail 0`. Then in `$KIT/README.md`, after the bullet that starts `- with \`--before\`, a comparison of Normal at rest` in "The rollout's kit", add this paragraph:
-
-```text
-While it waits for the stage to rest and while it takes a picture, the kit holds every animation in the stage that never ends
-(a blinking caret, a loader) at its first frame, as the page check does, so Normal before and after compares one moment; the
-clips show it moving.
-```
-
-Stop the 8840 server, `rm -rf /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.superpowers/sdd/2026-10-13-see-inside-compare/scratch/kit-hold`, and append to `$RUN/ledger.md` the two gate lines:
-`Kit short: done: record.mjs --short, reviewed (kit round 4, with round 3's comparison at 1280, 375 and 320), Task 5`
-`Kit hold: done: record.mjs holds the stage's endless animations while it judges rest and takes pictures (ok-caret 0 visibly three times; Typewriter Effect 0 visibly)`
-
----
-
-### Task 6: Twenty slots and seven category worktrees
-
-**Files:**
-- Create: worktrees `.claude/worktrees/sic-01a` … `sic-07c` (20) on branches `sic/01a` … `sic/07c`, and `sic-cat-01` … `sic-cat-07` on `sic/cat-01` … `sic/cat-07`, all from the head of `feat/see-inside-compare`.
-- Remove: the first batch's slot worktrees `sic-<NN>a` and the branches `sic/<NN>a`, `sic/cat-<NN>` (fully merged).
-- Create (outside the repository): `$RUN/pages.json` (`pages.mjs init`).
-
-**Interfaces:**
-- Consumes: Task 1's gate line; Task 2's tracker and `slots.json`; Task 3's ledger line; Task 5's ledger lines: `Kit hold: done` and the kit's `--short` (Phase 0's kit round 4, reviewed in Task 5: `Kit short: done`); Task 4's ledger line once the probe has ended (until then, its Step 7 lines go in before the next dispatch: Task 9, Step 2).
-- Produces: the 20 slots served on 8801–8820 from the same commit, the category worktrees, `pages.json` with 159 queued pages; the ledger line `Slots ready at <hash>`.
-
-- [ ] **Step 1: Everything before is done**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; grep -c "^First batch approved by the owner on .*rulings-159\.md:" $RUN/ledger.md; grep -c "^Briefs: 159 complete" $RUN/ledger.md; grep -c "^Kit hold: done" $RUN/ledger.md; grep -c "^Kit short: done" $RUN/ledger.md; grep -c "^Probe: " $RUN/ledger.md; git -C $REPO status --short; git -C $REPO branch --show-current`
-Expected: `1`, `1`, `1` and `1` (each gate counted apart: the previous plan's Task 14 also writes a line that begins "First batch approved by the owner", without `rulings-159.md:`; without `Kit short: done` every build's step 7 would meet a kit that does not know `--short`); for the probe, `1` once it has ended, or `0` while it still runs (this task may start then; Task 4, Step 7's lines go in before the next dispatch); an empty status (if another project's plan lies untracked there, the coordinator commits it first, as Task 0 commits this one); `feat/see-inside-compare`.
-
-- [ ] **Step 2: The first batch's slots and category branches go (they are merged)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO
-for n in 01 02 03 04 05 06 07; do
- ok=yes
- for b in sic/${n}a sic/cat-$n; do
- git rev-parse --verify -q $b > /dev/null || continue
- git merge-base --is-ancestor $b feat/see-inside-compare || ok=no
- done
- [ $ok = yes ] && echo "$n merged" || echo "$n NOT MERGED"
-done
-```
-Expected: seven lines `NN merged` (a branch that was never made is skipped). A `NOT MERGED` line: stop (the first batch is not fully on the branch). Then stop the first-batch servers that still run (ports 8801, 8804, 8815, 8808, 8812, 8814 and 8818: lane 03 took 8815 and left 8806 for Phase 0's bump), and:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO
-for n in 01 02 03 04 05 06 07; do
- git worktree remove .claude/worktrees/sic-${n}a
- for b in sic/${n}a sic/cat-$n; do git rev-parse --verify -q $b > /dev/null && git branch -d $b; done
-done
-git worktree list | grep -c "sic-0[1-7]a"
-git branch --list 'sic/0[1-7]a' 'sic/cat-0[1-7]' | wc -l
-```
-Expected: the branches deleted (only those that exist), then `0` and `0`.
-
-- [ ] **Step 3: The slots and the category worktrees**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO
-for s in 01a 01b 01c 02a 02b 03a 03b 04a 04b 04c 04d 05a 05b 06a 06b 06c 06d 07a 07b 07c; do git worktree add -q -b sic/$s .claude/worktrees/sic-$s feat/see-inside-compare; done
-for n in 01 02 03 04 05 06 07; do git worktree add -q -b sic/cat-$n .claude/worktrees/sic-cat-$n feat/see-inside-compare; done
-git worktree list | grep -cE "\[sic/(0[1-7][a-d]|cat-0[1-7])\]"
-git rev-parse feat/see-inside-compare
-```
-Expected: `27`, and the hash every slot starts from.
-
-- [ ] **Step 4: The servers**
-
-Start 20 background commands, one per slot, each `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-<slot> && python -m http.server <port> --bind 127.0.0.1` with the slot's port from "The slots" (01a 8801 … 07c 8820). Check: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node pages.mjs servers; curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8800/`
-Expected: `pages.mjs servers` prints nothing until `pages.json` exists (it lists only slots with pages); run it again after Step 5. The before-pictures server answers `200` (if not, restart it: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-before && python -m http.server 8800 --bind 127.0.0.1`, as a background command).
-
-- [ ] **Step 5: The tracker's pages**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node check-slots.mjs slots.json $REPO briefs && node pages.mjs init && node pages.mjs servers && node pages.mjs show | tail -1`
-Expected: `no problem`; `159 pages`; no `down` line; `queued 159`.
-
-- [ ] **Step 6: The ledger**
-
-Append to `$RUN/ledger.md`: `Slots ready at <hash>: 20 slots (8801-8820), 7 category worktrees, 159 pages queued. Page work starts (Task 9).`
-
----
-### Task 7: Build one page (the builder; 159 times)
-
-**Files:**
-- Modify (in the page's slot worktree): `animations/<category>/<slug>/index.html` (and its `README.md` where a ruling says so, with what `node tools/make-skill.mjs` then writes, if anything), one commit.
-- Create (outside the repository): `$RUN/reports/<NN>-<slug>/build.md` and `build-log.md`; check rounds `$RUN/checks/<NN>-<slug>/<R>/` with `<R>.log`; kit runs `$RUN/kit/<NN>-<slug>/` and `$RUN/kit/<NN>-<slug>-<setting>/` with their logs.
-
-**Interfaces:**
-- Consumes: the page's brief, `briefs/RULINGS.md`, `briefs/OPEN-QUESTIONS.md`, the page's row in its lane's summary, `brief-rulings.md`, `rulings-159.md`, `lessons.md` (Tasks 1 to 4); the kit with its hold (Task 5) and its `--short` run (Phase 0's kit round 4, reviewed in Task 5); its slot and server (Task 6); the prompt file the tracker writes, `$RUN/reports/<NN>-<slug>/build-prompt.md` (from the template below, Task 2 Step 8); the first-batch page the brief names; the page check, the kit, the pool, `wait-log.mjs`.
-- Produces: a commit `feat: <Title> shows … (See inside) and … beside … (Compare)` on `sic/<slot>` touching only the page; `build.md` whose first line is `RESULT: built <full hash>` (or `RESULT: stuck <why>`), with `SHRINKS:` and `MISTAKE:` lines that `pages.mjs done` reads.
-
-The coordinator starts the builder (Task 9, Step 2) with one sentence; the prompt file is the builder's whole task.
-
-- [ ] **Step 1: The builder's template**
-
-File `$RUN/prompts/build.md`:
-
-````markdown
-# Build: {{NUM}} {{TITLE}} (See inside and Compare)
-
-You build See inside and Compare for one page of the Animation Handbook, in that page's own CSS and script: {{NUM}}
-{{TITLE}}, `{{FILE}}`. A fresh reviewer checks your work afterwards, and you may be asked to fix it, at most three times.
-Work alone: start no agents, and never open the browser pane.
-
-**Where.** The slot worktree `{{WT}}` (branch `sic/{{SLOT}}`), served at `http://127.0.0.1:{{PORT}}/`. You are its only
-writer now. Change no file but `{{FILE}}` (and `{{PAGE}}/README.md`, with what `node tools/make-skill.mjs` then writes, only
-where a ruling for this page says so); never switch the branch, push, merge, rebase, amend or stash; never start or stop
-a server. Start every Bash call with:
-`REPO={{REPO}}; RUN={{RUN}}; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; WT={{WT}}`
-
-**Read first, in full.**
-1. `$REPO/CLAUDE.md`.
-2. `$REPO/docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md`, sections 1 and 2.
-3. `$REPO/docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md`, the section "Global Constraints" (its
- twelve acceptance lines are the reviewer's list).
-4. The brief `{{BRIEF}}`: this page's requirements. Where you find a clearer picture, build it and say why in your report.
- Where the brief says "see the open question" or waits for "the coordinator's answer (summary)", the answer is already
- given: in this page's row of its lane's summary (after `RULED:`), in `$RUN/briefs/OPEN-QUESTIONS.md`, in
- `$RUN/briefs/RULINGS.md` or in this page's line of `$RUN/brief-rulings.md`; nothing waits.
-5. The coordinator's rulings: `$RUN/briefs/RULINGS.md` (seven general rulings for the briefs), `$RUN/briefs/OPEN-QUESTIONS.md`
- (the rulings across lanes), the brief lane's summary that lists this page, whole (this command names it:
- `grep -l '^| {{NN}}-{{SLUG}} |' $RUN/briefs/summary-*.md`; the last cell of this page's row is its question and, after
- `RULED:`, the answer), and `$RUN/brief-rulings.md` (the general rulings and any line for {{NUM}}); `$RUN/rulings-159.md`
- (the owner's rules from the first batch); and `$RUN/lessons.md`. Where they and the brief or the Global Constraints
- differ, a ruling wins, and the owner's over the coordinator's. Read `lessons.md` again before you commit: it grows while
- you work.
-6. The page `$WT/{{FILE}}` and its README's How it works, `$WT/{{PAGE}}/README.md`.
-7. The first-batch page the brief names as closest, in full, from `$WT`, and its brief (`$RUN/briefs/<NN.MM>-<slug>.md`).
- If the brief names a twin that is already built (its page in `$WT` has `data-hb-modes`), read it too: your picture must
- differ from it.
-
-**Keep a log.** Write a line per step to `{{REPORTS}}/build-log.md` as you go, so another agent could take over.
-
-**Steps.**
-1. The slot. `cd $WT && git status --short && git branch --show-current` must print only `sic/{{SLOT}}` (an empty status).
- If the status shows `{{FILE}}` changed and `{{REPORTS}}/build-log.md` exists, you take over from a builder that stopped:
- read its log, keep what fits the brief, and go on from the step it reached. Any other change: write
- `RESULT: stuck the worktree has changes I did not make` as the first line of `{{REPORTS}}/build.md` and stop.
- `curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:{{PORT}}/{{PAGE}}/` prints `200` (if not: stuck, the server is
- down). Note `wc -l < $WT/{{FILE}}` for the report.
-2. The failing test. In the Watch step, between the `</div>` that closes `div.hb-step-head` and the `<div class="stage…`,
- add the switch exactly as it is here (the indentation may follow the page):
-
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
-
- and after the `</div>` that closes `div.hb-player`, the notes box with the brief's two notes:
-
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>(the brief's See inside note)</p>
- <p data-hb-for="compare" hidden>(the brief's Compare note)</p>
- </div>
-
- Run `cd $WT && node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -E "^✖ |AssertionError"`. Expected:
- only `✖ {{SLUG}}: the page's script listens for hb:mode, and its styles mark modes on the stage only` (named again under
- `✖ failing tests:`) with `AssertionError [ERR_ASSERTION]: the page script listens for hb:mode on document`.
-3. Build both views in the page's own `<style>` and `<script>`, by the brief and the Global Constraints: the `hb:mode`
- listener at the top level of the script; mode rules that start `.stage[data-hb-mode="inside"]` or
- `.stage[data-hb-mode="compare"]`; copies made once, without ids, `inert` and `aria-hidden="true"`; `data-hb-caption` on
- every label and half name; drawn from the page's own numbers, so every setting changes both views; Normal untouched.
-4. Tests: `cd $WT && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)|^✔ {{SLUG}}: "`.
- Expected: among the page's lines `✔ {{SLUG}}: the mode switch is as in the template…`, `✔ {{SLUG}}: exactly two
- notes…` and `✔ {{SLUG}}: the page's script listens for hb:mode…`, and `ℹ fail 0`.
-5. A page-check round R (1, then 2, 3, …). Start it as a background command (the Bash tool's run_in_background):
- `mkdir -p {{CHECKS}} && cd $WT && node $RUN/slot.mjs run b-{{NUM}} -- node tools/check-pages.mjs --base http://127.0.0.1:{{PORT}} --out {{CHECKS}}/R {{PAGE}} > {{CHECKS}}/R.log 2>&1; echo "EXIT=$?" >> {{CHECKS}}/R.log`
- then wait for it with a foreground call (timeout 600000 ms), again for as long as it says "still running":
- `node $RUN/wait-log.mjs {{CHECKS}}/R.log`
- Expected: `grep -c '^ok' {{CHECKS}}/R.log` prints `6`, and `ended with code 0`. A `FAIL` line names the problem: fix it.
-6. Look, and tune. Read with the Read tool, in `{{CHECKS}}/R/`: `{{NN}}-{{SLUG}}-desktop-inside.png`,
- `{{NN}}-{{SLUG}}-desktop-compare.png`, then the same name with `phone`, `phone-reduced` and `phone-small` in place of
- `desktop`, and Normal's `{{NN}}-{{SLUG}}-desktop.png`. Change sizes, places and words until, at 1280 and at 375, each
- view reads from the picture alone before the note is read; every mode is a still picture that still teaches under
- reduced motion; the labels are apart, inside the box and 12px or more; the box keeps its size on phones and nothing
- overflows. After each change, step 4 and a new round of step 5; six `ok` each time.
-7. Motion, and Normal before and after: the full kit run, in the background as in step 5:
- `mkdir -p {{KIT}} && cd $WT && node $RUN/slot.mjs run b-{{NUM}} -- node $KIT/record.mjs --base http://127.0.0.1:{{PORT}} --before http://127.0.0.1:8800 --out {{KIT}} --clean --keep-frames {{PAGE}} > {{KIT}}.log 2>&1; echo "EXIT=$?" >> {{KIT}}.log`
- then `node $RUN/wait-log.mjs {{KIT}}.log`. Expected: the line `9 pictures, 3 clips and 3 comparisons made, 0 skipped,
- 0 failed`, and three lines `ok {{NN}}-{{SLUG}}-before-1280 the stage: 0 of … pixels differ (0 visibly); Try it: 0 of
- … pixels differ (0 visibly)`, the same for `-before-375` and `-before-320` (`Try it: not on this page` on a page without
- settings; ` (the switch's row taken out)` at the end is expected on phones; a few pixels at the box's rounded corners,
- 0 visibly, are fine; a page drawn from random numbers is judged by eye from the pictures in `{{KIT}}/before/`). More
- than that: Normal changed; find why and fix it first. Read three frames from the middle of the See inside clip's and of the Compare clip's kept frame
- folders (the log names them): the views move as the brief says. Then delete those frame folders. Then the short
- stages (lesson 12), in the background as in step 5:
- `cd $WT && node $RUN/slot.mjs run b-{{NUM}} -- node $KIT/record.mjs --base http://127.0.0.1:{{PORT}} --short --out {{KIT}}-short {{PAGE}} > {{KIT}}-short.log 2>&1; echo "EXIT=$?" >> {{KIT}}-short.log`
- then `node $RUN/wait-log.mjs {{KIT}}-short.log`. Expected: the line `27 short-screen pictures checked, 0 with labels cut
- or overlapping, 0 skipped, 0 failed` and `EXIT=0` (nine screens, three modes); anything cut or overlapping (a `FAIL`
- line names it): fix it (step 6's rounds again) and run it again.
-8. Every setting (acceptance 7). For each choice of each setting other than its default, and each switch in Try it (never
- Loop, Slow motion, Pause or Play: playback is not a setting), a kit run with `--gallery --press "<selector>"` into
- `{{KIT}}-<short name>` (six stills: Normal, See inside and Compare at 1280 and 375), in the background as in step 5, its
- selector taken from the page's markup (for example `#speed-seg [data-ms='1000']`, or `#scale-tog`, Rotate In's "Grows
- from small" switch). Read its See inside and Compare stills at 1280: each differs from the default's. A setting that
- changes only timing or a shared rule, or one a ruling names (G1), is seen in motion instead: `--only clips --keep-frames
- --press "<selector>"`, and frames from its clips (then delete the frame folders). Your text: read the code path from the
- field to both views, and name it in the report.
-9. Size: `wc -l < $WT/{{FILE}}`: about 300 lines for the demo plus about 150 for the two views; a page already past 300
- adds about 150 at most. Over that: say why in the report.
-10. Read `$RUN/lessons.md` again and apply anything new. Commit, only this page:
- `cd $WT && git add {{FILE}} && git commit -m "feat: {{TITLE}} shows <the See inside picture, in plain words> (See inside) and <the first half> beside <the second half> (Compare)"`
- then `git show --name-only --format=%H HEAD`: the full hash, a blank line, and `{{FILE}}` alone. Where a ruling for this
- page also changes its README: edit `{{PAGE}}/README.md` as the ruling says, run `cd $WT && node tools/make-skill.mjs &&
- git status --short`, and `git add` the README and whatever `make-skill` changed (if anything) with `{{FILE}}` before
- that commit; `git show` then lists those files too, and nothing else.
-11. The report, `{{REPORTS}}/build.md`, with these lines in this order (the first one exactly):
-
- RESULT: built <the full commit hash>
- SHRINKS: yes|no (See inside scales a movement down, with faint start outlines: ruling 2)
- MISTAKE: yes|no (Compare's first half shows a common mistake or a made-up scene: ruling 3)
- Lines: <before> → <after>
- Check: {{CHECKS}}/<last round>: six ok
- Kit: {{KIT}}: <the three before lines>
- Settings: <each setting and choice: its kit folder, and what changes in See inside and in Compare>
- Changed from the brief: <what and why, or "nothing">
- For the reviewer: <what to look at closely: the hard cases, anything you are unsure of>
- Shared change wanted: <"none", or what and why; also add it as one line to $RUN/shared-wishes.md>
-
- If you cannot finish (the brief asks for something the rules forbid, or a shared file is in the way), the first line
- is `RESULT: stuck <why, in one line>` instead, and the rest says how far you got.
-12. Reply with three lines at most: the RESULT line, the last check round, the report's path.
-````
-
-- [ ] **Step 2: What the coordinator checks when a builder ends**
-
-Before `pages.mjs done` (the page still holds its slot's writer place, so nothing else writes there), run:
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; head -3 $RUN/reports/<NN>-<slug>/build.md; git -C $REPO/.claude/worktrees/sic-<slot> show --name-only --format=%h HEAD; git -C $REPO/.claude/worktrees/sic-<slot> status --short`
-Expected: `RESULT: built <hash>`, `SHRINKS: …`, `MISTAKE: …`; the hash, a blank line and the page's `index.html` alone (with its `README.md` and the files `make-skill` changed, only where a ruling for the page says so); an empty status. Then `cd $RUN && node pages.mjs done <NN.MM>` prints `<NN.MM> <slug>: built`.
-If the commit lists another file: SendMessage to the builder: "Your commit `<hash>` touches `<file>`. Run `git reset --soft HEAD~1`, then `git restore --staged <file> && git checkout -- <file>` (for a file the commit created: `git restore --staged <file> && rm <file>`), commit the page alone again with the same message, put the new hash in build.md's first line, and reply." (the one time a builder undoes a commit: it is still the slot's only writer). If `RESULT: stuck`: `pages.mjs done` blocks the page; Task 9, Step 5.
-
----
-
-### Task 8: Review one page, and the fix loop (the reviewer and the builder; 159 times)
-
-**Files:**
-- Modify (in the page's slot worktree, fix rounds only): `animations/<category>/<slug>/index.html` (and its `README.md` where a ruling says so), more commits.
-- Create (outside the repository): `$RUN/reports/<NN>-<slug>/review-<n>.md`, `fix-<n>.md`, `fix-<n>-log.md`; check rounds `review-<n>`, `fix<n>-<k>`; kit runs.
-
-**Interfaces:**
-- Consumes: Task 7's commit and report; the prompt files the tracker writes from the three templates below (`review-<n>-prompt.md`, `fix-<n>-prompt.md`); `pages.mjs done` reads each report's first line.
-- Produces: a verdict per review (`RESULT: approved` or `RESULT: changes <count>`, the twelve lines with evidence, numbered items, optional `Lesson:` and `Question for the coordinator:` lines); fix commits `fix: <Title>: …`; `fix-<n>.md` with `RESULT: fixed <hashes>`.
-
-How the loop runs (the tracker does the counting): `built` → a fresh reviewer, review 1 → `approved` (Task 10 merges it) or `changes` → the page's own builder, resumed, fix round 1, when its slot has no other writer → `fixed` → the same reviewer, resumed, review 2 → … At most three fix rounds: a review that still asks for changes after round 3 blocks the page (Task 9, Step 5). A re-review whose reviewer cannot be resumed goes to a fresh reviewer with the whole review's template; a fix whose builder cannot be resumed goes to a fresh builder with the fix template, which tells it to read everything first.
-
-- [ ] **Step 1: The reviewer's template**
-
-File `$RUN/prompts/review.md`:
-
-````markdown
-# Review {{N}}: {{NUM}} {{TITLE}} (See inside and Compare)
-
-You review one page of the Animation Handbook's See inside and Compare rollout: {{NUM}} {{TITLE}}, `{{FILE}}`. Another
-agent built it; you did not. You change nothing in the repository, start no agents and never open the browser pane: you
-check, then write a verdict.
-
-**Where.** The slot worktree `{{WT}}` (branch `sic/{{SLOT}}`), served at `http://127.0.0.1:{{PORT}}/`. Its writer may be
-building another page there now: read this page from git, touch nothing. Start every Bash call with:
-`REPO={{REPO}}; RUN={{RUN}}; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; WT={{WT}}`
-
-**Read.** `$REPO/CLAUDE.md`; the spec `$REPO/docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md`,
-sections 1 and 2; the "Global Constraints" of `$REPO/docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md`
-(the twelve acceptance lines are your list); the brief `{{BRIEF}}`; the coordinator's rulings, which win over the brief and
-the Global Constraints for this page: `$RUN/briefs/RULINGS.md`, `$RUN/briefs/OPEN-QUESTIONS.md`, the brief lane's summary
-that lists this page (`grep -l '^| {{NN}}-{{SLUG}} |' $RUN/briefs/summary-*.md` names it; after `RULED:` in its row, the
-answer) and `$RUN/brief-rulings.md`; the owner's, which win over those, `$RUN/rulings-159.md`; and `$RUN/lessons.md`; every
-report in `{{REPORTS}}` (`build.md`, `build-log.md`, earlier reviews and fixes, if any); the page's change
-`git -C $WT diff {{FROM}} {{TO}} -- {{FILE}}` and the whole page `git -C $WT show {{TO}}:{{FILE}}`.
-
-**Steps.**
-1. The server answers: `curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:{{PORT}}/{{PAGE}}/` prints `200` (if not,
- write `RESULT: stuck the server is down` as the first line of `{{REPORTS}}/review-{{N}}.md` and stop). Only this page
- changed, and the worktree holds it as committed: `git -C $WT show --name-only --format=%h {{COMMITS}}` lists `{{FILE}}`
- under each commit and nothing else (where a ruling for this page says so, also `{{PAGE}}/README.md` and the skill files
- `make-skill` wrote for it); `git -C $WT diff --quiet {{TO}} -- {{FILE}} && echo same` prints `same`. If not, write
- `RESULT: changes 1` with the item "the commits touch more than the page" (or "the worktree's page differs from the last
- commit") and stop.
-2. Your own page check (the builder's rounds are not proof), started in the background:
- `mkdir -p {{CHECKS}} && cd $WT && node $RUN/slot.mjs run r-{{NUM}} -- node tools/check-pages.mjs --base http://127.0.0.1:{{PORT}} --out {{CHECKS}}/review-{{N}} {{PAGE}} > {{CHECKS}}/review-{{N}}.log 2>&1; echo "EXIT=$?" >> {{CHECKS}}/review-{{N}}.log`
- then `node $RUN/wait-log.mjs {{CHECKS}}/review-{{N}}.log` (timeout 600000 ms), again while it says "still running". Six
- `ok` lines: acceptance 11, with the tests the coordinator runs when it merges the page.
-3. The pictures. In `{{CHECKS}}/review-{{N}}/`: `{{NN}}-{{SLUG}}-desktop-inside.png` and `-desktop-compare.png`, the same
- with `phone`, `phone-reduced` and `phone-small`, and Normal's `{{NN}}-{{SLUG}}-desktop.png` and `-phone.png`. In
- `{{KIT}}`: the nine stills, the before pictures and `{{KIT}}.log`. Three frames from the middle of each mode clip: run
- `cd $WT && node $RUN/slot.mjs run r-{{NUM}} -- node $KIT/record.mjs --base http://127.0.0.1:{{PORT}} --only clips --keep-frames --out {{KIT}}-review-{{N}} {{PAGE}} > {{KIT}}-review-{{N}}.log 2>&1; echo "EXIT=$?" >> {{KIT}}-review-{{N}}.log`
- in the background, wait for it the same way, read the frames, then delete the frame folders its log names. The short
- stages (lesson 12), in the background:
- `cd $WT && node $RUN/slot.mjs run r-{{NUM}} -- node $KIT/record.mjs --base http://127.0.0.1:{{PORT}} --short --out {{KIT}}-review-{{N}}-short {{PAGE}} > {{KIT}}-review-{{N}}-short.log 2>&1; echo "EXIT=$?" >> {{KIT}}-review-{{N}}-short.log`
- then `node $RUN/wait-log.mjs {{KIT}}-review-{{N}}-short.log`: the line `27 short-screen pictures checked, 0 with labels
- cut or overlapping, 0 skipped, 0 failed` and `EXIT=0`; read the stills (its `short/` folder) of any `FAIL` line.
- Acceptance 1, 2, 3, 6 and 8 from these.
-4. The settings (acceptance 7): the builder's `{{KIT}}-*` folders and report; make a run yourself (as in step 3, with
- `--only stills --press "<selector>"` into `{{KIT}}-review-{{N}}-<short name>`) for any setting not shown convincingly.
-5. The code, for what no picture shows: the `hb:mode` listener's rules (spec section 1 and the Global Constraints); the
- copies; the frame loops (elapsed time, a third in Slow motion, stopped when not needed, nothing made anew every frame);
- runs that hold their pauses with setTimeout; the keyboard, touch and screen readers in every mode; half the budget per
- half on phones; no doubled blur; one WebGL context; and each hard case of spec section 2 that this page has (the brief
- names them), and, for a twin (spec section 2), that its picture differs from its twin's. Acceptance 4, 5, 9, 10 and 12.
-6. The verdict, `{{REPORTS}}/review-{{N}}.md`, its first line exactly `RESULT: approved` or `RESULT: changes <count>`; then
- the twelve acceptance lines, each ✓ or ✗ with its evidence (a file and what it shows, or a code line); then the hard
- cases; then, for changes, the numbered items, each `[Critical|Important|Minor] what, where, why, and what would fix it`.
- Every item must be fixed before you approve, except one you mark "(optional)". A design question you cannot settle is
- an item that starts `Question for the coordinator:`. If the same mistake could be on other pages, end with one line
- `Lesson: <one sentence>`.
-7. Reply with three lines at most: the RESULT line, the items by severity, the report's path.
-````
-
-- [ ] **Step 2: The re-reviewer's template (the same reviewer, resumed)**
-
-File `$RUN/prompts/rereview.md`:
-
-````markdown
-# Review {{N}} after a fix round: {{NUM}} {{TITLE}}
-
-The builder of {{NUM}} {{TITLE}} (`{{FILE}}`) has answered the last review with a fix round. The last review is the newest
-`review-*.md` in `{{REPORTS}}` before this one: yours, or findings that a category check, the final review or the
-whole-site check wrote for this page. You change nothing in the repository, start no agents and never open the browser
-pane. Start every Bash call with:
-`REPO={{REPO}}; RUN={{RUN}}; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; WT={{WT}}`
-
-1. The server answers: `curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:{{PORT}}/{{PAGE}}/` prints `200` (if not,
- write `RESULT: stuck the server is down` as the first line of `{{REPORTS}}/review-{{N}}.md` and stop). The fix: the
- newest `{{REPORTS}}/fix-*.md`; the page's commits, oldest first, are now {{COMMITS}}; only `{{FILE}}` changed in them
- (and, where a ruling for this page says so, `{{PAGE}}/README.md` and the skill files `make-skill` wrote for it:
- `git -C $WT show --name-only --format=%h {{COMMITS}}`), and the worktree holds the last one
- (`git -C $WT diff --quiet {{TO}} -- {{FILE}} && echo same` prints `same`).
-2. Your own page check of the page now, started in the background:
- `mkdir -p {{CHECKS}} && cd $WT && node $RUN/slot.mjs run r-{{NUM}} -- node tools/check-pages.mjs --base http://127.0.0.1:{{PORT}} --out {{CHECKS}}/review-{{N}} {{PAGE}} > {{CHECKS}}/review-{{N}}.log 2>&1; echo "EXIT=$?" >> {{CHECKS}}/review-{{N}}.log`
- then `node $RUN/wait-log.mjs {{CHECKS}}/review-{{N}}.log` until it ends: six `ok`. Read the pictures each item is
- about (in `{{CHECKS}}/review-{{N}}/`), and the fix's own kit runs (`{{KIT}}`, `{{KIT}}-*`).
-3. The verdict, `{{REPORTS}}/review-{{N}}.md`, in the same form as before: its first line exactly `RESULT: approved` or
- `RESULT: changes <count>`; then each item of the last review ✓ or ✗ with its evidence; then anything the fix broke, as
- new items; a `Lesson:` line if one applies.
-4. Reply with three lines at most.
-````
-
-- [ ] **Step 3: The fix round's template (the page's builder, resumed)**
-
-File `$RUN/prompts/fix.md`:
-
-````markdown
-# Fix round {{N}}: {{NUM}} {{TITLE}}
-
-A review asked for changes to {{NUM}} {{TITLE}} (`{{FILE}}`): the newest `review-*.md` in `{{REPORTS}}`, whose first line
-is `RESULT: changes …`. If you built this page, you know it. If you did not (you take over from a builder that stopped),
-first read the brief `{{BRIEF}}`; the coordinator's rulings, `$RUN/briefs/RULINGS.md`, `$RUN/briefs/OPEN-QUESTIONS.md`, the
-brief lane's summary that lists this page (`grep -l '^| {{NN}}-{{SLUG}} |' $RUN/briefs/summary-*.md` names it) and
-`$RUN/brief-rulings.md`; the owner's, `$RUN/rulings-159.md`; then `{{REPORTS}}/build.md`, `build-log.md`, every review and
-fix report there, and the page's change so far, `git -C $WT diff {{FROM}} {{TO}} -- {{FILE}}`. The rules are the build's:
-the slot worktree `{{WT}}` (branch `sic/{{SLOT}}`, served at `http://127.0.0.1:{{PORT}}/`), no file but `{{FILE}}` (and
-`{{PAGE}}/README.md`, with what `node tools/make-skill.mjs` then writes, only where a ruling for this page says so), no
-agents, no browser pane, no push, merge, rebase, amend or stash; the plan's Global Constraints; `$RUN/lessons.md`, read
-again now. Start every Bash call with:
-`REPO={{REPO}}; RUN={{RUN}}; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; WT={{WT}}`
-Keep a log: a line per step in `{{REPORTS}}/fix-{{N}}-log.md`.
-
-1. `curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:{{PORT}}/{{PAGE}}/` prints `200` (if not, write
- `RESULT: stuck the server is down` as the first line of `{{REPORTS}}/fix-{{N}}.md` and stop).
- `cd $WT && git status --short` prints nothing. If it shows `{{FILE}}` changed and `{{REPORTS}}/fix-{{N}}-log.md` exists,
- you take over this round from a builder that stopped: read the log and go on. Anything else: write
- `RESULT: stuck the worktree has changes I did not make` as the first line of `{{REPORTS}}/fix-{{N}}.md` and stop.
-2. Each item: fix it, or answer why not (the reviewer decides). An item that starts `Question for the coordinator:` is
- answered in `$RUN/brief-rulings.md` (a line for {{NUM}}); if no answer is there yet, say so in your report and fix the
- rest.
-3. Tests: `cd $WT && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"` gives `ℹ fail 0`.
-4. Page-check rounds `fix{{N}}-1`, `fix{{N}}-2`, …, each started in the background:
- `mkdir -p {{CHECKS}} && cd $WT && node $RUN/slot.mjs run f-{{NUM}} -- node tools/check-pages.mjs --base http://127.0.0.1:{{PORT}} --out {{CHECKS}}/fix{{N}}-1 {{PAGE}} > {{CHECKS}}/fix{{N}}-1.log 2>&1; echo "EXIT=$?" >> {{CHECKS}}/fix{{N}}-1.log`
- then `node $RUN/wait-log.mjs {{CHECKS}}/fix{{N}}-1.log` until it ends: six `ok`. Read the pictures each item is about.
-5. If the views changed, the full kit again, in the background:
- `cd $WT && node $RUN/slot.mjs run f-{{NUM}} -- node $KIT/record.mjs --base http://127.0.0.1:{{PORT}} --before http://127.0.0.1:8800 --out {{KIT}} --clean --keep-frames {{PAGE}} > {{KIT}}.log 2>&1; echo "EXIT=$?" >> {{KIT}}.log`
- then wait: Normal still `0 of … pixels differ (0 visibly)` for the stage and Try it at 1280, 375 and 320 (or the same
- picture by eye on a random page); read the frames you need, then delete the kept frame folders. Settings an item names:
- their `--press` runs again, into `{{KIT}}-<short name>`. The short stages again, in the background:
- `cd $WT && node $RUN/slot.mjs run f-{{NUM}} -- node $KIT/record.mjs --base http://127.0.0.1:{{PORT}} --short --out {{KIT}}-short {{PAGE}} > {{KIT}}-short.log 2>&1; echo "EXIT=$?" >> {{KIT}}-short.log`
- then `node $RUN/wait-log.mjs {{KIT}}-short.log`: the line `27 short-screen pictures checked, 0 with labels cut or
- overlapping, 0 skipped, 0 failed` and `EXIT=0`.
-6. Commit, only this page, one commit or more: `cd $WT && git add {{FILE}} && git commit -m "fix: {{TITLE}}: <what changed>"`;
- `git show --name-only --format=%H HEAD` shows the hash and `{{FILE}}` alone (where a ruling for this page changes its
- README, as the build's step 10 says: the README and what `make-skill` changed may be in it too).
-7. The report, `{{REPORTS}}/fix-{{N}}.md`, its first line exactly `RESULT: fixed <hash> [<hash>…]` (every commit of this
- round, full hashes, oldest first), or `RESULT: fixed none` when you changed nothing because you answered every item why
- not (the reviewer decides); then each item: what changed, or why not; the check round; the kit runs. If you cannot
- finish: `RESULT: stuck <why>`.
-8. Reply with three lines at most.
-````
-
-- [ ] **Step 4: What the coordinator does with a verdict**
-
-When a reviewer ends: `cd $RUN && node pages.mjs done <NN.MM>` prints `approved`, `changes` or `blocked`. Then read only the verdict's last lines: `grep -E "^(Lesson:|([0-9]+\. )?(\[[A-Za-z]+\] )?Question for the coordinator:|[0-9]+\. \[(Critical|Important)\])" $RUN/reports/<NN>-<slug>/review-<n>.md` (review items are numbered, so a question may start `3. Question for the coordinator:` or `3. [Minor] Question for the coordinator:`).
-- A `Lesson:` line not yet in `lessons.md`: append it as `<NN.MM slug>: <the lesson>`.
-- A `Question for the coordinator:` item: answer it in `brief-rulings.md` (`NN.MM slug: …`) before the fix round starts (the fix template sends the builder there).
-- `approved`: Task 10, Step 1 for the page's slot.
-- For the first two reviews of each category, read the whole verdict: an item that is not this page's alone becomes a lesson at once.
-
-When a fixer ends: the same checks as Task 7, Step 2 (`head -1 …/fix-<n>.md`, the new commits list only the page, an empty status; no new commit for `RESULT: fixed none`), then `pages.mjs done <NN.MM>` prints `fixed`.
-
----
-
-### Task 9: The coordinator's loop: seats, Chrome, the order of work, lessons, stops
-
-**Files (outside the repository):** `$RUN/pages.json` (only through `pages.mjs`), `$RUN/ledger.md`, `$RUN/lessons.md`, `$RUN/brief-rulings.md`, `$RUN/slots.json` (re-cut slots).
-
-**Interfaces:**
-- Consumes: Task 6 (slots, servers, `pages.json`); the prompt files (Tasks 7 and 8); the pool (`slot.mjs`).
-- Produces: every page through build, review and fix rounds to `approved`, with its agents recorded in `pages.json`; a ledger line for every start, end, merge and stop. The loop ends when `node pages.mjs show | tail -1` prints `merged 159` (plus re-cut slots' pages, which are among the 159).
-
-- [ ] **Step 1: Count the seats**
-
-Before every dispatch: `seats = 20 − (agents running now, every project) − 1`. The coordinator knows every agent it started; `cd $RUN && node pages.mjs running` counts this plan's. If the owner raises the app's cap (`CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`), use that number for 20. The other projects (the finder, Famous effects, the ten new animations) are dispatched by the same coordinator by the same order: reviews and fix rounds of any project first; then new pages, taking turns between the projects that have pages waiting, one each.
-The pool sets the pace ("Agents and Chrome"): `cd $RUN && node slot.mjs list`. When it shows all eight slots taken at this look and at one 20 minutes before, with runs waiting (agents' check or kit logs that have no line yet), start no new build this round: give `dispatch` only as many seats as there are pages waiting for a review or a fix round (`node pages.mjs show | grep -cE ' (built|fixed|changes) +r[0-9]'`), so reviews and fix rounds keep their turn. If `dispatch` still prints a `build` line (a fix whose slot is busy left its seat), put that page back at once: `cd $RUN && node pages.mjs set <NN.MM> state=queued`.
-
-- [ ] **Step 2: Dispatch**
-
-First the servers: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node pages.mjs servers`. It names every slot with a page not yet merged whose server does not answer (a slot of a landed category comes back as soon as one of its pages is reopened); for each `<slot> <port> down` line, start that slot's server (a background command, as in Task 6, Step 4) before handing out any prompt. And while the probe (Task 4) has not ended, its Step 7 lines, once they exist, go in before this dispatch.
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node pages.mjs dispatch <seats>`
-Expected: up to `<seats>` lines `<step> <NN.MM> <slug> slot <slot> <new | resume <agent id>> prompt <file>`, or `nothing to start`.
-For each line, in one message (calls side by side):
-- `new`: the Agent tool with `description` `<Build|Review|Re-review|Fix> <NN.MM> <slug>`, `model` `opus`, and `prompt` `You work on the Animation Handbook's See inside and Compare rollout. Read the file <file> and do exactly what it says. Reply with at most three lines.`
-- `resume <id>`: SendMessage to `<id>` with the same prompt text (SendMessage is a deferred tool: load it once with ToolSearch, `select:SendMessage`).
-Then, for each new agent: `cd $RUN && node pages.mjs started <NN.MM> <agent id>` (several in one Bash call, joined with `&&`). A ledger line per start: `<time> start <step> <NN.MM> <slug> <agent id>`. A call the app refuses (its cap of agents was reached; it happened on 2026-10-14) leaves its page in a working state with no agent: `cd $RUN && node pages.mjs set <NN.MM> state=<the state before>` (`queued` for a build, `built` for a review, `fixed` for a re-review, `changes` with `rounds=<n − 1>` for a fix), and it is dispatched again when a seat frees.
-
-- [ ] **Step 3: When an agent ends**
-
-The agent's reply names its page. Do Task 7, Step 2 (a builder; a fixer the same way, as Task 8, Step 4 says) or Task 8, Step 4 (a reviewer): each runs `cd $RUN && node pages.mjs done <NN.MM>` at its point; a ledger line `<time> <NN.MM> <slug> <state>`. If `pages.mjs done` says `no report yet`, SendMessage to the agent: "Write your report file as your prompt says, with its RESULT line first, then reply." Then Step 1 and Step 2 again; for an `approved` page, Task 10, Step 1.
-
-- [ ] **Step 4: Every hour**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node slot.mjs sweep; node slot.mjs list; node pages.mjs servers; curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8800/; node pages.mjs show | tail -1; df -h /c | tail -1`
-- A pool slot shown with `?` and older than two hours (`ls -ld $RUN/slots/slot-N`): tell its project (the finder's, Famous effects' or the ten new animations' ledger); never remove it.
-- A `<slot> <port> down` line: start that slot's server again (a background command, as in Task 6, Step 4).
-- 8800 not `200`: start the before-pictures server again (Task 6, Step 4).
-- Less than 30 GB free: Task 10, Step 3 for every merged page; less than 10 GB: tell the owner.
-- A ledger line with the states line (`queued … · building … · approved … · merged …`).
-
-- [ ] **Step 5: A blocked page**
-
-`cd $RUN && node pages.mjs show | grep blocked` names it and why. Read its reports, then:
-- **A technical knot** (three rounds without agreement, a rule the brief broke, a hard case solved wrongly): write a ruling line for the page in `brief-rulings.md`, then give it a second builder, once, with three more rounds: `cd $RUN && node pages.mjs set <NN.MM> state=changes builder=none limit=6 note=second-builder`. The next dispatch starts a fresh builder on the fix template (it reads every report first). If the second builder's rounds end blocked too, the coordinator either approves with only Minor items left (listed in `$RUN/final/minors.md` for the owner) or asks the owner.
-- **A design question:** the coordinator decides (the owner's standing rule: decide, then let the owner judge the built page), writes the ruling line for the page in `brief-rulings.md`, adds the page to its list `For the owner's final look: <page>: <the choice made>`, and sends the page on: `set <NN.MM> state=changes` for its next fix round (a build that stopped on the question: `set <NN.MM> state=queued builder=none`, and the next builder takes over from `build-log.md`). Only when no option meets the spec, ask the owner mid-run in plain words: one question with the coordinator's suggested answer and the page's 1280 See inside and Compare screenshots from its last check round. A blocked page holds its slot's later pages back (`mergeable` stops before its commits), so the slot's landing, its category's and its final review part wait for the answer.
-- **Stuck because the worktree had changes:** look (`git -C <worktree> status`, the logs), find whose they are, restore the file (`git -C <worktree> checkout -- <file>`) or hand the logged work over, then `set <NN.MM> state=queued` (a build) or `state=changes` (a fix).
-- **Stuck because the server was down:** start the slot's server again (Task 6, Step 4), then `set <NN.MM> state=built reviewer=none` (a review), `state=fixed` (a re-review) or `state=changes rounds=<rounds − 1>` (a fix), and dispatch.
-- **A shared file in the way:** a wish (`shared-wishes.md`) waits for integration, but a page cannot pass the check without it only if the check is wrong: Step 8.
-
-- [ ] **Step 6: Stops: outages, pauses, usage limits**
-
-- An agent ends on an API error or never answers: SendMessage to it, "Go on from where you stopped." If it cannot be resumed (a pause or an outage stopped it), by its page's state: `building` → `pages.mjs set <NN.MM> state=queued builder=none` (the next builder takes over from `build-log.md`); `fixing` → `set <NN.MM> state=changes builder=none rounds=<rounds − 1>` (a fresh builder takes the round over from its log); `reviewing` → `set <NN.MM> state=built reviewer=none`; `rereviewing` → `set <NN.MM> state=fixed reviewer=none` (a fresh reviewer gets the whole review). Then dispatch.
-- The owner pauses the run: dispatch nothing more; stop the agents if the owner says so; write in the ledger the states line and every page in a working state. On "continue": start 8800 and the slot servers again, `pages.mjs show`, recover the stopped steps as above, dispatch.
-- A usage limit: dispatch no new builds; let reviews finish; tell the owner; the finder and Famous effects pause first (coordination file); then go on with fewer seats.
-
-- [ ] **Step 7: Re-cut a slot that has run out of pages**
-
-When a slot has no queued page left and all its pages are merged, and a slot of any category still has three or more queued pages: open a new slot for that category, from its category branch (so the new slot's history holds nothing but its own pages), with the next free port from 8821, and move to it about half of the busiest slot's queued pages from the end of its list (never one twin without the other):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare
-cd $RUN && node pages.mjs addslot <NN><next letter> <port>
-git -C $REPO worktree add -b sic/<NN><next letter> $REPO/.claude/worktrees/sic-<NN><next letter> sic/cat-<NN>
-node pages.mjs move <NN.MM> <NN><next letter>
-node pages.mjs show <NN>
-```
-(`move` once per page, in the order they had.) Start the new slot's server on its port (background). The emptied slot keeps its worktree and its server until its category lands (Task 10, Step 5): later fixes of its pages are made and checked there. A ledger line.
-
-- [ ] **Step 8: A fix of the page check in mid-run (only if a check rule is wrong)**
-
-If a builder or reviewer shows that the page check fails a right page, or passes a wrong one in a way the acceptance needs, and the coordinator confirms it on a fixture: lane `sic/00h` (`git -C $REPO worktree add -b sic/00h $REPO/.claude/worktrees/sic-00h feat/see-inside-compare`, server 8838), a fixture page in `$FX/sic-gen.mjs` that shows the fault (category `95-midrun`), the fix in `tools/check-pages.mjs`, the fixture categories 90 to 93 with the results of the merged Phase 0 Task 3, the seven first-batch pages six `ok` each, a fresh reviewer, then the merge into `feat/see-inside-compare`. Then into every slot and category worktree, each when it has no writer: `git -C $REPO/.claude/worktrees/<worktree> merge --no-ff feat/see-inside-compare -m "Merge the page check's fix into <worktree>"` (the tracker's `mergeable` passes such a merge commit); a slot with a writer gets it before its next dispatch. A ledger line per worktree.
-
-- [ ] **Step 9: When `main` moves during the run**
-
-When the finder, Famous effects or anything else goes live on `main`, the coordinator, the same day (coordination file, rule 4): merges `main` into `feat/see-inside-compare` exactly as Task 12, Step 2 does (generated files written again in the merge; the tests; `home`, and `famous` once it exists); refreshes the before-pictures checkout, `git -C $REPO/.claude/worktrees/sic-before checkout --detach main` (no project but this one changes an animation page, so Normal's before-pictures stay right); and leaves the slots and category branches as they are (they never take `main`). A ledger line.
-
----
-
-### Task 10: Approved pages into their category; a finished category into the branch
-
-**Files:** merges in `.claude/worktrees/sic-cat-NN` (branch `sic/cat-NN`) and, for a finished category, in the main checkout (`feat/see-inside-compare`); outside the repository, finding files `$RUN/reports/<NN>-<slug>/merge-finding.md` and `category-finding.md`.
-
-**Interfaces:**
-- Consumes: `pages.mjs mergeable`, `merged`, `reopen`, `parts`; the category worktrees (Task 6).
-- Produces: every approved page merged into its category branch with the tests passing and the skill unchanged; each finished category checked whole (six `ok` per page) and landed on `feat/see-inside-compare` (ledger line `Category NN landed at <hash>`), which starts its final review part (Task 11).
-
-- [ ] **Step 1: Merge a slot's approved pages**
-
-Whenever a page becomes `approved`:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare
-cd $RUN && node pages.mjs mergeable <slot>
-```
-Expected: `<hash> <NN.MM> …` (the commit to merge up to, and the pages it brings) or `nothing to merge` (a page before it is not approved yet); never a `PROBLEM:` line (if there is one, a commit touches more than its page: `git -C $REPO log --stat sic/cat-NN..sic/<slot>` finds it; send its page back with Step 2's finding file). Then:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare
-cd $REPO/.claude/worktrees/sic-cat-NN && git status --short
-git merge --no-ff <hash> -m "Merge slot <slot>: <Title>, <Title> (See inside and Compare)"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-node tools/make-skill.mjs && git status --short
-cd $RUN && node pages.mjs merged <NN.MM> <NN.MM>
-```
-Expected: an empty status; `ℹ fail 0`; an empty status again (no prompt or setting changed). A ledger line `merged <NN.MM> … into sic/cat-NN`.
-
-- [ ] **Step 2: If the tests fail, or the skill changes**
-
-Undo this merge only: `cd $REPO/.claude/worktrees/sic-cat-NN && git reset --hard ORIG_HEAD`. Find the page from the failing test's name (or the changed skill file). Write `$RUN/reports/<NN>-<slug>/merge-finding.md`:
-```markdown
-RESULT: changes 1
-1. [Critical] After merging into sic/cat-NN: <the failing test's line, or the skill file that changed, and why>
-```
-then `cd $RUN && node pages.mjs reopen <NN.MM> reports/<NN>-<slug>/merge-finding.md`. The fix loop runs (Tasks 8 and 9); Step 1 again when it is approved.
-
-- [ ] **Step 3: Space (only when the disk is short, Task 9, Step 4)**
-
-For a merged page: keep its last builder round, its review rounds and its main kit folder; remove the rest:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare
-cd $RUN/checks/<NN>-<slug> && ls -d [0-9]*/ 2>/dev/null | tr -d / | sort -n | head -n -1 | xargs -r rm -rf
-ls -d $RUN/kit/<NN>-<slug>-* 2>/dev/null | grep -v -- '-review-' | xargs -r rm -rf
-```
-
-- [ ] **Step 4: A finished category: the whole category checked**
-
-When `cd $RUN && node pages.mjs show NN | tail -1` prints only `merged <count>` (every page of the category, re-cut slots' too): the servers of the category's slots stay up until the category lands (Step 5), since a FAIL here reopens a page; start, as a background command, `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-cat-NN && python -m http.server 883<n> --bind 127.0.0.1` (01 → 8831, 02 → 8832, … 07 → 8837), and for each line `k` of `cd $RUN && node pages.mjs parts NN 8` start, as a background command, at most two parts at once while page work goes on:
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-cat-NN && node $RUN/slot.mjs run cat-NN-k -- node tools/check-pages.mjs --base http://127.0.0.1:883<n> --out $RUN/checks/cat-NN <that line's folders> > $RUN/checks/cat-NN-k.log 2>&1; echo "EXIT=$?" >> $RUN/checks/cat-NN-k.log`
-When all have ended: `cat $RUN/checks/cat-NN-*.log | grep -c '^ok'` prints six times the category's pages, first-batch page included: six times `cd $RUN && node pages.mjs parts NN 8 | wc -w` (today 01: 162, 02: 84, 03: 96, 04: 246, 05: 114, 06: 156, 07: 138), and `grep -h '^FAIL' $RUN/checks/cat-NN-*.log` prints nothing.
-A `FAIL` line: write `$RUN/reports/<NN>-<slug>/category-finding.md` (`RESULT: changes 1`, then `1. [Critical] The category check: <the FAIL line>; screenshots in $RUN/checks/cat-NN/`), `node pages.mjs reopen <NN.MM> reports/<NN>-<slug>/category-finding.md`; when the page is approved again, Step 1, then the part that holds it again. (A FAIL on the first-batch page: the coordinator reads it; it is fixed by a fresh builder in a lane of its own, reviewed, and merged into `sic/cat-NN`.)
-
-- [ ] **Step 5: Land the category**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && git status --short && git branch --show-current
-git merge --no-ff sic/cat-NN -m "Merge category NN of See inside and Compare: <count> pages"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-node tools/make-skill.mjs && git status --short
-git rev-parse HEAD
-```
-Expected: an empty status and `feat/see-inside-compare`; the merge with no conflict (a category changes only its own pages); `ℹ fail 0`; an empty status; the landing hash. Stop the category's server and its slots' servers (a later fix of one of its pages starts its slot's server again: Task 9, Step 2). Ledger: `Category NN landed at <hash>`. Task 11 starts for it.
-
-- [ ] **Step 6: A fix to a page of a landed category**
-
-The fix commit lands on the page's slot (Task 8), Step 1 merges it into `sic/cat-NN`, the category-check part that holds the page runs again (Step 4's command for that line, with the category's server started again), and Step 5 lands it again with the message `Merge category NN's fixes: <Title>, …`. After Task 12 has merged anything into `feat/see-inside-compare`, first merge `feat/see-inside-compare` into the page's slot (no writer there at that moment): `git -C $REPO/.claude/worktrees/sic-<slot> merge --no-ff feat/see-inside-compare -m "Merge feat/see-inside-compare into slot <slot> for a late fix"`, and into `sic/cat-NN` the same way, so the fix is checked with the final shared files.
-
----
-### Task 11: Final review, parts 1 to 7, as each category lands, and their fixes
-
-**Files:**
-- Create and remove: worktree `.claude/worktrees/fr-NN` (detached at the category's landing commit), served on `884<n>` (01 → 8841 … 07 → 8847).
-- Create (outside the repository): `$RUN/kit/gallery-NN/` (the kit's gallery of the category), `$RUN/final/part-NN-<k>.md`, `$RUN/final/consistency-NN.md`, `$RUN/final/<NN>-<slug>.md` (findings of a page), `$RUN/final/minors.md`.
-
-**Interfaces:**
-- Consumes: Task 10, Step 5 (`Category NN landed at <hash>`); the category check's screenshots `$RUN/checks/cat-NN/`; each page's brief and reports; `pages.mjs reopen`, `set`.
-- Produces: per category, every page looked at again with fresh eyes, the category made consistent, every Critical and Important item fixed (through the fix loop and Task 10, Step 6), Minor items fixed with them or listed in `final/minors.md` for the owner; ledger line `Final review part NN: <pages> pages; <c> Critical and <i> Important fixed; <m> minors listed`.
-
-- [ ] **Step 1: The frozen checkout and the category's gallery**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-git -C $REPO worktree add --detach $REPO/.claude/worktrees/fr-NN <landing hash>
-```
-Start, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/fr-NN && python -m http.server 884<n> --bind 127.0.0.1`. Then, as a background command:
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; cd $RUN && node slot.mjs run fr-NN -- node $KIT/record.mjs --base http://127.0.0.1:884<n> --gallery --out $RUN/kit/gallery-NN animations/<category folder> > $RUN/kit/gallery-NN.log 2>&1; echo "EXIT=$?" >> $RUN/kit/gallery-NN.log`
-and `cd $RUN && node wait-log.mjs kit/gallery-NN.log` until it ends. Expected: `$RUN/kit/gallery-NN/gallery-NN.html` with Normal, See inside and Compare at 1280 and 375 for every page of the category, `0 failed`.
-
-- [ ] **Step 2: The parts**
-
-Split the category's pages (sorted by number, as many as `cd $RUN && node pages.mjs parts NN 8 | wc -w` counts) into groups of at most ten, as even as they come, so one reviewer can look at every picture. Dispatch one fresh final reviewer (opus) per group, as seats allow, with this prompt, its `<…>` filled in by the coordinator:
-
-```text
-You do one part of the final review of the Animation Handbook's See inside and Compare rollout: category <NN>
-(<category folder>), pages <the list "NN.MM slug, …">. Their code is frozen in the detached checkout
-C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/fr-<NN> (at <landing hash>), served at
-http://127.0.0.1:884<n>/. Change no file in the repository, start no agents, never open the browser pane. RUN below is the
-run folder .superpowers/sdd/2026-10-13-see-inside-compare/ of the main checkout.
-Read first: CLAUDE.md; docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md, sections 1 and 2;
-docs/superpowers/plans/2026-10-14-see-inside-compare-other-pages.md, "Global Constraints" (the twelve acceptance lines);
-the coordinator's rulings RUN/briefs/RULINGS.md, RUN/briefs/OPEN-QUESTIONS.md and RUN/brief-rulings.md, and the owner's
-RUN/rulings-159.md (a ruling wins over the brief and the Global Constraints for its page, the owner's over the
-coordinator's). For each of your pages: its brief (RUN/briefs/<NN>-<slug>.md) and its row in the brief lane's summary that
-lists it (RUN/briefs/summary-*.md: the row starts "| <NN>-<slug> |"; after RULED:, the answer); its build report
-and newest review (RUN/reports/<NN>-<slug>/); its eight mode screenshots from the category check
-(RUN/checks/cat-<NN>/<NN>-<slug>-<desktop|phone|phone-reduced|phone-small>-<inside|compare>.png) and Normal's
-(<NN>-<slug>-desktop.png); its gallery stills (RUN/kit/gallery-<NN>/, named in gallery-<NN>.html); and its code in the
-checkout. Check each page against the twelve lines with fresh eyes: the pictures first (lines 1, 2, 5, 6, 8: does each
-view read from the picture alone at 1280 and at 375, before the note is read? is every mode still, and still teaching,
-under reduced motion?), then the code (lines 4, 9, 10: the hb:mode listener's rules, the copies, frame loops by elapsed
-time, half the budget per half on phones, one WebGL context, the page's hard cases from spec section 2). Twins of your
-category must draw different pictures (spec section 2).
-For a page with a Critical or Important item, write RUN/final/<NN>-<slug>.md: first line exactly "RESULT: changes <count>",
-then numbered items "[Critical|Important|Minor] what, where, why, and what would fix it" (its Minor items too). For a page
-with only Minor items, add each to RUN/final/minors.md as "<NN.MM slug>: <item>". Then write RUN/final/part-<NN>-<k>.md:
-each page you checked, "fine" or the count of its items. Reply with three lines: pages checked, pages with Critical or
-Important items, minors listed.
-```
-
-- [ ] **Step 3: The consistency pass (after the category's parts have ended)**
-
-One fresh agent (opus) per category, with this prompt:
-
-```text
-You do the consistency pass of the final review for category <NN> (<category folder>) of the Animation Handbook's See
-inside and Compare rollout: the whole category as a visitor going from page to page sees it. Change no file in the
-repository, start no agents, never open the browser pane. RUN is the run folder
-.superpowers/sdd/2026-10-13-see-inside-compare/ of the main checkout. Read CLAUDE.md and the spec
-docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md, sections 1 and 2, and the coordinator's rulings
-RUN/briefs/RULINGS.md, RUN/briefs/OPEN-QUESTIONS.md and RUN/brief-rulings.md (a difference a ruling made on purpose is
-not a fault). Look at the category's gallery
-(RUN/kit/gallery-<NN>/gallery-<NN>.html and its stills: See inside and Compare at 1280 for every page, then at 375) and read
-every page's two notes in the frozen checkout .claude/worktrees/fr-<NN>. Find what differs from page to page with no reason:
-the labels' look (size, backing, color), the half names' place and wording, the notes' tone and length, the phone layouts
-(side by side or stacked), how the posed stills look; and twins that look alike. Where a page differs from the category's
-way and it hurts reading, add an Important item to RUN/final/<NN>-<slug>.md (if the file exists, add your items and raise
-the count in its first line, "RESULT: changes <count>"; if not, create it with that first line); otherwise add the item to
-RUN/final/minors.md as "<NN.MM slug>: <item>". Write RUN/final/consistency-<NN>.md: what the category does alike, and what
-differs. Reply with three lines.
-```
-
-- [ ] **Step 4: The findings go back to their builders**
-
-For each `$RUN/final/<NN>-<slug>.md` of the category (its first line `RESULT: changes <count>`), the reviewer who wrote it being the agent to re-check the fix:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare
-cd $RUN && node pages.mjs reopen <NN.MM> final/<NN>-<slug>.md && node pages.mjs set <NN.MM> reviewer=<that final reviewer's agent id>
-```
-Task 9 then dispatches the fix (the page's builder, resumed, or a fresh one reading every report) and the re-review (the final reviewer, resumed); an approved fix lands by Task 10, Step 6. A page whose consistency items came from the consistency pass alone gets the consistency agent as its re-reviewer.
-
-- [ ] **Step 5: The part's end**
-
-When every finding of the category is approved and landed: `ls $RUN/final/0<n>-*.md` lists only pages whose state is `merged` again (`node pages.mjs show NN | tail -1` prints `merged <count>`). Remove the frozen checkout (`git -C $REPO worktree remove $REPO/.claude/worktrees/fr-NN`), stop its server. Ledger: `Final review part NN: <pages> pages; <c> Critical and <i> Important fixed; <m> minors listed`.
-
----
-
-### Task 12: Integration
-
-**Files:**
-- Merge `feat/ten-animations` into `feat/see-inside-compare` (in the main checkout), the version made one number and the generated files written again in the merge.
-- Merge `main` into `feat/see-inside-compare` (in the main checkout), generated files written again in the merge.
-- Lane `sic/00i` (only if `$RUN/shared-wishes.md` holds wishes): the files the wishes change, their tests, and the version line of every tracked animation page and of `index.html`.
-- Lane `sic/int` (`.claude/worktrees/sic-int`, port 8850): `tests/pages.test.js` (the final gate and the learning path's guard), `CLAUDE.md`, `CONTRIBUTING.md`, `.github/pull_request_template.md`, `README.md`, `CHANGELOG.md`, `sitemap.xml`.
-
-**Interfaces:**
-- Consumes: the seven landed categories (Task 10) with their final review parts done (Task 11); `feat/ten-animations`, its pages built and reviewed by the ten new animations' own plan; `$RUN/shared-wishes.md`; the coordination file's merging rules.
-- Produces: `feat/see-inside-compare` with all 176 pages (ledger line `Ten new animations merged at <hash>: 176 pages`); `sic/int` with the final gate flipped (`const SWITCHED = steps;`), the learning path's guard widened, the docs of spec section 6, the sitemap written again, the skill unchanged by this lane, the tests passing and the whole site six `ok` per page; ledger line `Integration lane ready at <hash>`. Task 13 reviews it and merges it.
-
-- [ ] **Step 1: Everything has landed, and `feat/ten-animations` comes in**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; grep -c "^Category 0[1-7] landed at" $RUN/ledger.md; grep -c "^Final review part 0[1-7]:" $RUN/ledger.md; cd $RUN && node pages.mjs show | tail -1; git -C $REPO status --short`
-Expected: `7` (or more, with fix landings: one line per landing), `7`, `merged 159`, an empty status.
-
-The ten new animations join now (the coordinator's ruling: the final review, the gallery and the owner's final look then cover all 176 pages, and both go live together). Their own plan's ledger must say that their pages are approved and their reviews done; if not, ask the owner whether integration waits for them or goes on without them (without them, this task's counts stay at 166 and they land later by their own plan). Then:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && git log --oneline -1 feat/ten-animations && git merge --no-ff --no-commit feat/ten-animations
-```
-Resolve any overlap by the coordination file's map: each project keeps its own lines (the five pages whose top bar gains a Next link, 02.14 Shatter Effect, 03.16 Cube Transition, 04.41 Dynamic Island, 06.26 Infinite Zoom and 07.23 Game of Life, keep both the link and this rollout's views; `tests/pages.test.js` keeps both projects' blocks); a resolution that needs more than keeping both sides is reviewed by a fresh agent. The version: `git grep -h -o 'demo-page\.\(css\|js\)?v=[0-9]*' -- 'animations/*/*/index.html' index.html | sort | uniq -c` shows one number for each file; if the two branches had different numbers, the higher wins: every tracked animation page and the home page are set to it with Task 1, Step 4's `sed -b` line (its `10` and `11` replaced by the lower and the higher number) and checked as that step checks them. Then write the generated files again and commit them in the merge:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && node tools/update-sitemap.mjs && node tools/make-skill.mjs
-[ -d famous ] && node tools/make-famous.mjs
-git add -A -- sitemap.xml llms.txt skills $([ -d famous ] && echo famous) && git status --short | head
-git commit -m "Merge feat/ten-animations: the ten new animations, with See inside and Compare, join before integration; generated files written again"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-git ls-files -- 'animations/*/*/index.html' | wc -l
-git grep -L 'data-hb-modes' -- 'animations/*/*/index.html' | wc -l
-```
-Expected: `ℹ fail 0`; `176`; `0` (the ten new pages have their two views from the start). `og-image.png` is the one `feat/ten-animations` drew for 176 (this rollout never changes the home page's top). Then `home` (and `famous` if the check knows it) through the pool against 8731, as Step 2 runs it, but into `$RUN/checks/ten-home.log` with `--out $RUN/checks/ten`: six `ok` each. Ledger: `Ten new animations merged at <hash>: 176 pages`. Their final review part (part 9) runs in Task 13.
-
-- [ ] **Step 2: `main` into the branch (coordination file, rule 2)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && git log --oneline -1 main && git merge --no-ff --no-commit main
-```
-If git says `Already up to date.`, go to Step 3. Otherwise resolve any overlap by the coordination file's map (each project keeps its own lines; a resolution that needs more than keeping both sides is reviewed by a fresh agent), then write the generated files again and commit them in the merge:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && node tools/update-sitemap.mjs && node tools/make-skill.mjs
-[ -d famous ] && node tools/make-famous.mjs
-git add -A -- sitemap.xml llms.txt skills $([ -d famous ] && echo famous) && git status --short
-git commit -m "Merge main into feat/see-inside-compare before integration; generated files written again"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-```
-If the merge changed the top of `index.html` (the home page's first screen), also `node tools/make-social-image.mjs --base http://127.0.0.1:8731` (the main checkout served on 8731; start it as a background command, `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook && python -m http.server 8731 --bind 127.0.0.1`, if it does not answer) before the commit, and `og-image.png` in the `git add`. Expected: `ℹ fail 0`. Then the `home` check, and `famous` if `tools/check-pages.mjs` knows it, through the pool against 8731: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO && node $RUN/slot.mjs run site-home -- node tools/check-pages.mjs --base http://127.0.0.1:8731 --out $RUN/checks/site home famous > $RUN/checks/site-home.log 2>&1; echo "EXIT=$?" >> $RUN/checks/site-home.log` (drop `famous` if the check does not list it), waited with `wait-log.mjs`: six `ok` each.
-
-- [ ] **Step 3: The shared wishes, and the next version (only if there are wishes)**
-
-Run: `grep -vc "^#" $RUN/shared-wishes.md`. `0`: go to Step 4. Otherwise the coordinator decides each wish (applied only if it helps every page and the spec allows it; else answered "no, because …" on its line), and for the kept ones: lane `sic/00i` (`git -C $REPO worktree add -b sic/00i $REPO/.claude/worktrees/sic-00i feat/see-inside-compare`, server 8839); an agent (opus) makes each test first (a test in `tests/demo-page.test.js` or `tests/pages.test.js`, or a fixture page for the check), sees it fail, makes the change, runs the tests; in the same lane, since it runs anyway, the comment in `assets/js/demo-page.js` that starts `// Do-it pages: the visitor's own press, key, wheel, touch or click inside the stage` also names a press of See inside or Compare as the visitor acting (Phase 0's Task 2 review; without wishes this comment waits, a change to that file taking a version bump); then the bump from the branch's number N to N+1 (N is `git grep -h -o 'demo-page\.js?v=[0-9]*' -- index.html` on the branch; if main brought a higher one, from that), exactly as Task 1, Step 4 does it with `10` and `11` replaced by N and N+1, its counts and line-ending check included; the whole site (Step 7, with `--base http://127.0.0.1:8839`); a fresh reviewer; the merge `git merge --no-ff sic/00i -m "Merge integration's shared changes: <what>, and the shared files at version <N+1>"`; tests; the lane removed. Ledger line.
-
-- [ ] **Step 4: The integration lane and the final gate**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-git -C $REPO worktree add -b sic/int $REPO/.claude/worktrees/sic-int feat/see-inside-compare
-cd $REPO/.claude/worktrees/sic-int && git grep -L 'data-hb-modes' -- 'animations/*/*/index.html'
-```
-Expected: no output (every animation page has the switch). Start its server, as a background command: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-int && python -m http.server 8850 --bind 127.0.0.1`.
-
-In `tests/pages.test.js` replace these four lines
-```js
-// The pages the switch tests cover. FINAL GATE: while the rollout runs these are the pages that have the switch; at integration
-// this line becomes `const SWITCHED = steps;`, so an animation page without the switch fails
-// (docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md, section 4, item 5).
-const SWITCHED = steps.filter(d => pageOf(d).includes('data-hb-modes'));
-```
-with
-```js
-// The pages the switch tests cover: every animation page, so a page without the switch fails (the final gate of
-// docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md, section 4, item 5).
-const SWITCHED = steps;
-```
-Run: `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-int && node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"` → `ℹ fail 0`. See the gate bite once: `sed -i 's/ data-hb-modes>/>/' animations/02-entrance-and-exit/slide-in/index.html && node --test tests/pages.test.js 2>&1 | grep -c "✖ slide-in"` prints a number above `0`; then `git checkout -- animations/02-entrance-and-exit/slide-in/index.html`.
-
-Then, in the same file, the learning path's guard (Phase 0's Task 1 review, deferred to integration), each change seen failing on a scratch page. In the test `'while the learning path waits, no tracked page links into learn/ and the shared stylesheet has none of its rules'`, replace
-```js
- const linking = pages.filter(f => /href="(?:(?:\.\.\/)+|\/animation-handbook\/)?learn\//.test(read(path.join(ROOT, f))));
-```
-with
-```js
- // Double or single quotes; learn/, ./learn/, ../learn/ or the site's own address, with or without its host
- const linking = pages.filter(f => /href=["'](?:\.\/|(?:\.\.\/)+|(?:https?:\/\/[^/"']+)?\/animation-handbook\/)?learn\//.test(read(path.join(ROOT, f))));
-```
-and after the line ` assert.ok(!fs.existsSync(path.join(ROOT, 'learn')), 'the learn/ folder is gone');` add
-```js
- assert.ok(!/\blearn\b/.test(read(path.join(ROOT, 'tools', 'check-pages.mjs'))), 'the page check names no learn target');
-```
-Run:
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-int
-printf '%s\n' "<a href='learn/'>x</a>" > guard-a.html
-printf '%s\n' '<a href="./learn/">x</a>' > guard-b.html
-printf '%s\n' '<a href="https://matinmonshizadeh.github.io/animation-handbook/learn/">x</a>' > guard-c.html
-git add -N guard-a.html guard-b.html guard-c.html
-node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -oE "'guard-[abc]\.html'" | sort -u | wc -l
-git rm -q --cached guard-a.html guard-b.html guard-c.html && rm guard-a.html guard-b.html guard-c.html
-printf '// learn\n' >> tools/check-pages.mjs
-node --test --test-reporter=spec tests/pages.test.js 2>&1 | grep -oE "AssertionError \[ERR_ASSERTION\]: the page check names no learn target" | sort -u
-git checkout -- tools/check-pages.mjs
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"; git status --short
-```
-Expected: `3` (three links the old pattern missed: single quotes, `./learn/` and the site's full address); `AssertionError [ERR_ASSERTION]: the page check names no learn target`; then `ℹ fail 0` and ` M tests/pages.test.js` alone.
-
-- [ ] **Step 5: The docs (spec section 6), on top of what `main` brought**
-
-Each edit is found by its current words (shown in a `text` block) and replaced or followed by new words. If `main` has changed a sentence, keep `main`'s words and add this rollout's beside them.
-
-**`CLAUDE.md`**
-
-(a) In "Hard rules", replace
-
-```text
-- **Keep demos under ~300 lines total.** If it's longer, the explanation has failed.
-```
-with
-```text
-- **Keep demos to about 300 lines, plus about 150 for See inside and Compare.** If it's longer, the explanation has failed.
-```
-
-(b) In "The page", replace item 3,
-
-```text
-3. **1 · Watch it** (`section.hb-watch`): help line, stage (`div.stage`), player bar (`div.hb-player`); the
- step title and help line are written per page.
-```
-with the four lines below, then an `html` block holding the switch and the notes box exactly as `animations/01-scroll-based/parallax-scrolling/index.html` has them on the branch (copied from that file, its two notes included):
-```text
-3. **1 · Watch it** (`section.hb-watch`): help line, the mode switch (`div.seg.hb-modes`: Normal, See inside, Compare),
- stage (`div.stage`), player bar (`div.hb-player`) and the two mode notes (`div.hb-mode-notes`); the step title, help line
- and notes are written per page. The switch and the notes box are exactly these (the tests pin them; each page writes its
- own two notes):
-```
-
-(c) After the part that starts `#### Reduced motion` and before `#### Try it`, add:
-
-```markdown
-#### See inside and Compare
-Every animation page has two more views of its stage, chosen with the switch above it. **See inside** shows what Normal
-hides (the layers, pieces, hidden shape, route, timing, trigger line, speed curve, pulls or hidden field) on the real demo,
-which keeps working in that mode (scroll, Play, Replay, Pause, Show me, hover, press, drag). Each part is labeled in words
-and, where it helps, a short bar or arrow, drawn from the page's own numbers so every setting changes it; where it scales a
-movement down to keep every part in view, a faint outline marks where each moving part started. **Compare** shows the scene
-twice, at the same size and time and driven by the same input: first (left, or top when stacked) the scene without the
-effect, or a common mistake or a small made-up scene where that teaches more, then the page as the visitor set it. Each half
-is named at its top in one to three words. Every setting reaches both halves except the one thing the first lacks; where a
-setting makes them match, the note says so and points to Try it. Where the difference needs movement, the halves rest on a
-posed moment, never on two identical pictures. The mode is not a setting: it never reaches Your settings, the prompt, the
-home page's Copy prompt or the skill.
-
-- **After a press** of See inside or Compare the shared script presses Replay (plays-once pages) or Show me (do-it pages)
- once, so the view is seen working; never under reduced motion, on scroll pages or loops, or after Normal.
-- **The page's `hb:mode` listener** sits at the top level of its script; hears every press (the pressed mode too, never one
- at boot) after the buttons, notes and stage mark have changed; keeps Normal the default look (no rule on
- `[data-hb-mode="normal"]`; every mode rule starts `.stage[data-hb-mode="inside"]` or `.stage[data-hb-mode="compare"]`,
- because the buttons carry `data-hb-mode` too); draws the current state at once (scroll position, frame, open or closed,
- paused or playing); is safe to run twice; and never scrolls, moves focus, presses a control, stops Play or changes Pause.
-- **Copies** are made once (at load or on first entry), with ids removed or renamed (gradients, masks, filters, `for`),
- `inert`, `aria-hidden="true"`, and are not rendered outside Compare. A canvas page splits one canvas; a WebGL page draws one
- context in two viewports, never a second context; a second simulation takes the same fixed steps as the first.
-- **Labels and half names** carry `data-hb-caption`: at least 12px as drawn, 4.5:1 against their own backing, inside the
- stage, covering neither the part they name nor each other, at most six (four on phones), with amounts as a beginner says
- them ("half a second", "moves most"), never ms, px, deg or CSS names.
-- **Notes:** one or two plain sentences each (at most 35 words) on what the visitor sees; the Compare note names the
- halves by their labels; when the stage looks like Normal until the visitor acts, the note ends with what to do ("Scroll the
- box or press Play to watch."). A note the script rewrites (for a setting or for reduced motion) uses the markup's own words
- for the default state.
-- **Reduced motion:** every mode is a still picture that still teaches (See inside: the parts apart, a bar or arrow as long
- as each move; Compare: a posed still). No mode adds movement.
-- **Phones:** the box keeps its size in every mode; Compare's halves sit side by side while each keeps about 160px of scene,
- else stacked; anything a mode adds that can be pressed is at least 44×44px (check it by hand: the page check skips the
- stage); hover and drag keep their touch equivalents. Only transform and opacity animate; on phones each half gets half the
- budget (particles, dots, tiles) and a blur is never doubled.
-- **Runs:** a Replay or Show me run holds its pauses with `setTimeout`, never inside a frame loop or a `setInterval`: the
- page check sees only `setTimeout` timers and animations, and waits up to 30 s for a run.
-- **Endless movement:** the page check holds every endless CSS animation in the stage (a blinking caret, a loader) while it
- judges rest and takes the mode screenshots, so it cannot see a mode that adds endless movement: never add one.
-- **Done** means a reviewer who did not build the page has confirmed spec section 1's twelve acceptance lines: among them,
- each view reads from the page check's screenshots at 1280px and 375px before the note is read, and Normal at rest matches
- the page before the change pixel for pixel, with Try it, the chips and the prompt unchanged.
-
-The hard cases (canvas and WebGL, second simulations, do-it pages, reduced motion that erases the difference, random pieces,
-"Shows the …" switches, your text, snapping, flash safety, twins) and the weak views are in
-`docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md`, section 2. Start from the page with the closest
-kind of picture: Parallax Scrolling (layers), Fade In / Fade Out (a graph over time), Overlay Wipe (steps on a time line),
-Magnetic Button (a hover pull), Marquee / Ticker (a common mistake), Fluid / Liquid Simulation (WebGL) or Flow Field (canvas).
-```
-
-(d) In "When asked to add a new animation", replace
-
-```text
-3. Create `index.html` by copying the closest page of the same kind and following the template above.
-```
-with
-```text
-3. Create `index.html` by copying the closest page of the same kind and following the template above, See inside and
- Compare included (see "See inside and Compare": start from the page with the closest kind of picture).
-```
-
-(e) In "Tests and the page check", the **Page check** bullet ends with
-
-```text
-It skips controls inside `.stage` when it measures touch targets, so check buttons and
- handles a demo draws there by hand.
-```
-(its line break may differ); after it add, in the same bullet:
-```text
- On a page with the mode switch it also tries Normal, See inside and Compare at every setup (the mark, the note, the
- box's size, the labels, ids and names, rest, Play through a mode change) and saves `<name>-<setup>-inside.png` and
- `<name>-<setup>-compare.png` beside each setup's own screenshot.
-```
-
-(f) In the testing checklist, after the line `- [ ] Does it respect prefers-reduced-motion?`, add the line
-
-```text
-- [ ] Do See inside and Compare each read from the picture alone at 375px and 1280px, still under reduced motion?
-```
-
-(g) In "Page kinds and their controls", the `data-hb-demo` bullet ends with
-
-```text
- Show me), so a do-it page never moves focus into its stage while it loads: its own `focus()` counts as the
- visitor's.
-```
-(its line break may differ); after it add, in the same bullet (Phase 0's Task 2 review, deferred to integration):
-```text
- A press of See inside or Compare counts as the visitor acting; a page that must tell it from the arrival press sets a
- flag in its `hb:mode` listener and clears it in a microtask.
-```
-
-**`CONTRIBUTING.md`**
-
-(a) In "Ground rules", replace
-
-```text
-- **Keep demos under ~300 lines.** If it's longer, the explanation has failed.
-```
-with
-```text
-- **Keep demos to about 300 lines, plus about 150 for See inside and Compare.** If it's longer, the explanation has failed.
-```
-
-(b) In "Adding a new technique", step 2 ends with
-
-```text
- `rotate-in` (plays once), `aurora` (loop in CSS), `starfield` (loop in JavaScript),
- `checkmark-draw` (do it), `snap-scrolling` (scroll).
-```
-after it add, in the same step:
-```text
- Give it See inside and Compare too (see [See inside and Compare](#see-inside-and-compare)), starting from the page
- with the closest kind of picture.
-```
-
-(c) In "The demo page", replace
-
-```text
-1. **Watch it** — the stage, with the player bar right below it.
-```
-with
-```text
-1. **Watch it** — the stage, with the mode switch above it (Normal, See inside, Compare), the player bar right below it
- and, under that, the note of the mode on show.
-```
-
-(d) At the end of the "Reduced motion" paragraph (it ends `script show the end state or a fade instead of movement.`) add the sentence `See inside and Compare are still pictures then, and pressing them plays nothing.` Then, after that paragraph and before `## Responsiveness (mandatory)`, add:
-
-```text
-### See inside and Compare
-
-Every page has a switch above its stage: **Normal**, **See inside** and **Compare**. See inside shows what the animation
-hides (layers, pieces, a hidden shape, a route, timing, a trigger line, a speed curve, pulls or a hidden field) on the real
-demo, labeled in plain words; Compare shows the scene twice, at the same size and time, first without the effect (or with a
-common mistake) and then as the visitor set it, each half named in one to three words. Both views live in the page's own CSS
-and script and are drawn from the page's own numbers, so every setting changes them; Normal stays exactly as it was, and the
-mode never reaches the settings, the prompt or the skill. Under reduced motion both are still pictures; on phones the box
-keeps its size. Copy the pattern from the page with the closest kind of picture: Parallax Scrolling, Fade In / Fade Out,
-Overlay Wipe, Magnetic Button, Marquee / Ticker, Fluid / Liquid Simulation or Flow Field. The rules (the `hb:mode` listener,
-copies, labels with `data-hb-caption`, notes) are in CLAUDE.md's "See inside and Compare" part.
-```
-
-(e) In "Self-check before opening a PR", after the line ``- [ ] Respects `prefers-reduced-motion`.`` add the line
-
-```text
-- [ ] See inside and Compare each read from the picture alone at 375px and 1280px, and are still under reduced motion.
-```
-
-(f) In "Tests and the page check", the paragraph that starts `It opens each page at six screen setups` ends with `so check buttons and handles a demo draws there by hand.`; after it add, in the same paragraph:
-
-```text
-On a page with the mode switch it also tries Normal, See inside and Compare at every setup and saves a screenshot of the
-Watch step in each (`<name>-<setup>-inside.png` and `<name>-<setup>-compare.png`).
-```
-
-**`.github/pull_request_template.md`**, in "A new technique": in the line that starts `- [ ] Copied from a page of the same kind`, replace `under ~300 lines` with `about 300 lines plus about 150 for See inside and Compare`; after that line add the line
-
-```text
-- [ ] See inside and Compare: both notes, each mode clear from its screenshot at 375px and 1280px, still under reduced motion
-```
-
-**`README.md`**, "How to use it", step 2: after `so you see exactly what you will get.` add the sentence `See inside pulls the animation apart to show how it works, and Compare shows it beside a version without the effect or with a common mistake.`
-
-**`CHANGELOG.md`**, under `## Unreleased`, a new first bullet:
-
-```text
-- See inside and Compare on every animation page: See inside pulls the animation apart to show how it works, and Compare
- shows it beside a version without the effect or with a common mistake.
-```
-
-- [ ] **Step 6: The generated files, the tests and the commit**
-
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-int
-node tools/make-skill.mjs && git status --short -- skills llms.txt
-node tools/update-sitemap.mjs && git diff --stat -- sitemap.xml | tail -1
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-git add tests/pages.test.js CLAUDE.md CONTRIBUTING.md .github/pull_request_template.md README.md CHANGELOG.md sitemap.xml
-git status --short
-git commit -m "feat: See inside and Compare on every animation page: the final gate, the docs and the sitemap"
-```
-Expected: no output for the skill (modes are not settings, the prompts did not change); the sitemap changed (every page's date moved to its last commit); `ℹ fail 0`; seven staged files and nothing else.
-
-- [ ] **Step 7: The whole site, in parts**
-
-For each category `NN` and each line `k` of `cd $RUN && node pages.mjs parts NN 8` (26 parts for the 176 pages: 01 has 4, 02 2, 03 3, 04 6, 05 3, 06 4, 07 4; 24 for 166 if the ten new pages stayed out), a background command, up to seven at once (the page work is over; one pool place stays for the other projects):
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $REPO/.claude/worktrees/sic-int && node $RUN/slot.mjs run site-NN-k -- node tools/check-pages.mjs --base http://127.0.0.1:8850 --out $RUN/checks/int <that line's folders> > $RUN/checks/int-NN-k.log 2>&1; echo "EXIT=$?" >> $RUN/checks/int-NN-k.log`
-and one for `home` (and `famous` if the check lists it) the same way into `int-home.log`; each waited with `wait-log.mjs`. (Phase 0's whole-site check left `site-01.log` … `site-07.log` and `site-home.log` in `$RUN/checks/`: the `int-` names keep the two apart.)
-Expected: `cat $RUN/checks/int-0*.log | grep -c '^ok'` prints six times the animation pages (`git -C $REPO/.claude/worktrees/sic-int ls-files 'animations/*/*/index.html' | wc -l`: 1056 for 176 pages), `int-home.log` six `ok` per target, and `grep -h '^FAIL' $RUN/checks/int-*.log` prints nothing. A `FAIL` on a page: its finding file and `reopen` (as Task 10, Step 4), and the fix lands by Task 10, Step 6 (on one of the ten new pages: their own plan's fix loop, then `feat/ten-animations` merged into `feat/see-inside-compare` again as in Step 1); then, in the lane, the late fixes and the sitemap written again (a conflict on a generated file: take either side, then write it again with its tool):
-```bash
-cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/sic-int
-git merge --no-ff feat/see-inside-compare -m "Merge the late fixes into the integration lane"
-node tools/update-sitemap.mjs && (git diff --quiet -- sitemap.xml || git commit -q -m "chore: the sitemap written again after the late fixes" -- sitemap.xml)
-```
-and that part again.
-
-- [ ] **Step 8: The ledger**
-
-Append: `Integration lane ready at <sic/int head>: gate flipped, docs, sitemap; whole site <count> ok, 0 FAIL; home ok`. Task 13 reviews it.
-
----
-
-### Task 13: Final review, parts 8 and 9, and the integration merged
-
-**Files:** worktree `.claude/worktrees/fr-08` (detached at the head of `sic/int`, port 8848); `$RUN/final/part-08.md`, `$RUN/final/part-09.md`, `$RUN/kit/gallery-ten/`; fixes as new commits on `sic/int`; the merge of `sic/int` into `feat/see-inside-compare`.
-
-**Interfaces:**
-- Consumes: Task 12's lane (`sic/int`) and logs (`$RUN/checks/int-*.log` and the screenshots in `$RUN/checks/int/`); the ten new animations' own plan (its run folder `.superpowers/sdd/<its start date>-ten-animations/`, with each new page's brief and reports, and its fix loop).
-- Produces: the shared files, tools, tests, docs and generated files reviewed with no Critical or Important item left (part 8); the ten new pages reviewed against the twelve acceptance lines and beside their categories (part 9); `sic/int` merged; ledger line `Integration merged at <hash>`.
-
-- [ ] **Step 1: The frozen checkout**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-git -C $REPO worktree add --detach $REPO/.claude/worktrees/fr-08 sic/int
-```
-Start its server on 8848 as a background command.
-
-- [ ] **Step 2: The part-8 reviewer, and part 9 for the ten new pages**
-
-One fresh agent (opus) with this prompt:
-
-```text
-You do part 8 of the final review of the Animation Handbook's See inside and Compare rollout: everything but the pages
-themselves. The integration is frozen in the detached checkout C:/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/fr-08
-(served at http://127.0.0.1:8848/). Change no file in the repository, start no agents, never open the browser pane. RUN is
-the run folder .superpowers/sdd/2026-10-13-see-inside-compare/ of the main checkout. Read: CLAUDE.md as the checkout has it;
-docs/superpowers/specs/2026-10-13-see-inside-compare-rollout-design.md (all of it, section 6 above all) and
-docs/superpowers/specs/2026-10-13-next-projects-coordination.md. Check, with `git -C <checkout> diff main...HEAD` limited to
-each path:
- 1. assets/css/demo-page.css and assets/js/demo-page.js: every change since main is one the spec or the owner asked for,
- with its test; tests/demo-page.test.js and tests/pages.test.js pin them; the final gate reads `const SWITCHED = steps;`.
- 2. tools/check-pages.mjs: the mode path, the do-it path, the caption, id and name checks, the hold of endless CSS
- animations and the 30 s run wait, as their comments say, and nothing else changed for pages without the switch.
- 3. The version: `git -C <checkout> grep -h -o 'demo-page\.\(css\|js\)?v=[0-9]*' -- '*.html' | sort | uniq -c`: one number
- for the stylesheet on every animation page, the same number for the script there and on the home page.
- 4. The docs: every item of spec section 6 is there, in plain words, matching what the pages do: CLAUDE.md (the Watch step,
- the See inside and Compare part, the line limit, step 3 of a new animation, the page check's modes, the checklist line),
- CONTRIBUTING.md (its six places), the PR template (two lines), the README's step 2 sentence, one CHANGELOG line.
- 5. Generated files: sitemap.xml written again (dates moved); llms.txt and skills/ as main has them, apart from what came
- in through a merge (`git diff main...HEAD --stat -- llms.txt skills` shows only main's own changes and the ten new
- animations' entries, from the merge of feat/ten-animations).
- 6. Nothing else outside animations/ changed: `git diff --stat main...HEAD -- . ':!animations'` lists only the files above,
- the sitemap and what main's merges and the merge of feat/ten-animations brought (that project's own files: the home
- page's cards and counts, the READMEs, 404.html, the issue template, og-image.png, its test entries); no file of
- .superpowers/ or .claude/ is tracked.
- 7. The whole-site logs RUN/checks/int-*.log: six ok per page (176 pages with the ten new ones), home ok, no FAIL.
- 8. The merge of feat/ten-animations: every count says 176 where that project writes one, and the five pages that gained
- a Next link (02.14 Shatter Effect, 03.16 Cube Transition, 04.41 Dynamic Island, 06.26 Infinite Zoom, 07.23 Game of
- Life) kept both projects' lines.
-Write RUN/final/part-08.md: first line "RESULT: approved" or "RESULT: changes <count>", then the numbered items
-"[Critical|Important|Minor] what, where, why, and what would fix it". Reply with three lines.
-```
-
-Part 9, the ten new pages, beside it. First their gallery from the frozen checkout, as a background command:
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; cd $RUN && node slot.mjs run fr-09 -- node $KIT/record.mjs --base http://127.0.0.1:8848 --gallery --out $RUN/kit/gallery-ten animations/02-entrance-and-exit/ink-spread-reveal animations/03-page-transitions/pixelate-transition animations/04-micro-interactions/before-after-slider animations/04-micro-interactions/magnifier-lens animations/04-micro-interactions/card-deck-swipe animations/06-3d-advanced/water-ripple animations/06-3d-advanced/audio-visualizer animations/07-ambient-background/ken-burns animations/07-ambient-background/fire-effect animations/07-ambient-background/lightning > $RUN/kit/gallery-ten.log 2>&1; echo "EXIT=$?" >> $RUN/kit/gallery-ten.log`
-waited with `cd $RUN && node wait-log.mjs kit/gallery-ten.log`. Expected: `60 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed` (Normal, See inside and Compare at 1280 and 375 for each page; one gallery file per category in `$RUN/kit/gallery-ten/`). Then one fresh final reviewer (opus) with Task 11, Step 2's prompt, filled in for these pages: its first sentence names "the ten new animations, merged from feat/ten-animations: 02.15 ink-spread-reveal, 03.17 pixelate-transition, 04.42 before-after-slider, 04.43 magnifier-lens, 04.44 card-deck-swipe, 06.27 water-ripple, 06.28 audio-visualizer, 07.24 ken-burns, 07.25 fire-effect, 07.26 lightning"; the checkout is `fr-08` at the head of `sic/int`, served at http://127.0.0.1:8848/; each page's brief, build report and newest review come from the ten new animations' run folder (`.superpowers/sdd/<its start date>-ten-animations/`, where its ledger names them) in place of RUN/briefs and RUN/reports; its eight mode screenshots and Normal's from the whole-site check (`RUN/checks/int/<NN>-<slug>-…png`) in place of the category check's; its stills in `RUN/kit/gallery-ten/`; one more check, that each page reads like the other pages of its category (`RUN/kit/gallery-<NN>/` and `RUN/final/consistency-<NN>.md`); and its files `RUN/final/ten-<NN>-<slug>.md` (a page with a Critical or Important item), `RUN/final/minors.md` and `RUN/final/part-09.md`.
-
-- [ ] **Step 3: Fixes**
-
-For `RESULT: changes` in part 8: an agent (opus) fixes each item in `sic-int` (new commits; a shared file's fix test first; a page's fix goes through Task 10, Step 6 and is merged into `sic/int` as in Task 12, Step 7, the sitemap written again there), reruns the tests and the whole-site parts the fix can touch; the part-8 reviewer (resumed) re-checks on a new frozen checkout at the new head (`git -C $REPO worktree remove $REPO/.claude/worktrees/fr-08` and Step 1 again). For each `RUN/final/ten-<NN>-<slug>.md` of part 9: the ten new animations' own fix loop (the page's builder fixes it on its lane, its reviewer re-checks), `feat/ten-animations` takes the approved fix, the coordinator merges `feat/ten-animations` into `feat/see-inside-compare` as Task 12, Step 1 does and `feat/see-inside-compare` into `sic/int` as Task 12, Step 7 does (the sitemap written again there), and the part-9 reviewer (resumed) re-checks on a new frozen checkout. At most three rounds each; then the coordinator decides, as for a page.
-
-- [ ] **Step 4: Merge**
-
-When part 8's last verdict is `RESULT: approved` and every finding of part 9 (`$RUN/final/ten-*.md`) is fixed and merged into `sic/int` (Step 3):
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO && git status --short && git merge --no-ff sic/int -m "Merge integration: See inside and Compare on every animation page (the final gate, the docs, the sitemap)"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-node tools/make-skill.mjs && git status --short
-git -C $REPO worktree remove $REPO/.claude/worktrees/fr-08
-```
-Expected: an empty status before; `ℹ fail 0`; an empty status after. Stop the 8848 and 8850 servers. Ledger: `Integration merged at <hash>`.
-
----
-
-### Task 14: The owner's final look
-
-**Files (outside the repository):** `$RUN/rulings-all.json`, `$RUN/kit/final-gallery/<NN>/`, `$RUN/kit/final-clips/`.
-
-**Interfaces:**
-- Consumes: Task 13's merge; `pages.mjs rulings`; the kit; the owner's preview.
-- Produces: the owner's verdict in `$RUN/ledger.md`: publish, or the changes (each sent back through the page loop or a lane, then shown again).
-
-- [ ] **Step 1: The owner's preview**
-
-Start the preview of the main checkout (Claude Browser `preview_start` with the name `static-site`: `python -m http.server 8731` from `.claude/launch.json`; it opens the browser pane, where the owner looks). Check: `curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8731/animations/04-micro-interactions/drag-to-reorder/` prints `200`.
-
-- [ ] **Step 2: The gallery of every page**
-
-Seven background commands, one per category (the pool takes them as it can; each category folder holds its pages, the ten new ones included: 176 in all):
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; cd $RUN && node slot.mjs run kit-gallery-NN -- node $KIT/record.mjs --base http://127.0.0.1:8731 --gallery --out $RUN/kit/final-gallery/NN animations/<category folder> > $RUN/kit/final-gallery-NN.log 2>&1; echo "EXIT=$?" >> $RUN/kit/final-gallery-NN.log`
-Expected when all have ended: seven files `$RUN/kit/final-gallery/NN/gallery-NN.html`, each log `0 failed`.
-
-- [ ] **Step 3: Clips of two pages per category**
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; cd $RUN && node pages.mjs rulings > rulings-all.json && head -3 rulings-all.json`
-Then, as a background command (about half an hour):
-`REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit; cd $RUN && node slot.mjs run kit-final -- node $KIT/record.mjs --base http://127.0.0.1:8731 --before http://127.0.0.1:8800 --rulings $RUN/rulings-all.json --out $RUN/kit/final-clips --clean --keep-frames animations/01-scroll-based/snap-scrolling animations/01-scroll-based/scroll-image-sequence animations/02-entrance-and-exit/shatter-effect animations/02-entrance-and-exit/split-text-reveal animations/03-page-transitions/view-transitions-api animations/03-page-transitions/page-curl animations/04-micro-interactions/drag-to-reorder animations/04-micro-interactions/gooey-menu animations/05-text-typography/text-particles animations/05-text-typography/typewriter-effect animations/06-3d-advanced/cloth-simulation animations/06-3d-advanced/gpgpu-particle-system animations/07-ambient-background/fireworks animations/07-ambient-background/abstract-geometric-motion > $RUN/kit/final-clips.log 2>&1; echo "EXIT=$?" >> $RUN/kit/final-clips.log`
-Expected: `126 pictures, 42 clips and 42 comparisons made, 0 skipped, 0 failed` (Normal before and after at 1280, 375 and 320 for each of the fourteen pages, each line giving the stage and Try it). (The coordinator may swap a page for one the final review found more on; two per category either way.)
-
-- [ ] **Step 4: The coordinator looks first**
-
-Read, with the Read tool, the 1280 See inside and Compare stills of every page in the seven galleries, and one frame from the middle of each clip (the kept frame folders; delete them after). Anything that does not read from the picture alone goes back as a fix round (a finding file and `reopen`) before the owner sees it.
-
-- [ ] **Step 5: Show the owner**
-
-Navigate the browser pane to a few pages (one per category, starting with `/animations/04-micro-interactions/drag-to-reorder/`). Send the owner, in very short plain words: that every page, all 176 with the ten new animations, now has See inside and Compare; the path of the seven gallery files and of `$RUN/kit/final-clips/index.html` (they open from disk); that the pages are open in the browser pane; the list in `$RUN/final/minors.md` and the "For the owner's final look" lines of `brief-rulings.md`, each in one line; the next launch post's date (coordination file, rule 7); and one question: "Publish See inside and Compare on all pages, with the ten new animations, now, or change something first?" Nothing is pushed.
-
-- [ ] **Step 6: The owner's answer**
-
-Write it in the ledger. A change to pages goes back through the page loop (a finding file per page, `reopen`, Tasks 8 to 10; for one of the ten new pages, their own plan's fix loop and `feat/ten-animations` merged in again as in Task 12, Step 1), a shared change through a lane like `sic/00i` with its version number; then Steps 2 to 5 for the changed pages, until the owner says publish. Ledger: `Owner approved See inside and Compare and the ten new animations for release on <date>`.
-
----
-
-### Task 15: Release on the owner's word, and the clean-up
-
-**Files:** `main` (in the release worktree), pushed; every rollout worktree, branch, server and temp folder removed.
-
-**Interfaces:**
-- Consumes: Task 14's approval; the coordination file's merging and releasing rules.
-- Produces: the rollout and the ten new animations live together on GitHub Pages; the machine clean; the ledger's last line.
-
-- [ ] **Step 1: The day**
-
-From 2026-10-23 to 2026-10-26 nothing merges into `main` without the owner's explicit word for that day (coordination file, rule 7). The owner's word for this release is in the ledger with its date.
-
-- [ ] **Step 2: `main` into the branch once more**
-
-If `main` moved since Task 12, Step 2 (`git -C $REPO log --oneline feat/see-inside-compare..main | wc -l` is above `0`): repeat Task 12, Step 2, then the tests, `home` and `famous`.
-
-- [ ] **Step 3: Merge into `main` in the release worktree, check, push**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-git -C $REPO worktree list | grep -c "/release "
-```
-If `0`: `git -C $REPO worktree add $REPO/.claude/worktrees/release main`. Then:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO/.claude/worktrees/release && git status --short && git branch --show-current
-git merge --no-ff --no-commit feat/see-inside-compare
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-[ -d famous ] && node tools/make-famous.mjs
-git add -A -- sitemap.xml llms.txt skills $([ -d famous ] && echo famous) && git status --short | head
-git commit -m "Merge See inside and Compare on every animation page, and the ten new animations"
-node --test --test-reporter=spec "tests/*.test.js" 2>&1 | grep -E "^ℹ (pass|fail)"
-```
-Expected: `main`; `ℹ fail 0`. Start, as a background command, `cd /c/Users/matin/OneDrive/Desktop/Projects/animation-handbook/.claude/worktrees/release && python -m http.server 8990 --bind 127.0.0.1`, then `home` (and `famous`) through the pool against 8990: six `ok` each. Then `git -C $REPO/.claude/worktrees/release push origin main`.
-
-- [ ] **Step 4: Live**
-
-A few minutes after the push: `curl -s https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/drag-to-reorder/ | grep -c data-hb-modes` prints `1`, and the same for a new page, `…/animations/07-ambient-background/lightning/` (try again for up to ten minutes while GitHub Pages builds). Tell the owner it is live, in one line. Ledger: `Live at <main hash> on <date>`.
-
-- [ ] **Step 5: Clean-up**
-
-Stop every server of this plan (8800, 8801–8850, 8990, 8731 if the owner is done). Then:
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook
-cd $REPO
-for w in $(git worktree list --porcelain | sed -n 's/^worktree //p' | grep -E '/\.claude/worktrees/(sic-|fr-)'); do git worktree remove "$w"; done
-for b in $(git branch --format='%(refname:short)' | grep '^sic/'); do git branch -d "$b"; done
-git worktree list | grep -cE '/(sic-|fr-)'
-```
-Expected: `0` (every `sic/` branch is merged, so `-d` takes each; one that is not: stop and look). The run folder stays (it is the record). Ask the owner before removing the temp folders: list them with their sizes (`du -sh "$TEMP"/hb-chrome-* "$TEMP"/hb-kit-* "$TEMP"/sic-run-* "$TEMP"/sic-repo-* "$TEMP"/sic-pool-* 2>/dev/null | tail -20`: the page check's and the kit's Chrome folders, and those of the tracker's and the pool's tests), and remove them on the owner's OK. Last ledger line: `Done: See inside and Compare live on every page, with the ten new animations; worktrees and branches removed`. The next project follows the coordination file's order: the tab pass (the ten new animations went live with this release).
-
----
-
-## Self-review
-
-**Spec coverage (the 159 pages, integration, the final review, the owner's look, release):**
-
-| Spec requirement | Task |
-|---|---|
-| §3 the owner approves the first batch or asks for changes; changes applied (a shared one with one more bump) before the rest starts | Task 1 (with the previous plan's Task 14, Step 6) |
-| §3 "while the owner looks, the leads write the other 159 briefs (no code)" | Task 3 (checking them; the rulings given while they were written stand); Tasks 0, 2, 4, 5 also run then |
-| §2 the brief from the survey row; the builder treats it as a suggestion; tuning from the mode screenshots; Normal before and after | Task 3; Task 7's template (steps 3, 6, 7) and G2 |
-| §1 the switch, notes, listener rules, copies, captions, reduced motion, phones; the twelve acceptance lines | Global Constraints; Task 7's template; Task 8's review template (the twelve lines with evidence) |
-| §2 hard cases: canvas and WebGL, second worlds, do-it pages, reduced motion that erases Compare, random pieces, "Shows the …" switches, "Without" settings, your text, Snap Scrolling, flash safety, twins | Global Constraints (copies, motion); Task 3's checklist (item 8) and twins check; the slot table (second worlds first, twins together); Task 8's review step 5 |
-| §2 weak views (rows marked \*) | Task 3's checklist (item 3) |
-| §7 one builder, then one fresh reviewer (never the builder), both on the strongest model; at most three fix rounds, then escalation (a design question: the coordinator decides and the owner judges the built page, asked mid-run only when no option meets the spec) | Global Constraints (Agents); Tasks 7, 8; the tracker's three-round limit; Task 9, Step 5 |
-| §7 slots: 20 (01 three, 02 two, 03 two, 04 four, 05 two, 06 four, 07 three), worktrees `sic-<NN><x>`, ports from 8801, one commit per page touching only its `index.html` (and its README where a ruling says so: Zoom Transition's, the one exception, in the ledger), twins share a slot, hard and heavy first | "The slots"; Task 6; Task 7's template (steps 10, 11); `check-slots.mjs` |
-| §7 the lead merges a slot when its pages so far are approved, into `sic/cat-NN`, with the tests and the category's page check; the coordinator merges categories | Task 10 (`mergeable` never cuts a page; tests and the skill at every merge; the whole category checked once it is complete) |
-| §7 machine: eight checks at once for every project, `slots/slot-1…8`, headless only, one server and scratch folder per slot, no `git stash`, temp folders removed with the owner's OK, the main checkout never switched; on a usage limit the finder and Famous effects pause first | Global Constraints (Machine); "Agents and Chrome"; Task 9, Steps 4 and 6; Task 15, Step 5 |
-| §7 integration: merge, the final gate, the tests, `home`, `famous`, the whole site, `make-skill` unchanged, `update-sitemap`, the docs | Task 12 (which first merges in `feat/ten-animations`: the coordinator's ruling) |
-| §7 the final review in eight parts on frozen detached checkouts, each started as its category lands; builders fix their own findings | Task 11 (parts 1 to 7, split into groups of at most ten pages plus a consistency pass), Task 13 (part 8; part 9 for the ten new pages) |
-| §7 the owner's final look: the gallery of every page (176 with the ten new animations), clips of two pages per category, the site served locally | Task 14 |
-| §7 published on the owner's word, all at once (with the ten new animations), by the coordination file's release rule | Task 15 |
-| §6 docs: CLAUDE.md (Watch step, the new part, line limit, step 3, the page check, the checklist), CONTRIBUTING.md, the PR template, README step 2, CHANGELOG; sitemap; skill unchanged | Task 12, Steps 5 and 6; Task 13 checks them |
-| §4 item 7: after the first batch, a lane needing a shared change writes it in its ledger; the coordinator applies them at integration with one more bump | Global Constraints (Version); `shared-wishes.md`; Task 12, Step 3 |
-| The previous plan's "After this plan": the verdict applied first; slots and `sic/cat-NN` take the branch's head; the briefs with the hard cases; the slot lists; the known risks (endless CSS animations, idle timers, runs held in frame loops, snapping, four labels on phones, pages past 300 lines); integration | Task 1; Task 6 (fresh slots from the head); Task 3; "The slots"; the page check's hold (Phase 0), Task 5 (the kit's hold), Task 4 and `lessons.md`; Task 12 |
-| Coordination: branches, ports, the file map, versions, merges with `--no-ff`, main merged in before a release, generated files never merged by hand, the launch-post window | Global Constraints (Places, Merges); "Who touches which file"; Task 0 (the coordination file's Order, branches and ports); Task 12, Steps 1 and 2; Task 15 |
-
-**Placeholder scan:** every code step shows its code (the tracker, its tests, the slot table, the checkers, the probe, the kit's hold, the learning path's guard); the prompt templates are complete, and their `{{…}}` names are the tracker's values (Task 2, Step 10 fills them and finds none left); the `<…>` marks in commands and prompts are the coordinator's inputs of the moment (a page number, a hash, a port from the tables), each named where it comes from.
-
-**Names used across tasks:** `pages.mjs` (`init`, `show`, `dispatch`, `started`, `done`, `set`, `addslot`, `move`, `mergeable`, `merged`, `reopen`, `parts`, `running`, `servers`, `rulings`), its states (`queued`, `building`, `built`, `reviewing`, `changes`, `fixing`, `fixed`, `rereviewing`, `approved`, `merged`, `blocked`) and report files (`build.md`, `review-<n>.md`, `fix-<n>.md`, `…-prompt.md`); `wait-log.mjs`, `check-slots.mjs`, `extract-prompts.mjs`, `probe.mjs` (`add`, `read`); `slot.mjs run` (previous plan); `record.mjs` with `--base`, `--before`, `--out`, `--clean`, `--keep-frames`, `--only`, `--press`, `--gallery`, `--rulings` (previous plan) and `--short` (Phase 0's kit round 4); `SWITCHED` (the final gate); `G1`–`G5` (brief-rulings.md); `R<k>` (rulings-159.md). The run folder `$RUN`, the kit `$KIT` and the fixtures `$FX` are the same paths in every task.
diff --git a/docs/superpowers/plans/2026-10-14-ten-new-animations.md b/docs/superpowers/plans/2026-10-14-ten-new-animations.md
deleted file mode 100644
index b9f08c7f..00000000
--- a/docs/superpowers/plans/2026-10-14-ten-new-animations.md
+++ /dev/null
@@ -1,7014 +0,0 @@
-# Ten New Animations Implementation Plan
-
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
-
-**Goal:** Add the ten new animations of `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md` (166 → 176 pages), each with Normal · See inside · Compare from the start, their home cards and previews, lists, counts and generated files, ready to go live together with the See inside and Compare rollout on the owner's word.
-
-**Architecture:** One lane per page, all ten at once as seats allow: lane *n* works on branch `ten/L<n>` in worktree `.claude/worktrees/ten-L<n>`, served on port `8960 + n`, cut from `feat/ten-animations`, which Task 0 cuts from `feat/see-inside-compare` as soon as the rollout's Phase 0 is merged into it. A lane applies its shared edits with a run-folder tool (`lanes.mjs`), writes its page, README and home preview from the complete code in its task, writes the generated files with the repository's tools, and passes the tests, its page check, the review kit's short screens and the home check before a reviewer approves it. Integration (Task 11, worktree `ten-int`, port 8971) merges `feat/see-inside-compare` again, then the ten lanes in table order (a run-folder tool settles the expected overlaps), links the split sections, sets every count to 176 and adds the test entries with another run-folder tool, and runs every check. A final review on a frozen checkout (`ten-rev`, port 8972) and the owner's look follow (Task 12); the rollout's own plan then merges the branch in, and both go live together on the owner's word.
-
-**Tech Stack:** Plain HTML, CSS and vanilla JavaScript (canvas 2D, SVG, CSS transforms, Web Audio behind one button); Node 22+ (`node --test`, the run-folder tools); the page check `tools/check-pages.mjs` and the rollout's review kit (`record.mjs`) in headless Chrome through the machine's pool (`slot.mjs`, waited on with `wait-log.mjs`); Python's static server.
-
-**Every page in this plan was built and checked before the plan was written,** in scratch copies of the site made from `feat/see-inside-compare` at `d810bce` with the rollout plan's Phase 0 Tasks 2, 3, 4 and 6 applied as that plan wrote them (the shared files at `?v=10`, the page check's do-it path, run waits, rest and caption checks, the switch tests): with its lane's shared edits, each page passed the tests, six `ok` lines of the page check, the review kit's 27 short-screen pictures with no label cut or overlapping, the home check and the check of the old last page it links, and its clips of Normal, See inside and Compare were read frame by frame; then the ten lanes were merged in order with Task 11's commands as written, and the result passed the tests and the page check of all ten pages, the five old last pages, the pages whose See also changed and the home page. Each lane's first five steps (its shared edits, page, README, preview and generated files, then the tests) and Task 11's merges and edits were run again on a copy of `feat/see-inside-compare` at `fce3a2b` (Phase 0, the first batch and the Animation finder merged) and on a copy of `feat/ten-animations` at `ece2689` (Famous effects too): every lane `ℹ fail 0` (1717 pass on `ece2689`), and the integration 1825 pass, 0 fail. Two pre-flight reviews and a re-review (`plan-review-A.md`, `plan-review-B.md`, `plan-rereview.md` in the run folder) were applied, and the changed pages checked again (`plan-fixes.md`). Each task's expected output comes from those runs. The real branch differs from that copy (the rollout's later commits, such as `sic/00f`'s help line and Task 3's review rounds): Task 0 writes the differences in the ledger, and a lane reads its first `FAIL` against them and tunes the page as its steps say.
-
-## Global Constraints
-
-- **CLAUDE.md governs every page** as it reads after the rollout's Phase 0; the rollout spec's section 1 and its acceptance list (`2026-10-13-see-inside-compare-rollout-design.md`) govern both views; where the ten-animations spec and the coordination file disagree, the coordination file (`2026-10-13-next-projects-coordination.md`) wins.
-- **The rollout's lessons and rulings bind these pages too**, since the rollout's final review (part 9) judges them by them: `$RUN/lessons.md` (lessons 1 to 21), `$RUN/briefs/RULINGS.md` (rulings 1 to 7), `$RUN/brief-rulings.md` (G1 to G11), `$RUN/briefs/OPEN-QUESTIONS.md` and `$RUN/rulings-159.md` (the owner approved the first batch on 2026-10-15 with no rules). Every builder and reviewer reads them first. A rule the owner gives later is applied to the ten pages, through the lanes' fix loop, before integration (Task 11 Step 1, Task 12 Step 7).
-- **One animation = one folder** `animations/<category>/<slug>/` holding exactly `index.html` and `README.md`. No build step, no frameworks, no npm packages, no external dependencies. Pictures are drawn in the page (inline SVG, CSS or canvas commands); no image, sound or font file is added; made-up names only, no real brand, place or person.
-- **About 300 lines for the demo plus about 150 for its two views** (the line counts in each task: 306 to 416).
-- **Shared files:** `../../../assets/css/demo-page.css?v=N` and `../../../assets/js/demo-page.js?v=N` (defer), after the page's own `<style>`, with N the number the branch's pages use (10 when this plan was written; Task 0 writes it in the ledger, and a lane's Step 2 sets it); Task 11 sets the ten pages to the number the other pages use by then. **This plan never changes a shared file or the version:** a need for a shared change goes in the builder's report, and the coordinator appends it as one line to `$RUN/shared-wishes.md` (page, file, what and why, with one `printf … >>`), which the rollout's integration applies with its next number.
-- **The switch and the notes, exactly:** `<div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>` with Normal (`class="on" aria-pressed="true"`), See inside, Compare, between the Watch heading and the stage; right after the player bar `<div class="hb-mode-notes" aria-live="polite">` holding `<p data-hb-for="inside" hidden>` then `<p data-hb-for="compare" hidden>`, each one or two sentences of at most 35 words (RULINGS 1); a note says left and right only where the halves never stack; a note stays true after every press and setting (lesson 16: under reduced motion "Shown still" only while paused).
-- **The `hb:mode` listener** sits at the top level of the page's script, draws the mode at once, never scrolls, moves focus, presses a control, stops Play or changes Pause; mode CSS starts `.stage[data-hb-mode="inside"]` or `.stage[data-hb-mode="compare"]`; no rule on `[data-hb-mode="normal"]`; no class exactly `lbl`.
-- **Captions** carry `data-hb-caption`, are at least 12px as drawn and 4.5:1, sit inside the stage, never overlap each other, at most six (four on phones), also on the kit's short screens (lesson 12); where the stage, its canvas or picture has an `aria-label`, it changes with the mode.
-- **Owner rulings (2026-10-13):** a press of See inside or Compare plays the demo once (Show me on the do-it pages, Replay on Ink Spread Reveal), never under reduced motion, and the loops are never pressed; on phones the box keeps its size in every mode; Audio Visualizer is silent by default and its Hear it button plays a beat the browser makes (no file, no microphone, no AudioContext before the press).
-- **Do-it pages:** Show me runs two to four seconds with its pauses held by `setTimeout` and ends at rest on exactly the picture it started from; `hb:input` and a trusted `focusin` in the stage stop a run; Normal at rest is never posed (G4). **Loops:** Pause freezes the stage at once; going back to Normal gives back the first picture. **Frame loops** move by elapsed time (`FRAME=1000/60`, `dt` at most 50 ms); Fire Effect and Water Ripple take fixed steps from an accumulator; reduced motion is read inside every frame loop. **Compare's halves** differ in one idea only (lesson 17, G9), and each half stays inside its half (lesson 14).
-- **What a lane changes:** its folder; the home page's card (`CATS`), `PLACES` row, `PV` key, its preview (CSS at the end of its section's bespoke block, a `case` in `pvMarkup()`, a `STILL` point where needed) and its `FIND` row (the finder is on the branch since `fce3a2b`); every written count set to 167 and its section's count plus one; the root README's catalog line and the category README's line (and 06's Browser requirements or 07's Implementation summary); the generated files by their tools; and, for the first lane of a section (L1, L2, L3, L6, L8), the old last page's Next link. **Never:** `assets/`, `tests/` (a proof edit is put back with `git checkout`), `tools/`, `CLAUDE.md`, `CONTRIBUTING.md`, `og-image.png`, `docs/`, or any other page.
-- **Counts:** 167 in each lane; 176 (02: 15, 03: 17, 04: 44, 06: 28, 07: 26) only at integration. **Generated files** (`sitemap.xml`, `llms.txt`, `skills/animation-handbook/`, `og-image.png`, the marked blocks of `famous/index.html`) are never merged by hand: after any merge take either side, run `node tools/update-sitemap.mjs`, `node tools/make-skill.mjs`, `node tools/make-famous.mjs` once `famous/` exists, and (the coordinator only) `node tools/make-social-image.mjs`.
-- **Agents:** only the coordinator starts agents, by the rollout's seat count (`seats = 20 − running − 1`; reviews and fix rounds before new lanes, new work taking turns with the rollout's); every builder and reviewer runs on the strongest model; agents start no agents and never open the browser pane. A builder writes only in its worktree, `$TEN/checks/L<n>/` and `$TEN/reports/L<n>/`; a reviewer only in `$TEN/reports/L<n>/`. Each writes its report as a file whose first line is `RESULT: built <commit>`, `RESULT: approved` or `RESULT: changes <count>`, and replies in at most three lines. **Only the coordinator writes `$TEN/ledger.md`**, from those files.
-- **Machine:** every Chrome run (page check, review kit, frame times) goes through the pool (`node $RUN/slot.mjs run <who> -- <command>`; at most eight at once on the machine), each as its own background command with its output in a log ending in an `EXIT=<code>` line, waited on with `node $RUN/wait-log.mjs <log>` (again while it says `still running`); headless Chrome only, never the browser pane (the owner's); the coordinator starts and stops each worktree's one server; no `git stash`; no `git config` (a setting a command needs goes on that command, `git -c …`); leftover `hb-chrome-*` temp folders removed only with the owner's OK. The main checkout stays on `feat/see-inside-compare` and is never switched.
-- **Every command block** starts with the shell variables below, and every `cd` is written `cd <path> || exit 1`, so a step can never fall back to the main checkout.
-- **Git:** merge, never rebase or squash; nothing is pushed; release only on the owner's word, together with the rollout.
-- **Words:** no code on the pages, plain labels and hints, American spelling, no hype ("stunning", "amazing", "powerful").
-
-**Shell variables** (Git Bash), at the top of every command block:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-```
-
-`$RUN` holds the machine's check pool (`slot.mjs`, `wait-log.mjs`) and the rollout's lessons and rulings; `$TEN` is this project's run folder (the coordinator made it for the plan's reviews; Task 0 adds the tools, the ledger and the folders for briefs, checks and reports). Lane *n*'s worktree is `$REPO/.claude/worktrees/ten-L<n>`, served on port 8960 + n (L10: 8970); integration's `ten-int` on 8971 and the final review's `ten-rev` on 8972.
-
----
-
-## Phases and parallel work
-
-| Phase | Tasks | Runs | Waits for |
-|---|---|---|---|
-| A | Task 0 (coordinator): branch, the owner's answer on the finder and Famous effects, run folder and its four tools, every lane's shared edits tried, the finder rows' check, ten worktrees | alone, about 1 hour | the rollout's Phase 0 merged into `feat/see-inside-compare` |
-| B | Tasks 1 to 10, one lane each (a builder, then a reviewer) | as many at once as the seat count allows; their Chrome runs share the pool of eight; lanes of one section (04: L3, L4, L5; 06: L6, L7; 07: L8, L9, L10) never wait for each other | Task 0 |
-| C | Task 11 (the coordinator runs the merges) | alone | all ten lanes approved, and every ruling that landed since applied |
-| D | Task 12: the final review in three parts at once, fixes by the lanes' builders, the whole-site check in parts, the owner's look, the hand-over to the rollout | parts at once | Task 11 |
-
-The pages are written in full in Tasks 1 to 10, so a lane's builder applies and verifies rather than designs; the slow part of a lane is its checks and review. Expect about 1.5 to 2.5 hours a lane with its review and kit runs, the lanes overlapping as seats allow; integration 1 to 2 hours; the final review and fixes 3 to 4 hours; the whole-site check about 1.5 hours (or the rollout's own, after the merge).
-
-## File structure
-
-| Path | Made by | What it is |
-|---|---|---|
-| `animations/02-entrance-and-exit/ink-spread-reveal/{index.html,README.md}` | Task 1 | 02.15, plays once (Replay, Loop, Slow motion `css`); SVG mask of growing blots |
-| `animations/03-page-transitions/pixelate-transition/{index.html,README.md}` | Task 2 | 03.17, do it (Show me, Reset, Slow motion); canvas drawn small and scaled up |
-| `animations/04-micro-interactions/before-after-slider/{index.html,README.md}` | Task 3 | 04.42, do it; a sliding window and two transforms |
-| `animations/04-micro-interactions/magnifier-lens/{index.html,README.md}` | Task 4 | 04.43, do it (Show me, Slow motion); a lens holding a bigger vector copy |
-| `animations/04-micro-interactions/card-deck-swipe/{index.html,README.md}` | Task 5 | 04.44, do it; a pile of cards with a pivot below |
-| `animations/06-3d-advanced/water-ripple/{index.html,README.md}` | Task 6 | 06.27, do it; a two-grid wave simulation on a small canvas |
-| `animations/06-3d-advanced/audio-visualizer/{index.html,README.md}` | Task 7 | 06.28, loop (Pause, Slow motion) with Hear it |
-| `animations/07-ambient-background/ken-burns/{index.html,README.md}` | Task 8 | 07.24, loop in CSS (Pause `css`, Slow motion `css`) |
-| `animations/07-ambient-background/fire-effect/{index.html,README.md}` | Task 9 | 07.25, loop (Pause, Slow motion); a heat grid on small canvases |
-| `animations/07-ambient-background/lightning/{index.html,README.md}` | Task 10 | 07.26, loop (Pause, Slow motion); bolts on a canvas |
-| `index.html` (home) | Tasks 1-10 (by `lanes.mjs` and each preview step), Task 11 (counts, `FIND`) | cards, `PLACES`, `PV`, previews, `STILL`, `FIND`, counts |
-| `README.md`, `animations/{02,03,04,06,07}-*/README.md`, `.github/ISSUE_TEMPLATE/config.yml`, `404.html` | Tasks 1-10 (`lanes.mjs`), Task 11 (`integrate.mjs`) | catalog and list lines, counts |
-| The old last pages `shatter-effect`, `cube-transition`, `dynamic-island`, `infinite-zoom`, `game-of-life` (`index.html`) | Tasks 1, 2, 3, 6, 8 (`lanes.mjs`) | the first Next link |
-| The new pages' pager lines | Task 11 (`integrate.mjs`) | the split sections linked |
-| `tests/pages.test.js` (`KEYBOARD_PAGES`, `PHONE_DEFAULTS`), `tests/finder.test.js` (case 9, if present) | Task 11 (`integrate.mjs`) | test entries |
-| Nine existing pages' `README.md` See also (one line each, as the coordination file's map now says), six See also lines between new pages, `CHANGELOG.md` | Task 11 (`integrate.mjs`) | links to and between the new pages, the Unreleased line |
-| `sitemap.xml`, `llms.txt`, `skills/animation-handbook/`, `og-image.png`, `famous/index.html` blocks | the tools, after every change and merge | generated |
-| `$TEN/lanes.mjs`, `$TEN/frametimes.mjs`, `$TEN/resolve.mjs`, `$TEN/integrate.mjs`, `$TEN/ledger.md`, `$TEN/briefs/`, `$TEN/checks/`, `$TEN/reports/`, `$TEN/final/` | Task 0 (tools, ledger), the lanes and reviewers (checks, reports), Task 12 (final) | run folder (not in the repository) |
-
----
-
-### Task 0: Branch, the owner's answer, run folder and its tools, every lane tried, the finder rows' check, ten worktrees (coordinator)
-
-**Files:**
-- Create (run folder, not in the repository): `$TEN/lanes.mjs`, `$TEN/frametimes.mjs`, `$TEN/resolve.mjs`, `$TEN/integrate.mjs`, `$TEN/ledger.md`, `$TEN/briefs/`, `$TEN/checks/`, `$TEN/reports/`
-- Create (git): branch `feat/ten-animations` from `feat/see-inside-compare`; branches `ten/L1` … `ten/L10` with worktrees `.claude/worktrees/ten-L1` … `ten-L10`
-- Test: ten scratch exports of `feat/ten-animations` outside the repository (`lanes.mjs` on each, the tests on one); a scratch export of the branch that holds the finder (`integrate.mjs --finder-check`, then `tests/finder.test.js`)
-
-**Interfaces:**
-- Consumes: the rollout's Phase 0 merged into `feat/see-inside-compare` (the shared files at `?v=10` or later, `setUpModes` pressing Replay or Show me after a mode press, the page check's `restShot`, `waitForRun` and `captionProblems`, the switch tests; its ledger line `Phase 0 done at …`); the machine pool `$RUN/slot.mjs` and `$RUN/wait-log.mjs`; the rollout's lessons and rulings.
-- Produces: `node $TEN/lanes.mjs <n> <root>` (lane *n*'s shared edits; exports `LANES`, `apply(n, root, total = 167)`, `nextLink(slug, title)`; refuses a second run on the same tree); `node $TEN/frametimes.mjs --base <url> [--phone] [--modes normal,inside,compare] <page folder>` (frame times with the CPU slowed four times); `node $TEN/resolve.mjs <file>...` (settles a lane merge's overlaps; exit 1 when one is left for a person); `node $TEN/integrate.mjs <root> [--finder-check]` (the integration's edits); `$TEN/ledger.md` (one line per event, `YYYY-MM-DD HH:MM L<n>|int|coord what happened`, written by the coordinator only); the shared-file version `N` and the base's differences in the ledger.
-
-- [ ] **Step 1: Check that Phase 0 is merged, and read the version**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-grep -c "^Phase 0 done at" $RUN/ledger.md
-git -C $REPO show feat/see-inside-compare:animations/01-scroll-based/parallax-scrolling/index.html | grep -o 'demo-page\.css?v=[0-9]*'
-git -C $REPO show feat/see-inside-compare:tools/check-pages.mjs | grep -c 'async function captionProblems'
-git -C $REPO show feat/see-inside-compare:index.html | grep -c '^const FIND={'
-git -C $REPO show feat/see-inside-compare:tools/make-famous.mjs > /dev/null 2>&1 && echo "famous: on the branch" || echo "famous: not on the branch"
-grep -c "^First batch approved by the owner on .*rulings-159\.md:" $RUN/ledger.md
-ls $RUN/slot.mjs $RUN/wait-log.mjs $RUN/lessons.md $RUN/briefs/RULINGS.md $RUN/brief-rulings.md $RUN/briefs/OPEN-QUESTIONS.md $RUN/rulings-159.md
-```
-
-Expected (each checked on 2026-10-15): `1` (the rollout's ledger line `Phase 0 done at 513be66; shared files frozen at v=10`, written at the start of a line); `demo-page.css?v=N` with N of 10 or more (10 then; write N down: the lanes set it in their pages); `1`; `1` (the Animation finder is live and `main` was merged into the rollout at `fce3a2b`, so the branch has `const FIND={` and each lane adds its own `FIND` row; `0` would mean it is not there); `famous: not on the branch` (until Famous effects goes live: Step 2); `1` (the owner approved the first batch on 2026-10-15 with `rulings-159.md: 0 rules`); the seven paths. If the first or third prints `0`, Phase 0 is not merged yet: stop and wait.
-
-- [ ] **Step 2: Famous effects: the owner's answer**
-
-The Animation finder is live and on `feat/see-inside-compare` (Step 1), so only Famous effects can be open. If Step 1 printed `famous: on the branch`, go to Step 3. Otherwise the coordination file's rule applies: the coordinator asks the owner whether the ten pages wait for Famous effects or take it in (it then goes live with them), and writes the answer in the ledger once Step 4 has made it. Then:
-- **Wait:** stop here until `main`, with Famous effects live, has been merged into `feat/see-inside-compare` (coordination rule 4); then Step 1 again, and Step 3.
-- **Take it in:** Step 3a, right after Step 3 and before Step 4 (Step 4's ledger line and Step 5's tries read the branch with it in); the lanes are cut after it.
-
-- [ ] **Step 3: Track this plan, then cut the branch (the main checkout stays where it is)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-P=docs/superpowers/plans/2026-10-14-ten-new-animations.md
-[ "$(git -C $REPO rev-parse --abbrev-ref HEAD)" = feat/see-inside-compare ] || exit 1
-git -C $REPO ls-files --error-unmatch $P > /dev/null 2>&1 && echo "plan tracked already" || { git -C $REPO add -- $P && git -C $REPO commit -m "docs: the ten new animations' plan" -- $P; }
-git -C $REPO branch feat/ten-animations feat/see-inside-compare
-git -C $REPO log --oneline -1 feat/ten-animations
-git -C $REPO rev-parse --abbrev-ref HEAD
-```
-
-Expected: `plan tracked already` or one commit of this plan alone (the rollout's integration expects an empty status in the main checkout, and the lanes read the plan from there); then that commit as the tip of `feat/ten-animations`, then `feat/see-inside-compare` (the main checkout was not switched).
-
-- [ ] **Step 3a (only on "take it in"): merge Famous effects into `feat/ten-animations`**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-git -C $REPO worktree add $REPO/.claude/worktrees/ten-int feat/ten-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = feat/ten-animations ] || exit 1
-git -c merge.conflictStyle=diff3 merge --no-ff --no-commit feat/famous-effects; git status --short | grep -E '^(UU|AA|DU|UD) ' || echo "no conflicts"
-```
-
-Overlaps are settled by coordination rule 6 (each project keeps its own lines; Phase 0's `tools/check-pages.mjs` and `tests/pages.test.js` against Famous effects' additions); a resolution beyond keeping both sides gets a fresh agent's review before the commit. Then write the generated files, commit and run the tests:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = feat/ten-animations ] || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs && ([ -f tools/make-famous.mjs ] && node tools/make-famous.mjs || true)
-git grep -qE '^(<{7}|\|{7}|>{7})( |$)' && { echo "conflict markers left"; exit 1; }
-git add -A && git commit -m "Merge feat/famous-effects into feat/ten-animations: it goes live with the ten new animations"
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0`. The coordinator starts the worktree's server as a background command (`cd $REPO/.claude/worktrees/ten-int && python -m http.server 8971 --bind 127.0.0.1`), then runs these two, each as its own background command, and waits on each with `node $RUN/wait-log.mjs <its log>` (again while it says `still running`):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1; mkdir -p $TEN/checks/take-in; node $RUN/slot.mjs run ten-take-in -- node tools/make-social-image.mjs --base http://127.0.0.1:8971 > $TEN/checks/take-in/social.log 2>&1; echo "EXIT=$?" >> $TEN/checks/take-in/social.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1; node $RUN/slot.mjs run ten-take-in -- node tools/check-pages.mjs --base http://127.0.0.1:8971 --out $TEN/checks/take-in home $( [ -d famous ] && echo famous ) > $TEN/checks/take-in/check.log 2>&1; echo "EXIT=$?" >> $TEN/checks/take-in/check.log
-```
-
-Expected: `EXIT=0` in both logs; six `ok home …` lines (and six `ok famous …` where it exists). If the image changed, commit it (`git add og-image.png && git commit -m "Draw the social image again after Famous effects' merge"`, in ten-int after the branch check). Then stop the server and `git -C $REPO worktree remove $REPO/.claude/worktrees/ten-int`. The ledger line comes after Step 4's, once the ledger exists: `<date time> coord took in feat/famous-effects at <commit>; it goes live with the rollout`.
-
-- [ ] **Step 4: The run folder, its ledger and its four tools**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-mkdir -p $TEN/briefs $TEN/checks $TEN/reports
-N=$(git -C $REPO show feat/ten-animations:animations/01-scroll-based/parallax-scrolling/index.html | grep -o 'demo-page\.css?v=[0-9]*' | grep -o '[0-9]*$')
-printf '%s coord run folder ready; feat/ten-animations at %s; shared files ?v=%s; finder on the branch: %s; famous: %s; the plan was checked on d810bce with a copy of Phase 0 Tasks 2, 3, 4 and 6; since then on feat/see-inside-compare: %s\n' "$(date '+%F %H:%M')" "$(git -C $REPO rev-parse --short feat/ten-animations)" "$N" "$(git -C $REPO show feat/ten-animations:index.html | grep -c '^const FIND={')" "$(git -C $REPO show feat/ten-animations:tools/make-famous.mjs > /dev/null 2>&1 && echo yes || echo no)" "$(git -C $REPO log --oneline d810bce..feat/ten-animations | wc -l | tr -d ' ') commits ($(git -C $REPO diff --stat d810bce feat/ten-animations -- assets tools/check-pages.mjs tests | tail -1))" >> $TEN/ledger.md
-tail -1 $TEN/ledger.md
-```
-
-Expected: one ledger line naming the cut commit, the version, the finder and Famous effects, and how far the branch has moved from the base this plan was checked on (the shared files, the page check and the tests); then, if Step 3a ran, its `took in` line and the owner's answer. Write these four files into `$TEN` exactly.
-
-`$TEN/lanes.mjs`:
-
-```js
-// The ten lanes' data and the shared edits a lane makes (everything but its own folder and its preview), applied to a site
-// root (a run-folder tool of the ten new animations, not part of the repository): node lanes.mjs <lane number> <root>.
-// Counts become 167 and the section's count goes up by one, as in a lane; the first lane of a section gives the section's
-// old last page its Next link.
-import { readFileSync, writeFileSync } from 'node:fs';
-import { join } from 'node:path';
-
-export const LIVE = 'https://matinmonshizadeh.github.io/animation-handbook/';
-export const LANES = {
- 1: { slug: 'ink-spread-reveal', cat: '02-entrance-and-exit', n: '02', no: '02.15', title: 'Ink Spread Reveal', catName: 'Entrance & Exit',
- lede: 'Ink drops spread and merge until the picture shows. Best for art and intros.', places: ['imgcard', 'intro'], pv: 'inkspread',
- last: 'shatter-effect', lastTitle: 'Shatter Effect', lastPv: 'shatter', first: true, count: 14, kind: 'once', find: ['card page', 'load scroll click', 'reveal grow'] },
- 2: { slug: 'pixelate-transition', cat: '03-page-transitions', n: '03', no: '03.17', title: 'Pixelate Transition', catName: 'Page Transitions',
- lede: 'The page breaks into big pixels, then sharpens into the next. Best for galleries.', places: ['page', 'imgcard'], pv: 'pixelate',
- last: 'cube-transition', lastTitle: 'Cube Transition', lastPv: 'cubepage', first: true, count: 16, kind: 'do', find: ['page card', 'newpage click', 'pieces glitch'] },
- 3: { slug: 'before-after-slider', cat: '04-micro-interactions', n: '04', no: '04.42', title: 'Before/After Slider', catName: 'Micro-Interactions',
- lede: 'Drag a line across two pictures to compare them. Best for photo edits.', places: ['imgcard'], pv: 'beforeafter',
- last: 'dynamic-island', lastTitle: 'Dynamic Island', lastPv: 'dynisland', first: true, count: 41, kind: 'do', find: ['card', 'drag', 'reveal slide'] },
- 4: { slug: 'magnifier-lens', cat: '04-micro-interactions', n: '04', no: '04.43', title: 'Magnifier Lens', catName: 'Micro-Interactions',
- lede: 'A lens follows your pointer and shows the picture up close. Best for product photos.', places: ['imgcard'], pv: 'magnifier',
- last: 'dynamic-island', lastTitle: 'Dynamic Island', lastPv: 'dynisland', first: false, count: 41, kind: 'do', find: ['card', 'hover drag', 'follow grow'] },
- 5: { slug: 'card-deck-swipe', cat: '04-micro-interactions', n: '04', no: '04.44', title: 'Card Deck Swipe', catName: 'Micro-Interactions',
- lede: 'Swipe the top card left or right; the next one rises. Best for quick choices.', places: ['imgcard'], pv: 'deckswipe',
- last: 'dynamic-island', lastTitle: 'Dynamic Island', lastPv: 'dynisland', first: false, count: 41, kind: 'do', find: ['card', 'drag click', 'slide turn'] },
- 6: { slug: 'water-ripple', cat: '06-3d-advanced', n: '06', no: '06.27', title: 'Water Ripple', catName: '3D & Advanced',
- lede: 'Ripples spread from your finger and bend the picture below. Best for hero images.', places: ['bg', 'imgcard'], pv: 'waterripple',
- last: 'infinite-zoom', lastTitle: 'Infinite Zoom', lastPv: 'izoom', first: true, count: 26, kind: 'do', find: ['background card', 'drag click hover', 'wave'] },
- 7: { slug: 'audio-visualizer', cat: '06-3d-advanced', n: '06', no: '06.28', title: 'Audio Visualizer', catName: '3D & Advanced',
- lede: 'Bars dance to the music, from bass to treble. Best for music players.', places: ['imgcard', 'bg'], pv: 'audioviz',
- last: 'infinite-zoom', lastTitle: 'Infinite Zoom', lastPv: 'izoom', first: false, count: 26, kind: 'loop', find: ['shape background', 'loop', 'bounce grow'] },
- 8: { slug: 'ken-burns', cat: '07-ambient-background', n: '07', no: '07.24', title: 'Ken Burns Effect', catName: 'Ambient & Background',
- lede: 'Photos slowly zoom and pan, then fade into the next. Best for hero slideshows.', places: ['imgcard', 'bg', 'intro'], pv: 'kenburns',
- last: 'game-of-life', lastTitle: 'Game of Life', lastPv: 'life', first: true, count: 23, kind: 'loop', find: ['card background', 'loop load', 'grow slide fade'] },
- 9: { slug: 'fire-effect', cat: '07-ambient-background', n: '07', no: '07.25', title: 'Fire Effect', catName: 'Ambient & Background',
- lede: 'Flames flicker and rise as heat climbs and cools. Best for game and event pages.', places: ['bg', 'intro'], pv: 'fire',
- last: 'game-of-life', lastTitle: 'Game of Life', lastPv: 'life', first: false, count: 23, kind: 'loop', find: ['background', 'loop', 'glitch color drift'] },
- 10: { slug: 'lightning', cat: '07-ambient-background', n: '07', no: '07.26', title: 'Lightning', catName: 'Ambient & Background',
- lede: 'Jagged bolts strike from the clouds and light up the sky. Best for dramatic intros.', places: ['bg', 'intro'], pv: 'lightning',
- last: 'game-of-life', lastTitle: 'Game of Life', lastPv: 'life', first: false, count: 23, kind: 'loop', find: ['background shape', 'loop click', 'glitch color'] }
-};
-const NEXT_ICON = '<svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>';
-export const nextLink = (slug, title) => `<a href="../${slug}/" rel="next" aria-label="Next: ${title}"><span><span class="hb-dir">Next: </span>${title}</span>${NEXT_ICON}</a>`;
-
-function edit(root, file, fn) {
- const p = join(root, file), s = readFileSync(p, 'utf8'), crlf = s.includes('\r\n');
- const t = fn(s.replace(/\r\n/g, '\n'));
- if (t === s.replace(/\r\n/g, '\n')) throw new Error(`${file}: nothing changed`);
- writeFileSync(p, crlf ? t.replace(/\n/g, '\r\n') : t);
-}
-function swap(s, from, to, what) {
- if (!s.includes(from)) throw new Error(`not found (${what}): ${from.slice(0, 120)}`);
- return s.replace(from, to);
-}
-const esc = s => s.replace(/'/g, "\\'");
-
-export function apply(n, root, total = 167) {
- const L = LANES[n], was = 166;
- // A second run would add the card, PV key and PLACES row again: refuse, so the tree is put back first (git checkout -- .)
- if (readFileSync(join(root, 'index.html'), 'utf8').includes(`
- ['${L.slug}',`)) throw new Error(`lane ${n} is applied already here: put the worktree back with "git checkout -- ." and run again`);
- // Home page: the card, its places, its preview key, the counts
- edit(root, 'index.html', s => {
- const line = s.split('\n').find(l => l.startsWith(` ['${L.last}',`));
- if (!line) throw new Error('CATS line of ' + L.last);
- s = swap(s, line + '\n', line + '\n' + ` ['${L.slug}','${esc(L.title)}','${esc(L.lede)}'],\n`, 'CATS');
- s = swap(s, `'${L.last}':'${L.lastPv}',`, `'${L.last}':'${L.lastPv}','${L.slug}':'${L.pv}',`, 'PV');
- const placeLine = s.split('\n').find(l => l.startsWith(` '${L.last}':[`));
- const row = ` '${L.slug}':[${L.places.map(p => `'${p}'`).join(',')}]`;
- s = placeLine.endsWith(',') ? swap(s, placeLine + '\n', placeLine + '\n' + row + ',\n', 'PLACES')
- : swap(s, placeLine + '\n', placeLine + ',\n' + row + '\n', 'PLACES (last row)');
- s = s.split(`${was} Web Animation Techniques`).join(`${total} Web Animation Techniques`)
- .split(`visual reference of ${was} web animation techniques`).join(`visual reference of ${total} web animation techniques`)
- .replace(`${was} free animations · no coding needed`, `${total} free animations · no coding needed`)
- .replace(`Browse all ${was} animations`, `Browse all ${total} animations`)
- .replace(`All ${was} are still easy to reach`, `All ${total} are still easy to reach`)
- .replace(`<p class="foot-t">${was} web animations`, `<p class="foot-t">${total} web animations`);
- // The finder's row (what moved, when, how), after the section's old last page's row, where the finder is on the branch
- const findAt = s.indexOf('\nconst FIND={');
- if (findAt >= 0) {
- const findLine = s.slice(findAt).split('\n').find(l => l.startsWith(` '${L.last}':[`));
- if (!findLine) throw new Error('FIND row of ' + L.last);
- const findRow = ` '${L.slug}':['${L.find.join("','")}']`;
- s = findLine.endsWith(',') ? swap(s, findLine + '\n', findLine + '\n' + findRow + ',\n', 'FIND')
- : swap(s, findLine + '\n', findLine + ',\n' + findRow + '\n', 'FIND (last row)');
- }
- return s;
- });
- // Root README: counts, the section's counts and the catalog line
- edit(root, 'README.md', s => {
- s = s.replace(`six of its ${was} web animation techniques`, `six of its ${total} web animation techniques`)
- .replace(`**A visual reference of ${was} web animation techniques`, `**A visual reference of ${total} web animation techniques`)
- .replace(`badge/techniques-${was}-`, `badge/techniques-${total}-`)
- .replace(`Here are ${was} web animation techniques`, `Here are ${total} web animation techniques`)
- .replace(`All ${was} techniques, each linked to its live demo.`, `All ${total} techniques, each linked to its live demo.`);
- const esName = L.catName;
- s = swap(s, `| ${L.n} | [${esName}](#${L.n}) | ${L.count} |`, `| ${L.n} | [${esName}](#${L.n}) | ${L.count + 1} |`, 'Categories row');
- s = swap(s, `### ${L.n} · ${esName} · ${L.count} techniques`, `### ${L.n} · ${esName} · ${L.count + 1} techniques`, 'heading');
- s = swap(s, `<details><summary>Browse all ${L.count} techniques in ${esName}</summary>`, `<details><summary>Browse all ${L.count + 1} techniques in ${esName}</summary>`, 'summary');
- const last = s.split('\n').find(l => l.startsWith(`- **[${L.lastTitle}](${LIVE}animations/${L.cat}/${L.last}/)**`));
- if (!last) throw new Error('README catalog line of ' + L.last);
- return swap(s, last + '\n', last + '\n' + `- **[${L.title}](${LIVE}animations/${L.cat}/${L.slug}/)** — ${L.lede}\n`, 'catalog');
- });
- // The category README: its list (and 06's Browser requirements, 07's Implementation summary)
- edit(root, `animations/${L.cat}/README.md`, s => {
- const lines = s.split('\n');
- const i = lines.findIndex(l => l.includes(`](${L.last}/)`));
- if (i < 0) throw new Error('category README line of ' + L.last);
- lines.splice(i + 1, 0, lines[i].startsWith('|') ? `| [${L.title}](${L.slug}/) | ${L.lede} |` : `- [${L.title}](${L.slug}/) — ${L.lede}`);
- s = lines.join('\n');
- if (L.slug === 'audio-visualizer') s = swap(s, '| SVG filter in backdrop-filter (Liquid Glass) |', '| Web Audio (Audio Visualizer) | Every modern browser; the sound starts only after Hear it is pressed, and the bars move without it |\n| SVG filter in backdrop-filter (Liquid Glass) |', 'browser row');
- if (L.slug === 'ken-burns') s = swap(s, 'breathing glow, scanline, wave layers |', 'breathing glow, scanline, wave layers, Ken Burns |', 'CSS keyframes row');
- if (L.slug === 'fire-effect') s = swap(s, 'light rays, game of life |', 'light rays, game of life, fire |', 'Canvas 2D row');
- if (L.slug === 'lightning') s = swap(s, 'light rays, game of life |', 'light rays, game of life, lightning |', 'Canvas 2D row');
- return s;
- });
- edit(root, '.github/ISSUE_TEMPLATE/config.yml', s => swap(s, `See all ${was} techniques`, `See all ${total} techniques`, 'config.yml'));
- edit(root, '404.html', s => swap(s, `>Browse all ${was} animations<`, `>Browse all ${total} animations<`, '404'));
- // The section's old last page gets its first Next link (the first lane of a section only)
- if (L.first) edit(root, `animations/${L.cat}/${L.last}/index.html`, s => {
- const pager = s.match(/<span class="hb-pager">([\s\S]*?)<\/a><\/span>/);
- if (!pager || pager[0].includes('rel="next"')) throw new Error('pager of ' + L.last);
- return s.replace(pager[0], pager[0].slice(0, -'</span>'.length) + nextLink(L.slug, L.title) + '</span>');
- });
-}
-
-if (process.argv[1] && process.argv[1].endsWith('lanes.mjs') && process.argv[2]) {
- apply(Number(process.argv[2]), process.argv[3]);
- console.log('lane', process.argv[2], 'shared edits applied to', process.argv[3]);
-}
-```
-
-`$TEN/frametimes.mjs`:
-
-```js
-#!/usr/bin/env node
-// Frame times of a demo page with Chrome's CPU slowed four times: a run-folder tool of the ten new animations, not part of the
-// repository. It loads the page in headless Chrome at 1280×800 (or --phone: 375×812 at scale 2, as a phone), slows the CPU
-// (--rate, default 4), starts the demo (a plays-once page: Loop off, then Replay; a do-it page: Show me; a loop: nothing, it
-// moves; --press <selector> clicks that instead, after the start) and records the time between animation frames for --ms
-// (default 4000) in each mode given with --modes (default normal; e.g. normal,inside,compare).
-// Usage: node frametimes.mjs --base http://127.0.0.1:<port> [--phone] [--rate 4] [--ms 4000] [--modes normal,inside,compare]
-// [--press "<selector>"] <page folder>
-// Prints, per mode: frames, the median and 95th-percentile frame time, and the share of frames slower than 20 ms (a frame
-// missed at 60 Hz). Exit code 1 when Chrome cannot be started. Needs Node 22+ (WebSocket) and Chrome (CHROME to its path).
-import { spawn, execFileSync } from 'node:child_process';
-import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { join } from 'node:path';
-
-const args = process.argv.slice(2);
-const opt = (name, fallback) => { const i = args.indexOf(name); if (i < 0) return fallback; const v = args[i + 1]; args.splice(i, 2); return v; };
-const flag = name => { const i = args.indexOf(name); if (i < 0) return false; args.splice(i, 1); return true; };
-const BASE = opt('--base', 'http://127.0.0.1:8961').replace(/\/$/, '');
-const RATE = Number(opt('--rate', '4')), MS = Number(opt('--ms', '4000'));
-const MODES = opt('--modes', 'normal').split(',');
-const PRESS = opt('--press', '');
-const PHONE = flag('--phone');
-const page = (args[0] || '').replace(/\\/g, '/').replace(/^\.?\//, '').replace(/\/?(index\.html)?$/, '/');
-if (!args[0]) { console.error('usage: node frametimes.mjs --base <url> [--phone] [--rate 4] [--ms 4000] [--modes …] [--press <selector>] <page folder>'); process.exit(2); }
-const CHROME = process.env.CHROME || 'C:/Program Files/Google/Chrome/Application/chrome.exe';
-const sleep = ms => new Promise(r => setTimeout(r, ms));
-const profile = mkdtempSync(join(tmpdir(), 'hb-chrome-'));
-const chrome = spawn(CHROME, ['--headless=new', '--disable-gpu', '--hide-scrollbars', '--remote-debugging-port=0', `--user-data-dir=${profile}`, 'about:blank'], { stdio: 'ignore' });
-chrome.once('error', err => { console.error(`Could not start Chrome at ${CHROME}: ${err.message}`); process.exit(1); });
-const done = async code => {
- try { ws && ws.close(); } catch {}
- chrome.kill();
- if (process.platform === 'win32') {
- try { execFileSync('powershell', ['-NoProfile', '-NonInteractive', '-Command', `Get-CimInstance Win32_Process -Filter "Name='chrome.exe'" | Where-Object { $_.CommandLine -and $_.CommandLine.Contains($env:HB_PROFILE) } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }`], { stdio: 'ignore', timeout: 20000, env: { ...process.env, HB_PROFILE: profile } }); } catch {}
- }
- for (const end = Date.now() + 10000; Date.now() < end; await sleep(200)) { try { rmSync(profile, { recursive: true, force: true }); break; } catch {} }
- process.exit(code);
-};
-let ws, id = 0;
-const pending = new Map();
-const send = (method, params = {}) => new Promise((resolve, reject) => { const n = ++id; pending.set(n, m => m.error ? reject(new Error(m.error.message)) : resolve(m.result)); ws.send(JSON.stringify({ id: n, method, params })); });
-const evaluate = async expression => (await send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true })).result.value;
-try {
- let url = null;
- for (let i = 0; i < 100 && !url; i++) {
- const f = join(profile, 'DevToolsActivePort');
- if (existsSync(f)) { try { const port = readFileSync(f, 'utf8').split('\n')[0].trim(); const list = await (await fetch(`http://127.0.0.1:${port}/json/list`)).json(); url = (list.find(t => t.type === 'page') || {}).webSocketDebuggerUrl; } catch {} }
- if (!url) await sleep(100);
- }
- if (!url) throw new Error('Chrome did not answer');
- ws = new WebSocket(url);
- await new Promise((res, rej) => { ws.addEventListener('open', res, { once: true }); ws.addEventListener('error', rej, { once: true }); });
- ws.addEventListener('message', e => { const m = JSON.parse(e.data); if (m.id && pending.has(m.id)) { pending.get(m.id)(m); pending.delete(m.id); } });
- await send('Page.enable');
- await send('Runtime.enable');
- await send('Emulation.setDeviceMetricsOverride', PHONE ? { width: 375, height: 812, deviceScaleFactor: 2, mobile: true } : { width: 1280, height: 800, deviceScaleFactor: 1, mobile: false });
- await send('Page.navigate', { url: `${BASE}/${page}` });
- await sleep(3000);
- await send('Emulation.setCPUThrottlingRate', { rate: RATE });
- const kind = await evaluate(`document.body.dataset.hbKind`);
- console.log(`${page} (${kind}) at ${PHONE ? '375×812, scale 2' : '1280×800'}, CPU slowed ${RATE} times, ${MS} ms per mode`);
- for (const mode of MODES) {
- await evaluate(`(() => { const b = document.querySelector('.hb-modes [data-hb-mode="${mode}"]'); if (b) b.click(); })()`);
- await sleep(400);
- // Start the demo in this mode: a plays-once page replays (Loop off first), a do-it page runs Show me, a loop moves already.
- await evaluate(`(() => {
- const loop = document.querySelector('[data-hb-loop]'); if (loop && loop.checked) loop.click();
- const p = document.querySelector('[data-hb-pause]'); if (p && p.getAttribute('data-state') === 'paused') p.click();
- const start = document.querySelector('[data-hb-replay]') || document.querySelector('[data-hb-demo]'); if (start) start.click();
- ${PRESS ? `const extra = document.querySelector(${JSON.stringify(PRESS)}); if (extra) extra.click();` : ''}
- })()`);
- const t = await evaluate(`new Promise(done => { const times = []; const end = performance.now() + ${MS};
- const step = now => { times.push(now); if (now < end) requestAnimationFrame(step); else done(times); }; requestAnimationFrame(step); })`);
- const d = t.slice(1).map((v, i) => v - t[i]).sort((a, b) => a - b);
- const at = q => d[Math.min(d.length - 1, Math.floor(q * d.length))];
- const slow = d.filter(v => v > 20).length;
- console.log(` ${mode.padEnd(8)} ${String(d.length).padStart(4)} frames · median ${at(.5).toFixed(1)} ms · 95% ${at(.95).toFixed(1)} ms · ${(100 * slow / Math.max(1, d.length)).toFixed(0)}% slower than 20 ms`);
- await sleep(300);
- }
- await done(0);
-} catch (err) { console.error(err.message); await done(1); }
-```
-
-`$TEN/resolve.mjs`:
-
-```js
-#!/usr/bin/env node
-// Resolves the conflicts left when a ten-animations lane is merged into a branch that already holds an earlier lane of the
-// same section (a run-folder tool of the ten new animations, not part of the repository). Every conflict keeps both sides,
-// the earlier lane's first (ours), then the later lane's (theirs): two lines added at the same place (a card, a PLACES row,
-// a preview, a catalog line, a table row) become both lines. Where both lanes changed the same single line by adding to it
-// (the PV keys, the STILL points, a row of 07's Implementation summary), the line keeps both additions, ours first. Anything
-// else is left in place and named, for a person to resolve, and so is a conflict that shows no base: the merge must be made
-// with the diff3 conflict style, for that one command only (never set in the repository's shared config):
-// git -c merge.conflictStyle=diff3 merge --no-ff <lane branch>
-// Usage: node resolve.mjs <file>... (in the worktree, after the merge stopped on conflicts; then `git add` the files)
-import { readFileSync, writeFileSync } from 'node:fs';
-
-const START = /^<{7}( |$)/, BASE = /^\|{7}( |$)/, MID = /^={7}$/, END = /^>{7}( |$)/;
-
-// The longest ending the three lines share, so that what each side added in the middle can be put together
-function sharedEnd(a, b, c) {
- let n = 0;
- while (n < a.length && n < b.length && n < c.length && a[a.length - 1 - n] === b[b.length - 1 - n] && b[b.length - 1 - n] === c[c.length - 1 - n]) n++;
- return n;
-}
-// One conflict, settled by keeping both sides (ours first); null when the rules below do not cover it
-function settle(ours, base, theirs) {
- if (!base.length) return [...ours, ...theirs];
- // Changes to the same lines, or to lines side by side: line by line, a line one side left alone takes the other side's,
- // and a line both changed keeps both additions
- if (ours.length === base.length && theirs.length === base.length) {
- const out = [];
- for (let i = 0; i < base.length; i++) {
- const [b, o, t] = [base[i], ours[i], theirs[i]];
- const one = o === b ? t : t === b || t === o ? o : joinLine(b, o, t);
- if (one === null) return null;
- out.push(one);
- }
- return out;
- }
- // The same change to the base's lines on both sides, then lines added by each: 07's last PLACES row gets its comma on both
- // sides, then each side's row; ours, now no longer the last row of the list, gets its comma too
- let k = 0;
- while (k < ours.length && k < theirs.length && ours[k] === theirs[k]) k++;
- if (!k || k < base.length) return null;
- const mine = [...ours];
- if (mine.length > k && theirs.length > k && ours[k - 1].endsWith(',') && !mine[mine.length - 1].endsWith(',')) mine[mine.length - 1] += ',';
- return [...mine, ...theirs.slice(k)];
-}
-// One line both sides added to: the base's start and end, with ours' addition, then theirs'
-function joinLine(b, o, t) {
- const n = sharedEnd(b, o, t), head = b.slice(0, b.length - n), tail = b.slice(b.length - n);
- return o.startsWith(head) && t.startsWith(head) && o.endsWith(tail) && t.endsWith(tail)
- ? head + o.slice(head.length, o.length - n) + t.slice(head.length, t.length - n) + tail : null;
-}
-
-let left = 0;
-for (const file of process.argv.slice(2)) {
- const raw = readFileSync(file, 'utf8'), crlf = raw.includes('\r\n'), lines = raw.replace(/\r\n/g, '\n').split('\n'), out = [];
- let solved = 0, open = 0;
- for (let i = 0; i < lines.length; i++) {
- if (!START.test(lines[i])) { out.push(lines[i]); continue; }
- const ours = [], base = [], theirs = [];
- let j = i + 1, part = ours, sawBase = false;
- for (; j < lines.length && !END.test(lines[j]); j++) {
- if (BASE.test(lines[j])) { part = base; sawBase = true; }
- else if (MID.test(lines[j])) part = theirs;
- else part.push(lines[j]);
- }
- // without the base section an addition cannot be told from a change: that conflict is a person's
- const done = sawBase ? settle(ours, base, theirs) : null;
- if (done) { out.push(...done); solved++; } else { out.push(...lines.slice(i, j + 1)); open++; }
- i = j;
- }
- writeFileSync(file, crlf ? out.join('\n').replace(/\n/g, '\r\n') : out.join('\n'));
- console.log(`${file}: ${solved} resolved${open ? `, ${open} left for a person` : ''}`);
- left += open;
-}
-process.exit(left ? 1 : 0);
-```
-
-`$TEN/integrate.mjs`:
-
-```js
-#!/usr/bin/env node
-// The integration's own edits, once the ten lanes are merged (a run-folder tool of the ten new animations, not part of the
-// repository): the split sections linked (04: Before/After Slider, Magnifier Lens, Card Deck Swipe; 06: Water Ripple, Audio
-// Visualizer; 07: Ken Burns Effect, Fire Effect, Lightning), every written count 176 and each section's count, the test
-// entries, the finder's rows and its case 9 (only where the finder is on the branch), a See also line on the closest pages,
-// the CHANGELOG line, and the ten pages' shared-file version set to the one the other pages use.
-// Usage: node integrate.mjs <root> [--finder-check] Each edit says what it did; an edit already made is skipped and said so.
-// --finder-check, for Task 0 on a scratch copy of the finder only: the ten cards, the finder's rows and its case 9.
-import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
-import { join } from 'node:path';
-import { LANES } from './lanes.mjs';
-
-const root = process.argv[2], FINDER_CHECK = process.argv.includes('--finder-check');
-if (!root || root.startsWith('--')) { console.error('usage: node integrate.mjs <root> [--finder-check]'); process.exit(2); }
-const said = [];
-function edit(file, fn) {
- const p = join(root, file), raw = readFileSync(p, 'utf8'), crlf = raw.includes('\r\n'), s = raw.replace(/\r\n/g, '\n'), t = fn(s);
- if (t !== s) writeFileSync(p, crlf ? t.replace(/\n/g, '\r\n') : t);
-}
-function swap(s, from, to, what) {
- if (s.includes(to) && !s.includes(from)) { said.push(`already: ${what}`); return s; }
- if (!s.includes(from)) throw new Error(`not found (${what}): ${from.slice(0, 140)}`);
- said.push(what);
- return s.split(from).join(to);
-}
-const PAGES = ['02-entrance-and-exit/ink-spread-reveal', '03-page-transitions/pixelate-transition', '04-micro-interactions/before-after-slider',
- '04-micro-interactions/magnifier-lens', '04-micro-interactions/card-deck-swipe', '06-3d-advanced/water-ripple', '06-3d-advanced/audio-visualizer',
- '07-ambient-background/ken-burns', '07-ambient-background/fire-effect', '07-ambient-background/lightning'];
-
-// The split sections: each later page's Previous points to the page before it, which gets its Next link
-const ICON_PREV = '<svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg>';
-const ICON_NEXT = '<svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>';
-const prev = (slug, title) => `<a href="../${slug}/" rel="prev" aria-label="Previous: ${title}">${ICON_PREV}<span><span class="hb-dir">Previous: </span>${title}</span></a>`;
-const next = (slug, title) => `<a href="../${slug}/" rel="next" aria-label="Next: ${title}"><span><span class="hb-dir">Next: </span>${title}</span>${ICON_NEXT}</a>`;
-function links() {
- const CHAINS = [
- ['04-micro-interactions', ['dynamic-island', 'Dynamic Island'], [['before-after-slider', 'Before/After Slider'], ['magnifier-lens', 'Magnifier Lens'], ['card-deck-swipe', 'Card Deck Swipe']]],
- ['06-3d-advanced', ['infinite-zoom', 'Infinite Zoom'], [['water-ripple', 'Water Ripple'], ['audio-visualizer', 'Audio Visualizer']]],
- ['07-ambient-background', ['game-of-life', 'Game of Life'], [['ken-burns', 'Ken Burns Effect'], ['fire-effect', 'Fire Effect'], ['lightning', 'Lightning']]]];
- for (const [cat, old, pages] of CHAINS) for (let i = 1; i < pages.length; i++) {
- const [a, b] = [pages[i - 1], pages[i]], before = i === 1 ? old : pages[i - 2];
- edit(`animations/${cat}/${b[0]}/index.html`, s => swap(s, prev(...old), prev(...a), `${b[1]}: Previous is ${a[1]}`));
- edit(`animations/${cat}/${a[0]}/index.html`, s => swap(s, `${prev(...before)}</span>`, `${prev(...before)}${next(...b)}</span>`, `${a[1]}: Next is ${b[1]}`));
- }
-}
-
-// Every written count 176, and each section's count
-function counts() {
- const [WAS, NOW] = [167, 176];
- edit('index.html', s => {
- for (const [a, b] of [[`${WAS} Web Animation Techniques`, `${NOW} Web Animation Techniques`], [`visual reference of ${WAS} web animation techniques`, `visual reference of ${NOW} web animation techniques`],
- [`${WAS} free animations · no coding needed`, `${NOW} free animations · no coding needed`], [`Browse all ${WAS} animations`, `Browse all ${NOW} animations`],
- [`All ${WAS} are still easy to reach`, `All ${NOW} are still easy to reach`], [`<p class="foot-t">${WAS} web animations`, `<p class="foot-t">${NOW} web animations`]]) s = swap(s, a, b, `home: ${b}`);
- return s;
- });
- const SECTIONS = [['04', 'Micro-Interactions', 42, 44], ['06', '3D & Advanced', 27, 28], ['07', 'Ambient & Background', 24, 26]];
- edit('README.md', s => {
- for (const [a, b] of [[`six of its ${WAS} web animation techniques`, `six of its ${NOW} web animation techniques`], [`**A visual reference of ${WAS} web animation techniques`, `**A visual reference of ${NOW} web animation techniques`],
- [`badge/techniques-${WAS}-`, `badge/techniques-${NOW}-`], [`Here are ${WAS} web animation techniques`, `Here are ${NOW} web animation techniques`],
- [`All ${WAS} techniques, each linked to its live demo.`, `All ${NOW} techniques, each linked to its live demo.`]]) s = swap(s, a, b, `README: ${b}`);
- for (const [n, name, was, now] of SECTIONS) {
- s = swap(s, `| ${n} | [${name}](#${n}) | ${was} |`, `| ${n} | [${name}](#${n}) | ${now} |`, `README: ${n} has ${now} in the Categories table`);
- s = swap(s, `### ${n} · ${name} · ${was} techniques`, `### ${n} · ${name} · ${now} techniques`, `README: ${n} heading says ${now}`);
- s = swap(s, `<details><summary>Browse all ${was} techniques in ${name}</summary>`, `<details><summary>Browse all ${now} techniques in ${name}</summary>`, `README: ${n} summary says ${now}`);
- }
- return s;
- });
- edit('.github/ISSUE_TEMPLATE/config.yml', s => swap(s, `See all ${WAS} techniques`, `See all ${NOW} techniques`, `config.yml: ${NOW}`));
- edit('404.html', s => swap(s, `>Browse all ${WAS} animations<`, `>Browse all ${NOW} animations<`, `404: ${NOW}`));
-}
-
-// The test entries: the four pages played with the pointer can be played from the keyboard; Audio Visualizer's phone default
-function tests() {
- edit('tests/pages.test.js', s => {
- s = s.replace(/^( '04-micro-interactions': \[[^\]\n]*?)(\])/m, (m, a, b) => a.includes('before-after-slider') ? (said.push('already: KEYBOARD_PAGES 04'), m) : (said.push('KEYBOARD_PAGES 04'), `${a}, 'before-after-slider', 'magnifier-lens', 'card-deck-swipe'${b}`));
- s = s.replace(/^( '06-3d-advanced': \[[^\]\n]*?)(\])/m, (m, a, b) => a.includes('water-ripple') ? (said.push('already: KEYBOARD_PAGES 06'), m) : (said.push('KEYBOARD_PAGES 06'), `${a}, 'water-ripple'${b}`));
- return s.includes(`'audio-visualizer': ['bars-seg', 'Some']`) ? (said.push('already: PHONE_DEFAULTS'), s)
- : swap(s, `const PHONE_DEFAULTS = { `, `const PHONE_DEFAULTS = { 'audio-visualizer': ['bars-seg', 'Some'], `, 'PHONE_DEFAULTS');
- });
-}
-
-// The finder's rows (what moved, when, how), each after its section's old last page, in CATS order, and its case 9
-const FIND = [['shatter-effect', [['ink-spread-reveal', 'card page', 'load scroll click', 'reveal grow']]],
- ['cube-transition', [['pixelate-transition', 'page card', 'newpage click', 'pieces glitch']]],
- ['dynamic-island', [['before-after-slider', 'card', 'drag', 'reveal slide'], ['magnifier-lens', 'card', 'hover drag', 'follow grow'], ['card-deck-swipe', 'card', 'drag click', 'slide turn']]],
- ['infinite-zoom', [['water-ripple', 'background card', 'drag click hover', 'wave'], ['audio-visualizer', 'shape background', 'loop', 'bounce grow']]],
- ['game-of-life', [['ken-burns', 'card background', 'loop load', 'grow slide fade'], ['fire-effect', 'background', 'loop', 'glitch color drift'], ['lightning', 'background shape', 'loop click', 'glitch color']]]];
-const row = ([slug, what, when, how]) => ` '${slug}':['${what}','${when}','${how}']`;
-function finder() {
- edit('index.html', s => {
- const at = s.indexOf('\nconst FIND={');
- if (at < 0) { said.push('FIND is not on this branch: its ten rows go in the ledger (listed below)'); return s; }
- const end = s.indexOf('\n};', at);
- let block = s.slice(at, end);
- for (const [last, rows] of FIND) {
- const line = block.split('\n').find(l => l.startsWith(` '${last}':[`));
- if (!line) throw new Error(`FIND row of ${last} not found`);
- const missing = rows.filter(r => !block.includes(`\n '${r[0]}':[`));
- if (!missing.length) { said.push(`already: FIND rows after ${last}`); continue; }
- if (missing.length < rows.length) throw new Error(`FIND after ${last} has some of its new rows: add ${missing.map(r => r[0]).join(', ')} by hand, in CATS order`);
- const lastRow = !line.endsWith(',');
- block = block.replace(line, (lastRow ? line + ',' : line) + '\n' + rows.map(row).join(',\n') + (lastRow ? '' : ','));
- said.push(`FIND rows after ${last}`);
- }
- return s.slice(0, at) + block + s.slice(end);
- });
- if (existsSync(join(root, 'tests/finder.test.js'))) edit('tests/finder.test.js', s => swap(s, `[9, 'page', 'click', '', ['Circle Reveal', 'Overlay Wipe', 'Portal / Tunnel Zoom']],`,
- `[9, 'page', 'click', '', ['Circle Reveal', 'Overlay Wipe', 'Portal / Tunnel Zoom', 'Ink Spread Reveal']],`, 'finder case 9 takes Ink Spread Reveal'));
-}
-
-// For the finder's check on a scratch copy only (Task 0): the ten cards in CATS, each after the card before it in its section,
-// and, where a page is not there yet, a stand-in that says its kind (the finder's tests read each page's kind)
-function cards() {
- for (const L of Object.values(LANES)) {
- const dir = join(root, 'animations', L.cat, L.slug);
- if (existsSync(join(dir, 'index.html'))) continue;
- mkdirSync(dir, { recursive: true });
- writeFileSync(join(dir, 'index.html'), `<!DOCTYPE html>\n<html lang="en"><body class="hb" data-hb-kind="${L.kind}"></body></html>\n`);
- said.push(`stand-in page ${L.slug} (${L.kind})`);
- }
- edit('index.html', s => {
- const after = {};
- for (const L of Object.values(LANES)) {
- if (s.includes(`\n ['${L.slug}',`)) { said.push(`already: card ${L.slug}`); after[L.cat] = L.slug; continue; }
- const line = s.split('\n').find(l => l.startsWith(` ['${after[L.cat] || L.last}',`));
- if (!line) throw new Error(`CATS line of ${after[L.cat] || L.last}`);
- s = s.replace(line + '\n', `${line}\n ['${L.slug}','${L.title}','${L.lede}'],\n`);
- after[L.cat] = L.slug;
- said.push(`card ${L.slug}`);
- }
- return s;
- });
-}
-
-// A See also line on the closest existing pages (nine page READMEs, one line each, as the coordination file's map says), and
-// between the new pages where they are close, at the end of each See also
-function seeAlso() {
- const SEE = [['02-entrance-and-exit/clip-path-reveal', '- [Ink Spread Reveal](../ink-spread-reveal/) — blots of ink spread and merge to uncover a picture'],
- ['03-page-transitions/dissolve', '- [Pixelate Transition](../pixelate-transition/) — the page breaks into big pixels, then sharpens into the next'],
- ['04-micro-interactions/spotlight-hover', '- [Magnifier Lens](../magnifier-lens/) — a lens follows the pointer and shows the picture up close'],
- ['04-micro-interactions/swipe-to-dismiss', '- [Card Deck Swipe](../card-deck-swipe/) — the top card of a pile goes left or right and the next one rises'],
- ['07-ambient-background/ambient-ripple', '- [Water Ripple](../../06-3d-advanced/water-ripple/) — ripples from a finger spread and bend the picture below'],
- ['07-ambient-background/abstract-geometric-motion', '- [Audio Visualizer](../../06-3d-advanced/audio-visualizer/) — bars that move to the music, from bass to treble'],
- ['06-3d-advanced/infinite-zoom', '- [Ken Burns Effect](../../07-ambient-background/ken-burns/) — photos slowly zoom and pan, then fade into the next'],
- ['07-ambient-background/fireworks', '- [Fire Effect](../fire-effect/) — flames flicker and rise as heat climbs and cools'],
- ['07-ambient-background/snow-rain', '- [Lightning](../lightning/) — jagged bolts strike from the clouds and light up the sky'],
- ['04-micro-interactions/before-after-slider', '- [Magnifier Lens](../magnifier-lens/) — a lens follows the pointer and shows the picture up close'],
- ['04-micro-interactions/magnifier-lens', '- [Before/After Slider](../before-after-slider/) — a line dragged across two pictures uncovers one over the other'],
- ['07-ambient-background/fire-effect', '- [Lightning](../lightning/) — jagged bolts strike from the clouds and light up the sky'],
- ['07-ambient-background/lightning', '- [Fire Effect](../fire-effect/) — flames flicker and rise as heat climbs and cools'],
- ['07-ambient-background/fire-effect', '- [Water Ripple](../../06-3d-advanced/water-ripple/) — a grid of water heights that steps at a fixed rate, as the heat does here'],
- ['06-3d-advanced/water-ripple', '- [Fire Effect](../../07-ambient-background/fire-effect/) — a grid of heat values that steps at a fixed rate, as the water does here']];
- for (const [page, line] of SEE) edit(`animations/${page}/README.md`, s => {
- if (s.includes(line)) { said.push(`already: See also in ${page}`); return s; }
- const lines = s.split('\n'), h = lines.findIndex(l => l === '## See also');
- if (h < 0) throw new Error(`no See also in ${page}`);
- let k = h + 1;
- while (k < lines.length && !lines[k].startsWith('## ')) k++;
- while (k > h + 1 && !lines[k - 1].trim()) k--;
- lines.splice(k, 0, line);
- said.push(`See also in ${page}`);
- return lines.join('\n');
- });
-}
-
-// The CHANGELOG's line, first under Unreleased
-function changelog() {
- const LOG = '- Ten new animations, 176 in all, each with See inside and Compare from the start: Ink Spread Reveal, Pixelate Transition,\n Before/After Slider, Magnifier Lens, Card Deck Swipe, Water Ripple, Audio Visualizer, Ken Burns Effect, Fire Effect and Lightning.';
- edit('CHANGELOG.md', s => s.includes(LOG) ? (said.push('already: CHANGELOG'), s) : swap(s, '## Unreleased\n\n', `## Unreleased\n\n${LOG}\n`, 'CHANGELOG'));
-}
-
-// The ten pages link the shared files with the version the other pages use
-function version() {
- const ref = readFileSync(join(root, 'animations/01-scroll-based/parallax-scrolling/index.html'), 'utf8').match(/demo-page\.css\?v=(\d+)/)[1];
- for (const p of PAGES) edit(`animations/${p}/index.html`, s => {
- const t = s.replace(/(demo-page\.(?:css|js)\?v=)\d+/g, `$1${ref}`);
- said.push(t === s ? `already: ${p} at ?v=${ref}` : `${p} now at ?v=${ref}`);
- return t;
- });
-}
-
-for (const step of FINDER_CHECK ? [cards, finder] : [links, counts, tests, finder, seeAlso, changelog, version]) step();
-for (const line of said) console.log(line);
-if (said.some(l => l.startsWith('FIND is not'))) for (const [, rows] of FIND) for (const r of rows) console.log(row(r) + ',');
-```
-
-Run: `REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations; for f in lanes frametimes resolve integrate; do node --check $TEN/$f.mjs && echo "$f ok"; done`
-Expected: `lanes ok`, `frametimes ok`, `resolve ok`, `integrate ok`.
-
-- [ ] **Step 5: Try every lane's shared edits on its own scratch export, and the tests on one (outside the repository)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-S=$(mktemp -d)/scratch-lanes
-for n in 1 2 3 4 5 6 7 8 9 10; do rm -rf $S; mkdir -p $S; git -C $REPO archive feat/ten-animations | tar -x -C $S; node $TEN/lanes.mjs $n $S || echo "lane $n FAILED"; done
-rm -rf $S; mkdir -p $S; git -C $REPO archive feat/ten-animations | tar -x -C $S; node $TEN/lanes.mjs 3 $S
-cd $S || exit 1; node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-cd /tmp && rm -rf $S
-```
-
-Expected: ten lines `lane <n> shared edits applied to …` and no `FAILED`; then, for lane 3, exactly seven failing tests: `make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG` (Famous effects': the card has no preview until the lane's Step 4), `the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll` (the finder's: its rules read each page's kind, and the page is not there yet), `04-micro-interactions/dynamic-island uses the guided-steps page correctly` (its new Next link opens a page that is not there yet), `the Full catalog in the root README lists every card once, in home order, linked to its live page`, `the counts written in the issue template, the 404 page and the sitemap match the cards`, `the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, and `llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`; `ℹ fail 7` (Task 0's run on `feat/ten-animations` at `ece2689`, the finder and Famous effects there: the branch alone 1705 pass, 0 fail; with lane 3's edits 1698 pass, 7 fail). A lane that gives no Next link has the other six. A `FAILED` lane names the anchor that no longer matches: the coordinator fixes it in `$TEN/lanes.mjs` (no one else edits the tool) and runs this step again.
-
-- [ ] **Step 6: Check the ten finder rows (a fresh agent; nothing committed)**
-
-The rows, by the finder spec's section 3 rules, from the ten-animations spec: Ink Spread Reveal `card page` · `load scroll click` · `reveal grow`; Pixelate Transition `page card` · `newpage click` · `pieces glitch`; Before/After Slider `card` · `drag` · `reveal slide`; Magnifier Lens `card` · `hover drag` · `follow grow`; Card Deck Swipe `card` · `drag click` · `slide turn`; Water Ripple `background card` · `drag click hover` · `wave`; Audio Visualizer `shape background` · `loop` · `bounce grow`; Ken Burns Effect `card background` · `loop load` · `grow slide fade`; Fire Effect `background` · `loop` · `glitch color drift`; Lightning `background shape` · `loop click` · `glitch color`. Dispatch a fresh agent (strongest model) with the finder spec (`docs/superpowers/specs/2026-10-13-animation-finder-design.md`, section 3) and these rows; it reads each page's section of the ten-animations spec, checks every answer against section 3's rules, then runs:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-F=$(git -C $REPO show feat/ten-animations:index.html | grep -q '^const FIND={' && echo feat/ten-animations || echo feat/animation-finder)
-S=$(mktemp -d)/scratch-finder; mkdir -p $S
-git -C $REPO archive $F | tar -x -C $S
-node $TEN/integrate.mjs $S --finder-check
-cd $S || exit 1; node --test tests/finder.test.js 2>&1 | grep -E "^ℹ (pass|fail)|^✖|case 9 \("
-cd /tmp && rm -rf $S
-```
-
-Expected: ten `stand-in page …` lines (the finder's tests read each page's kind, and the pages are not there yet), ten `card …` lines, five `FIND rows after …` lines and `finder case 9 takes Ink Spread Reveal`; then the case 9 diagnostic and `ℹ fail 0` (this plan's run on `feat/animation-finder` at `80f18fc`: 37 pass, 0 fail; case 9's best right answer Overlay Wipe at 8). The agent writes its verdict to `$TEN/reports/finder-rows.md` (first line `RESULT: rows as planned` or `RESULT: changes <count>`, then each corrected row with the rule that corrects it); the coordinator puts a corrected row into `$TEN/lanes.mjs` (the lane's `find`) and `$TEN/integrate.mjs` (`FIND`) before Step 7, and writes the ledger line.
-
-- [ ] **Step 7: Ten worktrees, one branch each**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-for n in 1 2 3 4 5 6 7 8 9 10; do git -C $REPO worktree add -b ten/L$n $REPO/.claude/worktrees/ten-L$n feat/ten-animations; done
-git -C $REPO worktree list | grep -c 'ten-L'
-```
-
-Expected: ten `Preparing worktree (new branch 'ten/L<n>')` messages, then `10`.
-
-- [ ] **Step 8: Briefs, servers and dispatch**
-
-For each lane write `$TEN/briefs/L<n>.md`: "Carry out Task <n> of `docs/superpowers/plans/2026-10-14-ten-new-animations.md` (the main checkout's copy) in `$REPO/.claude/worktrees/ten-L<n>`, served on port `<8960+n>` by the coordinator. First read CLAUDE.md, the plan's Global Constraints, your page's section of `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`. Write only in your worktree, `$TEN/checks/L<n>/` and `$TEN/reports/L<n>/` (a shared-file need goes in your report; the coordinator passes it on); start no agents; never open the browser pane; never use `git stash` or `git config`. The shared-file version is `?v=<N from the ledger>`. Write your report as the task's last step says and reply in at most three lines." Before dispatching a lane's builder, the coordinator starts its server as a background command, `cd $REPO/.claude/worktrees/ten-L<n> && python -m http.server <8960+n> --bind 127.0.0.1`, and keeps it until the lane is approved (and again for a later fix round). Dispatch builders (strongest model) by the rollout's seat count, `seats = 20 − running − 1`, reviews and fix rounds of any lane before a new builder, new lanes taking turns with the rollout's new pages; while the pool has been full for 20 minutes with runs waiting, start no new builder that round. Ledger line per dispatch: `… L<n> builder dispatched`.
-
----
-
-## The lanes
-
-Each lane task below is complete in itself: its builder needs no other task. The pages' code is the code that passed the checks; keep it as it is unless a step's check or the review asks for a change.
-
----
-
-### Task 1: L1 · 02.15 Ink Spread Reveal (`ten/L1`, port 8961)
-
-Plays once · step 1 "Watch it" · player bar: Replay, Loop and Slow motion (`data-hb-slowmo="css"`: the shared script slows every animation in the stage). See inside: the picture faint under the paper, each blot a numbered window growing to its dashed outline, the ink edge a ring just ahead. Compare: "Clean circles" (a copy whose drops grow round and neat) beside "Ink blots". Spec: "1 · Ink Spread Reveal (02.15)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/02-entrance-and-exit/ink-spread-reveal/index.html` (360 lines), `animations/02-entrance-and-exit/ink-spread-reveal/README.md`
-- Modify (by `$TEN/lanes.mjs 1`): `index.html` (the card after Shatter Effect's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 02's count 14 → 15, the catalog line), `animations/02-entrance-and-exit/README.md` (its line), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`, `animations/02-entrance-and-exit/shatter-effect/index.html` (its first Next link, to Ink Spread Reveal)
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 02 bespoke block, `case 'inkspread':` in `pvMarkup()`
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js`; the page check of the new page, of Shatter Effect and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults and of the timing settings' choices; frame times
-- Write (run folder): `$TEN/checks/L1/` (logs, screenshots, kit output), `$TEN/reports/L1/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L1` on `ten/L1`, its server on port 8961 (started and stopped by the coordinator), `$TEN/lanes.mjs`, `$TEN/frametimes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses Replay after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L1`: the card `['ink-spread-reveal','Ink Spread Reveal','Ink drops spread and merge until the picture shows. Best for art and intros.']` (02.15), `PV` key `'ink-spread-reveal':'inkspread'`, `PLACES` `['imgcard','intro']`, `FIND` `'ink-spread-reveal':['card page','load scroll click','reveal grow']`; Previous: Shatter Effect (final), and Shatter Effect's Next link to Ink Spread Reveal; no Next link yet. The reports in `$TEN/reports/L1/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-node $TEN/lanes.mjs 1 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 1 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/02-entrance-and-exit/README.md`, ` M animations/02-entrance-and-exit/shatter-effect/index.html`, ` M index.html`; then these 7 failing tests and `ℹ fail 7`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ 02-entrance-and-exit/shatter-effect uses the guided-steps page correctly`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, and Shatter Effect's new Next link opens a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/02-entrance-and-exit/ink-spread-reveal/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Ink Spread Reveal — Animation Handbook</title>
- <meta name="description" content="Ink drops spread and merge until the picture shows. Best for art and intros.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/ink-spread-reveal/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Ink Spread Reveal — Animation Handbook">
- <meta property="og:description" content="Ink drops spread and merge until the picture shows. Best for art and intros.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/ink-spread-reveal/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Ink Spread Reveal — Animation Handbook">
- <meta name="twitter:description" content="Ink drops spread and merge until the picture shows. Best for art and intros.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Ink Spread Reveal", "name": "Ink Spread Reveal", "description": "Ink drops spread and merge until the picture shows. Best for art and intros.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/ink-spread-reveal/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Ink Spread Reveal"}</script>
- <style>
- :root{--ui-accent:#5fd88a;--paper:#efe6d2;--ink:#1c1a26}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{position:relative;overflow:hidden;background:var(--paper)}
- /* One scene, or two side by side in Compare; each draws its own picture, paper and blots at its own size */
- .scenes{position:absolute;inset:0;display:grid;grid-template-columns:minmax(0,1fr)}
- .scene{position:relative;min-width:0;overflow:hidden}
- .scene>svg{position:absolute;inset:0;width:100%;height:100%;display:block}
- .paper{fill:var(--paper)}
- .edge path{fill:var(--ink)}
- /* A blot grows by scaling its own shape, from where its drop lands; it starts at nothing, so the box starts as paper */
- .grow{transform:scale(0)}
- .twin,.faint,.see,.side,.cap{display:none}
- /* See inside: the picture faint under the paper, each blot outlined and numbered, its final size dashed, the ink edge as a ring */
- .stage[data-hb-mode="inside"] .faint{display:inline;opacity:.3}
- .stage[data-hb-mode="inside"] .see{display:inline}
- .stage[data-hb-mode="inside"] .edge path{fill:rgba(28,26,38,.78)}
- .stage[data-hb-mode="inside"] .cap{display:block}
- .see path{fill:none;vector-effect:non-scaling-stroke}
- .see .line path{stroke:#fff;stroke-width:2.5}
- .see .dash{stroke:var(--ink);stroke-width:2;stroke-dasharray:8 6}
- .see .drop{fill:#fff;stroke:var(--ink);stroke-width:2}
- .cap,.side{position:absolute;z-index:3;padding:3px 8px;border-radius:6px;background:rgba(20,18,28,.9);color:#f4f4f2;
- font:600 13px/1.2 var(--hb-font);white-space:nowrap;pointer-events:none}
- .cap.num{padding:3px 8px;border-radius:999px}
- /* Compare: on the left a copy that grows clean circles, on the right the page as set; each half named at its top */
- .stage[data-hb-mode="compare"] .scenes{grid-template-columns:repeat(2,minmax(0,1fr));gap:2px;background:#2a2a30}
- .stage[data-hb-mode="compare"] .twin,.stage[data-hb-mode="compare"] .side{display:block}
- .side{top:10px;left:10px}
- @media(max-width:600px){.cap.c-dash{display:none!important}}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="once" data-hb-autoplay>
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../shatter-effect/" rel="prev" aria-label="Previous: Shatter Effect"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Shatter Effect</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">02.15 · Entrance &amp; Exit</p>
- <h1>Ink Spread Reveal</h1>
- <p class="hb-lede">Ink drops spread and merge until the picture shows. Best for art and intros.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Watch it</h2><p>It plays by itself. Turn on slow motion to watch each drop soak in.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage" id="stage" role="img" aria-label="A drawing of a mountain by the sea, uncovered by drops of ink that spread and merge">
- <div class="scenes" id="scenes"><div class="scene" id="scene"><p class="side" data-hb-caption>Ink blots</p></div></div>
- <p class="cap num" id="cap-1" data-hb-caption>1 · lands first</p>
- <p class="cap num" id="cap-2" data-hb-caption>2</p>
- <p class="cap num" id="cap-3" data-hb-caption>3</p>
- <p class="cap c-dash" id="cap-dash" data-hb-caption>Dashed: where it stops</p>
- <p class="cap" id="cap-faint" data-hb-caption>Faint: still hidden</p>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-play" data-hb-replay><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Replay</button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="loop-tog" data-hb-loop autocomplete="off"><span>Loop</span></label>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo="css" autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, the picture waits faintly under the paper. Each numbered blot is a window in the paper that grows to its dashed outline, with the dark ink edge as a ring just ahead.</p>
- <p data-hb-for="compare" hidden>On the left, Clean circles: the drops grow round and neat, which looks mechanical. On the right, Ink blots: ragged blots spread and merge, which looks like ink.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and the animation plays again.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="drops-lbl">Where the ink lands</p>
- <div class="seg" id="drops-seg" role="group" aria-labelledby="drops-lbl">
- <button type="button" data-drops="one" aria-pressed="false">One drop</button>
- <button type="button" data-drops="several" class="on" aria-pressed="true">Several drops</button>
- <button type="button" data-drops="corner" aria-pressed="false">From a corner</button>
- </div>
- <p class="hb-hint">Where the first drops fall.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="speed-lbl">Speed</p>
- <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">
- <button type="button" data-speed="slow" aria-pressed="false">Slow</button>
- <button type="button" data-speed="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-speed="fast" aria-pressed="false">Fast</button>
- </div>
- <p class="hb-hint">How long the ink takes to cover it.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="edge-lbl">Edge</p>
- <div class="seg" id="edge-seg" role="group" aria-labelledby="edge-lbl">
- <button type="button" data-edge="smooth" aria-pressed="false">Smooth</button>
- <button type="button" data-edge="ragged" class="on" aria-pressed="true">Ragged</button>
- <button type="button" data-edge="splashy" aria-pressed="false">Splashy</button>
- </div>
- <p class="hb-hint">Splashy throws small drops around each blot.</p>
- </div>
- </div>
- <details class="hb-options">
- <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
- <div class="hb-settings">
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Dark ink edge</span><input class="hb-switch" type="checkbox" role="switch" id="rim-tog" checked autocomplete="off"></label>
- <p class="hb-hint">A dark rim runs just ahead of the picture.</p>
- </div>
- </div>
- </details>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add an ink spread reveal to [the picture or section you want to uncover]. Start with it hidden under a plain paper-colored layer, then let drops of ink land and spread outward as blots that merge until the whole picture shows. Each blot grows quickly at first and slows as it soaks in, like ink on damp paper. Give the blots uneven outlines, as rough as the settings choose, and grow each one by scaling its shape, not redrawing it; when the settings include it, run a dark ink edge just ahead of the picture. If the visitor has reduced motion turned on, fade the picture in instead. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Art and portfolio sites</li><li>Page intros</li><li>Featured pictures</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Forms</li><li>Rows of small pictures</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const stage=document.getElementById('stage'),scenesEl=document.getElementById('scenes');
- const loopTog=document.getElementById('loop-tog'),rimTog=document.getElementById('rim-tog');
- const reduce=matchMedia('(prefers-reduced-motion: reduce)'),phone=matchMedia('(max-width:600px),(max-height:500px)');
- // Where each drop lands, as shares of the scene's width and height, in the order they land
- const DROPS={one:[[.5,.5]],several:[[.24,.42],[.77,.34],[.52,.7]],corner:[[.08,.12],[.34,.4],[.68,.72]]};
- // How long one blot grows and the time between two drops (ms)
- const SPEEDS={slow:[2600,520],normal:[1800,360],fast:[1100,220]};
- // How far an outline wanders from a circle (a share of the radius) and how many splash drops each blot throws
- const EDGES={smooth:[0,0],ragged:[.11,0],splashy:[.11,9]};
- const EASE='cubic-bezier(.15,.7,.25,1)'; // fast at first, then slower and slower, like ink soaking in
- // See inside and Compare rest on a posed moment, each blot grown this share of its full size (the first drop the most), so
- // the parts show and paper is still left; reduced motion holds every view there too
- const POSE=[.62,.44,.27];
- const LABELS={normal:'A drawing of a mountain by the sea, uncovered by drops of ink that spread and merge',
- inside:'The reveal taken apart: the picture faint under the paper, and each numbered blot growing to its dashed outline',
- compare:'The reveal twice: clean circles on the left, ragged ink blots on the right'};
- let drops='several',speed='normal',edge='ragged',mode='normal',view='paper',anims=[],timers=[];
- const later=(fn,ms)=>timers.push(setTimeout(fn,ms));
- const stopTimers=()=>{timers.forEach(clearTimeout);timers=[]};
- // The same picture for every scene: a mountain by the sea at dawn, drawn in a 400 by 250 box that fills the scene (the edges
- // that do not fit are cut off). id keeps each copy's gradients apart.
- const art=(id,W,H)=>`<svg viewBox="0 0 400 250" preserveAspectRatio="xMidYMid slice" width="${W}" height="${H}">
- <defs><linearGradient id="sky-${id}" x2="0" y2="1"><stop offset="0" stop-color="#2f5d9e"/><stop offset=".6" stop-color="#f0a77a"/><stop offset="1" stop-color="#ffd9a0"/></linearGradient>
- <linearGradient id="sea-${id}" x2="0" y2="1"><stop offset="0" stop-color="#2b86c0"/><stop offset="1" stop-color="#123f66"/></linearGradient></defs>
- <rect width="400" height="160" fill="url(#sky-${id})"/><circle cx="292" cy="122" r="40" fill="#fff3d2" opacity=".35"/><circle cx="292" cy="122" r="22" fill="#fff1c9"/>
- <path fill="#6273a6" d="M0 152L58 96 104 122 168 50 232 120 272 98 334 142 400 108V160H0Z"/><path fill="#f4f1ea" d="M150 70L168 50 190 72 180 68 171 77 160 69Z"/>
- <path fill="#2f4a3a" d="M0 160V118Q44 100 86 126T140 160Z"/><rect y="158" width="400" height="92" fill="url(#sea-${id})"/>
- <g fill="#ffe3a6" opacity=".85"><rect x="268" y="166" width="48" height="3" rx="1.5"/><rect x="276" y="176" width="32" height="3" rx="1.5"/><rect x="284" y="186" width="18" height="2.5" rx="1.2"/></g>
- <path fill="none" stroke="#9fd3f2" stroke-width="1.6" opacity=".7" d="M30 182q8-4 16 0t16 0M150 196q8-4 16 0t16 0M60 222q8-4 16 0t16 0M330 214q8-4 16 0t16 0"/>
- <path fill="#f6f1e6" d="M118 186V158L138 186Z"/><path fill="#7a3b2a" d="M108 188H146L141 195H113Z"/>
- <path fill="none" stroke="#3a3346" stroke-width="1.6" stroke-linecap="round" d="M206 70q5-4 9 0q4-4 9 0M228 86q4-3 7 0q3-3 7 0"/>
- <path fill="#e8c88f" d="M0 250V216Q90 200 172 228T260 250Z"/></svg>`;
- // A seeded random sequence, so both halves of Compare and every redraw get the same blots
- function rng(s){return()=>{s=s+0x6D2B79F5|0;let t=Math.imul(s^s>>>15,1|s);t=t+Math.imul(t^t>>>7,61|t)^t;return((t^t>>>14)>>>0)/4294967296}}
- // One blot of radius 1: a circle whose radius wanders with a few slow waves and a few small fast ones (the feathery edge), and
- // for Splashy a few drops thrown around it. min is the smallest radius the outline reaches.
- function unitBlot(rand,wob,dots){
- const waves=[2,3,5,9,14,23].map((n,i)=>[n,(rand()*2-1)/(i<3?1:2.6),rand()*6.283]);
- const sum=waves.reduce((s,w)=>s+Math.abs(w[1]),0)||1;
- waves.forEach(w=>{w[1]*=wob*1.8/sum});
- const pts=[];let min=1;
- for(let i=0;i<96;i++){const a=i/96*6.283;let k=1;for(const [n,amp,ph] of waves)k+=amp*Math.sin(n*a+ph);min=Math.min(min,k);pts.push([Math.cos(a)*k,Math.sin(a)*k])}
- const splash=[...Array(dots)].map(()=>{const a=rand()*6.283,d=1.08+rand()*.3;return [Math.cos(a)*d,Math.sin(a)*d,.022+rand()*.04]});
- return {pts,splash,min};
- }
- // The blot's outline at radius R (and k times larger plus add pixels, for the ink edge), as one path
- function pathOf(b,R,k=1,add=0){
- const r=R*k+add,f=v=>(v*r).toFixed(1);
- let d='M'+b.pts.map(p=>f(p[0])+' '+f(p[1])).join('L')+'Z';
- for(const [x,y,s] of b.splash){const q=(s*r).toFixed(1);d+=`M${f(x)} ${f(y)}m-${q} 0a${q} ${q} 0 1 0 ${(2*s*r).toFixed(1)} 0a${q} ${q} 0 1 0 -${(2*s*r).toFixed(1)} 0Z`}
- return d;
- }
- // Each scene: the page's own (main) and, for Compare, a copy (twin) that grows clean circles with no ink edge. The copy has no
- // ids of its own outside its drawing, is out of the keyboard's way and hidden from screen readers.
- const main={el:document.getElementById('scene'),twin:false};
- const twinEl=main.el.cloneNode(true);twinEl.removeAttribute('id');twinEl.classList.add('twin');twinEl.inert=true;twinEl.setAttribute('aria-hidden','true');
- twinEl.querySelector('.side').textContent='Clean circles';main.el.before(twinEl);
- const twin={el:twinEl,twin:true};
- const shown=()=>mode==='compare'?[twin,main]:[main];
- // Draws a scene for its size: the paper, the ink edge, the picture seen through the blots, and See inside's outlines. Every blot
- // gets the radius that, with the others, covers the whole scene at full size: each spot of the scene belongs to its nearest
- // drop, and that drop's blot reaches the farthest of its spots even where its outline dips in.
- function build(sc){
- const W=sc.el.clientWidth||1,H=sc.el.clientHeight||1,id=sc.twin?'twin':'main',rand=rng(7);
- const [wob,dots0]=sc.twin?[0,0]:EDGES[edge],dots=phone.matches?Math.ceil(dots0/2):dots0;
- const c=DROPS[drops].map(([x,y])=>[x*W,y*H]),far=c.map(()=>1);
- for(let i=0;i<=12;i++)for(let j=0;j<=8;j++){const x=i/12*W,y=j/8*H,d=c.map(p=>Math.hypot(p[0]-x,p[1]-y)),n=d.indexOf(Math.min(...d));far[n]=Math.max(far[n],d[n])}
- sc.blots=c.map((p,i)=>{const b=unitBlot(rand,wob,dots);return {x:p[0],y:p[1],R:far[i]*1.06/b.min,b}});
- sc.W=W;sc.H=H;
- const g=(cls,i,d)=>`<g transform="translate(${sc.blots[i].x.toFixed(1)} ${sc.blots[i].y.toFixed(1)})"><g class="grow" data-i="${i}"><path class="${cls}" d="${d}"/></g></g>`;
- const each=fn=>sc.blots.map(fn).join('');
- const rim=!sc.twin&&rimTog.checked;
- sc.el.querySelector('svg')?.remove();
- sc.el.insertAdjacentHTML('afterbegin',`<svg viewBox="0 0 ${W} ${H}" aria-hidden="true"><defs><mask id="ink-${id}" maskUnits="userSpaceOnUse" x="0" y="0" width="${W}" height="${H}">
- ${each((b,i)=>g('',i,pathOf(b.b,b.R)).replace('<path class=""','<path fill="#fff"'))}</mask></defs>
- <rect class="paper" width="${W}" height="${H}"/><g class="faint">${art('f'+id,W,H)}</g>
- <g class="edge"${rim?'':' display="none"'}>${each((b,i)=>g('',i,pathOf(b.b,b.R,1.04,3)))}</g>
- <g class="reveal" mask="url(#ink-${id})">${art(id,W,H)}</g>
- <g class="see">${each(b=>`<path class="dash" d="${pathOf(b.b,b.R)}" transform="translate(${b.x.toFixed(1)} ${b.y.toFixed(1)})"/>`)}
- <g class="line">${each((b,i)=>g('',i,pathOf(b.b,b.R)))}</g>${each(b=>`<circle class="drop" cx="${b.x.toFixed(1)}" cy="${b.y.toFixed(1)}" r="4"/>`)}</g></svg>`);
- sc.grows=[...sc.el.querySelectorAll('.grow')];
- sc.fades=[...sc.el.querySelectorAll('.reveal,.edge')];
- }
- // See inside's labels, placed from the blots: a number beside each drop, the dashed line's label on a stretch of the first dashed
- // outline that is inside the box, and Faint where the paper still hides the most at the resting moment. None goes outside the box.
- function placeLabels(){
- const sc=main,W=sc.W,H=sc.H,put=(el,x,y)=>{el.style.left=Math.max(6,Math.min(W-el.offsetWidth-6,x))+'px';el.style.top=Math.max(6,Math.min(H-el.offsetHeight-6,y))+'px'};
- [1,2,3].forEach(n=>{const el=document.getElementById('cap-'+n),b=sc.blots[n-1];el.style.display=b?'':'none';if(b)put(el,b.x+10,b.y-34)});
- // the dashed label sits on a stretch of a dashed outline inside the box; with one drop the outline lies outside it, and
- // the label goes too
- const dash=document.getElementById('cap-dash');dash.hidden=false;
- const p=sc.blots.flatMap(b=>b.b.pts.map(([x,y])=>[b.x+x*b.R,b.y+y*b.R])).find(([x,y])=>x>12&&x<W-dash.offsetWidth-12&&y>40&&y<H-40);
- dash.hidden=!p;if(p)put(dash,p[0]+8,p[1]+6);
- const s=POSE,spots=[];
- for(let i=1;i<10;i++)for(let j=1;j<7;j++)spots.push([i/10*W,j/7*H]);
- const open=([x,y])=>Math.min(...sc.blots.map((b,i)=>Math.hypot(b.x-x,b.y-y)/Math.max(1,b.R*s[i])));
- const best=spots.reduce((a,q)=>open(q)>open(a)?q:a);
- const faint=document.getElementById('cap-faint');put(faint,best[0]-faint.offsetWidth/2,best[1]-12);
- }
- // The share of a blot's growing time at which it has reached size y (0 to 1), by the same ease as the animation: the ease's
- // own t for that height found by halving, then its time there
- const bez=(t,a,b)=>3*a*t*(1-t)*(1-t)+3*b*t*t*(1-t)+t*t*t;
- function timeFor(y){let lo=0,hi=1;for(let k=0;k<24;k++){const m=(lo+hi)/2;bez(m,.7,1)<y?lo=m:hi=m}return bez((lo+hi)/2,.15,.25)}
- const total=()=>{const [grow,gap]=SPEEDS[speed];return grow+gap*(DROPS[drops].length-1)};
- // The blots of every scene on show, each starting when its drop lands. at: the time to start from, or 'pose' for each blot at
- // its posed size; still: hold there
- function blots(at,still){
- anims.forEach(a=>a.cancel());anims=[];
- const [grow,gap]=SPEEDS[speed];
- for(const sc of shown())sc.grows.forEach(el=>{
- const i=+el.dataset.i,a=el.animate([{transform:'scale(0)'},{transform:'scale(1)'}],{duration:grow,delay:i*gap,easing:EASE,fill:'both'});
- a.currentTime=at==='pose'?i*gap+grow*timeFor(POSE[i]):Math.min(at,total());
- if(still)a.pause();
- anims.push(a);
- });
- }
- function layout(){shown().forEach(build);if(mode==='inside')placeLabels()}
- // One play from plain paper; under reduced motion the whole picture fades in instead. When it ends, Loop holds the picture,
- // fades it back to paper and plays again; See inside and Compare go back to their resting moment.
- function play(){
- stopTimers();layout();view='play';
- if(reduce.matches){blots(total(),true);fade(0,1,600,end);return}
- blots(0,false);
- Promise.all(anims.map(a=>a.finished)).then(end,()=>{});
- }
- function fade(from,to,ms,then){
- const f=shown().flatMap(sc=>sc.fades.map(el=>el.animate([{opacity:from},{opacity:to}],{duration:ms,fill:'forwards'})));
- anims.push(...f);
- Promise.all(f.map(a=>a.finished)).then(then,()=>{});
- }
- function end(){
- view='full';
- if(loopTog.checked&&!reduce.matches)later(()=>{if(!loopTog.checked)return;view='fade';fade(1,0,600,play)},1200);
- else if(mode!=='normal')later(rest,800);
- }
- // At rest: Normal shows the whole picture (or paper, before the first play), and with Loop on goes on looping from there;
- // See inside and Compare their resting moment
- function rest(){
- stopTimers();layout();
- if(mode==='normal'){blots(view==='paper'?0:total(),true);if(loopTog.checked&&!reduce.matches&&view!=='paper')end();return}
- view='pose';blots('pose',true);
- }
- document.addEventListener('hb:mode',e=>{
- mode=e.detail.mode;stage.setAttribute('aria-label',LABELS[mode]);notes();
- // A play under way goes on from where it is, drawn for the new size of its scene
- if(view==='play'&&anims[0]&&!reduce.matches){const t=anims[0].currentTime;layout();blots(t,false);Promise.all(anims.map(a=>a.finished)).then(end,()=>{})}
- else rest();
- });
- // The notes follow the settings: with Smooth edges both halves of Compare grow round blots (the same ones with the ink edge
- // off), and with the ink edge off See inside has no ring to name; the markup's words hold for the defaults
- const said={inside:document.querySelector('[data-hb-for="inside"]').textContent,compare:document.querySelector('[data-hb-for="compare"]').textContent};
- function notes(){
- const rim=rimTog.checked,still=reduce.matches;
- document.querySelector('[data-hb-for="compare"]').textContent=edge==='smooth'
- ?(rim?'Edge is set to Smooth, so both halves grow round blots and only Ink blots has the dark ink edge. Pick Ragged or Splashy in Try it to see uneven edges.'
- :'Edge is set to Smooth and the ink edge is off, so Clean circles and Ink blots match. Pick Ragged or Splashy in Try it to see the difference.')
- :still?'Shown still, part of the way: on the left, Clean circles have grown round and neat; on the right, Ink blots have spread with ragged edges.'
- :said.compare;
- document.querySelector('[data-hb-for="inside"]').textContent=still?'Shown still, part of the way: the picture waits faintly under the paper, and each numbered blot will grow to its dashed outline.'
- :rim?said.inside:'Inside, the picture waits faintly under the paper. Each numbered blot is a window in the paper that grows to its dashed outline.';
- }
- // Loop on plays at once; Loop off during the fade back to paper shows the whole picture again
- loopTog.addEventListener('change',()=>{if(loopTog.checked)play();else if(view==='fade'){view='full';rest()}});
- new ResizeObserver(()=>{if(view!=='play')rest()}).observe(stage);
- document.getElementById('btn-play').addEventListener('click',play);
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);notes();
- }));
- }
- choices('drops-seg',d=>{drops=d.drops});choices('speed-seg',d=>{speed=d.speed});choices('edge-seg',d=>{edge=d.edge});
- rimTog.addEventListener('change',notes);
- notes();layout();
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/02-entrance-and-exit/ink-spread-reveal/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/02-entrance-and-exit/ink-spread-reveal/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/02-entrance-and-exit/ink-spread-reveal/README.md`**
-
-````markdown
-# Ink Spread Reveal
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/ink-spread-reveal/)
-
-## What it is
-An ink spread reveal uncovers a picture the way ink spreads on damp paper. The picture starts hidden under a plain paper-colored layer, drops land one after another, and each spreads into a blot with an uneven edge; the blots grow, merge and finally show the whole picture. Each blot races outward at first and slows as it soaks in, which is what makes it read as ink rather than as a shape growing.
-
-## When to use it
-- The opening picture of an art, illustration or portfolio site
-- A featured artwork or photo that deserves a slower entrance
-- Intros for stories, posters and event pages with a hand-made look
-- Section openers on pages about painting, calligraphy or print
-
-## How it works
-The picture sits under an SVG mask. The mask holds one white blot per drop: white shows the picture and everything else stays paper. Each blot is made once, from a circle whose radius wanders with a few slow waves and a few small fast ones, so its edge looks uneven and feathery; Splashy adds small drops thrown around it. A seeded random sequence makes the same blots on every redraw.
-
-```js
-// One blot of radius 1: a circle whose radius wanders with six waves, the slow ones larger. wob is how far it may wander.
-function unitBlot(rand, wob, dots) {
- const waves = [2, 3, 5, 9, 14, 23].map((n, i) => [n, (rand() * 2 - 1) / (i < 3 ? 1 : 2.6), rand() * 6.283]);
- const sum = waves.reduce((s, w) => s + Math.abs(w[1]), 0) || 1;
- waves.forEach(w => { w[1] *= wob * 1.8 / sum; });
- const pts = []; let min = 1;
- for (let i = 0; i < 96; i++) {
- const a = i / 96 * 6.283; let k = 1;
- for (const [n, amp, ph] of waves) k += amp * Math.sin(n * a + ph);
- min = Math.min(min, k); pts.push([Math.cos(a) * k, Math.sin(a) * k]);
- }
- const splash = [...Array(dots)].map(() => { const a = rand() * 6.283, d = 1.08 + rand() * .3; return [Math.cos(a) * d, Math.sin(a) * d, .022 + rand() * .04]; });
- return { pts, splash, min };
-}
-```
-
-Each blot's full size is worked out so the blots cover the whole picture together: every spot of the picture belongs to its nearest drop, and that drop's blot is made large enough to reach the farthest of its spots, even where its outline dips in (the radius is divided by the outline's smallest reach). The blot then grows by scaling that same shape from where its drop lands, with an ease that starts fast and slows down, each drop a moment after the one before:
-
-```js
-grows.forEach(el => el.animate([{ transform: 'scale(0)' }, { transform: 'scale(1)' }],
- { duration: 1800, delay: +el.dataset.i * 360, easing: 'cubic-bezier(.15,.7,.25,1)', fill: 'both' }));
-```
-
-```html
-<svg viewBox="0 0 900 440">
- <defs><mask id="ink"><g transform="translate(216 185)"><g class="grow" data-i="0"><path fill="#fff" d="…"/></g></g></mask></defs>
- <rect class="paper" width="900" height="440"/>
- <g class="edge"><!-- the same blots a little larger, dark --></g>
- <g mask="url(#ink)"><!-- the picture --></g>
-</svg>
-```
-
-A dark copy of each blot, 4% larger, sits under the picture and shows as a rim just ahead of it. When the last blot has grown, Loop holds the picture, fades it back to paper and plays again. Under reduced motion the whole picture fades in instead.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Where the ink lands | Several drops | One drop lands in the middle; several drops are three that land in turn across the picture; from a corner, three drops land one after another from the top left toward the bottom right |
-| Speed | Normal | How long it takes to cover the picture: slow is about 3.6 seconds (each blot grows for 2.6 seconds, the drops half a second apart), normal 2.5 seconds (1.8 seconds, a third of a second apart) and fast 1.5 seconds (1.1 seconds, a fifth of a second apart) |
-| Edge | Ragged | Smooth grows round circles; ragged lets each outline wander by about a tenth of its radius; splashy adds nine small drops around each blot (five on phones) |
-| Dark ink edge | on | A dark copy of each blot, a little larger, shows as a rim just ahead of the picture; off, the picture shows with no rim |
-
-## Production notes
-- **A mask is repainted.** Animating the shapes inside an SVG mask repaints the masked picture on every frame. That is fine for one picture of this size; for a full-screen hero on slow phones, draw the blots on a canvas and use it as a `mask-image`, or reveal a canvas copy of the picture directly.
-- **Scale, never redraw.** Build each blot's outline once and grow it with `transform: scale()`. Rewriting the path every frame makes the browser parse and lay it out again.
-- **Cover the corners.** Blots that look big enough in the middle often leave the corners as paper. Size each blot from the spots it has to reach, or let the last drop be the largest.
-- **Reduced motion.** Fade the picture in instead of growing blots.
-- **GSAP** grows the blots with `gsap.fromTo(".grow", { scale: 0 }, { scale: 1, duration: 1.8, ease: "power3.out", stagger: 0.36, transformOrigin: "0 0" })`; set the origin so each grows from its drop. **Framer Motion** animates each blot `<motion.path>` inside a `<mask>` from `scale: 0` to `scale: 1` with `transition={{ delay: i * 0.36, ease: [0.15, 0.7, 0.25, 1] }}`.
-- **Real ink.** A scanned ink blot or a short ink video used as a luminance mask looks richest; keep it small and fall back to the drawn blots.
-
-## See also
-- [Clip-Path Reveal](../clip-path-reveal/) — a clean shape grows to uncover a picture
-- [Circle Reveal](../../03-page-transitions/circle-reveal/) — one circle grows from a click to show the next page
-- [Curtain Reveal](../curtain-reveal/) — a colored panel covers it, then slides away
-- [Fade In / Fade Out](../fade-in-out/) — the plain fade this becomes under reduced motion
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: 03 Page Transitions ── */` (the end of the 02 bespoke block):
-
-```css
-.pv-inkspread{background:#efe6d2;overflow:hidden}
-.pv-inkspread i{position:absolute;width:58%;aspect-ratio:1;border-radius:47% 53% 41% 59%/55% 44% 56% 45%;background:#1c1a26;transform:scale(0);animation:inkspread-blot 5s cubic-bezier(.15,.7,.25,1) infinite}
-.pv-inkspread .b1{left:-4%;top:6%}.pv-inkspread .b2{left:46%;top:-14%;border-radius:58% 42% 52% 48%/46% 58% 42% 54%;animation-delay:.35s}.pv-inkspread .b3{left:22%;top:38%;border-radius:44% 56% 60% 40%/50% 46% 54% 50%;animation-delay:.7s}
-.pv-inkspread .pic{position:absolute;inset:0;opacity:0;background:radial-gradient(circle at 72% 40%,#fff1c9 0 6%,#0000 6.5%),linear-gradient(160deg,#0000 52%,#6273a6 52.5% 63%,#0000 63.5%),linear-gradient(#2f5d9e,#f0a77a 55%,#2b86c0 56%,#123f66);animation:inkspread-pic 5s ease-out infinite}
-@keyframes inkspread-blot{0%{transform:scale(0);opacity:1}45%,80%{transform:scale(1);opacity:1}92%,100%{transform:scale(1);opacity:0}}
-@keyframes inkspread-pic{0%,28%{opacity:0}62%,84%{opacity:1}96%,100%{opacity:0}}
-```
-
-(b) insert this line right before the line that starts with `case 'sig3':` (after the end of the `case 'shatter':` block):
-
-```js
- case 'inkspread': return '<i class="b1 anim"></i><i class="b2 anim"></i><i class="b3 anim"></i><span class="pic anim"></span>';
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-grep -c "pv-inkspread" index.html; grep -c "case 'inkspread':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8961: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8961/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L1 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-node $RUN/slot.mjs run ten-L1 -- node tools/check-pages.mjs --base http://127.0.0.1:8961 --out $TEN/checks/L1/1 animations/02-entrance-and-exit/ink-spread-reveal animations/02-entrance-and-exit/shatter-effect home > $TEN/checks/L1/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L1/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-node $RUN/slot.mjs run ten-L1 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8961 --short --out $TEN/checks/L1/short-1 animations/02-entrance-and-exit/ink-spread-reveal > $TEN/checks/L1/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L1/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L1/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L1/1.log; grep '^FAIL' $TEN/checks/L1/1.log; tail -2 $TEN/checks/L1/short-1.log`.
-
-Expected: `18` (six `ok` lines each for `ink-spread-reveal`, `shatter-effect`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 7: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`) and for each choice of the settings that change only timing or show only while the demo moves (G1, G11): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-i=0; for sel in "" "#drops-seg [data-drops='one']" "#drops-seg [data-drops='corner']" "#speed-seg [data-speed='slow']" "#speed-seg [data-speed='fast']" "#edge-seg [data-edge='smooth']" "#edge-seg [data-edge='splashy']" "#rim-tog"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L1 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8961 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L1/press-$i animations/02-entrance-and-exit/ink-spread-reveal || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L1/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L1/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-i=0; for sel in "" "#speed-seg [data-speed='slow']" "#speed-seg [data-speed='fast']"; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L1 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8961 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L1/clip-$i animations/02-entrance-and-exit/ink-spread-reveal || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L1/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L1/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 8 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 3 `== clip-…` lines, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders; for a timing choice, the same frames beside `clip-0`'s): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L1/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 8: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L1/<round>/02-ink-spread-reveal-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- Replay plays from plain paper to the whole picture and stops; Loop (switched on by the shared script after arrival) fades back to paper and plays again, and goes on looping when Normal is pressed or the window resized during its hold or its fade; Slow motion makes the blots grow three times slower.
-- Every setting changes the play: Where the ink lands (One drop, Several drops, From a corner), Speed, Edge (Smooth, Ragged, Splashy) and the ink edge switch. The notes stay true after every press (lesson 16): with Edge on Smooth the Compare note says both halves grow round blots and only Ink blots has the ink edge (with the ink edge off too, that the halves match), each with how to see uneven edges; with the ink edge off, the See inside note leaves the ring out.
-- See inside and Compare play once after their press, then rest on the posed moment (blots at 62%, 44% and 27% of their final size): paper and picture both show, and the two views differ from Normal and from each other.
-- Under reduced motion the picture fades in with no blots, and each view is its posed still; at 375px the dashed outline's label is hidden so the box holds four labels at most.
-
-Decisions already made in this page (keep them; a reviewer weighs them): The blots stay an SVG mask animated with the Web Animations API (the spec allowed a canvas if the mask missed 60 fps): the mask holds a 16.7 ms median in every mode at both sizes. Both views rest on a posed moment (blot sizes 62%, 44%, 27%) so their still pictures show the mechanism; reduced motion holds every view there.
-
-- [ ] **Step 9: Frame times (required: a canvas or mask page)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-(node $RUN/slot.mjs run ten-L1 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8961 --modes normal,inside,compare animations/02-entrance-and-exit/ink-spread-reveal; node $RUN/slot.mjs run ten-L1 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8961 --phone --modes normal,inside,compare animations/02-entrance-and-exit/ink-spread-reveal; node $RUN/slot.mjs run ten-L1 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8961 animations/02-entrance-and-exit/clip-path-reveal; node $RUN/slot.mjs run ten-L1 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8961 --phone animations/02-entrance-and-exit/clip-path-reveal) > $TEN/checks/L1/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L1/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes, and no larger share of frames slower than 20 ms than Clip-Path Reveal measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: desktop 0 / 0 / 0%, phone 0 / 0 / 1%; Clip-Path Reveal 0% at both sizes. A page that misses lightens its per-frame work (a smaller grid, fewer dots, less drawn per frame) until it meets this, and says what it changed.
-
-- [ ] **Step 10: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L1 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L1 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 02.15 Ink Spread Reveal, with See inside and Compare from the start (lane 1)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/02-entrance-and-exit/ink-spread-reveal/README.md`, `A animations/02-entrance-and-exit/ink-spread-reveal/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/02-entrance-and-exit/README.md`, `M animations/02-entrance-and-exit/shatter-effect/index.html`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L1/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 11: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L1`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at the posed rest of both views after their run; the Compare note that the script rewrites; Loop after arrival; the mask's cost at phone size. It writes `$TEN/reports/L1/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 6 again (and the galleries, clips or frame times a fix touches), commits `fix: Ink Spread Reveal: <what>` after the branch check, writes `$TEN/reports/L1/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L1 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L1/`.
-
----
-
-### Task 2: L2 · 03.17 Pixelate Transition (`ten/L2`, port 8962)
-
-Do it · step 1 "Click it" · player bar: Show me, Reset and Slow motion (the page slows itself). See inside: the blocks with their grid at the chosen size, the small copy they come from in an inset, and a strip of block size over a change with the swap marked. Compare: "Cuts at once" beside "Pixelates", one click driving both. Spec: "2 · Pixelate Transition (03.17)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/03-page-transitions/pixelate-transition/index.html` (306 lines), `animations/03-page-transitions/pixelate-transition/README.md`
-- Modify (by `$TEN/lanes.mjs 2`): `index.html` (the card after Cube Transition's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 03's count 16 → 17, the catalog line), `animations/03-page-transitions/README.md` (its line), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`, `animations/03-page-transitions/cube-transition/index.html` (its first Next link, to Pixelate Transition)
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 03 bespoke block, `case 'pixelate':` in `pvMarkup()`, a `STILL` point
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js`; the page check of the new page, of Cube Transition and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults and of the timing settings' choices; frame times
-- Write (run folder): `$TEN/checks/L2/` (logs, screenshots, kit output), `$TEN/reports/L2/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L2` on `ten/L2`, its server on port 8962 (started and stopped by the coordinator), `$TEN/lanes.mjs`, `$TEN/frametimes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses Show me after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L2`: the card `['pixelate-transition','Pixelate Transition','The page breaks into big pixels, then sharpens into the next. Best for galleries.']` (03.17), `PV` key `'pixelate-transition':'pixelate'`, `PLACES` `['page','imgcard']`, `FIND` `'pixelate-transition':['page card','newpage click','pieces glitch']`; Previous: Cube Transition (final), and Cube Transition's Next link to Pixelate Transition; no Next link yet. The reports in `$TEN/reports/L2/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-node $TEN/lanes.mjs 2 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 2 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/03-page-transitions/README.md`, ` M animations/03-page-transitions/cube-transition/index.html`, ` M index.html`; then these 7 failing tests and `ℹ fail 7`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ 03-page-transitions/cube-transition uses the guided-steps page correctly`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, and Cube Transition's new Next link opens a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/03-page-transitions/pixelate-transition/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Pixelate Transition — Animation Handbook</title>
- <meta name="description" content="The page breaks into big pixels, then sharpens into the next. Best for galleries.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/pixelate-transition/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Pixelate Transition — Animation Handbook">
- <meta property="og:description" content="The page breaks into big pixels, then sharpens into the next. Best for galleries.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/pixelate-transition/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Pixelate Transition — Animation Handbook">
- <meta name="twitter:description" content="The page breaks into big pixels, then sharpens into the next. Best for galleries.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Pixelate Transition", "name": "Pixelate Transition", "description": "The page breaks into big pixels, then sharpens into the next. Best for galleries.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/pixelate-transition/", "inLanguage": "en", "articleSection": "Page Transitions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Page Transitions, Pixelate Transition"}</script>
- <style>
- :root{--bg:#0b0b0d;--ui-bg:#111114;--ui-border:rgba(255,255,255,.09);--ui-accent:#b98cff;--ui-text:#f4f4f2;--ui-muted:#8a8a92}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{display:flex;flex-direction:column;overflow:hidden;background:var(--bg);color:var(--ui-text)}
- .mini-nav{display:flex;gap:6px;padding:10px 12px;background:var(--ui-bg);border-bottom:1px solid var(--ui-border);flex-shrink:0}
- .nav-btn{background:none;border:1px solid var(--ui-border);color:var(--ui-muted);font:inherit;font-size:13px;padding:0 12px;border-radius:4px;cursor:pointer;min-height:44px}
- .nav-btn.active{border-color:var(--ui-accent);color:var(--ui-accent)}
- @media(hover:hover){.nav-btn:hover{border-color:var(--ui-accent)}}
- .page-area{flex:1;position:relative;overflow:hidden;min-height:0}
- #cvs{position:absolute;inset:0;width:100%;height:100%;display:block}
- /* See inside and Compare: plain words over the page */
- .px-lbl{display:none;position:absolute;z-index:2;padding:3px 8px;border-radius:6px;background:rgba(11,11,13,.9);color:#f4f4f2;font:600 13px/1.25 var(--hb-font);white-space:nowrap;pointer-events:none}
- .stage[data-hb-mode="inside"] .in,.stage[data-hb-mode="compare"] .half{display:block}
- .in.copy{white-space:normal;text-align:right;max-width:calc(100% - 150px)}
- .half{bottom:10px}.half.first{left:10px}.half.second{left:calc(50% + 10px)}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="do" data-hb-autoplay>
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../cube-transition/" rel="prev" aria-label="Previous: Cube Transition"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Cube Transition</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">03.17 · Page Transitions</p>
- <h1>Pixelate Transition</h1>
- <p class="hb-lede">The page breaks into big pixels, then sharpens into the next. Best for galleries.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Click it</h2><p>Click Work or About at the top of the box, or press Show me.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage">
- <nav class="mini-nav" id="nav" aria-label="Demo pages"></nav>
- <div class="page-area" id="page-area">
- <canvas id="cvs" role="img" aria-label="A small gallery site whose page breaks into big pixels and sharpens into the next page"></canvas>
- <p class="px-lbl in copy" id="l-copy" aria-hidden="true" data-hb-caption>Small copy · one pixel per block</p>
- <p class="px-lbl in up" id="l-up" aria-hidden="true" data-hb-caption>Scaled up, smoothing off</p>
- <p class="px-lbl in swap" id="l-swap" aria-hidden="true" data-hb-caption>Swap here</p>
- <p class="px-lbl half first" aria-hidden="true" data-hb-caption>Cuts at once</p>
- <p class="px-lbl half second" aria-hidden="true" data-hb-caption>Pixelates</p>
- </div>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-demo" data-hb-demo><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>Show me</button>
- <button class="hb-play" type="button" id="btn-reset" data-hb-reset><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Reset</button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, each block is one pixel of a small copy of the page, scaled up with smoothing off. The strip shows the blocks grow, swap the page at their largest, then shrink.</p>
- <p data-hb-for="compare" hidden>Cuts at once swaps the page in a blink. Pixelates breaks it into blocks, swaps while it cannot be read, then sharpens, so the cut is hidden.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting, then click a page or press Show me.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="block-lbl">Block size</p>
- <div class="seg" id="block-seg" role="group" aria-labelledby="block-lbl">
- <button type="button" data-b="8" aria-pressed="false">Small</button>
- <button type="button" data-b="16" class="on" aria-pressed="true">Medium</button>
- <button type="button" data-b="28" aria-pressed="false">Large</button>
- </div>
- <p class="hb-hint">How big the squares get mid-change.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="speed-lbl">Speed</p>
- <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">
- <button type="button" data-ms="1200" aria-pressed="false">Slow</button>
- <button type="button" data-ms="800" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-ms="500" aria-pressed="false">Fast</button>
- </div>
- <p class="hb-hint">How long the change takes.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="steps-lbl">How the blocks change</p>
- <div class="seg" id="steps-seg" role="group" aria-labelledby="steps-lbl">
- <button type="button" data-steps="0" class="on" aria-pressed="true">Smoothly</button>
- <button type="button" data-steps="1" aria-pressed="false">In steps</button>
- </div>
- <p class="hb-hint">In steps looks like an old game console.</p>
- </div>
- </div>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add a pixelate transition to [the pictures or views you switch between]. When the visitor moves to the next one, break the current picture into square blocks that grow larger, swap to the new picture while the blocks are at their largest, then shrink the blocks until the new picture is sharp again. Make each block one flat color by drawing the picture very small on a canvas and scaling it back up with smoothing turned off. Keep the page names and buttons outside the pixelated area so they stay readable, and draw only while a change runs. If the visitor has reduced motion turned on, use a short, plain fade instead. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Photo galleries</li><li>Game and retro sites</li><li>Slideshows</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Everyday navigation</li><li>Text-heavy pages</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const nav=document.getElementById('nav'),area=document.getElementById('page-area'),cvs=document.getElementById('cvs'),ctx=cvs.getContext('2d');
- const slowTog=document.getElementById('slow-tog'),reduceMQ=matchMedia('(prefers-reduced-motion: reduce)');
- const LABELS={normal:'A small gallery site whose page breaks into big pixels and sharpens into the next page',
- inside:'The page as big blocks with their grid, the small copy they come from, and a strip of block size over a change',
- compare:'The same page change twice: a plain cut on the left, the pixelating change on the right'};
- // Three pages of a made-up photography site, each a drawn picture with a title (in the site's font once it has loaded)
- const PAGES=[
- {name:'Home',draw:(g,w,h)=>{const sky=g.createLinearGradient(0,0,0,h);sky.addColorStop(0,'#28204a');sky.addColorStop(.6,'#c4567a');sky.addColorStop(1,'#f6a85c');g.fillStyle=sky;g.fillRect(0,0,w,h);
- g.fillStyle='#ffe2a0';g.beginPath();g.arc(w*.7,h*.62,h*.16,0,6.283);g.fill();
- g.fillStyle='#3b2c5a';g.beginPath();g.moveTo(0,h);g.lineTo(0,h*.72);g.lineTo(w*.22,h*.5);g.lineTo(w*.42,h*.7);g.lineTo(w*.62,h*.46);g.lineTo(w*.86,h*.68);g.lineTo(w,h*.6);g.lineTo(w,h);g.fill();
- g.fillStyle='#1d1733';g.fillRect(0,h*.86,w,h*.14);return['Northlight','Photography by the sea']}},
- {name:'Work',draw:(g,w,h)=>{g.fillStyle='#14161c';g.fillRect(0,0,w,h);
- const cols=[['#ff7a59','#ffd36e'],['#4fd1c5','#2b6cb0'],['#b794f4','#ed64a6'],['#68d391','#2f855a'],['#f6ad55','#c05621'],['#63b3ed','#5a67d8']];
- cols.forEach((c,i)=>{const x=w*(.08+(i%3)*.3),y=h*(.36+(i/3|0)*.31),tw=w*.26,th=h*.26,gr=g.createLinearGradient(x,y,x+tw,y+th);gr.addColorStop(0,c[0]);gr.addColorStop(1,c[1]);g.fillStyle=gr;g.fillRect(x,y,tw,th)});
- return['Selected work','Six stories from the coast']}},
- {name:'About',draw:(g,w,h)=>{const bg=g.createLinearGradient(0,0,w,h);bg.addColorStop(0,'#2a2016');bg.addColorStop(1,'#6b4a2b');g.fillStyle=bg;g.fillRect(0,0,w,h);
- const cx=w*.72,cy=h*.6,s=h*.2;g.fillStyle='#1b1410';g.fillRect(cx-s*1.3,cy-s*.8,s*2.6,s*1.7);g.fillStyle='#d9c6a5';g.fillRect(cx-s*.5,cy-s*1.05,s,s*.3);
- g.fillStyle='#0f0b08';g.beginPath();g.arc(cx,cy+s*.05,s*.62,0,6.283);g.fill();g.fillStyle='#4a7ab8';g.beginPath();g.arc(cx,cy+s*.05,s*.36,0,6.283);g.fill();
- g.fillStyle='#bfe0ff';g.beginPath();g.arc(cx-s*.12,cy-s*.08,s*.1,0,6.283);g.fill();return['About the studio','Two people, one old camera']}}
- ];
- let blockMax=16,changeMs=800,stepped=false,mode='normal',current=0,dpr=1,W=0,H=0,raf=0,lastT=null,change=null,runTimers=[],font='sans-serif';
- const pics={}; // each page drawn once for a size (the whole area, or a Compare half): pics[page+':'+w] is a canvas
- const small=document.createElement('canvas'),sctx=small.getContext('2d');
- function pic(i,w,h){
- const key=i+':'+w+'x'+h;if(pics[key])return pics[key];
- const c=document.createElement('canvas'),g=c.getContext('2d');c.width=w;c.height=h;
- const [title,sub]=PAGES[i].draw(g,w,h),fs=Math.max(18,Math.min(w*.09,h*.17));
- g.fillStyle='#fff';g.font=`800 ${fs}px ${font}`;g.fillText(title,w*.07,h*.08+fs);
- g.globalAlpha=.75;g.font=`500 ${fs*.42}px ${font}`;g.fillText(sub,w*.07,h*.08+fs*1.62);g.globalAlpha=1;
- return pics[key]=c;
- }
- // The block size at a share p of a change: it grows to the largest at the middle, where the page swaps, then shrinks back; In
- // steps holds it at a few sizes in turn, as old game consoles did
- function blockAt(p){
- const k=p<.5?p*2:(1-p)*2;let b=1+(blockMax-1)*k*k*(3-2*k);
- if(stepped)b=Math.max(1,Math.round(b/blockMax*4)/4*blockMax);
- return b;
- }
- // A page in a rectangle of the canvas (device pixels), as blocks of size b: drawn small, one pixel per block, then scaled back up
- // with smoothing off, so each block is one flat color
- function blocks(img,x,y,w,h,b){
- if(b<1.01*dpr){ctx.drawImage(img,x,y,w,h);return}
- const bw=Math.max(1,Math.ceil(w/b)),bh=Math.max(1,Math.ceil(h/b));
- sctx.imageSmoothingEnabled=true;sctx.drawImage(img,0,0,bw,bh);
- ctx.imageSmoothingEnabled=false;ctx.save();ctx.beginPath();ctx.rect(x,y,w,h);ctx.clip();ctx.drawImage(small,0,0,bw,bh,x,y,bw*b,bh*b);ctx.restore();
- }
- function draw(){
- const w=cvs.width,h=cvs.height,p=change?change.p:null,b=(p===null?1:blockAt(p))*dpr,show=p!==null&&p>=.5?change.to:current;
- ctx.clearRect(0,0,w,h);
- const fade=!!change&&change.fade!==undefined; // a change under reduced motion: no block grows or shrinks, in any mode
- if(mode==='compare'){
- const half=Math.floor(w/2),ph=h,rest=p===null,rw=w-half-2*dpr;
- // the cut swaps at the very moment the blocks are biggest; at rest the right holds that moment beside the page it cut to;
- // under reduced motion the right fades from one page to the next at that block size
- ctx.drawImage(pic(show,half,ph),0,0,half,ph);
- if(fade){blocks(pic(change.from,rw,ph),half+2*dpr,0,rw,ph,blockMax*dpr);ctx.globalAlpha=change.fade;blocks(pic(change.to,rw,ph),half+2*dpr,0,rw,ph,blockMax*dpr);ctx.globalAlpha=1}
- else blocks(pic(show,rw,ph),half+2*dpr,0,rw,ph,rest?blockMax*dpr:b);
- ctx.fillStyle='#000';ctx.fillRect(half,0,2*dpr,h);
- }else if(mode==='inside')drawInside(show,fade?null:p);
- else if(change&&change.fade!==undefined){ctx.drawImage(pic(change.from,w,h),0,0);ctx.globalAlpha=change.fade;ctx.drawImage(pic(change.to,w,h),0,0);ctx.globalAlpha=1}
- else blocks(pic(show,w,h),0,0,w,h,b);
- }
- // See inside: the page as blocks (the chosen size at rest) with their grid, the small copy in an inset (its size at rest, kept
- // through a change) with an arrow to the box, and a strip of block size over a change, its top marked where the page swaps
- function drawInside(show,p){
- const w=cvs.width,h=cvs.height,b=(p===null?blockMax:Math.max(1,blockAt(p)))*dpr,img=pic(show,w,h);
- blocks(img,0,0,w,h,b);
- if(b>=6*dpr){ctx.strokeStyle='rgba(255,255,255,.18)';ctx.lineWidth=1;ctx.beginPath();for(let x=b;x<w;x+=b){ctx.moveTo(x,0);ctx.lineTo(x,h)}for(let y=b;y<h;y+=b){ctx.moveTo(0,y);ctx.lineTo(w,y)}ctx.stroke()}
- const bw=Math.ceil(w/b),bh=Math.ceil(h/b),rw=Math.ceil(w/(blockMax*dpr)),rh=Math.ceil(h/(blockMax*dpr)),cell=Math.max(2,Math.floor(Math.min(110*dpr/rw,70*dpr/rh))),iw=rw*cell,ih=rh*cell,ix=w-iw-10*dpr,iy=36*dpr;
- ctx.fillStyle='rgba(11,11,13,.9)';ctx.fillRect(ix-4*dpr,iy-4*dpr,iw+8*dpr,ih+8*dpr);
- sctx.imageSmoothingEnabled=true;sctx.drawImage(img,0,0,bw,bh);ctx.imageSmoothingEnabled=false;ctx.drawImage(small,0,0,bw,bh,ix,iy,iw,ih);
- const ax=ix-6*dpr,ay=iy+ih+6*dpr,tx=w*.42,ty=h*.6;
- ctx.strokeStyle='#ffce5a';ctx.lineWidth=2.5*dpr;ctx.lineCap='round';ctx.beginPath();ctx.moveTo(ax,ay);ctx.lineTo(tx,ty);
- const a=Math.atan2(ty-ay,tx-ax);ctx.moveTo(tx-10*dpr*Math.cos(a-.5),ty-10*dpr*Math.sin(a-.5));ctx.lineTo(tx,ty);ctx.lineTo(tx-10*dpr*Math.cos(a+.5),ty-10*dpr*Math.sin(a+.5));ctx.stroke();
- const sx=10*dpr,sw=Math.min(w*.4,180*dpr),sh=34*dpr,sy=h-sh-10*dpr;
- ctx.fillStyle='rgba(11,11,13,.9)';ctx.fillRect(sx-6*dpr,sy-6*dpr,sw+12*dpr,sh+12*dpr);
- ctx.strokeStyle='#b98cff';ctx.lineWidth=2*dpr;ctx.beginPath();
- for(let i=0;i<=60;i++){const q=i/60,y=sy+sh-(blockAt(q)-1)/(blockMax-1)*sh;i?ctx.lineTo(sx+q*sw,y):ctx.moveTo(sx+q*sw,y)}ctx.stroke();
- ctx.setLineDash([4*dpr,4*dpr]);ctx.strokeStyle='rgba(255,255,255,.6)';ctx.beginPath();ctx.moveTo(sx+sw/2,sy);ctx.lineTo(sx+sw/2,sy+sh);ctx.stroke();ctx.setLineDash([]);
- const q=p===null?.5:p;ctx.fillStyle='#fff';ctx.beginPath();ctx.arc(sx+q*sw,sy+sh-(blockAt(q)-1)/(blockMax-1)*sh,5*dpr,0,6.283);ctx.fill();
- // the small copy's name to its left, Scaled up under it beside where the arrow starts, Swap here over the strip's top; the
- // labels are all measured before any moves, so the page lays out once a frame
- const L=['l-copy','l-up','l-swap'].map(id=>{const el=document.getElementById(id);return{el,w:el.offsetWidth,h:el.offsetHeight}});
- const at=[[ix/dpr-12-L[0].w,iy/dpr],[(ix+iw)/dpr-L[1].w,(iy+ih)/dpr+12],[(sx+sw/2)/dpr-L[2].w/2,sy/dpr-30]];
- L.forEach((l,i)=>{l.el.style.left=Math.max(6,Math.min(W-l.w-6,at[i][0]))+'px';l.el.style.top=Math.max(6,Math.min(H-l.h-6,at[i][1]))+'px'});
- }
- // A change runs by the time that passed (three times as long in slow motion) and draws only while it runs
- function loop(ts){
- raf=change?requestAnimationFrame(loop):0;if(!change)return;
- if(lastT===null){lastT=ts;draw();return}
- const dt=Math.min(ts-lastT,50);lastT=ts;
- const dur=(reduceMQ.matches?250:changeMs)*(slowTog.checked?3:1);
- if(change.fade!==undefined)change.fade=Math.min(1,change.fade+dt/dur);
- change.p=Math.min(1,change.p+dt/dur);
- if(change.p>=1){current=change.to;const then=change.then;change=null;draw();if(then)then();return}
- draw();
- }
- function navigate(to,then){
- if(change||to===current)return;
- change={from:current,to,p:0,then};if(reduceMQ.matches)change.fade=0;
- updateNav(to);lastT=null;cancelAnimationFrame(raf);raf=requestAnimationFrame(loop);
- }
- const navBtns=PAGES.map((p,i)=>{const b=document.createElement('button');b.type='button';b.className='nav-btn';b.textContent=p.name;b.addEventListener('click',()=>navigate(i));nav.appendChild(b);return b});
- function updateNav(n){navBtns.forEach((b,i)=>{b.classList.toggle('active',i===n);b.setAttribute('aria-current',i===n?'page':'false')})}
- // Show me: the next page, a hold of 1.2 s, and back to where it started; every pause waits on a timer
- function later(fn,ms){const id=setTimeout(()=>{runTimers=runTimers.filter(t=>t!==id);fn()},ms);runTimers.push(id)}
- function stopRun(){runTimers.forEach(clearTimeout);runTimers=[];if(change)change.then=null}
- document.getElementById('btn-demo').addEventListener('click',()=>{
- stopRun();if(change)return;const start=current;
- navigate((start+1)%PAGES.length,()=>later(()=>navigate(start),1200));
- });
- document.getElementById('btn-reset').addEventListener('click',()=>{stopRun();change=null;cancelAnimationFrame(raf);raf=0;current=0;updateNav(0);draw()});
- document.addEventListener('hb:input',()=>{if(runTimers.length||(change&&change.then))stopRun()});
- // A run never moves the focus, so focus arriving in the stage while one runs (a Tab to the page names) is the visitor's
- document.querySelector('.stage').addEventListener('focusin',e=>{if(e.isTrusted&&(runTimers.length||(change&&change.then)))stopRun()});
- // The mode switch draws the mode at once
- document.addEventListener('hb:mode',e=>{mode=e.detail.mode;cvs.setAttribute('aria-label',LABELS[mode]);if(W)draw()});
- function resize(){
- const w=area.clientWidth,h=area.clientHeight;if(!w||!h||(w===W&&h===H))return;W=w;H=h;
- dpr=Math.min(devicePixelRatio||1,2);cvs.width=Math.round(W*dpr);cvs.height=Math.round(H*dpr);small.width=cvs.width;small.height=cvs.height;
- for(const k in pics)delete pics[k];
- draw();
- }
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);if(W)draw();
- }));
- }
- choices('block-seg',d=>{blockMax=+d.b});
- choices('speed-seg',d=>{changeMs=+d.ms});
- choices('steps-seg',d=>{stepped=d.steps==='1'});
- // Under reduced motion a change is a short plain fade, and both views are still pictures
- if(reduceMQ.matches){
- document.querySelector('[data-hb-for="inside"]').textContent='Shown still: each block is one pixel of a small copy of the page, scaled up with smoothing off; the strip shows the blocks grow, swap the page at their largest and shrink.';
- document.querySelector('[data-hb-for="compare"]').textContent='Shown still: Cuts at once has swapped to the new page at once, while Pixelates is caught at its largest blocks, the moment the page swaps.';
- }
- updateNav(0);
- new ResizeObserver(resize).observe(area);
- resize();
- // The titles use the site's font: once it has loaded, the pages are drawn again
- document.fonts.ready.then(()=>{font=getComputedStyle(document.body).fontFamily;for(const k in pics)delete pics[k];if(W)draw()});
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/03-page-transitions/pixelate-transition/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/03-page-transitions/pixelate-transition/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/03-page-transitions/pixelate-transition/README.md`**
-
-````markdown
-# Pixelate Transition
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/pixelate-transition/)
-
-## What it is
-A pixelate transition hides the change from one page or picture to the next behind big square blocks. The current page breaks into blocks of flat color that grow larger, the page swaps while it cannot be read, and the blocks shrink until the new page is sharp. It looks like a picture losing and regaining focus in an old video game.
-
-## When to use it
-- Photo galleries and portfolios, between one picture and the next
-- Game, music and retro-themed sites
-- Slideshows and story pages where each step is a full picture
-- A playful change between the sections of a landing page
-
-## How it works
-The pages are pictures drawn once onto hidden canvases. During a change, each frame draws the current page very small on a second canvas, one pixel per block, with smoothing on, so each pixel becomes the average color of its block; then it draws that small copy back up to the full size with smoothing off, so every pixel turns into one flat square:
-
-```js
-const bw = Math.ceil(w / b), bh = Math.ceil(h / b); // b: the block size this frame
-small.imageSmoothingEnabled = true; small.drawImage(page, 0, 0, bw, bh);
-ctx.imageSmoothingEnabled = false; ctx.drawImage(smallCanvas, 0, 0, bw, bh, 0, 0, bw * b, bh * b);
-```
-
-The block size follows the change: it grows from one pixel to the largest size at the middle and shrinks back, and the page swaps exactly at the middle, when the blocks are largest. In steps holds the block size at a few sizes in turn instead of growing smoothly:
-
-```js
-const k = p < .5 ? p * 2 : (1 - p) * 2; // p: 0 to 1 over the change
-let b = 1 + (blockMax - 1) * k * k * (3 - 2 * k);
-if (stepped) b = Math.max(1, Math.round(b / blockMax * 4) / 4 * blockMax);
-```
-
-A change runs by the time that has passed, three times as long in slow motion, and nothing is drawn between changes. The page names are real buttons above the canvas, so they never pixelate and stay easy to read and to reach with the keyboard. The page titles are drawn in the site's font once it has loaded. Under reduced motion a change is a short, plain fade.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Block size | Medium | How big the squares are at the middle of a change: small is 8 pixels, medium 16 and large 28 |
-| Speed | Normal | How long a change takes: slow is 1.2 seconds, normal 0.8 seconds and fast 0.5 seconds |
-| How the blocks change | Smoothly | Smoothly grows and shrinks the blocks evenly; in steps holds them at a quarter, a half, three quarters and the full size in turn |
-
-## Production notes
-- **Two small drawings a frame.** Draw the page small and back up with `drawImage`; never read and average pixels in a loop. Keep the hidden page canvases at most twice the screen's pixels.
-- **Pictures, not live pages.** A canvas cannot pixelate HTML. For real pages, take a picture of each view first (html2canvas or a server-side screenshot), or pixelate only the hero picture and fade the rest. With the View Transitions API, the old and new views can be shown as pictures that a shader or canvas pixelates.
-- **WebGL.** A fragment shader that rounds each pixel's coordinates to its block (`floor(uv * blocks) / blocks`) pixelates a full-screen view in one pass; PixiJS has a ready-made pixelate filter.
-- **Keep text readable.** Leave navigation and buttons out of the pixelated area, and keep the change short: it hides the page for a moment by design.
-- **Reduced motion.** Use a short, plain crossfade instead.
-
-## See also
-- [Dissolve Transition](../dissolve/) — the page breaks into tiles that give way in an order
-- [Blur Transition](../blur-transition/) — the page goes out of focus and comes back as the next one
-- [ASCII / Halftone](../../06-3d-advanced/ascii-halftone/) — a picture drawn small and shown as characters or dots
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: 04 Micro-Interactions ── */` (the end of the 03 bespoke block):
-
-```css
-.pv-pixelate{background:#14161c;overflow:hidden}
-.pv-pixelate>*{position:absolute;inset:0;width:100%;height:100%;opacity:0;animation:pixelate-a 6s steps(1,end) infinite}
-.pv-pixelate .pa{background:radial-gradient(circle at 70% 62%,#ffe2a0 0 13%,#0000 13.5%),linear-gradient(162deg,#0000 58%,#3b2c5a 58.5% 86%,#1d1733 86.5%),linear-gradient(#28204a,#c4567a 60%,#f6a85c)}
-.pv-pixelate .ma{animation-name:pixelate-ma}.pv-pixelate .mb{animation-name:pixelate-mb}
-.pv-pixelate .pb{background:linear-gradient(135deg,#ff7a59,#ffd36e) 8% 34%/24% 26% no-repeat,linear-gradient(135deg,#4fd1c5,#2b6cb0) 38% 34%/24% 26% no-repeat,linear-gradient(135deg,#b794f4,#ed64a6) 68% 34%/24% 26% no-repeat,linear-gradient(135deg,#68d391,#2f855a) 8% 66%/24% 26% no-repeat,linear-gradient(135deg,#f6ad55,#c05621) 38% 66%/24% 26% no-repeat,linear-gradient(135deg,#63b3ed,#5a67d8) 68% 66%/24% 26% no-repeat,#14161c;animation-name:pixelate-b}
-@keyframes pixelate-a{0%{opacity:1}30%{opacity:0}92%{opacity:1}}
-@keyframes pixelate-ma{0%{opacity:0}30%{opacity:1}38%{opacity:0}86%{opacity:1}92%{opacity:0}}
-@keyframes pixelate-mb{0%{opacity:0}38%{opacity:1}46%{opacity:0}80%{opacity:1}86%{opacity:0}}
-@keyframes pixelate-b{0%{opacity:0}46%{opacity:1}80%{opacity:0}}
-```
-
-(b) insert this line right after the line that starts with `case 'cubepage':`:
-
-```js
- case 'pixelate': return '<span class="pa anim"></span><svg class="ma anim" viewBox="0 0 8 5" preserveAspectRatio="none"><rect x="0" y="0" width="1.02" height="1.02" fill="#2b2250"/><rect x="1" y="0" width="1.02" height="1.02" fill="#2b2250"/><rect x="2" y="0" width="1.02" height="1.02" fill="#2b2250"/><rect x="3" y="0" width="1.02" height="1.02" fill="#2b2250"/><rect x="4" y="0" width="1.02" height="1.02" fill="#2b2250"/><rect x="5" y="0" width="1.02" height="1.02" fill="#2b2250"/><rect x="6" y="0" width="1.02" height="1.02" fill="#2b2250"/><rect x="7" y="0" width="1.02" height="1.02" fill="#2b2250"/><rect x="0" y="1" width="1.02" height="1.02" fill="#3a2758"/><rect x="1" y="1" width="1.02" height="1.02" fill="#3a2758"/><rect x="2" y="1" width="1.02" height="1.02" fill="#4a2b60"/><rect x="3" y="1" width="1.02" height="1.02" fill="#4a2b60"/><rect x="4" y="1" width="1.02" height="1.02" fill="#4a2b60"/><rect x="5" y="1" width="1.02" height="1.02" fill="#4a2b60"/><rect x="6" y="1" width="1.02" height="1.02" fill="#3a2758"/><rect x="7" y="1" width="1.02" height="1.02" fill="#3a2758"/><rect x="0" y="2" width="1.02" height="1.02" fill="#9a4a74"/><rect x="1" y="2" width="1.02" height="1.02" fill="#b04f78"/><rect x="2" y="2" width="1.02" height="1.02" fill="#c4567a"/><rect x="3" y="2" width="1.02" height="1.02" fill="#c4567a"/><rect x="4" y="2" width="1.02" height="1.02" fill="#d87a6e"/><rect x="5" y="2" width="1.02" height="1.02" fill="#ffd994"/><rect x="6" y="2" width="1.02" height="1.02" fill="#d87a6e"/><rect x="7" y="2" width="1.02" height="1.02" fill="#c4567a"/><rect x="0" y="3" width="1.02" height="1.02" fill="#3b2c5a"/><rect x="1" y="3" width="1.02" height="1.02" fill="#e08a64"/><rect x="2" y="3" width="1.02" height="1.02" fill="#3b2c5a"/><rect x="3" y="3" width="1.02" height="1.02" fill="#3b2c5a"/><rect x="4" y="3" width="1.02" height="1.02" fill="#e8966a"/><rect x="5" y="3" width="1.02" height="1.02" fill="#f3b07a"/><rect x="6" y="3" width="1.02" height="1.02" fill="#3b2c5a"/><rect x="7" y="3" width="1.02" height="1.02" fill="#3b2c5a"/><rect x="0" y="4" width="1.02" height="1.02" fill="#231a3c"/><rect x="1" y="4" width="1.02" height="1.02" fill="#231a3c"/><rect x="2" y="4" width="1.02" height="1.02" fill="#231a3c"/><rect x="3" y="4" width="1.02" height="1.02" fill="#231a3c"/><rect x="4" y="4" width="1.02" height="1.02" fill="#231a3c"/><rect x="5" y="4" width="1.02" height="1.02" fill="#231a3c"/><rect x="6" y="4" width="1.02" height="1.02" fill="#231a3c"/><rect x="7" y="4" width="1.02" height="1.02" fill="#231a3c"/></svg><svg class="mb anim" viewBox="0 0 8 5" preserveAspectRatio="none"><rect x="0" y="0" width="1.02" height="1.02" fill="#14161c"/><rect x="1" y="0" width="1.02" height="1.02" fill="#14161c"/><rect x="2" y="0" width="1.02" height="1.02" fill="#14161c"/><rect x="3" y="0" width="1.02" height="1.02" fill="#14161c"/><rect x="4" y="0" width="1.02" height="1.02" fill="#14161c"/><rect x="5" y="0" width="1.02" height="1.02" fill="#14161c"/><rect x="6" y="0" width="1.02" height="1.02" fill="#14161c"/><rect x="7" y="0" width="1.02" height="1.02" fill="#14161c"/><rect x="0" y="1" width="1.02" height="1.02" fill="#14161c"/><rect x="1" y="1" width="1.02" height="1.02" fill="#ff8a5c"/><rect x="2" y="1" width="1.02" height="1.02" fill="#ffb764"/><rect x="3" y="1" width="1.02" height="1.02" fill="#14161c"/><rect x="4" y="1" width="1.02" height="1.02" fill="#3fa9c0"/><rect x="5" y="1" width="1.02" height="1.02" fill="#14161c"/><rect x="6" y="1" width="1.02" height="1.02" fill="#c08ae8"/><rect x="7" y="1" width="1.02" height="1.02" fill="#d66fb0"/><rect x="0" y="2" width="1.02" height="1.02" fill="#14161c"/><rect x="1" y="2" width="1.02" height="1.02" fill="#ffa060"/><rect x="2" y="2" width="1.02" height="1.02" fill="#ffc868"/><rect x="3" y="2" width="1.02" height="1.02" fill="#14161c"/><rect x="4" y="2" width="1.02" height="1.02" fill="#2f86b8"/><rect x="5" y="2" width="1.02" height="1.02" fill="#14161c"/><rect x="6" y="2" width="1.02" height="1.02" fill="#c98ad8"/><rect x="7" y="2" width="1.02" height="1.02" fill="#e07ab4"/><rect x="0" y="3" width="1.02" height="1.02" fill="#14161c"/><rect x="1" y="3" width="1.02" height="1.02" fill="#5cc286"/><rect x="2" y="3" width="1.02" height="1.02" fill="#3c9b62"/><rect x="3" y="3" width="1.02" height="1.02" fill="#14161c"/><rect x="4" y="3" width="1.02" height="1.02" fill="#f39a4c"/><rect x="5" y="3" width="1.02" height="1.02" fill="#14161c"/><rect x="6" y="3" width="1.02" height="1.02" fill="#5fa8e8"/><rect x="7" y="3" width="1.02" height="1.02" fill="#6a76d8"/><rect x="0" y="4" width="1.02" height="1.02" fill="#14161c"/><rect x="1" y="4" width="1.02" height="1.02" fill="#4caf74"/><rect x="2" y="4" width="1.02" height="1.02" fill="#2f855a"/><rect x="3" y="4" width="1.02" height="1.02" fill="#14161c"/><rect x="4" y="4" width="1.02" height="1.02" fill="#d27a38"/><rect x="5" y="4" width="1.02" height="1.02" fill="#14161c"/><rect x="6" y="4" width="1.02" height="1.02" fill="#5b9ae0"/><rect x="7" y="4" width="1.02" height="1.02" fill="#5a67d8"/></svg><span class="pb anim"></span>';
-```
-
-(c) in `const STILL={`, the map's last line ends with `izoom:.02` (the line before `};`): make it end with `izoom:.02,pixelate:.34` (the middle of its loop is not a clear frame; reduced motion holds the preview there).
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-grep -c "pv-pixelate" index.html; grep -c "case 'pixelate':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8962: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8962/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L2 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-node $RUN/slot.mjs run ten-L2 -- node tools/check-pages.mjs --base http://127.0.0.1:8962 --out $TEN/checks/L2/1 animations/03-page-transitions/pixelate-transition animations/03-page-transitions/cube-transition home > $TEN/checks/L2/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L2/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-node $RUN/slot.mjs run ten-L2 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8962 --short --out $TEN/checks/L2/short-1 animations/03-page-transitions/pixelate-transition > $TEN/checks/L2/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L2/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L2/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L2/1.log; grep '^FAIL' $TEN/checks/L2/1.log; tail -2 $TEN/checks/L2/short-1.log`.
-
-Expected: `18` (six `ok` lines each for `pixelate-transition`, `cube-transition`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 7: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`) and for each choice of the settings that change only timing or show only while the demo moves (G1, G11): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-i=0; for sel in "" "#block-seg [data-b='8']" "#block-seg [data-b='28']" "#speed-seg [data-ms='1200']" "#speed-seg [data-ms='500']" "#steps-seg [data-steps='1']"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L2 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8962 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L2/press-$i animations/03-page-transitions/pixelate-transition || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L2/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L2/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-i=0; for sel in "" "#speed-seg [data-ms='1200']" "#speed-seg [data-ms='500']" "#steps-seg [data-steps='1']"; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L2 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8962 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L2/clip-$i animations/03-page-transitions/pixelate-transition || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L2/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L2/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 6 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 4 `== clip-…` lines, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders; for a timing choice, the same frames beside `clip-0`'s): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L2/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 8: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L2/<round>/03-pixelate-transition-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- Work and About at the top of the box are real buttons, at least 44px tall on phones; a click pixelates to that page; Show me goes to the next page and back in about 2.8 s and ends on the page it started from (a Tab into the buttons stops it); Reset returns to Home; at rest the page is sharp on a 2x screen too (drawn straight, not through blocks).
-- Block size (Small, Medium, Large), Speed (Slow, Normal, Fast) and How the blocks change (Smoothly, In steps) each change the next change and both views (See inside's inset and strip, Compare's right half).
-- Compare rests with the right half at its largest blocks beside the left half's plain cut; See inside rests at the chosen block size with its grid, and its small copy keeps its rest size all through a change (the clips show it).
-- Under reduced motion a change is a 250 ms plain fade in every mode: Compare's left half cuts at the fade's middle while its right half crossfades at the largest blocks, and See inside shows the new page at that block size with the strip's dot held at the swap; nothing grows or shrinks, and nothing is drawn between changes.
-
-Decisions already made in this page (keep them; a reviewer weighs them): Compare's halves sit side by side at every width and its note names them by their labels (no left or right). See inside draws its grid only where blocks are at least 6 device pixels (fewer lines a frame), and measures its labels before it moves them (one layout a frame). See inside's inset keeps the size it has at rest while the blocks change, and the small copy of each moment is drawn into it: drawn at its own size, it filled the box while the blocks were small (this plan's clips found it; no still shows a change's middle).
-
-- [ ] **Step 9: Frame times (required: a canvas or mask page)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-(node $RUN/slot.mjs run ten-L2 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8962 --modes normal,inside,compare animations/03-page-transitions/pixelate-transition; node $RUN/slot.mjs run ten-L2 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8962 --phone --modes normal,inside,compare animations/03-page-transitions/pixelate-transition; node $RUN/slot.mjs run ten-L2 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8962 animations/03-page-transitions/dissolve; node $RUN/slot.mjs run ten-L2 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8962 --phone animations/03-page-transitions/dissolve) > $TEN/checks/L2/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L2/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes, and no larger share of frames slower than 20 ms than Dissolve Transition measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: desktop 0 / 1 / 0%, phone 0 / 1 / 0% (earlier runs, the machine busy: See inside 1 to 14% on a desktop); Dissolve Transition 4 to 26% on a desktop and 1% on a phone. A page that misses lightens its per-frame work (a smaller grid, fewer dots, less drawn per frame) until it meets this, and says what it changed.
-
-- [ ] **Step 10: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L2 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L2 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 03.17 Pixelate Transition, with See inside and Compare from the start (lane 2)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/03-page-transitions/pixelate-transition/README.md`, `A animations/03-page-transitions/pixelate-transition/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/03-page-transitions/README.md`, `M animations/03-page-transitions/cube-transition/index.html`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L2/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 11: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L2`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at the nav buttons' size on phones; nothing drawn between changes; the inset (its size through a change) and the strip labels at 375 and 320. It writes `$TEN/reports/L2/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 6 again (and the galleries, clips or frame times a fix touches), commits `fix: Pixelate Transition: <what>` after the branch check, writes `$TEN/reports/L2/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L2 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L2/`.
-
----
-
-### Task 3: L3 · 04.42 Before/After Slider (`ten/L3`, port 8963)
-
-Do it · step 1 "Drag it" · player bar: Show me, Reset and Slow motion (the page slows itself). See inside: Before at the back, After in front with its hidden part faint and its window dashed, the line on the window's edge. Compare: "Resizes it" (a copy whose top picture is squeezed) beside "Uncovers it", one line driving both. Spec: "3 · Before/After Slider (04.42)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/04-micro-interactions/before-after-slider/index.html` (344 lines), `animations/04-micro-interactions/before-after-slider/README.md`
-- Modify (by `$TEN/lanes.mjs 3`): `index.html` (the card after Dynamic Island's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 04's count 41 → 42, the catalog line), `animations/04-micro-interactions/README.md` (its line), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`, `animations/04-micro-interactions/dynamic-island/index.html` (its first Next link, to Before/After Slider)
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 04 bespoke block, `case 'beforeafter':` in `pvMarkup()`
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js` (with a proof edit, put back); the page check of the new page, of Dynamic Island and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults
-- Write (run folder): `$TEN/checks/L3/` (logs, screenshots, kit output), `$TEN/reports/L3/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L3` on `ten/L3`, its server on port 8963 (started and stopped by the coordinator), `$TEN/lanes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses Show me after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L3`: the card `['before-after-slider','Before/After Slider','Drag a line across two pictures to compare them. Best for photo edits.']` (04.42), `PV` key `'before-after-slider':'beforeafter'`, `PLACES` `['imgcard']`, `FIND` `'before-after-slider':['card','drag','reveal slide']`; Previous: Dynamic Island (final), and Dynamic Island's Next link to Before/After Slider; no Next link yet. For Task 11: `'before-after-slider'` in the `'04-micro-interactions'` list of `KEYBOARD_PAGES`. The reports in `$TEN/reports/L3/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-node $TEN/lanes.mjs 3 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 3 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/04-micro-interactions/README.md`, ` M animations/04-micro-interactions/dynamic-island/index.html`, ` M index.html`; then these 7 failing tests and `ℹ fail 7`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ 04-micro-interactions/dynamic-island uses the guided-steps page correctly`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, and Dynamic Island's new Next link opens a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/04-micro-interactions/before-after-slider/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Before/After Slider — Animation Handbook</title>
- <meta name="description" content="Drag a line across two pictures to compare them. Best for photo edits.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Before/After Slider — Animation Handbook">
- <meta property="og:description" content="Drag a line across two pictures to compare them. Best for photo edits.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Before/After Slider — Animation Handbook">
- <meta name="twitter:description" content="Drag a line across two pictures to compare them. Best for photo edits.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Before/After Slider", "name": "Before/After Slider", "description": "Drag a line across two pictures to compare them. Best for photo edits.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/", "inLanguage": "en", "articleSection": "Micro-Interactions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Micro-Interactions, Before/After Slider"}</script>
- <style>
- :root{--ui-accent:#ff9d5c}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- /* --v: how much of After shows, 0 to 1 (the line's place from the left, or from the bottom in Top and bottom) */
- .stage{--v:.5;position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);background:#0b0b0d;-webkit-user-select:none;user-select:none}
- .defs{position:absolute;width:0;height:0;overflow:hidden}
- .ba{position:relative;min-width:0;overflow:hidden;touch-action:pan-y;cursor:ew-resize}
- .vert .ba{cursor:pointer}
- .layer,.win,.pic,.rail{position:absolute;inset:0}
- .pic svg{display:block;width:100%;height:100%}
- /* Before lies whole underneath, gray and flat. After sits in a window that slides with the line, and its picture slides back
- by the same amount, so it never moves: two transforms, nothing redrawn */
- .before{filter:grayscale(1) contrast(.72) brightness(1.08)}
- .win{overflow:hidden;transform:translateX(calc((var(--v) - 1) * 100%));will-change:transform}
- .win .pic{transform:translateX(calc((1 - var(--v)) * 100%));will-change:transform}
- .vert .win{transform:translateY(calc((1 - var(--v)) * 100%))}
- .vert .win .pic{transform:translateY(calc((var(--v) - 1) * 100%))}
- .rail{pointer-events:none;transform:translateX(calc(var(--v) * 100%));will-change:transform}
- .vert .rail{transform:translateY(calc((1 - var(--v)) * 100%))}
- .line{position:absolute;left:-1px;top:0;bottom:0;width:2px;background:#fff;box-shadow:0 0 0 1px rgba(0,0,0,.25)}
- .vert .line{left:0;right:0;top:-1px;bottom:auto;width:auto;height:2px}
- /* The handle: a slider the keyboard can move too, at least 48px to touch whatever its look */
- .handle{position:absolute;left:0;top:50%;width:48px;height:48px;margin:-24px 0 0 -24px;display:grid;place-items:center;border-radius:24px;pointer-events:auto;cursor:grab;touch-action:none}
- .vert .handle{left:50%;top:0}
- .h-bar .handle{height:68px;margin-top:-34px}
- .vert.h-bar .handle{width:68px;height:48px;margin:-24px 0 0 -34px}
- .grip{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:#fff;color:#16161a;box-shadow:0 2px 10px rgba(0,0,0,.4)}
- .grip svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
- .vert .grip svg{transform:rotate(90deg)}
- .h-bar .grip{width:12px;height:60px;border-radius:6px}
- .vert.h-bar .grip{width:60px;height:12px}
- .h-bar .grip svg,.h-line .grip{opacity:0}
- .tag{position:absolute;top:10px;padding:4px 10px;border-radius:999px;background:rgba(11,11,13,.78);color:#f4f4f2;font:600 13px/1.2 var(--hb-font);transition:opacity .25s}
- .tag-a{left:10px}.tag-b{right:10px}
- .vert .tag-b{right:auto;left:10px}.vert .tag-a{top:auto;bottom:10px}
- .tag.gone,.no-tags .tag{opacity:0}
- /* See inside and Compare: plain words over the stage; in See inside the two pictures pulled apart, Before at the back and
- After in front, its hidden part faint and its window dashed */
- .ghost,.twin,.cap{display:none}
- .cap{position:absolute;z-index:3;padding:3px 8px;border-radius:6px;background:rgba(11,11,13,.9);color:#f4f4f2;font:600 13px/1.25 var(--hb-font);white-space:nowrap;pointer-events:none}
- .stage[data-hb-mode="inside"] .cap.in,.stage[data-hb-mode="compare"] .cap.half{display:block}
- .stage[data-hb-mode="inside"] .ghost{display:block;opacity:.3}
- .stage[data-hb-mode="inside"] .layer{outline:2px solid rgba(255,255,255,.4)}
- .stage[data-hb-mode="inside"] .back{transform:translate(-9%,-9%) scale(.62)}
- .stage[data-hb-mode="inside"] .front{overflow:hidden;transform:translate(9%,9%) scale(.62);box-shadow:0 18px 40px rgba(0,0,0,.65)}
- .stage[data-hb-mode="inside"] .win::after{content:"";position:absolute;inset:0;border:4px dashed var(--ui-accent)}
- .stage[data-hb-mode="inside"] .tag{font-size:20px}
- .stage[data-hb-mode="inside"] .tag-b{display:none}
- .stage[data-hb-mode="inside"] .handle{transform:scale(1.62)}
- /* Compare: a copy whose After picture is resized with the line beside the real one, which uncovers it; one line drives both.
- Their names sit in a strip under them, clear of the Before and After labels */
- .stage[data-hb-mode="compare"]{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr) 36px;column-gap:4px}
- .stage[data-hb-mode="compare"] .twin{display:block}
- .twin .win{transform:none}
- .twin .after{transform:scaleX(var(--v));transform-origin:0 50%}
- .vert .twin .after{transform:scaleY(var(--v));transform-origin:50% 100%}
- .cap.half{bottom:6px}.cap.first{left:8px}.cap.second{left:calc(50% + 10px)}
- @media(prefers-reduced-motion:reduce){.tag{transition:none}}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="do" data-hb-autoplay>
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../dynamic-island/" rel="prev" aria-label="Previous: Dynamic Island"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Dynamic Island</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">04.42 · Micro-Interactions</p>
- <h1>Before/After Slider</h1>
- <p class="hb-lede">Drag a line across two pictures to compare them. Best for photo edits.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Drag it</h2><p>Drag the line, or press Show me.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage">
- <svg class="defs" aria-hidden="true"><defs>
- <linearGradient id="ba-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2b3f8f"/><stop offset=".6" stop-color="#f08a6c"/><stop offset="1" stop-color="#ffd18a"/></linearGradient>
- <linearGradient id="ba-sea" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2a9d9b"/><stop offset="1" stop-color="#0f3b57"/></linearGradient>
- <!-- A made-up harbor at dusk: a sun, hills, a lighthouse, houses on the shore, a pier and two boats -->
- <symbol id="ba-harbor" viewBox="0 0 800 500">
- <rect width="800" height="330" fill="url(#ba-sky)"/>
- <circle cx="400" cy="200" r="60" fill="#ffe7a8"/>
- <path d="M0 296 120 236 214 280 330 222 470 288 560 256 680 300 800 262V332H0Z" fill="#5b4a8c"/>
- <rect y="326" width="800" height="174" fill="url(#ba-sea)"/>
- <path d="M346 348h108M364 366h72M378 384h44M390 402h20" stroke="#ffe7a8" stroke-width="6" stroke-linecap="round" opacity=".85"/>
- <path d="M0 326H268L238 356H0Z" fill="#3a2d29"/>
- <path d="M20 326V282L52 256 84 282V326ZM96 326V292L126 268 156 292V326ZM168 326V286L196 262 224 286V326Z" fill="#e85d4a"/>
- <path d="M96 292 126 268 156 292ZM20 282 52 256 84 282Z" fill="#2c3e78"/>
- <path d="M40 296h12v12H40ZM116 300h12v12h-12ZM186 296h12v12h-12Z" fill="#ffd36e"/>
- <path d="M236 352H330V362H236Z" fill="#7a5235"/><path d="M250 362h6v26h-6ZM288 362h6v26h-6ZM320 362h6v26h-6Z" fill="#5a3a24"/>
- <path d="M580 330C596 300 664 296 700 330Z" fill="#2e2a3a"/><path d="M624 314V214H658V314Z" fill="#f4f1ea"/>
- <path d="M624 240H658V256H624ZM624 278H658V294H624Z" fill="#e0453a"/><path d="M618 214H664L641 190Z" fill="#e0453a"/><rect x="629" y="198" width="24" height="16" fill="#ffe7a8"/>
- <path d="M470 388H570L552 408H488Z" fill="#d6453d"/><path d="M518 386V316L566 384Z" fill="#fbf7ee"/>
- <path d="M150 404H222L210 418H162Z" fill="#f2b33d"/><path d="M184 402V356L218 400Z" fill="#fbf7ee"/>
- <path d="M250 128q12-10 24 0q12-10 24 0M318 104q9-8 18 0q9-8 18 0" fill="none" stroke="#2a2342" stroke-width="4" stroke-linecap="round"/>
- </symbol>
- </defs></svg>
- <div class="ba" id="ba">
- <div class="layer back">
- <div class="pic before" id="before-pic" role="img" aria-label="A harbor at dusk, half the gray original and half the edited picture in full color, split by a line you can drag"><svg viewBox="0 0 800 500" preserveAspectRatio="xMidYMid slice"><use href="#ba-harbor" width="800" height="500"/></svg></div>
- <span class="tag tag-b" aria-hidden="true">Before</span>
- </div>
- <div class="layer front">
- <div class="pic ghost" aria-hidden="true"><svg viewBox="0 0 800 500" preserveAspectRatio="xMidYMid slice"><use href="#ba-harbor" width="800" height="500"/></svg></div>
- <div class="win"><div class="pic after" aria-hidden="true"><svg viewBox="0 0 800 500" preserveAspectRatio="xMidYMid slice"><use href="#ba-harbor" width="800" height="500"/></svg></div></div>
- <span class="tag tag-a" aria-hidden="true">After</span>
- <div class="rail"><span class="line"></span><div class="handle" id="handle" role="slider" tabindex="0" aria-label="Before and after" aria-orientation="horizontal" aria-valuemin="0" aria-valuemax="100" aria-valuenow="50" aria-valuetext="50% After"><span class="grip"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m9 7-5 5 5 5M15 7l5 5-5 5"/></svg></span></div></div>
- </div>
- </div>
- <p class="cap in" id="c-before" aria-hidden="true" data-hb-caption>Before · whole, underneath</p>
- <p class="cap in" id="c-after" aria-hidden="true" data-hb-caption>After · shows only in the window</p>
- <p class="cap in" id="c-win" aria-hidden="true" data-hb-caption>Window · slides with the line</p>
- <p class="cap half first" aria-hidden="true" data-hb-caption>Resizes it</p>
- <p class="cap half second" aria-hidden="true" data-hb-caption>Uncovers it</p>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-demo" data-hb-demo><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>Show me</button>
- <button class="hb-play" type="button" id="btn-reset" data-hb-reset><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Reset</button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, Before lies whole underneath and After sits in front, showing only inside its dashed window. The window slides with the line, while the picture in it stays put.</p>
- <p data-hb-for="compare" hidden>On the left the top picture is resized with the line, so it squeezes. On the right it is only uncovered, so both pictures stay put.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting, then drag the line or press Show me.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="split-lbl">Split</p>
- <div class="seg" id="split-seg" role="group" aria-labelledby="split-lbl">
- <button type="button" data-split="lr" class="on" aria-pressed="true">Left and right</button>
- <button type="button" data-split="tb" aria-pressed="false">Top and bottom</button>
- </div>
- <p class="hb-hint">Which way the line runs.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="handle-lbl">Handle</p>
- <div class="seg" id="handle-seg" role="group" aria-labelledby="handle-lbl">
- <button type="button" data-h="knob" class="on" aria-pressed="true">Knob</button>
- <button type="button" data-h="bar" aria-pressed="false">Bar</button>
- <button type="button" data-h="line" aria-pressed="false">Line only</button>
- </div>
- <p class="hb-hint">A knob tells people they can drag.</p>
- </div>
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Shows labels</span><input class="hb-switch" type="checkbox" role="switch" id="tags-tog" checked autocomplete="off"></label>
- <p class="hb-hint">Before and After fade as the line covers them.</p>
- </div>
- </div>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add a before-and-after slider to [the two pictures you want to compare]. Stack the pictures exactly on top of each other and show the top one only up to a dividing line with a handle, so each side of the line shows one picture. Dragging on the pictures moves the line, and a tap jumps it there. Uncover the top picture with a clip or a sliding window, never by resizing it, so neither picture moves or squeezes. Use pointer events for mouse and touch, keep page scrolling free on phones, and let the arrow keys move the handle. If the visitor has reduced motion turned on, move the line without gliding. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Photo edits</li><li>Redesigns</li><li>Renovations</li><li>Product upgrades</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Small thumbnails</li><li>Unrelated pictures</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const stage=document.querySelector('.stage'),ba=document.getElementById('ba'),back=ba.querySelector('.back'),front=ba.querySelector('.front');
- const handle=document.getElementById('handle'),pic=document.getElementById('before-pic'),slowTog=document.getElementById('slow-tog');
- const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),caps=['c-before','c-after','c-win'].map(id=>document.getElementById(id));
- const LABELS={normal:pic.getAttribute('aria-label'),
- inside:'The two pictures pulled apart: the gray original whole at the back, the edited one in front, showing only in its window',
- compare:'The same split twice: the edited picture squeezed into the space beside the line, then only uncovered by it'};
- // v: how much of After shows (0 to 1); aim: where the line is going (a glide's end, or v)
- // runTo: where a Show me run ends (where it started, or the middle once Normal takes the views' pose away)
- let v=.5,aim=.5,runTo=.5,mode='normal',posed=false,twin=null,glideRaf=0,demo=false,runTimers=[],drag=null;
- const isVert=()=>stage.classList.contains('vert');
-
- function setV(x){
- v=Math.min(1,Math.max(0,x));stage.style.setProperty('--v',v);
- const pct=Math.round(v*100);handle.setAttribute('aria-valuenow',pct);handle.setAttribute('aria-valuetext',pct+'% After');
- fadeTags();if(mode==='inside')placeCaps();
- }
- // Before and After fade while the line covers them, on the real pictures and, in Compare, on the copy
- function fadeTags(){
- const vert=isVert();
- stage.querySelectorAll('.ba').forEach(f=>{
- const a=f.querySelector('.tag-a'),b=f.querySelector('.tag-b'),size=vert?f.clientHeight:f.clientWidth,at=vert?(1-v)*size:v*size;
- if(!size)return;
- a.classList.toggle('gone',vert?at>a.offsetTop-8:at<a.offsetLeft+a.offsetWidth+8);
- b.classList.toggle('gone',vert?at<b.offsetTop+b.offsetHeight+8:at>b.offsetLeft-8);
- });
- }
- // The line glides to a place by the time that passes (three times as long in slow motion); under reduced motion it jumps
- function glide(to,ms,then){
- cancelAnimationFrame(glideRaf);glideRaf=0;aim=Math.min(1,Math.max(0,to));
- if(reduceMQ.matches){setV(aim);if(then)then();return}
- const from=v,dur=ms*(slowTog.checked?3:1);let t0=null;
- const step=ts=>{
- if(t0===null)t0=ts;
- const k=reduceMQ.matches?1:Math.min(1,(ts-t0)/dur);
- setV(from+(aim-from)*k*k*(3-2*k));
- if(k<1)glideRaf=requestAnimationFrame(step);else{glideRaf=0;if(then)then()}
- };
- glideRaf=requestAnimationFrame(step);
- }
- // Show me: to 80%, to 20% and back to where it started; every pause waits on a timer, and slow motion triples the moves only
- function later(fn,move,hold){const id=setTimeout(()=>{runTimers=runTimers.filter(t=>t!==id);fn()},move*(slowTog.checked?3:1)+hold);runTimers.push(id)}
- function stopRun(){runTimers.forEach(clearTimeout);runTimers=[];if(demo){cancelAnimationFrame(glideRaf);glideRaf=0;aim=v}demo=false}
- // The visitor takes over: a run stops, and the views' pose no longer needs undoing
- function take(){stopRun();posed=false}
- document.getElementById('btn-demo').addEventListener('click',()=>{
- stopRun();cancelAnimationFrame(glideRaf);glideRaf=0;demo=true;runTo=v;
- glide(.8,700);
- later(()=>glide(.2,900),700,250);
- later(()=>glide(runTo,700,()=>{demo=false}),1600,500);
- });
- document.getElementById('btn-reset').addEventListener('click',()=>{take();cancelAnimationFrame(glideRaf);glideRaf=0;aim=.5;setV(.5)});
- document.addEventListener('hb:input',()=>{if(demo)stopRun()});
- stage.addEventListener('focusin',e=>{if(e.isTrusted&&demo)stopRun()});
-
- // A drag moves the line with the pointer (in Top and bottom, from the handle only, so the page still scrolls); a tap glides it there
- const vAt=e=>{const r=front.getBoundingClientRect();return isVert()?1-(e.clientY-r.top)/r.height:(e.clientX-r.left)/r.width};
- ba.addEventListener('pointerdown',e=>{
- if(e.pointerType==='mouse'&&e.button!==0)return;
- drag={id:e.pointerId,x:e.clientX,y:e.clientY,far:false,grab:!isVert()||!!e.target.closest('.handle')};
- if(drag.grab)ba.setPointerCapture(e.pointerId);
- });
- ba.addEventListener('pointermove',e=>{
- if(!drag||e.pointerId!==drag.id)return;
- if(!drag.far&&Math.hypot(e.clientX-drag.x,e.clientY-drag.y)<5)return;
- drag.far=true;if(!drag.grab)return;
- take();cancelAnimationFrame(glideRaf);glideRaf=0;setV(vAt(e));aim=v;
- });
- ba.addEventListener('pointerup',e=>{if(!drag||e.pointerId!==drag.id)return;const d=drag;drag=null;if(!d.far){take();glide(vAt(e),300)}});
- ba.addEventListener('pointercancel',()=>{drag=null});
- // The keyboard: the arrows move the line a twentieth, Page Up and Page Down a quarter, Home and End to the ends
- handle.addEventListener('keydown',e=>{
- const step={ArrowRight:.05,ArrowUp:.05,ArrowLeft:-.05,ArrowDown:-.05,PageUp:.25,PageDown:-.25}[e.key];
- const to=e.key==='Home'?0:e.key==='End'?1:step===undefined?null:aim+step;
- if(to===null)return;
- e.preventDefault();take();glide(to,160);
- });
-
- // See inside's three labels: Before above the back picture, After under the front one, Window over the line; all are measured
- // before any moves, so the page lays out once
- function placeCaps(){
- const s=stage.getBoundingClientRect(),b=back.getBoundingClientRect(),f=front.getBoundingClientRect(),vert=isVert();
- const size=caps.map(c=>[c.offsetWidth,c.offsetHeight]),lx=f.left-s.left+v*f.width,ly=f.top-s.top+(1-v)*f.height;
- const at=[[b.left-s.left,b.top-s.top-size[0][1]-6],[f.right-s.left-size[1][0],f.bottom-s.top+6],
- vert?[f.right-s.left-size[2][0]-8,ly-size[2][1]-8]:[lx-size[2][0]/2,f.top-s.top-size[2][1]-6]];
- caps.forEach((c,i)=>{c.style.left=Math.max(6,Math.min(s.width-size[i][0]-6,at[i][0]))+'px';c.style.top=Math.max(6,Math.min(s.height-size[i][1]-6,at[i][1]))+'px'});
- }
- // Compare's first half: a copy of the pictures, made once, with no ids, names or focus, whose After picture is resized
- function makeTwin(){
- twin=ba.cloneNode(true);twin.classList.add('twin');twin.inert=true;twin.setAttribute('aria-hidden','true');
- twin.querySelectorAll('[id],[role],[tabindex],[aria-label]').forEach(n=>['id','role','tabindex','aria-label'].forEach(a=>n.removeAttribute(a)));
- twin.removeAttribute('id');stage.insertBefore(twin,ba);
- }
- // The mode switch draws the mode at once. The views hold the line at 70% when it rests in the middle; Normal gets it back.
- document.addEventListener('hb:mode',e=>{
- mode=e.detail.mode;pic.setAttribute('aria-label',LABELS[mode]);
- if(mode==='compare'&&!twin)makeTwin();
- if(mode!=='normal'&&!demo&&!glideRaf&&v===.5){posed=true;aim=.7;setV(.7)}
- else if(mode==='normal'&&posed){posed=false;aim=runTo=.5;setV(.5)}
- else setV(v);
- });
- new ResizeObserver(()=>setV(v)).observe(stage);
-
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);setV(v);
- }));
- }
- choices('split-seg',d=>{stage.classList.toggle('vert',d.split==='tb');handle.setAttribute('aria-orientation',d.split==='tb'?'vertical':'horizontal')});
- choices('handle-seg',d=>{stage.classList.toggle('h-bar',d.h==='bar');stage.classList.toggle('h-line',d.h==='line')});
- document.getElementById('tags-tog').addEventListener('change',e=>stage.classList.toggle('no-tags',!e.target.checked));
- setV(.5);
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/04-micro-interactions/before-after-slider/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/04-micro-interactions/before-after-slider/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/04-micro-interactions/before-after-slider/README.md`**
-
-````markdown
-# Before/After Slider
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/)
-
-## What it is
-A before/after slider stacks two pictures of the same scene, such as a photo before and after an edit, and shows the top one only up to a dividing line. Dragging the line uncovers more of one picture and less of the other, so the eye can compare the same spot in both. Neither picture moves: only the line does.
-
-## When to use it
-- Photo edits and retouching, the original beside the result
-- Website and app redesigns, the old screen against the new one
-- Renovations, restorations and cleanups
-- Product upgrades, such as a new screen or a better camera
-- Maps and aerial views of one place at two dates
-
-## How it works
-Both pictures fill the same box. Before lies whole underneath. After sits in a window as big as the box, and one number from 0 to 1 says how much of it shows. The window slides with the line and the picture inside it slides back by the same amount, so it stays exactly over Before; all three moves are transforms, so a drag redraws nothing:
-
-```css
-.win { overflow: hidden; transform: translateX(calc((var(--v) - 1) * 100%)); }
-.win .pic { transform: translateX(calc((1 - var(--v)) * 100%)); }
-.rail { transform: translateX(calc(var(--v) * 100%)); } /* the line and its handle */
-```
-
-Pointer events turn the pointer's place into that number, with pointer capture so a drag keeps working outside the box:
-
-```js
-const r = front.getBoundingClientRect();
-stage.style.setProperty('--v', Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)));
-```
-
-A press that does not move glides the line to it, eased by the time that passes. The handle is a slider whose value is read as "60% After": the arrow keys move it a twentieth, Page Up and Page Down a quarter, Home and End to the ends. With Left and right the pictures keep `touch-action: pan-y`, so an up-and-down swipe still scrolls the page; with Top and bottom only the handle starts a drag, for the same reason. The Before and After labels fade when the line comes over them. Under reduced motion the line jumps instead of gliding.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Split | Left and right | Which way the line runs: left and right shows After to the left of an upright line, dragged anywhere on the pictures; top and bottom shows After below a level line, dragged by its handle only |
-| Handle | Knob | What there is to grab: knob is a round button with two arrows, bar a narrow bar along the line, line only the bare line (still grabbed across a strip about as wide as a fingertip) |
-| Shows labels | on | Before and After name each side from a corner, and each fades out when the line comes within a few pixels of it |
-
-## Production notes
-- **Uncover, never resize.** Shrinking the top picture's width squeezes it, and changing width forces layout on every move. A sliding window with the picture slid back, or `clip-path: inset(0 calc((1 - var(--v)) * 100%) 0 0)` on the top picture, keeps both pictures still; clip-path is shorter to write but repaints the top picture on each move.
-- **Same size, same framing.** Both pictures need exactly the same size and crop (`object-fit: cover` on both); a few pixels of offset reads as a wobble when the line moves.
-- **Phones.** `touch-action: pan-y` on the pictures leaves up-and-down scrolling to the browser; a `pointercancel` means the browser took the gesture over, so stop the drag there.
-- **Accessibility.** Give the handle `role="slider"`, `aria-valuenow` and an `aria-valuetext` such as "60% After", handle the arrow, Page Up, Page Down, Home and End keys, and give the pictures their own alternative text.
-- **Libraries.** The img-comparison-slider web component, juxtapose.js and TwentyTwenty (jQuery) package the same idea; in an app, GSAP's Draggable or Framer Motion's `drag` can move the line.
-- **Reduced motion.** Let the line jump to a tap or a key press instead of gliding.
-
-## See also
-- [Swipe to Dismiss](../swipe-to-dismiss/) — a drag that follows the finger and springs back
-- [Liquid Glass](../../06-3d-advanced/liquid-glass/) — a glass panel dragged over a picture, arrow keys too
-- [Clip-Path Reveal](../../02-entrance-and-exit/clip-path-reveal/) — a shape uncovers a picture once, by itself
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: 05 Text & Typography ── */` (the end of the 04 bespoke block):
-
-```css
-.pv-beforeafter{background:#0b0b0d;overflow:hidden;container-type:size}
-.pv-beforeafter .sc{position:absolute;inset:0;background:radial-gradient(circle at 72% 44%,#ffe7a8 0 8%,#0000 8.5%),linear-gradient(172deg,#0000 54%,#5b4a8c 54.5% 64%,#0000 64.5%),linear-gradient(#2b3f8f,#f08a6c 50%,#ffd18a 64%,#2a9d9b 64.5%,#0f3b57)}
-.pv-beforeafter .gray{filter:grayscale(1) contrast(.72) brightness(1.08)}
-.pv-beforeafter .win{position:absolute;inset:0;overflow:hidden;animation:beforeafter-win 5s ease-in-out infinite}
-.pv-beforeafter .win .sc{animation:beforeafter-pic 5s ease-in-out infinite}
-.pv-beforeafter .ln{position:absolute;inset:0;animation:beforeafter-ln 5s ease-in-out infinite}
-.pv-beforeafter .ln::before{content:"";position:absolute;left:-1px;top:0;bottom:0;width:2px;background:#fff}
-.pv-beforeafter .ln b{position:absolute;left:-6cqw;top:calc(50% - 6cqw);width:12cqw;height:12cqw;border-radius:50%;background:#fff;box-shadow:0 1px 6px rgba(0,0,0,.4)}
-.pv-beforeafter .ln b::before,.pv-beforeafter .ln b::after{content:"";position:absolute;top:calc(50% - 2cqw);left:2cqw;border:2cqw solid #0000;border-right-color:#16161a;border-left-width:0}
-.pv-beforeafter .ln b::after{left:auto;right:2cqw;border-width:2cqw 0 2cqw 2cqw;border-color:#0000 #0000 #0000 #16161a}
-@keyframes beforeafter-win{0%,8%,100%{transform:translateX(-50%)}30%,42%{transform:translateX(-18%)}66%,78%{transform:translateX(-82%)}}
-@keyframes beforeafter-pic{0%,8%,100%{transform:translateX(50%)}30%,42%{transform:translateX(18%)}66%,78%{transform:translateX(82%)}}
-@keyframes beforeafter-ln{0%,8%,100%{transform:translateX(50%)}30%,42%{transform:translateX(82%)}66%,78%{transform:translateX(18%)}}
-```
-
-(b) insert this line right after the line that starts with `case 'dynisland':`:
-
-```js
- case 'beforeafter': return '<span class="sc gray"></span><span class="win anim"><span class="sc anim"></span></span><span class="ln anim"><b></b></span>';
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-grep -c "pv-beforeafter" index.html; grep -c "case 'beforeafter':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: Prove the keyboard test for Task 11, then put the test file back**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-sed -i "s/'magnetic-button', 'click-ripple'\]/'magnetic-button', 'click-ripple', 'before-after-slider']/" tests/pages.test.js
-grep -c "'before-after-slider'" tests/pages.test.js
-node --test tests/pages.test.js 2>&1 | grep -E "keyboard|^ℹ (pass|fail)"
-git checkout -- tests/pages.test.js && git status --short tests/
-```
-
-Expected: `1` (the entry is in), then `✔ the do-it pages played with the pointer can be played from the keyboard` and `ℹ fail 0`, then nothing (the file is back as it was). If the grep prints `0`, the list's last entry changed since this plan: add `'before-after-slider'` in the `'04-micro-interactions'` list of `KEYBOARD_PAGES` by hand, run, and put the file back the same way.
-
-- [ ] **Step 7: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8963: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8963/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L3 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-node $RUN/slot.mjs run ten-L3 -- node tools/check-pages.mjs --base http://127.0.0.1:8963 --out $TEN/checks/L3/1 animations/04-micro-interactions/before-after-slider animations/04-micro-interactions/dynamic-island home > $TEN/checks/L3/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L3/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-node $RUN/slot.mjs run ten-L3 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8963 --short --out $TEN/checks/L3/short-1 animations/04-micro-interactions/before-after-slider > $TEN/checks/L3/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L3/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L3/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L3/1.log; grep '^FAIL' $TEN/checks/L3/1.log; tail -2 $TEN/checks/L3/short-1.log`.
-
-Expected: `18` (six `ok` lines each for `before-after-slider`, `dynamic-island`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 8: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-i=0; for sel in "" "#split-seg [data-split='tb']" "#handle-seg [data-h='bar']" "#handle-seg [data-h='line']" "#tags-tog"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L3 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8963 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L3/press-$i animations/04-micro-interactions/before-after-slider || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L3/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L3/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-i=0; for sel in ""; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L3 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8963 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L3/clip-$i animations/04-micro-interactions/before-after-slider || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L3/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L3/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 5 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 1 `== clip-…` line, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L3/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 9: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L3/<round>/04-before-after-slider-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- Dragging anywhere on the pictures moves the line (Left and right), a tap glides it there, and a vertical swipe on a phone still scrolls the page; with Top and bottom only the handle drags.
-- The handle is a slider read as "50% After": the arrows move it a twentieth, Page Up and Page Down a quarter, Home and End to the ends; Right and Up raise the share of After.
-- Show me glides to 80%, to 20% and back to where it started (about 2.8 s); Normal pressed during a view's run ends with the line in the middle, never at the views' 70% (G4); Reset centers the line; Split, Handle (Knob, Bar, Line only) and Shows labels change Normal and both views.
-- The handle is at least 44px to touch in every mode (48px; scaled back up in See inside); under reduced motion the line jumps instead of gliding and Show me steps with pauses.
-
-Decisions already made in this page (keep them; a reviewer weighs them): After is anchored on the left with Left and right and at the bottom with Top and bottom, so the slider's value ("60% After") rises with Right and Up and the line moves the way the key points. Both views pose the line at 70% when it rests in the middle (the spec's stills at 70%), and Normal gets the middle back. Compare's halves sit side by side at every width (the note says left and right) with their names in a 36px strip under the pictures, so they never cover the Before and After labels; the box keeps its size. See inside hides the Before label (its caption names that layer); the drawn harbor puts the sun in the middle so the squeeze shows at every size.
-
-- [ ] **Step 10: Frame times (optional: a page moved by transforms)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-(node $RUN/slot.mjs run ten-L3 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8963 --modes normal,inside,compare animations/04-micro-interactions/before-after-slider; node $RUN/slot.mjs run ten-L3 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8963 --phone --modes normal,inside,compare animations/04-micro-interactions/before-after-slider; node $RUN/slot.mjs run ten-L3 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8963 animations/04-micro-interactions/swipe-to-dismiss; node $RUN/slot.mjs run ten-L3 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8963 --phone animations/04-micro-interactions/swipe-to-dismiss) > $TEN/checks/L3/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L3/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes, and no larger share of frames slower than 20 ms than Swipe to Dismiss measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: desktop 0 to 9% in each mode (0% in two runs of three), phone 1 to 4%; Swipe to Dismiss 0% and 1%. Report the numbers; nothing to change unless a mode is clearly worse than the closest page.
-
-- [ ] **Step 11: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L3 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L3 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 04.42 Before/After Slider, with See inside and Compare from the start (lane 3)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/04-micro-interactions/before-after-slider/README.md`, `A animations/04-micro-interactions/before-after-slider/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/04-micro-interactions/README.md`, `M animations/04-micro-interactions/dynamic-island/index.html`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L3/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 12: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L3`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at the keyboard and its value text; touch-action pan-y on the pictures and none on the handle; the copy in Compare (no ids, no names, inert). It writes `$TEN/reports/L3/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 7 again (and the galleries, clips or frame times a fix touches), commits `fix: Before/After Slider: <what>` after the branch check, writes `$TEN/reports/L3/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L3 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L3/`.
-
----
-
-### Task 4: L4 · 04.43 Magnifier Lens (`ten/L4`, port 8964)
-
-Do it · step 1 "Hover it" · player bar: Show me and Slow motion (the page slows itself; no Reset). See inside: zoomed out so the bigger copy fits, drawn whole but faint and dashed, the lens a window onto it, a cross on the pointer's spot. Compare: "Stretched copy" (a lens enlarging a small picture, which blurs) beside "Bigger copy". Spec: "4 · Magnifier Lens (04.43)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/04-micro-interactions/magnifier-lens/index.html` (367 lines), `animations/04-micro-interactions/magnifier-lens/README.md`
-- Modify (by `$TEN/lanes.mjs 4`): `index.html` (the card after Dynamic Island's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 04's count 41 → 42, the catalog line), `animations/04-micro-interactions/README.md` (its line), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 04 bespoke block, `case 'magnifier':` in `pvMarkup()`
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js` (with a proof edit, put back); the page check of the new page and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults
-- Write (run folder): `$TEN/checks/L4/` (logs, screenshots, kit output), `$TEN/reports/L4/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L4` on `ten/L4`, its server on port 8964 (started and stopped by the coordinator), `$TEN/lanes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses Show me after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L4`: the card `['magnifier-lens','Magnifier Lens','A lens follows your pointer and shows the picture up close. Best for product photos.']` (04.43), `PV` key `'magnifier-lens':'magnifier'`, `PLACES` `['imgcard']`, `FIND` `'magnifier-lens':['card','hover drag','follow grow']`; Previous: Dynamic Island (for now: Task 11 points it at the page before it in the section); no Next link yet. For Task 11: `'magnifier-lens'` in the `'04-micro-interactions'` list of `KEYBOARD_PAGES`. The reports in `$TEN/reports/L4/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-node $TEN/lanes.mjs 4 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 4 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/04-micro-interactions/README.md`, ` M index.html`; then these 6 failing tests and `ℹ fail 6`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, from a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/04-micro-interactions/magnifier-lens/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Magnifier Lens — Animation Handbook</title>
- <meta name="description" content="A lens follows your pointer and shows the picture up close. Best for product photos.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Magnifier Lens — Animation Handbook">
- <meta property="og:description" content="A lens follows your pointer and shows the picture up close. Best for product photos.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Magnifier Lens — Animation Handbook">
- <meta name="twitter:description" content="A lens follows your pointer and shows the picture up close. Best for product photos.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Magnifier Lens", "name": "Magnifier Lens", "description": "A lens follows your pointer and shows the picture up close. Best for product photos.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/", "inLanguage": "en", "articleSection": "Micro-Interactions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Micro-Interactions, Magnifier Lens"}</script>
- <style>
- :root{--ui-accent:#ff9d5c}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- /* --r: the lens's radius; --s: how far See inside zooms out; --grow: how long the lens takes to grow in or shrink away */
- .stage{--r:75px;--s:.3;--grow:.22s;position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);background:#0b0d13;touch-action:none;-webkit-user-select:none;user-select:none}
- .stage svg{font-family:var(--hb-font)}
- .defs{position:absolute;width:0;height:0;overflow:hidden}
- .mag{position:relative;min-width:0;overflow:hidden;cursor:crosshair}
- .world{position:absolute;inset:0}
- .pic,.whole{position:absolute;left:0;top:0;display:block;width:100%;height:100%}
- /* The lens: a window moved to the pointer by a transform, holding a copy as many times bigger as the zoom (drawn at that size,
- so it stays sharp) that moves the other way, so the spot under the pointer sits in its middle */
- .lens{position:absolute;left:0;top:0;width:calc(var(--r) * 2);height:calc(var(--r) * 2);pointer-events:none;will-change:transform}
- .glass{position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;background:#0b0d13;box-shadow:0 10px 28px rgba(0,0,0,.55);transform:scale(0);transition:transform var(--grow) cubic-bezier(.2,.8,.2,1)}
- .glass::after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 2px rgba(255,255,255,.85),inset 0 0 16px rgba(0,0,0,.35)}
- .square .glass{border-radius:14px}
- .lens-on .glass{transform:scale(1)}
- .zoom{position:absolute;left:0;top:0;display:block;will-change:transform}
- /* See inside and Compare: plain words over the stage */
- .whole,.cross,.twin,.cap{display:none}
- .cap{position:absolute;z-index:3;padding:3px 8px;border-radius:6px;background:rgba(11,11,13,.9);color:#f4f4f2;font:600 13px/1.25 var(--hb-font);white-space:nowrap;pointer-events:none}
- .stage[data-hb-mode="inside"] .cap.in,.stage[data-hb-mode="compare"] .cap.half{display:block}
- /* See inside: zoomed out so the bigger copy fits, drawn whole but faint and outlined, with a cross on the pointer's spot */
- .stage[data-hb-mode="inside"] .mag{overflow:visible}
- .stage[data-hb-mode="inside"] .world{transform:scale(var(--s))}
- .stage[data-hb-mode="inside"] .whole{display:block;opacity:.32;outline:calc(2px / var(--s)) dashed rgba(255,255,255,.7)}
- .stage[data-hb-mode="inside"] .pic{outline:calc(2px / var(--s)) solid rgba(255,255,255,.75)}
- .stage[data-hb-mode="inside"] .cross{display:block}
- .cross{position:absolute;left:0;top:0;width:20px;height:20px;margin:-10px 0 0 -10px;pointer-events:none}
- .cross::before,.cross::after{content:"";position:absolute;left:8px;top:0;width:4px;height:20px;border-radius:2px;background:var(--ui-accent);box-shadow:0 0 0 1.5px #0b0d13}
- .cross::after{transform:rotate(90deg)}
- /* Compare: a copy whose lens stretches a small picture of the watch beside the real one; one pointer moves both */
- .stage[data-hb-mode="compare"]{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:4px}
- .stage[data-hb-mode="compare"] .twin{display:block}
- .cap.half{top:8px}.cap.first{left:8px}.cap.second{left:calc(50% + 10px)}
- @media(prefers-reduced-motion:reduce){.glass{transition:none}}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="do" data-hb-autoplay>
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../dynamic-island/" rel="prev" aria-label="Previous: Dynamic Island"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Dynamic Island</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">04.43 · Micro-Interactions</p>
- <h1>Magnifier Lens</h1>
- <p class="hb-lede">A lens follows your pointer and shows the picture up close. Best for product photos.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Hover it</h2><p>Point at the watch or touch it, or press Show me.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage">
- <svg class="defs" aria-hidden="true"><defs>
- <radialGradient id="mg-bg" cx=".5" cy=".45" r=".7"><stop offset="0" stop-color="#2a3145"/><stop offset="1" stop-color="#0b0d13"/></radialGradient>
- <linearGradient id="mg-case" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#eef0f4"/><stop offset=".5" stop-color="#9aa0ad"/><stop offset="1" stop-color="#d9dce3"/></linearGradient>
- <radialGradient id="mg-dial" cx=".45" cy=".4" r=".75"><stop offset="0" stop-color="#2b3f78"/><stop offset="1" stop-color="#121a36"/></radialGradient>
- <!-- A made-up watch: its maker's name, a date window, a small seconds dial and two lines of fine print that need the lens -->
- <symbol id="mg-watch" viewBox="0 0 1000 500">
- <rect width="1000" height="500" fill="url(#mg-bg)"/>
- <g transform="translate(100 0)">
- <path d="M332 0H468L460 112H340ZM340 388H460L468 500H332Z" fill="#6b3f26"/>
- <path d="M346 0 351 106M454 0 449 106M351 394 346 500M449 394 454 500" fill="none" stroke="#d9a877" stroke-width="2" stroke-dasharray="6 5"/>
- <rect x="560" y="234" width="24" height="32" rx="5" fill="#a7acb8"/>
- <circle cx="400" cy="250" r="168" fill="url(#mg-case)"/>
- <circle cx="400" cy="250" r="152" fill="url(#mg-dial)"/>
- <circle cx="400" cy="250" r="142" fill="none" stroke="#cfd8ee" stroke-width="7" stroke-dasharray="1.2 13.67" stroke-dashoffset=".6"/>
- <circle cx="400" cy="250" r="132" fill="none" stroke="#f4efe2" stroke-width="16" stroke-dasharray="4 65.12" stroke-dashoffset="2"/>
- <text x="400" y="188" text-anchor="middle" font-size="24" font-weight="800" letter-spacing="5" fill="#f4efe2">NORDVEL</text>
- <text x="400" y="205" text-anchor="middle" font-size="7.5" font-weight="600" letter-spacing="2.5" fill="#d8c79c">AUTOMATIC · CHRONOMETER</text>
- <rect x="494" y="237" width="36" height="26" rx="3" fill="#f7f3ea"/>
- <text x="512" y="256" text-anchor="middle" font-size="17" font-weight="700" fill="#1b2340">14</text>
- <circle cx="400" cy="300" r="30" fill="#16203f" stroke="#d8c79c" stroke-width="1.5"/>
- <circle cx="400" cy="300" r="25" fill="none" stroke="#cfd8ee" stroke-width="4" stroke-dasharray="1 9.47"/>
- <text x="400" y="288" text-anchor="middle" font-size="5.5" fill="#d8c79c">60</text>
- <text x="416" y="302" text-anchor="middle" font-size="5.5" fill="#d8c79c">20</text>
- <text x="384" y="302" text-anchor="middle" font-size="5.5" fill="#d8c79c">40</text>
- <path d="M400 300 409 285" stroke="#e2553f" stroke-width="1.5" stroke-linecap="round"/>
- <text x="400" y="348" text-anchor="middle" font-size="5" font-weight="600" letter-spacing="1" fill="#d8c79c">25 JEWELS · WATER RESIST 100 M</text>
- <text x="400" y="357" text-anchor="middle" font-size="5" font-weight="600" letter-spacing="1" fill="#d8c79c">No. 0417 · MADE BY HAND</text>
- <path d="M400 250 331 210" stroke="#f4efe2" stroke-width="9" stroke-linecap="round"/>
- <path d="M400 250 504 190" stroke="#f4efe2" stroke-width="6" stroke-linecap="round"/>
- <path d="M400 250 513 315" stroke="#e2553f" stroke-width="2.5" stroke-linecap="round"/>
- <circle cx="400" cy="250" r="8" fill="#d8c79c"/>
- </g>
- </symbol>
- </defs></svg>
- <div class="mag" id="mag" tabindex="0" role="img" aria-label="A watch with fine print on its face: point at it, touch it or use the arrow keys to see it up close in a lens">
- <div class="world">
- <svg class="whole" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><use href="#mg-watch" width="1000" height="500"/></svg>
- <svg class="pic" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><use href="#mg-watch" width="1000" height="500"/></svg>
- <div class="lens"><div class="glass"><svg class="zoom" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><use href="#mg-watch" width="1000" height="500"/></svg></div></div>
- <span class="cross"></span>
- </div>
- </div>
- <p class="cap in" id="c-copy" aria-hidden="true" data-hb-caption>Bigger copy · slides the other way</p>
- <p class="cap in" id="c-lens" aria-hidden="true" data-hb-caption>Lens · a window onto the copy</p>
- <p class="cap in" id="c-ptr" aria-hidden="true" data-hb-caption>Pointer</p>
- <p class="cap half first" aria-hidden="true" data-hb-caption>Stretched copy</p>
- <p class="cap half second" aria-hidden="true" data-hb-caption>Bigger copy</p>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-demo" data-hb-demo><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>Show me</button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, the box is zoomed out: the picture sits in the middle of a faint, bigger copy. The lens is a window onto that copy, which slides the other way as the lens moves.</p>
- <p data-hb-for="compare" hidden>On the left the lens stretches the small picture, so the detail blurs. On the right it shows a bigger copy, so the detail stays sharp.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting, then point at the watch or press Show me.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="zoom-lbl">Zoom</p>
- <div class="seg" id="zoom-seg" role="group" aria-labelledby="zoom-lbl">
- <button type="button" data-z="2" aria-pressed="false">2 times</button>
- <button type="button" data-z="3" class="on" aria-pressed="true">3 times</button>
- <button type="button" data-z="4" aria-pressed="false">4 times</button>
- </div>
- <p class="hb-hint">How much bigger things look in the lens.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="size-lbl">Lens size</p>
- <div class="seg" id="size-seg" role="group" aria-labelledby="size-lbl">
- <button type="button" data-r="55" aria-pressed="false">Small</button>
- <button type="button" data-r="75" class="on" aria-pressed="true">Medium</button>
- <button type="button" data-r="100" aria-pressed="false">Large</button>
- </div>
- <p class="hb-hint">A bigger lens shows more around the spot.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="shape-lbl">Lens shape</p>
- <div class="seg" id="shape-seg" role="group" aria-labelledby="shape-lbl">
- <button type="button" data-shape="round" class="on" aria-pressed="true">Round</button>
- <button type="button" data-shape="square" aria-pressed="false">Square</button>
- </div>
- <p class="hb-hint">Square suits maps and plans.</p>
- </div>
- </div>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add a magnifier lens to [the product photo or detailed picture people want to inspect]. While the pointer is over the picture, show a lens there holding an enlarged copy, placed so the spot under the pointer sits in the middle of the lens. Fill the lens from a larger, sharper version of the picture, never the same small one stretched, and move the lens and the copy with transforms only. On touch screens, show it while a finger is down, just above the finger; from the keyboard, show it on focus and move it with the arrow keys. If the visitor has reduced motion turned on, let it appear without growing. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Product photos</li><li>Maps</li><li>Artwork</li><li>Detailed plans</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Small or plain pictures</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const stage=document.querySelector('.stage'),mag=document.getElementById('mag'),defs=stage.querySelector('.defs'),slowTog=document.getElementById('slow-tog');
- const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),phoneMQ=matchMedia('(max-width:600px),(max-height:500px)');
- const caps=['c-copy','c-lens','c-ptr'].map(id=>document.getElementById(id));
- const LABELS={normal:mag.getAttribute('aria-label'),
- inside:'Zoomed out: the watch small in the middle of a faint, bigger copy, and the lens showing part of that copy',
- compare:'The watch twice: a lens that stretches a small picture of it, and a lens that shows a bigger, sharp copy'};
- // The details Show me visits, in the drawing's own units (1000 by 500): the maker's name, the date and the fine print
- const SPOTS=[[500,192],[612,250],[500,352]];
- const parts=el=>({el,world:el.querySelector('.world'),lens:el.querySelector('.lens'),zoom:el.querySelector('.zoom'),whole:el.querySelector('.whole'),cross:el.querySelector('.cross'),w:0,h:0});
- const real=parts(mag);
- // fx,fy: the spot magnified, as shares of the picture's width and height; lifted: the lens sits above the spot (for a finger)
- let Z=3,size=75,R=75,mode='normal',twin=null,fx=.5,fy=.5,lifted=false,mouseIn=false,keyed=false,touchId=null,runTimers=[],runFrame=0;
- const frames=()=>twin&&mode==='compare'?[twin,real]:[real];
-
- // Sizes: the lens, how far See inside zooms out, and each copy as many times bigger than its picture as the zoom
- function measure(){
- R=size*(phoneMQ.matches?.8:1);
- stage.style.setProperty('--r',R+'px');stage.style.setProperty('--s',.92/Z);stage.style.setProperty('--grow',slowTog.checked?'.66s':'.22s');
- for(const f of frames()){
- f.w=f.el.clientWidth;f.h=f.el.clientHeight;
- for(const c of [f.zoom,f.whole])if(c){c.style.width=f.w*Z+'px';c.style.height=f.h*Z+'px'}
- }
- if(twin&&mode==='compare')paintSmall();
- place();
- }
- // The lens over the spot, or just above it for a finger (below it near the top); the copy inside moves the other way by the
- // zoom, so the spot sits in the lens's middle. In See inside the whole copy and a cross on the spot are drawn too.
- function place(){
- for(const f of frames()){
- if(!f.w)continue;
- const x=fx*f.w,y=fy*f.h,up=y-R-28,ly=!lifted?y:up>=R*.6?up:y+R+28;
- f.lens.style.transform=`translate(${x-R}px,${ly-R}px)`;
- f.zoom.style.transform=`translate(${R-x*Z}px,${R-y*Z}px)`;
- if(f.whole){f.whole.style.transform=`translate(${x-x*Z}px,${ly-y*Z}px)`;f.cross.style.transform=`translate(${x}px,${y}px) scale(${Z/.92})`}
- }
- if(mode==='inside')placeCaps();
- }
- const show=on=>stage.classList.toggle('lens-on',on);
- // A point of the drawing as shares of the picture (the drawing is cut to fill it, as a cover image is)
- function spot([px,py]){const w=real.w,h=real.h,k=Math.max(w/1000,h/500);return[((w-1000*k)/2+px*k)/w,((h-500*k)/2+py*k)/h]}
- // At rest: no lens in Normal; See inside holds it in the middle, Compare on the fine print
- const pose=()=>mode==='inside'?[.5,.5]:spot(SPOTS[2]);
- function rest(){lifted=false;if(mode==='normal')show(false);else{[fx,fy]=pose();place();show(true)}}
- const running=()=>runTimers.length>0||runFrame!==0;
- const idle=()=>!mouseIn&&touchId===null&&!keyed&&!running();
-
- // The pointer's spot on the picture under it (in Compare either half; one pointer moves both lenses)
- function aimAt(e){
- const fs=frames(),f=fs.length>1&&e.clientX<real.el.getBoundingClientRect().left?fs[0]:real,r=f.world.getBoundingClientRect();
- fx=Math.min(1,Math.max(0,(e.clientX-r.left)/r.width));fy=Math.min(1,Math.max(0,(e.clientY-r.top)/r.height));place();
- }
- // A mouse or a pen in the air shows the lens where it points; a finger while it is down, above it (touch-action none keeps the
- // drag on the picture). A run under way stops first.
- stage.addEventListener('pointermove',e=>{
- if(e.pointerType==='touch'){if(e.pointerId===touchId)aimAt(e);return}
- if(e.isTrusted&&running())stopRun();
- mouseIn=true;keyed=false;lifted=false;aimAt(e);show(true);
- });
- stage.addEventListener('pointerleave',e=>{if(e.pointerType==='touch')return;mouseIn=false;if(e.isTrusted&&running())stopRun();if(idle())rest()});
- stage.addEventListener('pointerdown',e=>{
- if(e.pointerType!=='touch'||touchId!==null)return;
- touchId=e.pointerId;try{stage.setPointerCapture(touchId)}catch(_){}
- keyed=false;lifted=true;aimAt(e);show(true);
- });
- ['pointerup','pointercancel'].forEach(t=>stage.addEventListener(t,e=>{if(e.pointerId===touchId){touchId=null;rest()}}));
- // The keyboard: focus shows the lens in the middle, the arrows move it (Shift for bigger steps), Escape puts it away
- mag.addEventListener('focus',()=>{if(!mag.matches(':focus-visible'))return;if(running())stopRun();keyed=true;lifted=false;fx=fy=.5;place();show(true)});
- mag.addEventListener('blur',()=>{if(keyed){keyed=false;if(idle())rest()}});
- mag.addEventListener('keydown',e=>{
- if(e.key==='Escape'){if(keyed){keyed=false;rest()}return}
- const d={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];
- if(!d||e.altKey||e.ctrlKey||e.metaKey)return;
- e.preventDefault();if(running())stopRun();
- if(!keyed){keyed=true;lifted=false;show(true)}
- const st=e.shiftKey?.15:.04;fx=Math.min(1,Math.max(0,fx+d[0]*st));fy=Math.min(1,Math.max(0,fy+d[1]*st));place();
- });
-
- // The lens glides to a spot by the time that passes (three times as long in slow motion); under reduced motion it jumps
- function glide(to,ms){
- cancelAnimationFrame(runFrame);runFrame=0;
- if(reduceMQ.matches){[fx,fy]=to;place();return}
- const from=[fx,fy],dur=ms*(slowTog.checked?3:1);let t0=null;
- const step=ts=>{
- if(t0===null)t0=ts;
- const k=reduceMQ.matches?1:Math.min(1,(ts-t0)/dur),e=k*k*(3-2*k);
- fx=from[0]+(to[0]-from[0])*e;fy=from[1]+(to[1]-from[1])*e;place();
- runFrame=k<1?requestAnimationFrame(step):0;
- };
- runFrame=requestAnimationFrame(step);
- }
- // Show me: the lens over the maker's name, the date and the fine print, then away (in See inside and Compare back to its
- // place). Every pause waits on a timer; slow motion triples the moves, never the pauses.
- function later(fn,move,hold){const id=setTimeout(()=>{runTimers=runTimers.filter(t=>t!==id);fn()},move*(slowTog.checked?3:1)+hold);runTimers.push(id)}
- function stopRun(){runTimers.forEach(clearTimeout);runTimers=[];cancelAnimationFrame(runFrame);runFrame=0}
- document.getElementById('btn-demo').addEventListener('click',()=>{
- stopRun();keyed=false;lifted=false;
- const pts=SPOTS.map(spot),view=mode!=='normal',first=view?600:220;
- if(view)glide(pts[0],600);else{[fx,fy]=pts[0];place();show(true)}
- later(()=>glide(pts[1],600),first,350);
- later(()=>glide(pts[2],600),first+600,700);
- later(()=>{if(mode!=='normal')glide(pose(),600);else show(false)},first+1200,1050);
- });
- document.addEventListener('hb:input',()=>{if(running()){stopRun();if(idle())rest()}});
- stage.addEventListener('focusin',e=>{if(e.isTrusted&&running())stopRun()});
-
- // See inside's three labels: the copy's at its corner, the lens's above it and the pointer's below it; all are measured
- // before any moves, so the page lays out once
- function placeCaps(){
- const s=stage.getBoundingClientRect(),g=real.lens.firstElementChild.getBoundingClientRect(),c=real.whole.getBoundingClientRect();
- const size=caps.map(el=>[el.offsetWidth,el.offsetHeight]),mid=(g.left+g.right)/2-s.left;
- const at=[[c.left-s.left+8,c.top-s.top+8],[mid-size[1][0]/2,g.top-s.top-size[1][1]-8],[mid-size[2][0]/2,g.bottom-s.top+8]];
- caps.forEach((el,i)=>{el.style.left=Math.max(6,Math.min(s.width-size[i][0]-6,at[i][0]))+'px';el.style.top=Math.max(6,Math.min(s.height-size[i][1]-6,at[i][1]))+'px'});
- }
- // Compare's first half: a copy of the watch, made once, with no ids, name or focus, whose lens holds the small picture stretched
- function makeTwin(){
- const el=mag.cloneNode(true);el.removeAttribute('id');el.classList.add('twin');el.inert=true;el.setAttribute('aria-hidden','true');
- ['tabindex','role','aria-label'].forEach(a=>el.removeAttribute(a));
- const c=document.createElement('canvas');c.className='zoom';el.querySelector('.zoom').replaceWith(c);
- stage.insertBefore(el,mag);twin=parts(el);
- }
- // The small picture: the drawing at one pixel per pixel of its half, as a photo shown at its own size would be
- function paintSmall(){
- const w=twin.w,h=twin.h,c=twin.zoom,img=new Image();if(!w||!h)return;
- img.onload=()=>{c.width=w;c.height=h;c.getContext('2d').drawImage(img,0,0,w,h)};
- img.src='data:image/svg+xml,'+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMid slice" font-family="sans-serif">${defs.innerHTML}<use href="#mg-watch" width="1000" height="500"/></svg>`);
- }
- // The mode switch draws the mode at once: the copies' sizes for its layout, then its picture at rest
- document.addEventListener('hb:mode',e=>{
- mode=e.detail.mode;mag.setAttribute('aria-label',LABELS[mode]);
- if(mode==='compare'&&!twin)makeTwin();
- measure();if(idle())rest();
- });
- new ResizeObserver(measure).observe(stage);
-
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);measure();
- }));
- }
- choices('zoom-seg',d=>{Z=+d.z});
- choices('size-seg',d=>{size=+d.r});
- choices('shape-seg',d=>{stage.classList.toggle('square',d.shape==='square')});
- slowTog.addEventListener('change',measure);
- measure();
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/04-micro-interactions/magnifier-lens/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/04-micro-interactions/magnifier-lens/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/04-micro-interactions/magnifier-lens/README.md`**
-
-````markdown
-# Magnifier Lens
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/)
-
-## What it is
-A magnifier lens shows part of a picture up close: a round or square window follows the pointer and holds an enlarged copy of the picture, placed so the spot under the pointer sits in the lens's middle. It lets people read fine print and check small details without leaving the page or opening a bigger picture.
-
-## When to use it
-- Product photos: stitching, textures, engravings, labels
-- Maps and floor plans with small names and numbers
-- Artwork and photography, to look at brushwork or grain
-- Technical drawings, diagrams and detailed plans
-
-## How it works
-The lens is a small box with rounded corners and hidden overflow, moved to the pointer by a transform. Inside it sits a second copy of the picture, as many times bigger as the zoom. The copy moves the other way, so the point under the pointer lands in the lens's middle:
-
-```js
-lens.style.transform = `translate(${x - R}px, ${y - R}px)`; // x, y: the pointer on the picture; R: the lens's radius
-copy.style.transform = `translate(${R - x * Z}px, ${R - y * Z}px)`; // Z: the zoom
-```
-
-The copy is drawn at its full bigger size, not scaled up with a transform: a layer that is scaled up after it is drawn shows a stretched, blurry picture. Here the drawing is vector, so the bigger copy stays sharp; with photos, the lens loads a larger version of the image. The lens grows in when the pointer arrives and shrinks away when it leaves, a short transition on the lens's scale. A finger shows the lens while it is down, just above the finger so the finger does not cover it, with `touch-action: none` so the drag moves the lens instead of the page. From the keyboard the picture takes focus, which shows the lens in the middle; the arrow keys move it (Shift for bigger steps) and Escape puts it away. Under reduced motion the lens appears and goes without growing, and Show me jumps between the details.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Zoom | 3 times | How many times bigger the copy in the lens is than the picture: 2 times, 3 times or 4 times |
-| Lens size | Medium | How wide the lens is: small is 110 pixels across, medium 150 and large 200, a fifth less on phones |
-| Lens shape | Round | Round is a circle; square is a square with slightly rounded corners, which suits maps and plans |
-
-## Production notes
-- **Use a bigger image.** Stretching the same small image only enlarges its pixels and the detail blurs; load a version two to four times larger (with `srcset`, or lazily when the pointer first arrives) and use it as the lens's copy or as its background.
-- **Size it, then move it.** Give the copy its final size in layout and move it only with transforms; scaling it up with a transform after the browser has drawn it as a layer blurs it.
-- **Background-image variant.** A lens can also be a single element whose background is the large image, moved with `background-position`; that repaints the lens on every move, which is fine for small lenses.
-- **Touch and keyboard.** Show the lens above the finger, flip it below near the top edge, and give keyboard users focus, arrow keys and Escape.
-- **Libraries.** Drift, Zoomist and many shop themes package the same idea; in a React app, react-medium-image-zoom or a small custom hook does it.
-- **Reduced motion.** Let the lens appear and go at once instead of growing.
-
-## See also
-- [Spotlight Hover Glow](../spotlight-hover/) — a light follows the pointer across cards
-- [Cursor Follower](../cursor-follower/) — a shape trails the pointer, from the keyboard too
-- [Liquid Glass](../../06-3d-advanced/liquid-glass/) — a panel bends the picture behind it at its rim
-- [Image Distortion on Hover](../../06-3d-advanced/image-distortion-hover/) — the picture warps near the pointer
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: 05 Text & Typography ── */` (the end of the 04 bespoke block):
-
-```css
-.pv-magnifier{background:#e9e4d6;overflow:hidden;container-type:size}
-.pv-magnifier .mp{position:absolute;left:0;top:0;width:100cqw;height:100cqh;background:radial-gradient(circle at 72% 28%,#9fcf8a 0 11%,#0000 11.5%),radial-gradient(circle at 24% 74%,#f2c879 0 7%,#0000 7.5%),linear-gradient(115deg,#0000 44%,#8cc3e8 44.5% 53%,#0000 53.5%),repeating-linear-gradient(0deg,#0000 0 14%,#fff 14% 15.5%),repeating-linear-gradient(90deg,#0000 0 11%,#fff 11% 12.5%),#e9e4d6}
-.pv-magnifier .ln{position:absolute;left:0;top:0;width:34cqw;height:34cqw;margin:-17cqw 0 0 -17cqw;border-radius:50%;overflow:hidden;box-shadow:0 0 0 2px #fff,0 6px 16px rgba(0,0,0,.35);animation:magnifier-ln 6s ease-in-out infinite}
-.pv-magnifier .ln .mp{transform-origin:0 0;animation:magnifier-mp 6s ease-in-out infinite}
-@keyframes magnifier-ln{0%,100%{transform:translate(28cqw,34cqh)}33%{transform:translate(70cqw,40cqh)}66%{transform:translate(48cqw,70cqh)}}
-@keyframes magnifier-mp{0%,100%{transform:translate(calc(17cqw - 56cqw),calc(17cqw - 68cqh)) scale(2)}33%{transform:translate(calc(17cqw - 140cqw),calc(17cqw - 80cqh)) scale(2)}66%{transform:translate(calc(17cqw - 96cqw),calc(17cqw - 140cqh)) scale(2)}}
-```
-
-(b) insert this line right after the line that starts with `case 'dynisland':`:
-
-```js
- case 'magnifier': return '<span class="mp"></span><span class="ln anim"><span class="mp anim"></span></span>';
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-grep -c "pv-magnifier" index.html; grep -c "case 'magnifier':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: Prove the keyboard test for Task 11, then put the test file back**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-sed -i "s/'magnetic-button', 'click-ripple'\]/'magnetic-button', 'click-ripple', 'magnifier-lens']/" tests/pages.test.js
-grep -c "'magnifier-lens'" tests/pages.test.js
-node --test tests/pages.test.js 2>&1 | grep -E "keyboard|^ℹ (pass|fail)"
-git checkout -- tests/pages.test.js && git status --short tests/
-```
-
-Expected: `1` (the entry is in), then `✔ the do-it pages played with the pointer can be played from the keyboard` and `ℹ fail 0`, then nothing (the file is back as it was). If the grep prints `0`, the list's last entry changed since this plan: add `'magnifier-lens'` in the `'04-micro-interactions'` list of `KEYBOARD_PAGES` by hand, run, and put the file back the same way.
-
-- [ ] **Step 7: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8964: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8964/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L4 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-node $RUN/slot.mjs run ten-L4 -- node tools/check-pages.mjs --base http://127.0.0.1:8964 --out $TEN/checks/L4/1 animations/04-micro-interactions/magnifier-lens home > $TEN/checks/L4/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L4/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-node $RUN/slot.mjs run ten-L4 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8964 --short --out $TEN/checks/L4/short-1 animations/04-micro-interactions/magnifier-lens > $TEN/checks/L4/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L4/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L4/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L4/1.log; grep '^FAIL' $TEN/checks/L4/1.log; tail -2 $TEN/checks/L4/short-1.log`.
-
-Expected: `12` (six `ok` lines each for `magnifier-lens`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 8: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-i=0; for sel in "" "#zoom-seg [data-z='2']" "#zoom-seg [data-z='4']" "#size-seg [data-r='55']" "#size-seg [data-r='100']" "#shape-seg [data-shape='square']"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L4 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8964 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L4/press-$i animations/04-micro-interactions/magnifier-lens || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L4/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L4/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-i=0; for sel in ""; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L4 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8964 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L4/clip-$i animations/04-micro-interactions/magnifier-lens || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L4/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L4/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 6 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 1 `== clip-…` line, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L4/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 9: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L4/<round>/04-magnifier-lens-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- The lens grows in where the pointer arrives, follows it, and shrinks away when it leaves; a finger shows it while down, just above the finger (below it near the top); the fine print on the dial cannot be read without the lens.
-- Tab to the watch shows the lens in the middle; the arrows move it, Shift for bigger steps; Escape puts it away (in a view, back to its place).
-- Show me glides over the maker's name, the date and the fine print, then the lens shrinks away (about 2.7 s; 3.5 s in the views, where it returns to its place: See inside the middle, Compare the fine print); Normal pressed during a view's run puts the lens away at the end, never left posed (G4).
-- Zoom (2, 3, 4 times), Lens size (Small, Medium, Large) and Lens shape (Round, Square) change the lens in Normal and both views; under reduced motion the lens appears without growing and Show me jumps between details.
-
-Decisions already made in this page (keep them; a reviewer weighs them): The drawing is 1000 by 500 units with the watch in the middle, so wide boxes show the whole watch; the fine print is 5 units tall, too small to read without the lens. Compare's "Stretched copy" is real: the drawing is made once into a small picture, one pixel per pixel of its half, and the lens shows it stretched by the zoom (its letters fall back to a plain sans-serif, unseen under the blur). See inside zooms out by 0.92 divided by the zoom, and the pointer is held to the small picture there.
-
-- [ ] **Step 10: Frame times (optional: a page moved by transforms)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-(node $RUN/slot.mjs run ten-L4 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8964 --modes normal,inside,compare animations/04-micro-interactions/magnifier-lens; node $RUN/slot.mjs run ten-L4 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8964 --phone --modes normal,inside,compare animations/04-micro-interactions/magnifier-lens; node $RUN/slot.mjs run ten-L4 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8964 animations/04-micro-interactions/spotlight-hover; node $RUN/slot.mjs run ten-L4 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8964 --phone animations/04-micro-interactions/spotlight-hover) > $TEN/checks/L4/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L4/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes, and no larger share of frames slower than 20 ms than Spotlight Hover Glow measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: desktop 0 / 6 / 1%, phone 0 / 1 / 0%; Spotlight Hover Glow 7% and 1%. Report the numbers; nothing to change unless a mode is clearly worse than the closest page.
-
-- [ ] **Step 11: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L4 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L4 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 04.43 Magnifier Lens, with See inside and Compare from the start (lane 4)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/04-micro-interactions/magnifier-lens/README.md`, `A animations/04-micro-interactions/magnifier-lens/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/04-micro-interactions/README.md`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L4/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 12: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L4`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at the copy is sized at its full bigger size, never scaled up (sharp); the stretched copy is made only on entering Compare and on resize; hover, touch and keys. It writes `$TEN/reports/L4/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 7 again (and the galleries, clips or frame times a fix touches), commits `fix: Magnifier Lens: <what>` after the branch check, writes `$TEN/reports/L4/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L4 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L4/`.
-
----
-
-### Task 5: L5 · 04.44 Card Deck Swipe (`ten/L5`, port 8965)
-
-Do it · step 1 "Drag it" · player bar: Show me, Reset and Slow motion (the page slows itself). See inside: the pile spread apart and numbered, dashed lines at the swipe distance that light as the card's middle passes them, the pivot below the card with a short arc. Compare: "Vanishes" (a copy whose card slides flat and is gone at once) beside "Flies off". Spec: "5 · Card Deck Swipe (04.44)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/04-micro-interactions/card-deck-swipe/index.html` (404 lines), `animations/04-micro-interactions/card-deck-swipe/README.md`
-- Modify (by `$TEN/lanes.mjs 5`): `index.html` (the card after Dynamic Island's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 04's count 41 → 42, the catalog line), `animations/04-micro-interactions/README.md` (its line), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 04 bespoke block, `case 'deckswipe':` in `pvMarkup()`, a `STILL` point
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js` (with a proof edit, put back); the page check of the new page and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults
-- Write (run folder): `$TEN/checks/L5/` (logs, screenshots, kit output), `$TEN/reports/L5/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L5` on `ten/L5`, its server on port 8965 (started and stopped by the coordinator), `$TEN/lanes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses Show me after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L5`: the card `['card-deck-swipe','Card Deck Swipe','Swipe the top card left or right; the next one rises. Best for quick choices.']` (04.44), `PV` key `'card-deck-swipe':'deckswipe'`, `PLACES` `['imgcard']`, `FIND` `'card-deck-swipe':['card','drag click','slide turn']`; Previous: Dynamic Island (for now: Task 11 points it at the page before it in the section); no Next link yet. For Task 11: `'card-deck-swipe'` in the `'04-micro-interactions'` list of `KEYBOARD_PAGES`. The reports in `$TEN/reports/L5/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-node $TEN/lanes.mjs 5 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 5 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/04-micro-interactions/README.md`, ` M index.html`; then these 6 failing tests and `ℹ fail 6`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, from a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/04-micro-interactions/card-deck-swipe/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Card Deck Swipe — Animation Handbook</title>
- <meta name="description" content="Swipe the top card left or right; the next one rises. Best for quick choices.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Card Deck Swipe — Animation Handbook">
- <meta property="og:description" content="Swipe the top card left or right; the next one rises. Best for quick choices.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Card Deck Swipe — Animation Handbook">
- <meta name="twitter:description" content="Swipe the top card left or right; the next one rises. Best for quick choices.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Card Deck Swipe", "name": "Card Deck Swipe", "description": "Swipe the top card left or right; the next one rises. Best for quick choices.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/", "inLanguage": "en", "articleSection": "Micro-Interactions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Micro-Interactions, Card Deck Swipe"}</script>
- <style>
- :root{--ui-accent:#ff9d5c;--like:#34c77b;--nope:#ff5a5f;--undo:#f5c84c}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- /* --sp: 3 in slow motion. The box is taller on phones, in every mode alike, so the pile and its buttons both fit */
- .stage{--sp:1;--hb-stage-h-phone:400px;position:relative;display:flex;flex-direction:column;background:#0b0b0d;-webkit-user-select:none;user-select:none}
- .decks{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
- .deck{position:relative;min-width:0;container-type:size}
- .pile{position:absolute;inset:0}
- /* A card: about 60% of the box's width at most, turning around a point below its bottom edge (transform-origin) */
- .card{--tb:translateY(calc(var(--i) * 12px)) scale(calc(1 - var(--i) * .05));position:absolute;left:50%;top:50%;width:min(70cqh,60cqw);aspect-ratio:4/5;translate:-50% -50%;
- display:flex;flex-direction:column;overflow:hidden;border-radius:14px;background:#17171c;box-shadow:0 10px 26px rgba(0,0,0,.45);container-type:inline-size;
- transform-origin:50% 130%;transform:var(--spread,translate(0)) var(--tb);touch-action:pan-y;cursor:grab;
- transition:transform calc(.3s * var(--sp)) cubic-bezier(.2,.8,.2,1),opacity calc(.3s * var(--sp))}
- .fan .card{--tb:rotate(calc(var(--i) * var(--f) * 5deg)) scale(calc(1 - var(--i) * .03))}
- .hide .card{--tb:scale(calc(1 - min(var(--i),1) * .05))}
- .hide .card:not(.top),.card.deep{opacity:0}
- .card.drag{transition:none}
- .card.spring{transition:transform calc(.4s * var(--sp)) cubic-bezier(.3,1.35,.5,1),opacity calc(.3s * var(--sp))}
- .card.out{pointer-events:none;transition:transform calc(.42s * var(--sp)) cubic-bezier(.4,0,1,1),opacity calc(.42s * var(--sp)) ease-in}
- .photo{flex:1;min-height:0;background:radial-gradient(circle at 50% 44%,#f1c7a3 0 15%,#0000 15.5%),radial-gradient(circle at 50% 37%,var(--hair) 0 19%,#0000 19.5%),radial-gradient(ellipse 34% 24% at 50% 100%,var(--shirt) 0 99%,#0000 100%),linear-gradient(160deg,var(--bg1),var(--bg2))}
- .who{padding:8cqw 9cqw 1cqw;color:#f4f4f2;font:700 clamp(12px,8.5cqw,19px)/1.2 var(--hb-font)}
- .line{padding:0 9cqw;color:#b4b4bb;font:500 clamp(10px,6cqw,13px)/1.4 var(--hb-font);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
- .line:last-of-type{padding-bottom:7cqw}
- .stamp{position:absolute;top:8%;padding:1px 8px;border:3px solid;border-radius:8px;font:800 clamp(13px,11cqw,24px)/1.15 var(--hb-font);letter-spacing:.06em;opacity:0;pointer-events:none}
- .like{left:8%;color:var(--like);transform:rotate(-14deg)}.nope{right:8%;color:var(--nope);transform:rotate(14deg)}
- .spring .stamp{transition:opacity calc(.3s * var(--sp))}
- /* Nope, Undo and Like: round buttons under the pile, 48px to touch */
- .acts{display:flex;justify-content:center;gap:18px;padding:8px 0 12px}
- .act{display:grid;place-items:center;width:48px;height:48px;border-radius:50%;border:1px solid rgba(255,255,255,.14);background:#17171c;cursor:pointer}
- .act svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
- .nope-b{color:var(--nope)}.undo-b{color:var(--undo)}.like-b{color:var(--like)}
- @media(hover:hover){.act:hover{border-color:currentColor}}
- /* See inside and Compare: plain words over the stage; in See inside the pile spread apart and numbered, the swipe distance
- dashed on both sides (lit once the card's middle passes it) and the point the card turns around */
- .guide,.pivot,.twin,.cap{display:none}
- .cap{position:absolute;z-index:3;padding:3px 8px;border-radius:6px;background:rgba(11,11,13,.9);color:#f4f4f2;font:600 13px/1.25 var(--hb-font);white-space:nowrap;pointer-events:none}
- .stage[data-hb-mode="inside"] .cap.in,.stage[data-hb-mode="compare"] .cap.half{display:block}
- .stage[data-hb-mode="inside"] .deck{transform:scale(.7);transform-origin:50% 8%}
- .stage[data-hb-mode="inside"] .card{--spread:translate(calc(var(--i) * -40px),calc(var(--i) * -14px))}
- .stage[data-hb-mode="inside"].hide .card:not(.top):not(.deep){opacity:.45}
- .stage[data-hb-mode="inside"] .card::after{content:attr(data-n);position:absolute;left:8px;bottom:8px;width:32px;height:32px;border-radius:50%;background:var(--ui-accent);color:#16161a;font:800 18px/32px var(--hb-font);text-align:center}
- .stage[data-hb-mode="inside"] .guide,.stage[data-hb-mode="inside"] .pivot{display:block}
- .guide{position:absolute;left:50%;top:0;z-index:2;border-left:3px dashed rgba(255,255,255,.6);pointer-events:none}
- .guide.lit{border-left-color:var(--ui-accent)}
- .pivot{position:absolute;left:0;top:0;z-index:2;width:60px;height:60px;margin:-30px 0 0 -30px;overflow:visible;pointer-events:none}
- .pivot path{fill:none;stroke:var(--ui-accent);stroke-width:3;stroke-linecap:round}.pivot circle{fill:var(--ui-accent);stroke:#0b0b0d;stroke-width:2}
- /* Compare: a copy of the pile whose cards slide flat and vanish beside the real one; one drag moves both; a card flying off
- is cut off at its own half's edge (lesson 14) */
- .stage[data-hb-mode="compare"] .decks{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:4px}.stage[data-hb-mode="compare"] .deck{overflow:hidden}
- .stage[data-hb-mode="compare"] .twin{display:block}
- .twin .card,.twin .card.spring{transition:none}
- .cap.half{top:8px}.cap.first{left:8px}.cap.second{left:calc(50% + 10px)}
- @media(prefers-reduced-motion:reduce){.card,.card.spring,.card.out{transition:opacity .2s}.spring .stamp{transition:none}}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="do" data-hb-autoplay>
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../dynamic-island/" rel="prev" aria-label="Previous: Dynamic Island"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Dynamic Island</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">04.44 · Micro-Interactions</p>
- <h1>Card Deck Swipe</h1>
- <p class="hb-lede">Swipe the top card left or right; the next one rises. Best for quick choices.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Drag it</h2><p>Drag the top card sideways and let go, or press Show me.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage">
- <div class="decks">
- <div class="deck" id="deck">
- <div class="pile" id="pile" role="group" aria-label="Profile cards"></div>
- <span class="guide gl" aria-hidden="true"></span><span class="guide gr" aria-hidden="true"></span>
- <svg class="pivot" viewBox="-30 -30 60 60" aria-hidden="true"><path d="M-17-13A21 21 0 0 1 17-13M11-19 17-13 10-8M-11-19-17-13-10-8"/><circle r="6"/></svg>
- </div>
- </div>
- <div class="acts">
- <button class="act nope-b" type="button" id="btn-nope" aria-label="Nope"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
- <button class="act undo-b" type="button" id="btn-undo" aria-label="Undo"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 0 11H11"/></svg></button>
- <button class="act like-b" type="button" id="btn-like" aria-label="Like"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10Z"/></svg></button>
- </div>
- <p class="cap in" id="c-go" aria-hidden="true" data-hb-caption>Let go past here: it flies</p>
- <p class="cap in" id="c-held" aria-hidden="true" data-hb-caption>Held here, so it turns</p>
- <p class="cap in" id="c-next" aria-hidden="true" data-hb-caption>Next · waits a little smaller</p>
- <p class="cap half first" aria-hidden="true" data-hb-caption>Vanishes</p>
- <p class="cap half second" aria-hidden="true" data-hb-caption>Flies off</p>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-demo" data-hb-demo><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>Show me</button>
- <button class="hb-play" type="button" id="btn-reset" data-hb-reset><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Reset</button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, the pile is spread apart and numbered: each waiting card is smaller. The top card turns around a point below it, and a dashed line lights once it is far enough to fly.</p>
- <p data-hb-for="compare" hidden>On the left the card vanishes when you let go, so it is hard to tell where it went. On the right it flies off the side you chose as the next one rises.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting, then drag a card or press Show me.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="dist-lbl">How far to swipe</p>
- <div class="seg" id="dist-seg" role="group" aria-labelledby="dist-lbl">
- <button type="button" data-t="0.25" aria-pressed="false">Short</button>
- <button type="button" data-t="0.4" class="on" aria-pressed="true">Medium</button>
- <button type="button" data-t="0.6" aria-pressed="false">Long</button>
- </div>
- <p class="hb-hint">How far to drag before letting go sends it.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="turn-lbl">How much it turns</p>
- <div class="seg" id="turn-seg" role="group" aria-labelledby="turn-lbl">
- <button type="button" data-turn="0" aria-pressed="false">None</button>
- <button type="button" data-turn="14" class="on" aria-pressed="true">A little</button>
- <button type="button" data-turn="30" aria-pressed="false">A lot</button>
- </div>
- <p class="hb-hint">As if held at the bottom edge.</p>
- </div>
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Shows stamps</span><input class="hb-switch" type="checkbox" role="switch" id="stamp-tog" checked autocomplete="off"></label>
- <p class="hb-hint">Like and Nope fade in as you drag.</p>
- </div>
- </div>
- <details class="hb-options">
- <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="behind-lbl">Cards behind</p>
- <div class="seg" id="behind-seg" role="group" aria-labelledby="behind-lbl">
- <button type="button" data-behind="peek" class="on" aria-pressed="true">Peeking</button>
- <button type="button" data-behind="fan" aria-pressed="false">Fanned</button>
- <button type="button" data-behind="hide" aria-pressed="false">Hidden</button>
- </div>
- <p class="hb-hint">How the waiting cards show.</p>
- </div>
- </div>
- </details>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add a swipeable card deck to [your stack of cards, such as profiles or products]. Pile the cards with the waiting ones behind the top one, showing as the settings choose. While dragged, the top card follows the finger and turns as the settings choose, as if held at its bottom edge, and Like or Nope stamps fade in when the settings include them. On release, send it off that side if it went far enough or was flicked; otherwise spring it back, and grow the next card into place. Use transforms and pointer events, and add Nope, Like and Undo buttons for keyboards. If the visitor has reduced motion turned on, fade cards out instead of throwing them. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Matching apps</li><li>Product pickers</li><li>Flashcards</li><li>Quick polls</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Lists people compare</li><li>Choices that need care</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const stage=document.querySelector('.stage'),deck=document.getElementById('deck'),slowTog=document.getElementById('slow-tog');
- const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),gl=deck.querySelector('.gl'),gr=deck.querySelector('.gr'),pivot=deck.querySelector('.pivot');
- const caps=['c-go','c-held','c-next'].map(id=>document.getElementById(id));
- // Five made-up people: name, two lines, and the picture's colors (background, shirt, hair)
- const PEOPLE=[['Mira, 27','Climbs on weekends','Bakes bread at dawn','#ff9a76','#7c4dff','#2f3b8f','#3b2416'],
- ['Theo, 31','Plays the cello','Has two old cats','#5ec7c0','#1f5f8b','#e8b04a','#1b1b1f'],
- ['Lena, 25','Draws maps for fun','Runs by the river','#f6c85f','#d1495b','#3a7d44','#8a4b2a'],
- ['Kofi, 29','Cooks for twelve','Fixes old bikes','#8fb8ff','#3d348b','#f26b38','#16120f'],
- ['Ines, 33','Grows tomatoes','Loves night trains','#b8e1a3','#2d6a4f','#9b5de5','#5a2d1c']];
- const real={pile:document.getElementById('pile'),twin:false};
- // thr: how far the card's middle must go to fly, as a share of its width; turn: degrees of turn for a card width of drag
- let thr=.4,turn=14,stamps=true,mode='normal',twin=null,cardW=0,cardH=0,dx=0,gone=[],drag=null,runTimers=[],runFrame=0,runDragging=false;
- const decks=()=>twin?[real,twin]:[real];
- const live=d=>[...d.pile.children].filter(c=>!c.classList.contains('out'));
- const topOf=d=>{const l=live(d);return l[l.length-1]||null};
- const clamp01=x=>Math.min(1,Math.max(0,x));
-
- function cardEl(p,copy){
- const [who,l1,l2,bg1,bg2,shirt,hair]=PEOPLE[p],c=document.createElement('div');
- c.className='card';c.dataset.p=p;c.style.setProperty('--f',p%2?1:-1);
- c.innerHTML=`<div class="photo" style="--bg1:${bg1};--bg2:${bg2};--shirt:${shirt};--hair:${hair}"></div><p class="who">${who}</p><p class="line">${l1}</p><p class="line">${l2}</p>`+
- (copy?'':'<span class="stamp like" aria-hidden="true">LIKE</span><span class="stamp nope" aria-hidden="true">NOPE</span>');
- return c;
- }
- // Depth of every card (0 on top); only the top card of the real pile takes focus, and it says what the keys do
- function restack(d){
- const l=live(d);
- l.forEach((c,k)=>{
- const i=l.length-1-k;c.style.setProperty('--i',i);c.dataset.n=i+1;c.classList.toggle('top',!i);c.classList.toggle('deep',i>=(mode==='inside'?4:3));
- if(i)c.style.transform='';
- if(d.twin)return;
- if(i)c.querySelectorAll('.stamp').forEach(m=>{m.style.opacity=''});
- c.tabIndex=i?-1:0;
- if(i)c.removeAttribute('aria-label');else c.setAttribute('aria-label',PEOPLE[c.dataset.p].slice(0,3).join(', ')+'. Left arrow for Nope, right arrow for Like');
- });
- }
- function build(){gone=[];dx=0;for(const d of decks()){d.pile.textContent='';[4,3,2,1,0].forEach(p=>d.pile.appendChild(cardEl(p,d.twin)));restack(d)}}
- // The top card where a drag puts it: moved, turned around its pivot below, its stamp as strong as the drag is far; the copy in
- // Compare only slides, flat. See inside lights the line the card's middle has passed and moves the pivot with the card.
- function follow(x,y=0){
- dx=x;const c=topOf(real),s=thr*cardW,t=twin&&topOf(twin);
- if(c){
- c.style.transform=x||y?`translate(${x}px,${y}px) rotate(${cardW?x/cardW*turn:0}deg)`:'';
- c.querySelector('.like').style.opacity=stamps?clamp01(x/s):0;c.querySelector('.nope').style.opacity=stamps?clamp01(-x/s):0;
- }
- if(t)t.style.transform=x?`translateX(${x}px)`:'';
- gr.classList.toggle('lit',x>s);gl.classList.toggle('lit',-x>s);
- pivot.style.transform=`translate(${deck.clientWidth/2+x}px,${deck.clientHeight/2+cardH*.8+y}px)`;
- if(mode==='inside')placeCaps();
- }
- // At rest the top card sits in the middle; See inside holds it half way to the line, Compare a third of a card to the right
- // (short of the line, so a plain click never sends it)
- const restX=()=>mode==='inside'?thr*cardW/2:mode==='compare'?Math.min(cardW/3,thr*cardW*.8):0;
- function settle(spring){
- for(const d of decks()){const c=topOf(d);if(c){c.classList.remove('drag');c.classList.toggle('spring',spring)}}
- follow(restX());
- }
- // The top card leaves to one side (under reduced motion it fades where it is); the copy's card vanishes at once; the next card
- // grows into place, and an empty pile fills again
- function send(dir){
- const c=topOf(real);if(!c)return;
- const had=document.activeElement===c,t=twin&&topOf(twin);
- gone.push({p:+c.dataset.p,dir});if(t)t.remove();
- c.classList.remove('drag','spring','top');c.classList.add('out');c.style.opacity='0';
- if(!reduceMQ.matches)c.style.transform=`translate(${dir*cardW*2.2}px,${-cardW*.12}px) rotate(${dir*Math.max(turn,8)*1.6}deg)`;
- c.addEventListener('transitionend',()=>{c.remove();if(!live(real).length&&!real.pile.children.length){build();settle(false)}},{once:true});
- for(const d of decks())restack(d);
- settle(!reduceMQ.matches);
- const n=topOf(real);if(had)(n||document.getElementById('btn-undo')).focus({preventScroll:true});
- }
- // Undo: the last card comes back from the side it left on (under reduced motion it fades in)
- function undo(){
- const g=gone.pop();if(!g)return;
- const c=cardEl(g.p,false);c.classList.add('drag');c.style.opacity='0';
- if(!reduceMQ.matches)c.style.transform=`translate(${g.dir*cardW*2.2}px,${-cardW*.12}px) rotate(${g.dir*Math.max(turn,8)*1.6}deg)`;
- real.pile.appendChild(c);if(twin)twin.pile.appendChild(cardEl(g.p,true));
- for(const d of decks())restack(d);
- void c.offsetWidth;c.style.opacity='';settle(!reduceMQ.matches);
- }
-
- // The visitor's drag: the top card follows the pointer (touch-action pan-y keeps the page scrolling up and down); letting go
- // past the line or with a flick sends it, otherwise it springs back
- const scale=()=>deck.getBoundingClientRect().width/deck.offsetWidth||1;
- real.pile.addEventListener('pointerdown',e=>{
- const c=e.target.closest('.card');if(!c||c!==topOf(real)||(e.pointerType==='mouse'&&e.button!==0))return;
- stopRun();const k=scale();
- drag={id:e.pointerId,x0:e.clientX-dx*k,y0:e.clientY,k,lastX:e.clientX,lastT:performance.now(),vel:0};
- for(const d of decks()){const t=topOf(d);if(t){t.classList.add('drag');t.classList.remove('spring')}}
- c.setPointerCapture(e.pointerId);
- });
- real.pile.addEventListener('pointermove',e=>{
- if(!drag||e.pointerId!==drag.id)return;
- const now=performance.now();if(now>drag.lastT){drag.vel=(e.clientX-drag.lastX)/(now-drag.lastT);drag.lastX=e.clientX;drag.lastT=now}
- follow((e.clientX-drag.x0)/drag.k,(e.clientY-drag.y0)/drag.k*.25);
- });
- function release(e,cancelled){
- if(!drag||e.pointerId!==drag.id)return;
- const d=drag;drag=null;if(performance.now()-d.lastT>100)d.vel=0;
- const past=Math.abs(dx)>thr*cardW,flick=Math.abs(d.vel)>.5&&Math.abs(dx)>20&&Math.sign(d.vel)===Math.sign(dx);
- if(!cancelled&&(past||flick))send(dx>0?1:-1);else settle(!reduceMQ.matches);
- }
- real.pile.addEventListener('pointerup',e=>release(e,false));
- real.pile.addEventListener('pointercancel',e=>release(e,true));
- // The keyboard and the buttons: Left and Right on the focused top card, or Nope, Like and Undo
- real.pile.addEventListener('keydown',e=>{
- if(e.target!==topOf(real)||(e.key!=='ArrowLeft'&&e.key!=='ArrowRight'))return;
- e.preventDefault();stopRun();send(e.key==='ArrowRight'?1:-1);
- });
- document.getElementById('btn-nope').addEventListener('click',()=>{stopRun();send(-1)});
- document.getElementById('btn-like').addEventListener('click',()=>{stopRun();send(1)});
- document.getElementById('btn-undo').addEventListener('click',()=>{stopRun();undo()});
-
- // Show me: a drag that springs back, a throw to the left, then Undo. Its drags move the card the way a finger would, by the
- // time that passes; every pause waits on a timer, and slow motion triples the moves, never the pauses.
- function later(fn,move,hold){const id=setTimeout(()=>{runTimers=runTimers.filter(t=>t!==id);fn()},move*(slowTog.checked?3:1)+hold);runTimers.push(id)}
- const running=()=>runTimers.length>0||runFrame!==0;
- function runDrag(to,ms,then){
- for(const d of decks()){const t=topOf(d);if(t){t.classList.add('drag');t.classList.remove('spring')}}
- const from=dx,dur=ms*(slowTog.checked?3:1);let t0=null;runDragging=true;
- const step=ts=>{
- if(t0===null)t0=ts;
- const k=reduceMQ.matches?1:Math.min(1,(ts-t0)/dur);follow(from+(to-from)*k*k*(3-2*k));
- if(k<1){runFrame=requestAnimationFrame(step);return}
- runFrame=0;runDragging=false;then();
- };
- runFrame=requestAnimationFrame(step);
- }
- function stopRun(){
- runTimers.forEach(clearTimeout);runTimers=[];cancelAnimationFrame(runFrame);runFrame=0;
- if(runDragging){runDragging=false;settle(!reduceMQ.matches)}
- }
- document.getElementById('btn-demo').addEventListener('click',()=>{
- stopRun();if(!topOf(real))return;
- const s=thr*cardW;
- runDrag(restX()+s*.55,700,()=>settle(!reduceMQ.matches));
- // the spring-back (400 ms) and the fly-off (420 ms) count as moves, so slow motion slows them as it slows the drags
- later(()=>runDrag(-(s+cardW*.2),600,()=>send(-1)),700+400,200);
- later(undo,1300+400+420,580);
- });
- document.getElementById('btn-reset').addEventListener('click',()=>{stopRun();build();settle(false)});
- document.addEventListener('hb:input',()=>{if(running())stopRun()});
- stage.addEventListener('focusin',e=>{if(e.isTrusted&&running())stopRun()});
-
- // See inside's labels: the line's under its end, the pivot's to its left (never higher than under the line's), the next
- // card's above it; all are measured before any moves
- function placeCaps(){
- const s=stage.getBoundingClientRect(),g=gr.getBoundingClientRect(),p=pivot.getBoundingClientRect(),n=live(real),nx=n[n.length-2];
- const size=caps.map(el=>[el.offsetWidth,el.offsetHeight]),b=nx?nx.getBoundingClientRect():null;
- const at=[[(g.left+g.right)/2-s.left-size[0][0]/2,g.bottom-s.top+4],[p.left-s.left-size[1][0]-4,Math.max((p.top+p.bottom)/2-size[1][1]/2,g.bottom+size[0][1]+8)-s.top],
- b?[b.left-s.left,b.top-s.top-size[2][1]-6]:[6,6]];
- caps.forEach((el,i)=>{el.style.left=Math.max(6,Math.min(s.width-size[i][0]-6,at[i][0]))+'px';el.style.top=Math.max(6,Math.min(s.height-size[i][1]-6,at[i][1]))+'px'});
- }
- // Compare's first half: a copy of the pile, made once, inert and unnamed; it then follows every change of the real one
- function makeTwin(){
- const el=document.createElement('div');el.className='deck twin';el.inert=true;el.setAttribute('aria-hidden','true');
- el.innerHTML='<div class="pile"></div>';deck.before(el);twin={pile:el.firstChild,twin:true};
- live(real).forEach(c=>twin.pile.appendChild(cardEl(+c.dataset.p,true)));restack(twin);
- }
- // Card sizes, and the dashed lines at the swipe distance, as tall as a card and a little more
- function measure(){
- const c=real.pile.querySelector('.card');cardW=c?c.offsetWidth:0;cardH=c?c.offsetHeight:0;
- for(const [g,k] of [[gl,-1],[gr,1]]){g.style.top=deck.clientHeight/2-cardH*.6+'px';g.style.height=cardH*1.16+'px';g.style.transform=`translateX(${k*thr*cardW}px)`}
- }
- // The mode switch draws the mode at once: the card at the mode's rest, with no spring
- document.addEventListener('hb:mode',e=>{
- mode=e.detail.mode;
- if(mode==='compare'&&!twin)makeTwin();
- for(const d of decks())restack(d);
- measure();if(!drag&&!running())settle(false);else follow(dx);
- });
- new ResizeObserver(()=>{measure();follow(drag||running()?dx:restX())}).observe(deck);
-
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);measure();if(!drag&&!running())settle(false);
- }));
- }
- choices('dist-seg',d=>{thr=+d.t});
- choices('turn-seg',d=>{turn=+d.turn});
- choices('behind-seg',d=>{stage.classList.remove('fan','hide');if(d.behind!=='peek')stage.classList.add(d.behind)});
- document.getElementById('stamp-tog').addEventListener('change',e=>{stamps=e.target.checked;follow(dx)});
- slowTog.addEventListener('change',()=>stage.style.setProperty('--sp',slowTog.checked?3:1));
- build();measure();
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/04-micro-interactions/card-deck-swipe/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/04-micro-interactions/card-deck-swipe/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/04-micro-interactions/card-deck-swipe/README.md`**
-
-````markdown
-# Card Deck Swipe
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/)
-
-## What it is
-A card deck swipe shows a pile of cards, such as profiles or products, one at a time. The top card follows a drag, turns a little as if held at its bottom edge, and flies off to the left or the right when let go far enough, while the next card grows into its place. The two sides are two answers, such as no and yes, so people decide quickly, one card at a time.
-
-## When to use it
-- Matching and dating apps
-- Product pickers and "this or that" shopping
-- Flashcards: known, or not yet
-- Quick polls and preference quizzes
-
-## How it works
-The cards are stacked in one box. Each card knows its depth (0 on top), and the waiting cards are moved down and made a little smaller from that number, so the pile peeks out behind the top card:
-
-```css
-.card { transform-origin: 50% 130%; /* a point below the bottom edge */
- transform: translateY(calc(var(--i) * 12px)) scale(calc(1 - var(--i) * .05)); }
-```
-
-While it is dragged, the top card's transform follows the pointer and turns in proportion to the distance. Because it turns around a point below its bottom edge, its top swings further than its bottom, as a card held at the bottom would. The stamps grow stronger with the distance:
-
-```js
-card.style.transform = `translate(${dx}px, ${dy}px) rotate(${dx / cardWidth * turn}deg)`;
-like.style.opacity = Math.min(1, Math.max(0, dx / (threshold * cardWidth)));
-```
-
-On release, a card whose middle went past the swipe distance, or that was flicked away from the middle faster than half a pixel per millisecond, gets a transition and is moved off that side; otherwise it springs back with an overshooting curve. The next card's depth becomes 0, so its own transition grows it into place, and the card that left is removed once its transition ends. Undo puts the last card back on top where it left and lets the transition bring it in. Nope, Like and Undo are real buttons, and the Left and Right keys work on the focused top card. Under reduced motion, cards fade instead of flying.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| How far to swipe | Medium | How far the card's middle must go before letting go sends it: short is a quarter of the card's width, medium 40% and long 60%; a quick flick sends it from anywhere |
-| How much it turns | A little | How far the card turns for each card width of drag, around a point below its bottom edge: none does not turn, a little turns 14 degrees and a lot 30 degrees |
-| Shows stamps | on | Like in green and Nope in red fade in on the card as it is dragged, fully shown at the swipe distance |
-| Cards behind | Peeking | How the waiting cards show: peeking sets each one a little lower and 5% smaller, fanned turns them 5 degrees left or right in turn around the same low point, hidden shows only the top card until the next one grows in |
-
-## Production notes
-- **Transforms only.** Move, turn and grow the cards with transform and fade them with opacity; never change their left, top or size.
-- **Pointer events.** One set of pointerdown, pointermove and pointerup handlers, with pointer capture, serves mouse, pen and touch; `touch-action: pan-y` keeps vertical scrolling on phones, and a `pointercancel` springs the card back.
-- **Keep a few cards in the page.** Render the top three to five cards, add more as cards leave, and remove a card once its fly-off ends.
-- **Buttons and keys.** Swiping alone shuts out keyboards and some assistive tools: add Nope, Like and Undo buttons and arrow keys, and announce each choice.
-- **Libraries.** react-tinder-card and Swiper's cards effect package the idea; in an app, Framer Motion's `drag` with a velocity check in `onDragEnd`, or GSAP's Draggable, builds it.
-- **Reduced motion.** Fade the card out instead of throwing it, and let the next one appear without growing.
-
-## See also
-- [Swipe to Dismiss](../swipe-to-dismiss/) — one list row slides off with a drag or a flick
-- [3D Carousel](../../06-3d-advanced/carousel-3d/) — cards on a ring that turn with a drag and glide on
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: 05 Text & Typography ── */` (the end of the 04 bespoke block):
-
-```css
-.pv-deckswipe{background:#0b0b0d;overflow:hidden;container-type:size}
-.pv-deckswipe i{position:absolute;left:36%;top:11%;width:28%;height:76%;border-radius:2.6cqw;background:linear-gradient(#0000 62%,#17171c 62%),linear-gradient(160deg,var(--a),var(--b));box-shadow:0 1.5cqw 4cqw rgba(0,0,0,.5);transform-origin:50% 130%}
-.pv-deckswipe i::after{content:"";position:absolute;left:12%;right:34%;bottom:11%;height:3cqh;border-radius:1cqw;background:#5a5a63;box-shadow:0 -5cqh 0 #f4f4f2}
-.pv-deckswipe .c3{--a:#5ec7c0;--b:#1f5f8b;transform:translateY(5cqh) scale(.9)}
-.pv-deckswipe .c2{--a:#f6c85f;--b:#d1495b;animation:deckswipe-next 4s ease-in-out infinite}
-.pv-deckswipe .c1{--a:#ff9a76;--b:#7c4dff;animation:deckswipe-top 4s ease-in-out infinite}
-.pv-deckswipe .c1 b{position:absolute;left:10%;top:9%;padding:0 1.4cqw;border:.5cqw solid #34c77b;border-radius:1.2cqw;color:#34c77b;font:800 4cqw/1.3 var(--disp);transform:rotate(-14deg);opacity:0;animation:deckswipe-like 4s ease-in-out infinite}
-@keyframes deckswipe-top{0%,10%{transform:none;opacity:1}40%{transform:translateX(14cqw) rotate(6deg);opacity:1}62%{transform:translateX(80cqw) rotate(20deg);opacity:1}63%,88%{transform:none;opacity:0}100%{transform:none;opacity:1}}
-@keyframes deckswipe-next{0%,42%{transform:translateY(2.5cqh) scale(.95)}60%,88%{transform:none}100%{transform:translateY(2.5cqh) scale(.95)}}
-@keyframes deckswipe-like{0%,12%{opacity:0}40%,62%{opacity:1}63%,100%{opacity:0}}
-```
-
-(b) insert this line right after the line that starts with `case 'dynisland':`:
-
-```js
- case 'deckswipe': return '<i class="c3"></i><i class="c2 anim"></i><i class="c1 anim"><b class="anim">LIKE</b></i>';
-```
-
-(c) in `const STILL={`, the map's last line ends with `izoom:.02` (the line before `};`): make it end with `izoom:.02,deckswipe:.4` (the middle of its loop is not a clear frame; reduced motion holds the preview there).
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-grep -c "pv-deckswipe" index.html; grep -c "case 'deckswipe':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: Prove the keyboard test for Task 11, then put the test file back**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-sed -i "s/'magnetic-button', 'click-ripple'\]/'magnetic-button', 'click-ripple', 'card-deck-swipe']/" tests/pages.test.js
-grep -c "'card-deck-swipe'" tests/pages.test.js
-node --test tests/pages.test.js 2>&1 | grep -E "keyboard|^ℹ (pass|fail)"
-git checkout -- tests/pages.test.js && git status --short tests/
-```
-
-Expected: `1` (the entry is in), then `✔ the do-it pages played with the pointer can be played from the keyboard` and `ℹ fail 0`, then nothing (the file is back as it was). If the grep prints `0`, the list's last entry changed since this plan: add `'card-deck-swipe'` in the `'04-micro-interactions'` list of `KEYBOARD_PAGES` by hand, run, and put the file back the same way.
-
-- [ ] **Step 7: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8965: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8965/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L5 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-node $RUN/slot.mjs run ten-L5 -- node tools/check-pages.mjs --base http://127.0.0.1:8965 --out $TEN/checks/L5/1 animations/04-micro-interactions/card-deck-swipe home > $TEN/checks/L5/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L5/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-node $RUN/slot.mjs run ten-L5 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8965 --short --out $TEN/checks/L5/short-1 animations/04-micro-interactions/card-deck-swipe > $TEN/checks/L5/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L5/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L5/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L5/1.log; grep '^FAIL' $TEN/checks/L5/1.log; tail -2 $TEN/checks/L5/short-1.log`.
-
-Expected: `12` (six `ok` lines each for `card-deck-swipe`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 8: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-i=0; for sel in "" "#dist-seg [data-t='0.25']" "#dist-seg [data-t='0.6']" "#turn-seg [data-turn='0']" "#turn-seg [data-turn='30']" "#behind-seg [data-behind='fan']" "#behind-seg [data-behind='hide']" "#stamp-tog"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L5 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8965 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L5/press-$i animations/04-micro-interactions/card-deck-swipe || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L5/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L5/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-i=0; for sel in ""; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L5 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8965 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L5/clip-$i animations/04-micro-interactions/card-deck-swipe || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L5/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L5/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 8 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 1 `== clip-…` line, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L5/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 9: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L5/<round>/04-card-deck-swipe-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- The top card follows a drag, turns around a point below its bottom edge and shows Like or Nope as it goes; let go past the line or with a flick it flies off that side and the next card grows into place; short of it, it springs back; a vertical swipe still scrolls the page.
-- Nope, Undo and Like are 48px round buttons under the pile; Left and Right work on the focused top card, and focus moves to the next top card; an empty pile fills again.
-- Show me drags and springs back, throws to the left, then Undo brings the card back (about 3.1 s) and the pile is as it started; in Slow motion each part waits for the one before (the spring-back ends before the throw, Undo waits for the card to fly off); Reset rebuilds the pile.
-- How far to swipe, How much it turns, Shows stamps and Cards behind (Peeking, Fanned, Hidden) change Normal and both views; under reduced motion cards fade instead of flying and a short drag jumps back.
-- In Compare a card flying off is cut off at its own half's edge and never crosses into the other half (lesson 14; this plan's clips found it crossing before each half clipped its pile).
-
-Decisions already made in this page (keep them; a reviewer weighs them): The box is 400px tall on phones in every mode (`--hb-stage-h-phone`), so the pile and its buttons fit; a card is at most 60% of the box's width. The swipe distance is how far the card's middle must go, as a share of its width (a quarter, 40%, 60%); the turn is 0, 14 or 30 degrees per card width of drag, around a point 30% of the card's height below it. Both views pose the top card: half way to the line in See inside, a third of a card to the right in Compare (always short of the line, so a click never sends it). The helper that finds the top card is `topOf` (a global `top` would clash with `window.top`).
-
-- [ ] **Step 10: Frame times (optional: a page moved by transforms)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-(node $RUN/slot.mjs run ten-L5 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8965 --modes normal,inside,compare animations/04-micro-interactions/card-deck-swipe; node $RUN/slot.mjs run ten-L5 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8965 --phone --modes normal,inside,compare animations/04-micro-interactions/card-deck-swipe; node $RUN/slot.mjs run ten-L5 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8965 animations/04-micro-interactions/swipe-to-dismiss; node $RUN/slot.mjs run ten-L5 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8965 --phone animations/04-micro-interactions/swipe-to-dismiss) > $TEN/checks/L5/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L5/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes, and no larger share of frames slower than 20 ms than Swipe to Dismiss measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: 0% in every mode at both sizes; Swipe to Dismiss 0% at both sizes. Report the numbers; nothing to change unless a mode is clearly worse than the closest page.
-
-- [ ] **Step 11: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L5 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L5 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 04.44 Card Deck Swipe, with See inside and Compare from the start (lane 5)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/04-micro-interactions/card-deck-swipe/README.md`, `A animations/04-micro-interactions/card-deck-swipe/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/04-micro-interactions/README.md`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L5/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 12: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L5`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at the pile kept in step in Compare (the copy's card vanishes at once); focus after a keyboard throw; the pivot and labels at 320. It writes `$TEN/reports/L5/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 7 again (and the galleries, clips or frame times a fix touches), commits `fix: Card Deck Swipe: <what>` after the branch check, writes `$TEN/reports/L5/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L5 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L5/`.
-
----
-
-### Task 6: L6 · 06.27 Water Ripple (`ten/L6`, port 8966)
-
-Do it · step 1 "Drag it" · player bar: Show me, Reset and Slow motion (the page slows itself). See inside: the water's height as a gray map beside the bent picture, with the rule in words. Compare: "Rings on top" (light rings over a flat picture) beside "Bends the picture"; both halves take drags and taps. Spec: "6 · Water Ripple (06.27)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/06-3d-advanced/water-ripple/index.html` (386 lines), `animations/06-3d-advanced/water-ripple/README.md`
-- Modify (by `$TEN/lanes.mjs 6`): `index.html` (the card after Infinite Zoom's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 06's count 26 → 27, the catalog line), `animations/06-3d-advanced/README.md` (its line), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`, `animations/06-3d-advanced/infinite-zoom/index.html` (its first Next link, to Water Ripple)
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 06 bespoke block, `case 'waterripple':` in `pvMarkup()`
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js` (with a proof edit, put back); the page check of the new page, of Infinite Zoom and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults and of the timing settings' choices; frame times
-- Write (run folder): `$TEN/checks/L6/` (logs, screenshots, kit output), `$TEN/reports/L6/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L6` on `ten/L6`, its server on port 8966 (started and stopped by the coordinator), `$TEN/lanes.mjs`, `$TEN/frametimes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses Show me after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L6`: the card `['water-ripple','Water Ripple','Ripples spread from your finger and bend the picture below. Best for hero images.']` (06.27), `PV` key `'water-ripple':'waterripple'`, `PLACES` `['bg','imgcard']`, `FIND` `'water-ripple':['background card','drag click hover','wave']`; Previous: Infinite Zoom (final), and Infinite Zoom's Next link to Water Ripple; no Next link yet. For Task 11: `'water-ripple'` in the `'06-3d-advanced'` list of `KEYBOARD_PAGES`. The reports in `$TEN/reports/L6/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-node $TEN/lanes.mjs 6 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 6 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/06-3d-advanced/README.md`, ` M animations/06-3d-advanced/infinite-zoom/index.html`, ` M index.html`; then these 7 failing tests and `ℹ fail 7`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ 06-3d-advanced/infinite-zoom uses the guided-steps page correctly`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, and Infinite Zoom's new Next link opens a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/06-3d-advanced/water-ripple/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Water Ripple — Animation Handbook</title>
- <meta name="description" content="Ripples spread from your finger and bend the picture below. Best for hero images.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Water Ripple — Animation Handbook">
- <meta property="og:description" content="Ripples spread from your finger and bend the picture below. Best for hero images.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Water Ripple — Animation Handbook">
- <meta name="twitter:description" content="Ripples spread from your finger and bend the picture below. Best for hero images.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Water Ripple", "name": "Water Ripple", "description": "Ripples spread from your finger and bend the picture below. Best for hero images.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/", "inLanguage": "en", "articleSection": "3D & Advanced", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, 3D & Advanced, Water Ripple"}</script>
- <style>
- :root{--ui-accent:#3fd6c4}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{position:relative;overflow:hidden;background:#0b3b44}
- /* The water is drawn at the grid's size on small canvases that the browser stretches over the box (or a half of it) */
- .view{position:absolute;display:block;pointer-events:none}
- .view.half,.view.flat,#over,.wr-lbl,.divide{display:none}
- #cvs{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:crosshair;background:transparent}
- #cvs:focus-visible{outline:2px solid var(--ui-accent);outline-offset:-3px}
- /* The keyboard's spot: a small ring the arrow keys move, shown while the box has keyboard focus */
- .spot{position:absolute;left:0;top:0;width:26px;height:26px;margin:-13px 0 0 -13px;border:2px solid #fff;border-radius:50%;box-shadow:0 0 0 2px rgba(0,0,0,.45);opacity:0;pointer-events:none}
- #cvs:focus-visible~.spot{opacity:1}
- /* Under reduced motion a touch shows still rings that fade */
- .still-rings{position:absolute;width:120px;height:120px;margin:-60px 0 0 -60px;pointer-events:none;transition:opacity .9s linear}
- .stage[data-hb-mode="inside"] .view.whole,.stage[data-hb-mode="compare"] .view.whole{display:none}
- .stage[data-hb-mode="inside"] .view.flat,.stage[data-hb-mode="inside"] #over,.stage[data-hb-mode="compare"] .view.half,.stage[data-hb-mode="compare"] .divide{display:block}
- #over{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
- .divide{position:absolute;left:calc(50% - 1px);top:0;width:2px;height:100%;background:#08262c}
- .wr-lbl{position:absolute;padding:3px 8px;border-radius:6px;background:rgba(6,20,24,.9);color:#f4f4f2;font:600 13px/1.25 var(--hb-font);pointer-events:none;max-width:46%}
- .stage[data-hb-mode="inside"] .in,.stage[data-hb-mode="compare"] .half-name{display:block}
- .in.crest{left:10px;top:10px}.in.patch{right:10px;bottom:104px;text-align:right}.in.read{left:10px;bottom:10px}
- .half-name{top:10px}.half-name.first{left:10px}.half-name.second{left:calc(50% + 10px)}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="do" data-hb-autoplay>
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../infinite-zoom/" rel="prev" aria-label="Previous: Infinite Zoom"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Infinite Zoom</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">06.27 · 3D &amp; Advanced</p>
- <h1>Water Ripple</h1>
- <p class="hb-lede">Ripples spread from your finger and bend the picture below. Best for hero images.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Drag it</h2><p>Drag across the pond, tap it to drop a pebble, or press Show me.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage">
- <canvas id="over" aria-hidden="true"></canvas><i class="divide" aria-hidden="true"></i>
- <canvas id="cvs" role="img" tabindex="0" aria-label="A pond with pebbles, a koi and lily pads under clear water. Drag or tap to make ripples; with the keyboard, the arrow keys move a ring and Enter drops a pebble."></canvas>
- <i class="spot" aria-hidden="true"></i>
- <p class="wr-lbl in crest" aria-hidden="true" data-hb-caption>Light is a crest, dark a trough</p>
- <p class="wr-lbl in patch" aria-hidden="true" data-hb-caption>Each point: its neighbors, minus its last height</p>
- <p class="wr-lbl in read" aria-hidden="true" data-hb-caption>The picture is read from a shifted spot</p>
- <p class="wr-lbl half-name first" aria-hidden="true" data-hb-caption>Rings on top</p>
- <p class="wr-lbl half-name second" aria-hidden="true" data-hb-caption>Bends the picture</p>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-demo" data-hb-demo><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>Show me</button>
- <button class="hb-play" type="button" id="btn-reset" data-hb-reset><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Reset</button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, the gray map is the water's height. Each step, every point becomes its four neighbors' heights minus its own last height, and the picture is read from a spot shifted by the slope.</p>
- <p data-hb-for="compare" hidden>Rings on top draws light rings over a picture that stays flat; Bends the picture shifts the picture itself under the waves, so it looks like water. Drag or tap either half.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting, then drag the water or press Show me.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="size-lbl">Ripple size</p>
- <div class="seg" id="size-seg" role="group" aria-labelledby="size-lbl">
- <button type="button" data-r="2" aria-pressed="false">Small</button>
- <button type="button" data-r="3.5" class="on" aria-pressed="true">Medium</button>
- <button type="button" data-r="5.5" aria-pressed="false">Large</button>
- </div>
- <p class="hb-hint">How wide each push or drop is.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="last-lbl">How long ripples last</p>
- <div class="seg" id="last-seg" role="group" aria-labelledby="last-lbl">
- <button type="button" data-damp=".05" aria-pressed="false">Short</button>
- <button type="button" data-damp=".022" class="on" aria-pressed="true">Medium</button>
- <button type="button" data-damp=".009" aria-pressed="false">Long</button>
- </div>
- <p class="hb-hint">Long lets them bounce off the edges and cross.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="bend-lbl">Bend</p>
- <div class="seg" id="bend-seg" role="group" aria-labelledby="bend-lbl">
- <button type="button" data-bend="5" aria-pressed="false">Subtle</button>
- <button type="button" data-bend="12" class="on" aria-pressed="true">Medium</button>
- <button type="button" data-bend="22" aria-pressed="false">Strong</button>
- </div>
- <p class="hb-hint">How much the picture under the water bends.</p>
- </div>
- </div>
- <details class="hb-options">
- <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
- <div class="hb-settings">
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Light on the waves</span><input class="hb-switch" type="checkbox" role="switch" id="light-tog" checked autocomplete="off"></label>
- <p class="hb-hint">Bright glints on the slopes.</p>
- </div>
- </div>
- </details>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add a water ripple effect to [the picture you want to look as if it lies under water]. Keep two grids of water heights, now and one step earlier. On each step, set every point to half the total of its four neighbors minus its earlier height, then damp it slightly, so ripples spread, cross, bounce off the edges and fade. A drag leaves a trail of small pushes; a tap drops a pebble. Draw the picture shifted at each point by the slope of the water, so it bends under the waves. Use a coarse grid and fixed steps, and stop once the water is calm. If the visitor has reduced motion turned on, show still rings that fade. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Hero pictures</li><li>Pool, spa and travel sites</li><li>Playful backgrounds</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Pictures with text</li><li>Busy pages</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const cvs=document.getElementById('cvs'),stage=cvs.parentElement,over=document.getElementById('over'),octx=over.getContext('2d');
- const spot=stage.querySelector('.spot'),slowTog=document.getElementById('slow-tog'),lightTog=document.getElementById('light-tog');
- const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),phone=matchMedia('(max-width:600px),(max-height:500px)');
- // CALM: below this height no point of the picture moves by a pixel or changes its light, so the water counts as calm
- const FRAME=1000/60,CALM=.04;
- const LABELS={normal:'A pond with pebbles, a koi and lily pads under clear water. Drag or tap to make ripples; with the keyboard, the arrow keys move a ring and Enter drops a pebble.',
- inside:'The water\'s height as a gray map over a faint pond, a magnified patch of nine points and arrows to the spots the picture is read from. Drag or tap to make ripples.',
- compare:'The same ripples twice: light rings over a flat picture on the left, the picture bending under the water on the right. Drag or tap either half.'};
- let radius=3.5,damp=.022,bend=12,mode='normal',W=0,H=0,raf=0,lastT=null,behind=0,calmSteps=0,running=false;
- let main=null,pair=null,frozen=null,runTimers=[],path=null,down=null,key={x:.5,y:.5};
- // A water surface for a rectangle of the box (in shares of it): two grids of heights, now and one step earlier, about one point
- // per four pixels and at most 200 across (128 on phones, half that for Compare's water), and the views that draw it
- function Water(rect,cols){
- const gw=Math.max(24,cols),gh=Math.max(16,Math.round(gw*rect.h*H/(rect.w*W)));
- return{rect,gw,gh,cur:new Float32Array(gw*gh),prev:new Float32Array(gw*gh),sx:new Float32Array(gw*gh),sy:new Float32Array(gw*gh)};
- }
- // One step: every point becomes half the total of its four neighbors minus its own earlier height, then loses a little
- // (How long ripples last); the edges stay flat, so waves bounce off them. Returns the largest height left.
- function step(w){
- const {gw,gh,cur,prev}=w;let most=0;
- for(let y=1;y<gh-1;y++)for(let x=1,i=y*gw+1;x<gw-1;x++,i++){
- const v=((cur[i-1]+cur[i+1]+cur[i-gw]+cur[i+gw])/2-prev[i])*(1-damp);
- prev[i]=v;const a=v<0?-v:v;if(a>most)most=a;
- }
- w.cur=prev;w.prev=cur;return most;
- }
- // A push of the water at (x, y) in the box's pixels: a round dip, deeper in the middle; a pebble is a bigger, deeper one
- function push(w,x,y,k){
- const gx=(x/W-w.rect.x)/w.rect.w*w.gw,gy=(y/H-w.rect.y)/w.rect.h*w.gh,r=radius*(w.gw/(phone.matches?128:200))*(k>1?1.5:1);
- for(let j=Math.max(1,Math.floor(gy-r));j<=Math.min(w.gh-2,Math.ceil(gy+r));j++)for(let i=Math.max(1,Math.floor(gx-r));i<=Math.min(w.gw-2,Math.ceil(gx+r));i++){
- const d=Math.hypot(i-gx,j-gy)/r;if(d<1)w.cur[j*w.gw+i]-=k*.5*(1+Math.cos(d*Math.PI))}
- }
- // The pond, drawn with canvas commands at a view's size: deep water, a pebble floor, a koi and lily pads with a flower
- function pond(g,w,h){
- const s=Math.min(w/320,h/200),rnd=(n=>()=>{n=(n*16807)%2147483647;return n/2147483647})(42);
- const water=g.createLinearGradient(0,0,0,h);water.addColorStop(0,'#1d6f7a');water.addColorStop(1,'#0b3b44');g.fillStyle=water;g.fillRect(0,0,w,h);
- for(let i=0;i<140;i++){const x=rnd()*w,y=rnd()*h,r=(3+rnd()*8)*s,t=rnd();g.fillStyle=`rgb(${110+t*60|0},${118+t*44|0},${104+t*30|0})`;
- g.beginPath();g.ellipse(x,y,r,r*.7,rnd()*3,0,6.283);g.fill()}
- g.fillStyle='rgba(20,90,100,.35)';g.fillRect(0,0,w,h);
- const kx=w*.55,ky=h*.55;g.save();g.translate(kx,ky);g.rotate(-.35);g.scale(s,s);
- g.fillStyle='#f5f0e6';g.beginPath();g.ellipse(0,0,34,12,0,0,6.283);g.fill();
- g.fillStyle='#ff7a2f';g.beginPath();g.ellipse(-6,-2,16,9,0,0,6.283);g.fill();g.beginPath();g.ellipse(18,1,8,6,0,0,6.283);g.fill();
- g.fillStyle='#f5f0e6';g.beginPath();g.moveTo(-30,0);g.lineTo(-52,-12);g.lineTo(-48,0);g.lineTo(-52,12);g.closePath();g.fill();g.restore();
- for(const [px,py,pr] of [[.18,.3,22],[.8,.22,26],[.86,.72,18],[.28,.78,20]]){const x=px*w,y=py*h,r=pr*s;
- g.fillStyle='#3f8f3a';g.beginPath();g.moveTo(x,y);g.arc(x,y,r,.3,6.1);g.closePath();g.fill();g.strokeStyle='#2b6b2a';g.lineWidth=1.2*s;g.stroke()}
- g.fillStyle='#ff9ec0';for(let i=0;i<6;i++){g.beginPath();g.ellipse(w*.8+Math.cos(i)*5*s,h*.22+Math.sin(i)*5*s,6*s,3*s,i,0,6.283);g.fill()}
- g.fillStyle='#ffe38a';g.beginPath();g.arc(w*.8,h*.22,3*s,0,6.283);g.fill();
- }
- // A view: a small canvas for one water, twice the grid's size each way (R), stretched over its rectangle; it keeps the pond's
- // pixels and three lighter copies of them for the light on the waves
- const R=2;
- function View(w,cls){
- const c=document.createElement('canvas'),g=c.getContext('2d'),rw=w.gw*R,rh=w.gh*R;c.width=rw;c.height=rh;c.className='view '+cls;c.setAttribute('aria-hidden','true');
- Object.assign(c.style,{left:w.rect.x*100+'%',top:w.rect.y*100+'%',width:w.rect.w*100+'%',height:w.rect.h*100+'%'});
- stage.prepend(c);pond(g,rw,rh);
- const img=g.getImageData(0,0,rw,rh),base=new Uint32Array(img.data.buffer.slice(0)),lit=[base];
- for(const k of [.12,.24,.4]){const d=new Uint8ClampedArray(img.data),a=new Uint32Array(d.buffer);for(let i=0;i<d.length;i+=4){d[i]+=(255-d[i])*k;d[i+1]+=(255-d[i+1])*k;d[i+2]+=(255-d[i+2])*k}lit.push(a)}
- return{c,g,img,px:new Uint32Array(img.data.buffer),lit};
- }
- // Draws a water in a view: each point shows the pond read from a spot shifted by the slope there (bend), lit where the slope
- // faces the light; rings: the pond stays where it is and only the light shows (Compare's first half)
- function paint(w,v,rings){
- const {gw,gh,cur,sx,sy}=w,{px,lit}=v,rw=gw*R,rh=gh*R,b=bend*R*gw/(phone.matches?128:200),light=lightTog.checked||rings;
- for(let y=0,i=0;y<gh;y++)for(let x=0;x<gw;x++,i++){sx[i]=x>0&&x<gw-1?cur[i+1]-cur[i-1]:0;sy[i]=y>0&&y<gh-1?cur[i+gw]-cur[i-gw]:0}
- for(let Y=0,o=0;Y<rh;Y++)for(let X=0;X<rw;X++,o++){
- const i=(Y/R|0)*gw+(X/R|0),dx=sx[i],dy=sy[i];
- let qx=X,qy=Y;if(!rings&&(dx||dy)){qx=Math.min(rw-1,Math.max(0,X+Math.round(dx*b)));qy=Math.min(rh-1,Math.max(0,Y+Math.round(dy*b)))}
- const l=light?Math.min(3,Math.max(0,Math.round(rings?(Math.abs(dx)+Math.abs(dy))*7:-(dx+dy)*6))):0;
- px[o]=lit[l][qy*rw+qx];
- }
- v.g.putImageData(v.img,0,0);
- }
- // See inside: the heights in grays over a faint pond (light a crest, dark a trough), a magnified patch of nine points around the
- // steepest spot, and on a coarse grid small arrows from each point to the spot its picture is read from
- function paintInside(w,v){
- const {gw,gh,cur}=w,{px,lit}=v,u=new Uint8ClampedArray(px.buffer),rw=gw*R,rh=gh*R;
- for(let Y=0,o=0;Y<rh;Y++){const row=(Y/R|0)*gw;for(let X=0;X<rw;X++,o++){
- const g=Math.max(0,Math.min(255,128+cur[row+(X/R|0)]*230))*.7,q=o*4,s=lit[0][o];
- u[q]=(s&255)*.3+g;u[q+1]=(s>>8&255)*.3+g;u[q+2]=(s>>16&255)*.3+g;u[q+3]=255}}
- v.g.putImageData(v.img,0,0);
- octx.clearRect(0,0,W,H);
- const step=phone.matches?34:28,cx=W/gw,cy=H/gh,b=bend*gw/(phone.matches?128:200);
- octx.strokeStyle='#ffce5a';octx.fillStyle='#ffce5a';octx.lineWidth=1.6;octx.beginPath();
- for(let y=step/2;y<H-90;y+=step)for(let x=step/2;x<W;x+=step){
- const i=Math.min(gh-2,Math.max(1,y/cy|0))*gw+Math.min(gw-2,Math.max(1,x/cx|0)),dx=(cur[i+1]-cur[i-1])*b*cx*2,dy=(cur[i+gw]-cur[i-gw])*b*cy*2;
- if(Math.hypot(dx,dy)<1.5){octx.moveTo(x+1,y);octx.arc(x,y,1,0,6.283);continue}
- octx.moveTo(x,y);octx.lineTo(x+dx,y+dy)}
- octx.stroke();
- let best=gw+1,top=0;for(let i=gw+1;i<gw*(gh-1)-1;i++){const s=Math.abs(cur[i+1]-cur[i-1])+Math.abs(cur[i+gw]-cur[i-gw]);if(s>top){top=s;best=i}}
- const bx=best%gw,by=best/gw|0,size=phone.matches?18:22,ox=W-10-size*3,oy=H-10-size*3;
- for(let j=-1;j<=1;j++)for(let i=-1;i<=1;i++){const g=Math.max(0,Math.min(255,128+cur[best+j*gw+i]*230))|0;octx.fillStyle=`rgb(${g},${g},${g})`;octx.fillRect(ox+(i+1)*size+1,oy+(j+1)*size+1,size-2,size-2)}
- octx.strokeStyle='#ffce5a';octx.lineWidth=2;octx.strokeRect(ox+size+1,oy+size+1,size-2,size-2);
- octx.setLineDash([4,4]);octx.beginPath();octx.moveTo(ox,oy+size*1.5);octx.lineTo(bx*cx,by*cy);octx.stroke();octx.setLineDash([]);
- }
- function draw(){
- if(!main)return;
- const at=w=>calmNow(w)&&frozen?frozen[w===main?0:1]:w;
- if(mode==='inside')paintInside(at(main),main.views[1]);
- else if(mode==='compare'){const w=at(pair);paint(w,pair.views[0],true);paint(w,pair.views[1],false)}
- else paint(main,main.views[0],false);
- }
- const calmNow=w=>!running&&w.still;
- // The loop takes fixed steps of a 60th of a second (a third as many in slow motion, at most three a frame) and stops once the
- // water is calm for a third of a second: then the plain picture (or See inside's and Compare's frozen ripple) is drawn
- function loop(ts){
- if(reduceMQ.matches){calm();return} // reduced motion turned on while the water moves: it goes flat at once
- raf=requestAnimationFrame(loop);
- if(lastT===null){lastT=ts;return}
- const dt=Math.min(ts-lastT,50)*(slowTog.checked?1/3:1);lastT=ts;behind+=dt;
- const w=mode==='compare'?pair:main;
- if(path)trace(dt);
- let n=0,most=1;while(behind>=FRAME-1&&n<3){most=step(w);behind-=FRAME;n++}
- if(n){calmSteps=most<CALM?calmSteps+n:0;w.still=false}
- if(calmSteps>20&&!path){w.cur.fill(0);w.prev.fill(0);w.still=true;running=false;cancelAnimationFrame(raf);raf=0}
- if(n||path)draw();
- }
- function wake(){if(reduceMQ.matches)return;running=true;calmSteps=0;(mode==='compare'?pair:main).still=false;if(!raf){lastT=null;behind=0;raf=requestAnimationFrame(loop)}}
- function calm(){for(const w of [main,pair]){w.cur.fill(0);w.prev.fill(0);w.still=true}running=false;cancelAnimationFrame(raf);raf=0;draw()}
- // A touch on the water: in Compare a touch on either half reaches the one water both halves draw
- let ringAt=-1e9;
- function touchAt(x,y,k){
- if(reduceMQ.matches){const now=performance.now();if(k>.9||now-ringAt>300){ringAt=now;stillRings(x,y)}return}
- const w=mode==='compare'?pair:main;if(mode==='compare'&&x>W/2)x-=W/2;
- push(w,x,y,k);wake();
- }
- // Under reduced motion: still rings at the spot, which fade within a second (a few per touch at most)
- function stillRings(x,y){
- const r=document.createElementNS('http://www.w3.org/2000/svg','svg');r.setAttribute('viewBox','-60 -60 120 120');r.setAttribute('class','still-rings');r.setAttribute('aria-hidden','true');
- r.innerHTML=[18,34,50].map((c,i)=>`<circle r="${c}" fill="none" stroke="rgba(255,255,255,${.8-i*.2})" stroke-width="2"/>`).join('');
- r.style.left=x+'px';r.style.top=y+'px';stage.insertBefore(r,spot);
- setTimeout(()=>{r.style.opacity='0';setTimeout(()=>r.remove(),950)},60);
- }
- // Pointer Events for mouse, pen and touch: a drag leaves a trail of small pushes, a short tap drops a pebble; a mouse that only
- // points leaves a faint wake
- const local=e=>{const r=cvs.getBoundingClientRect();return{x:e.clientX-r.left,y:e.clientY-r.top}};
- cvs.addEventListener('pointerdown',e=>{if(e.button)return;const p=local(e);down={...p,t:e.timeStamp,moved:0};cvs.setPointerCapture(e.pointerId)});
- cvs.addEventListener('pointermove',e=>{const p=local(e);
- if(down){down.moved+=Math.hypot(p.x-down.x,p.y-down.y);down.x=p.x;down.y=p.y;touchAt(p.x,p.y,.35)}
- else if(e.pointerType==='mouse'&&!reduceMQ.matches)touchAt(p.x,p.y,.12)});
- cvs.addEventListener('pointerup',e=>{if(down&&down.moved<8&&e.timeStamp-down.t<400)touchAt(down.x,down.y,1);down=null});
- cvs.addEventListener('pointercancel',()=>{down=null});
- // The keyboard: the arrow keys move the ring, leaving a wake (Shift for bigger moves); Enter or Space drops a pebble there
- cvs.addEventListener('keydown',e=>{
- const d={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];
- if(d){e.preventDefault();const k=e.shiftKey?.12:.04;key.x=Math.min(.97,Math.max(.03,key.x+d[0]*k));key.y=Math.min(.95,Math.max(.05,key.y+d[1]*k));placeSpot();touchAt(key.x*W,key.y*H,.35)}
- else if(e.key==='Enter'||e.key===' '){e.preventDefault();touchAt(key.x*W,key.y*H,1)}
- });
- const placeSpot=()=>{spot.style.transform=`translate(${key.x*W}px,${key.y*H}px)`};
- // Show me: a finger draws an S across the pond, then two taps (3 s in all); the water then calms by itself. The S moves by the
- // time that passed; the taps wait with timers, as every pause of a run does.
- function later(fn,ms){const id=setTimeout(()=>{runTimers=runTimers.filter(t=>t!==id);fn()},ms*(slowTog.checked?3:1));runTimers.push(id)}
- function stopRun(){runTimers.forEach(clearTimeout);runTimers=[];path=null}
- function trace(dt){
- path.t+=dt/1800;const t=Math.min(1,path.t),x=W*(.2+.6*t),y=H*(.5+.28*Math.sin(t*Math.PI*2));
- touchAt(x,y,.35*dt/FRAME);if(t>=1)path=null;
- }
- document.getElementById('btn-demo').addEventListener('click',()=>{
- stopRun();
- if(reduceMQ.matches){touchAt(W*.32,H*.45,1);later(()=>touchAt(W*.68,H*.58,1),800);return}
- path={t:0};wake();
- later(()=>touchAt(W*.3,H*.32,1),2000);later(()=>touchAt(W*.72,H*.68,1),2500);
- });
- document.getElementById('btn-reset').addEventListener('click',()=>{stopRun();calm()});
- document.addEventListener('hb:input',()=>{if(runTimers.length||path)stopRun()});
- stage.addEventListener('focusin',e=>{if(e.isTrusted&&(runTimers.length||path))stopRun()});
- // The mode switch draws the mode at once; See inside and Compare show a frozen ripple while the water is calm
- // Normal and See inside show one water, Compare another: each keeps moving where it was left, so the water a mode shows wakes
- // if it was still moving when the loop stopped for the other
- document.addEventListener('hb:mode',e=>{
- mode=e.detail.mode;cvs.setAttribute('aria-label',LABELS[mode]);if(mode!=='inside')octx.clearRect(0,0,W,H);draw();
- const w=mode==='compare'?pair:main;if(!w.still&&!reduceMQ.matches)wake();
- });
- // A frozen ripple for See inside and Compare at rest: two pebbles from a fixed start, a fixed number of steps on
- function freeze(){
- frozen=[main,pair].map(w=>{const f={...w,cur:new Float32Array(w.cur.length),prev:new Float32Array(w.cur.length)};
- push(f,W*(w===main?.36:.18),H*.45,1.4);push(f,W*(w===main?.66:.34),H*.6,1.1);for(let i=0;i<26;i++)step(f);return f});
- }
- function build(){
- stage.querySelectorAll('.view').forEach(c=>c.remove());
- const cols=Math.min(phone.matches?128:200,Math.round(W/4)),half=Math.round(cols/2);
- main=Water({x:0,y:0,w:1,h:1},cols);main.views=[View(main,'whole'),View(main,'flat')];main.still=true;
- pair=Water({x:0,y:0,w:.5,h:1},half);pair.views=[View(pair,'half'),View({...pair,rect:{x:.5,y:0,w:.5,h:1}},'half')];pair.still=true;
- freeze();
- }
- function resize(){
- const w=stage.clientWidth,h=stage.clientHeight;if(!w||!h||(w===W&&h===H))return;W=w;H=h;
- const dpr=Math.min(devicePixelRatio||1,1.5);over.width=W*dpr;over.height=H*dpr;octx.setTransform(dpr,0,0,dpr,0,0);
- stopRun();running=false;cancelAnimationFrame(raf);raf=0;build();placeSpot();draw();
- }
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);if(main){freeze();draw()}
- }));
- }
- choices('size-seg',d=>{radius=+d.r});
- choices('last-seg',d=>{damp=+d.damp});
- choices('bend-seg',d=>{bend=+d.bend});
- lightTog.addEventListener('change',draw);
- // Under reduced motion the water never moves: the notes say what the still views show
- if(reduceMQ.matches){
- document.querySelector('[data-hb-for="inside"]').textContent='Shown still: the gray map is the water\'s height, each point set from its four neighbors minus its own last height, and the arrows show where the picture is read from.';
- document.querySelector('[data-hb-for="compare"]').textContent='Shown still: Rings on top draws light rings over a flat picture, while Bends the picture shifts the picture itself under the waves, so it looks like water.';
- }
- new ResizeObserver(resize).observe(stage);
- resize();
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/06-3d-advanced/water-ripple/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/06-3d-advanced/water-ripple/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/06-3d-advanced/water-ripple/README.md`**
-
-````markdown
-# Water Ripple
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/)
-
-## What it is
-A water ripple effect makes a picture look as if it lies under clear water: a drag leaves a wake, a tap drops a pebble, and the ripples spread, cross, bounce off the edges and fade, bending the picture beneath them as they pass. It is a real little wave simulation, not rings drawn by formula, which is why two ripples cross and add up the way water does.
-
-## When to use it
-- Hero pictures on pool, spa, travel and seaside sites
-- Playful backgrounds that invite people to touch them
-- Landing pages for games or kids' products
-- Photography sites, as a calm hover effect on one featured picture
-
-## How it works
-The water is two grids of heights, about one point per four pixels of the box (at most 200 across, 128 on phones): the heights now and one step earlier. At 60 fixed steps a second, every point becomes half the total of its four neighbors minus its own earlier height, then loses a little, so ripples spread outward, cross and fade; the edges stay flat, so waves bounce off them. The new heights are written over the earlier grid, and the two swap:
-
-```js
-for (let y = 1; y < gh - 1; y++) for (let x = 1, i = y * gw + 1; x < gw - 1; x++, i++)
- prev[i] = ((cur[i - 1] + cur[i + 1] + cur[i - gw] + cur[i + gw]) / 2 - prev[i]) * (1 - damp);
-[cur, prev] = [prev, cur];
-```
-
-A touch pushes a small round dip into the grid (a pebble a bigger, deeper one). To draw the water, each point shows the picture read from a spot shifted by the slope there, so the picture bends under every wave; slopes that face the light get a lighter copy of the picture, which makes the glints:
-
-```js
-const dx = cur[i + 1] - cur[i - 1], dy = cur[i + gw] - cur[i - gw];
-const sx = clamp(x + Math.round(dx * bend)), sy = clamp(y + Math.round(dy * bend));
-pixels[i] = lighter[light(dx, dy)][sy * gw + sx];
-```
-
-The pond is drawn once with canvas commands at the grid's size, so its pixels can be read, and three lighter copies of it are made for the glints. The result is written into a small canvas of one pixel per point that the browser stretches over the box. The steps come from an accumulator (at most three a frame, a third as many in slow motion), so the waves move at the same speed on every screen; once the water has stayed calm for a third of a second the loop stops and the plain picture is drawn, so the box is exactly at rest. Under reduced motion nothing moves: a tap or a drag shows still rings that fade within a second.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Ripple size | Medium | How wide each push is, in grid points: small is 2, medium 3.5 and large 5.5 (a pebble half as wide again) |
-| How long ripples last | Medium | How much height the water loses each step: short is 5%, which fades a pebble's rings within a second; medium 2.2%, about three seconds; long 0.9%, long enough for rings to bounce off the edges and cross |
-| Bend | Medium | How far the picture under a slope is shifted: subtle is 5 grid points for a full slope, medium 12 and strong 22 |
-| Light on the waves | on | Slopes that face the light show a lighter picture, in three steps of brightness; off, only the bending shows |
-
-## Production notes
-- **A coarse grid is enough.** The ripples are smooth, so a grid of one point per three to four pixels, drawn on a small canvas stretched over the box, looks as good as one point per pixel at a tenth of the cost. Use typed arrays and swap the two grids instead of copying them.
-- **Fixed steps, then stop.** The wave rule needs equal steps: take them from an accumulator at a fixed rate, and stop the loop when the largest height is tiny, so a calm picture costs nothing.
-- **Read the pixels once.** Draw the picture into the small canvas once and keep its pixels (`getImageData`); a picture from another site needs CORS headers, or the canvas cannot be read.
-- **WebGL for full screen.** For a full-screen hero on a large display, the same two-grid rule runs in a fragment shader on ping-pong textures (as in the jQuery Ripples plugin or a Three.js render target), and the bending is a second shader that offsets the texture lookup.
-- **Touch and keyboard.** Use Pointer Events with `touch-action: none` on the water so a drag does not scroll the page, and let the keyboard move a ring and drop a pebble.
-- **Reduced motion.** Do not run the waves; a still ring that fades shows where the touch landed.
-
-## See also
-- [Cloth / Soft-Body Simulation](../cloth-simulation/) — fixed steps and a drag move a cloth
-- [Image Distortion on Hover](../image-distortion-hover/) — rings worked out by formula warp a picture near the pointer
-- [Ambient Ripple Effect](../../07-ambient-background/ambient-ripple/) — rings spread on their own, with no water
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: 07 Ambient & Background ── */` (the end of the 06 bespoke block):
-
-```css
-.pv-waterripple{background:radial-gradient(4% 6% at 14% 22%,#9a9585 60%,#0000 64%),radial-gradient(5% 7.5% at 30% 70%,#9a9585 60%,#0000 64%),radial-gradient(3.5% 5.25% at 52% 30%,#9a9585 60%,#0000 64%),radial-gradient(5% 7.5% at 70% 64%,#9a9585 60%,#0000 64%),radial-gradient(4% 6% at 86% 26%,#9a9585 60%,#0000 64%),radial-gradient(3.5% 5.25% at 62% 86%,#9a9585 60%,#0000 64%),radial-gradient(4.5% 6.75% at 20% 88%,#9a9585 60%,#0000 64%),radial-gradient(3% 4.5% at 44% 56%,#9a9585 60%,#0000 64%),radial-gradient(4% 6% at 92% 80%,#9a9585 60%,#0000 64%),linear-gradient(#1d6f7a,#0b3b44);overflow:hidden}
-.pv-waterripple i{position:absolute;width:60%;aspect-ratio:1;border-radius:50%;border:1.5px solid rgba(240,255,255,.8);opacity:0;transform:translate(-50%,-50%) scale(.05);
- animation:waterripple-ring 3s ease-out infinite}
-.pv-waterripple .a{left:36%;top:46%}.pv-waterripple .b{left:64%;top:58%;animation-delay:-1.5s}.pv-waterripple .r2{animation-delay:-.6s}.pv-waterripple .b.r2{animation-delay:-2.1s}
-@keyframes waterripple-ring{0%{opacity:.9;transform:translate(-50%,-50%) scale(.05)}100%{opacity:0;transform:translate(-50%,-50%) scale(1)}}
-```
-
-(b) insert this line right after the line that starts with `case 'izoom':`:
-
-```js
- case 'waterripple': return '<i class="a anim"></i><i class="a r2 anim"></i><i class="b anim"></i><i class="b r2 anim"></i>';
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-grep -c "pv-waterripple" index.html; grep -c "case 'waterripple':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: Prove the keyboard test for Task 11, then put the test file back**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-sed -i "s/'image-distortion-hover', 'parallax-3d-tilt'\]/'image-distortion-hover', 'parallax-3d-tilt', 'water-ripple']/" tests/pages.test.js
-grep -c "'water-ripple'" tests/pages.test.js
-node --test tests/pages.test.js 2>&1 | grep -E "keyboard|^ℹ (pass|fail)"
-git checkout -- tests/pages.test.js && git status --short tests/
-```
-
-Expected: `1` (the entry is in), then `✔ the do-it pages played with the pointer can be played from the keyboard` and `ℹ fail 0`, then nothing (the file is back as it was). If the grep prints `0`, the list's last entry changed since this plan: add `'water-ripple'` in the `'06-3d-advanced'` list of `KEYBOARD_PAGES` by hand, run, and put the file back the same way.
-
-- [ ] **Step 7: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8966: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8966/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L6 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-node $RUN/slot.mjs run ten-L6 -- node tools/check-pages.mjs --base http://127.0.0.1:8966 --out $TEN/checks/L6/1 animations/06-3d-advanced/water-ripple animations/06-3d-advanced/infinite-zoom home > $TEN/checks/L6/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L6/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-node $RUN/slot.mjs run ten-L6 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8966 --short --out $TEN/checks/L6/short-1 animations/06-3d-advanced/water-ripple > $TEN/checks/L6/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L6/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L6/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L6/1.log; grep '^FAIL' $TEN/checks/L6/1.log; tail -2 $TEN/checks/L6/short-1.log`.
-
-Expected: `18` (six `ok` lines each for `water-ripple`, `infinite-zoom`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 8: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`) and for each choice of the settings that change only timing or show only while the demo moves (G1, G11): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-i=0; for sel in "" "#size-seg [data-r='2']" "#size-seg [data-r='5.5']" "#last-seg [data-damp='.05']" "#last-seg [data-damp='.009']" "#bend-seg [data-bend='5']" "#bend-seg [data-bend='22']" "#light-tog"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L6 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8966 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L6/press-$i animations/06-3d-advanced/water-ripple || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L6/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L6/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-i=0; for sel in "" "#last-seg [data-damp='.05']" "#last-seg [data-damp='.009']"; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L6 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8966 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L6/clip-$i animations/06-3d-advanced/water-ripple || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L6/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L6/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 8 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 3 `== clip-…` lines, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders; for a timing choice, the same frames beside `clip-0`'s): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L6/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 9: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L6/<round>/06-water-ripple-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- A drag leaves a wake, a tap drops a pebble, a hovering mouse leaves a faint wake; ripples cross, bounce off the edges and fade; the box takes focus, the arrow keys move a ring and Enter or Space drops a pebble there.
-- Show me draws an S and taps (about 3 s); with the default settings the water is calm again and the plain picture redrawn within about 5 s of the run's end.
-- Ripple size, How long ripples last, Bend and Light on the waves change the water in Normal and both views; Reset makes the water flat at once; back in Normal after Compare (and the other way) the water goes on and calms, never frozen mid-wave (RULINGS 7).
-- The step numbers, chips and pressed buttons use 06's accent, `#3fd6c4` (every 06 page's), not the home page's green dot.
-- Under reduced motion nothing moves: a tap or a drag shows still rings that fade within a second; turning reduced motion on while ripples run flattens the water at once.
-
-Decisions already made in this page (keep them; a reviewer weighs them): The grid follows the box's shape: one point per four pixels, at most 200 across (128 on phones), instead of a fixed size; the views are drawn at twice the grid. The water counts as calm below 0.04 of a ripple's height; then the loop stops and the plain picture is drawn, so the box is exactly at rest. A hovering mouse leaves a faint wake (not in the spec): it shows the water is there before a press.
-
-- [ ] **Step 10: Frame times (required: a canvas or mask page)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-(node $RUN/slot.mjs run ten-L6 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8966 --modes normal,inside,compare animations/06-3d-advanced/water-ripple; node $RUN/slot.mjs run ten-L6 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8966 --phone --modes normal,inside,compare animations/06-3d-advanced/water-ripple; node $RUN/slot.mjs run ten-L6 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8966 animations/06-3d-advanced/cloth-simulation; node $RUN/slot.mjs run ten-L6 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8966 --phone animations/06-3d-advanced/cloth-simulation) > $TEN/checks/L6/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L6/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes (See inside on a desktop may reach a 33 ms median when the machine is busy, as Cloth / Soft-Body Simulation does in Normal), and no larger share of frames slower than 20 ms than Cloth / Soft-Body Simulation measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: desktop 9 to 12 / 20 to 57 / 0 to 2%, phone 0 / 0 / 0%; Cloth / Soft-Body Simulation 83 to 87% on a desktop (median 33.4 ms) and 37% on a phone. A page that misses lightens its per-frame work (a smaller grid, fewer dots, less drawn per frame) until it meets this, and says what it changed.
-
-- [ ] **Step 11: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L6 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L6 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 06.27 Water Ripple, with See inside and Compare from the start (lane 6)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/06-3d-advanced/water-ripple/README.md`, `A animations/06-3d-advanced/water-ripple/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/06-3d-advanced/README.md`, `M animations/06-3d-advanced/infinite-zoom/index.html`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L6/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 12: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L6`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at fixed steps from an accumulator (at most three a frame, a third in slow motion); the loop stopping when calm; the keyboard ring. It writes `$TEN/reports/L6/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 7 again (and the galleries, clips or frame times a fix touches), commits `fix: Water Ripple: <what>` after the branch check, writes `$TEN/reports/L6/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L6 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L6/`.
-
----
-
-### Task 7: L7 · 06.28 Audio Visualizer (`ten/L7`, port 8967)
-
-Loop · step 1 "Watch it" · player bar: Pause and Slow motion (the page pauses and slows itself); Hear it is a real button in the box. See inside: each bar split by the parts of the tune filling it, with a beat strip on top and a legend. Compare: "Equal slices" (the bass crowded into a few bars) beside "Wider for treble". Spec: "7 · Audio Visualizer (06.28)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/06-3d-advanced/audio-visualizer/index.html` (416 lines), `animations/06-3d-advanced/audio-visualizer/README.md`
-- Modify (by `$TEN/lanes.mjs 7`): `index.html` (the card after Infinite Zoom's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 06's count 26 → 27, the catalog line), `animations/06-3d-advanced/README.md` (its line and a Browser requirements row), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 06 bespoke block, `case 'audioviz':` in `pvMarkup()`
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js` (with a proof edit, put back); the page check of the new page and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults and of the timing settings' choices; frame times
-- Write (run folder): `$TEN/checks/L7/` (logs, screenshots, kit output), `$TEN/reports/L7/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L7` on `ten/L7`, its server on port 8967 (started and stopped by the coordinator), `$TEN/lanes.mjs`, `$TEN/frametimes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses nothing on a loop after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L7`: the card `['audio-visualizer','Audio Visualizer','Bars dance to the music, from bass to treble. Best for music players.']` (06.28), `PV` key `'audio-visualizer':'audioviz'`, `PLACES` `['imgcard','bg']`, `FIND` `'audio-visualizer':['shape background','loop','bounce grow']`; Previous: Infinite Zoom (for now: Task 11 points it at the page before it in the section); no Next link yet. For Task 11: `'audio-visualizer': ['bars-seg', 'Some']` in `PHONE_DEFAULTS`. The reports in `$TEN/reports/L7/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-node $TEN/lanes.mjs 7 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 7 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/06-3d-advanced/README.md`, ` M index.html`; then these 6 failing tests and `ℹ fail 6`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, from a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/06-3d-advanced/audio-visualizer/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Audio Visualizer — Animation Handbook</title>
- <meta name="description" content="Bars dance to the music, from bass to treble. Best for music players.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/audio-visualizer/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Audio Visualizer — Animation Handbook">
- <meta property="og:description" content="Bars dance to the music, from bass to treble. Best for music players.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/audio-visualizer/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Audio Visualizer — Animation Handbook">
- <meta name="twitter:description" content="Bars dance to the music, from bass to treble. Best for music players.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Audio Visualizer", "name": "Audio Visualizer", "description": "Bars dance to the music, from bass to treble. Best for music players.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/audio-visualizer/", "inLanguage": "en", "articleSection": "3D & Advanced", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, 3D & Advanced, Audio Visualizer"}</script>
- <style>
- :root{--ui-accent:#3fd6c4}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{position:relative;overflow:hidden;background:radial-gradient(80% 70% at 50% 100%,#1a1430,#08080c 70%)}
- #cvs{position:absolute;inset:0;width:100%;height:100%;display:block}
- /* Hear it: a small player row in the box, at least 44px */
- .hear{position:absolute;right:10px;top:10px;z-index:2;display:inline-flex;align-items:center;gap:8px;min-height:44px;min-width:44px;padding:0 14px;
- border:1px solid rgba(255,255,255,.28);border-radius:999px;background:rgba(8,8,12,.82);color:#f4f4f2;font:600 14px/1 var(--hb-font);cursor:pointer}
- .hear svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
- .hear[aria-pressed="true"]{border-color:var(--ui-accent);color:var(--ui-accent)}
- @media(hover:hover){.hear:hover{border-color:rgba(255,255,255,.6)}}
- /* See inside and Compare: plain words over the picture */
- .av-lbl{display:none;position:absolute;padding:3px 8px;border-radius:6px;background:rgba(8,8,12,.9);color:#f4f4f2;font:600 13px/1.25 var(--hb-font);white-space:nowrap;pointer-events:none}
- .stage[data-hb-mode="inside"] .in:not(.scale),.stage[data-hb-mode="compare"] .row{display:block}
- .key{left:10px;top:10px;max-width:calc(100% - 140px);white-space:normal}
- .key i{display:inline-block;width:9px;height:9px;margin:0 4px 0 2px;border-radius:50%;vertical-align:0}
- .beat{left:10px;top:var(--beat-y,50px)}
- .scale{left:10px;right:10px;bottom:8px}
- .stage[data-hb-mode="inside"].st-bars .scale{display:flex;justify-content:space-between}
- .row{left:10px}.row.first{top:10px}.row.second{top:calc(50% + 8px)}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="loop">
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../infinite-zoom/" rel="prev" aria-label="Previous: Infinite Zoom"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Infinite Zoom</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">06.28 · 3D &amp; Advanced</p>
- <h1>Audio Visualizer</h1>
- <p class="hb-lede">Bars dance to the music, from bass to treble. Best for music players.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Watch it</h2><p>It moves to a built-in beat, in silence. Press Hear it to play the beat out loud.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage st-bars">
- <canvas id="cvs" role="img" aria-label="Bars from bass on the left to treble on the right, jumping to a beat and sinking back"></canvas>
- <button class="hear" type="button" id="hear" aria-pressed="false"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9v6h4l5 4V5L8 9z"/><path d="M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12"/></svg><span>Hear it</span></button>
- <p class="av-lbl in key" aria-hidden="true" data-hb-caption><i style="background:#ff5d5d"></i>Kick <i style="background:#ffa94d"></i>Snare <i style="background:#b07cff"></i>Bass <i style="background:#5cd18a"></i>Melody <i style="background:#4fc3f7"></i>Hi-hats</p>
- <p class="av-lbl in beat" aria-hidden="true" data-hb-caption>The beat</p>
- <p class="av-lbl in scale" aria-hidden="true" data-hb-caption><span>Bass</span><span>Middle</span><span>Treble</span></p>
- <p class="av-lbl row first" aria-hidden="true" data-hb-caption>Equal slices</p>
- <p class="av-lbl row second" aria-hidden="true" data-hb-caption>Wider for treble</p>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-pause" data-hb-pause data-state="playing"><svg class="hb-ic hb-i-pause" viewBox="0 0 24 24" aria-hidden="true"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg><svg class="hb-ic hb-i-play" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3l14 9-14 9z"/></svg><span class="hb-pause-label">Pause</span></button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, each bar is split by the parts of the tune filling it, kick and bass on the left, hi-hats on the right. The top strip marks the beat: each kick lifts the low bars.</p>
- <p data-hb-for="compare" hidden>Equal slices gives every bar the same share of pitches, so the bass crowds into a few bars. Wider for treble widens the slices as pitches rise, as we hear, so the whole row dances.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and see the difference as it moves.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="style-lbl">Style</p>
- <div class="seg" id="style-seg" role="group" aria-labelledby="style-lbl">
- <button type="button" data-style="bars" class="on" aria-pressed="true">Bars</button>
- <button type="button" data-style="wave" aria-pressed="false">Wave</button>
- <button type="button" data-style="circle" aria-pressed="false">Circle</button>
- </div>
- <p class="hb-hint">Wave draws the sound's shape instead of its pitches.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="bars-lbl">Number of bars</p>
- <div class="seg" id="bars-seg" role="group" aria-labelledby="bars-lbl">
- <button type="button" data-n="16" aria-pressed="false">Few</button>
- <button type="button" data-n="32" data-hb-phone aria-pressed="false">Some</button>
- <button type="button" data-n="64" class="on" aria-pressed="true">Many</button>
- </div>
- <p class="hb-hint">Fewer read better when small.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="fall-lbl">How bars fall</p>
- <div class="seg" id="fall-seg" role="group" aria-labelledby="fall-lbl">
- <button type="button" data-fall="2.6" aria-pressed="false">Quickly</button>
- <button type="button" data-fall="1.2" class="on" aria-pressed="true">Gently</button>
- <button type="button" data-fall="0.45" aria-pressed="false">Slowly</button>
- </div>
- <p class="hb-hint">Slowly sinks like an old stereo.</p>
- </div>
- </div>
- <details class="hb-options">
- <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
- <div class="hb-settings">
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Peak marks</span><input class="hb-switch" type="checkbox" role="switch" id="peak-tog" checked autocomplete="off"></label>
- <p class="hb-hint">A small mark holds each bar's highest point for a moment.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="colors-lbl">Colors</p>
- <div class="seg" id="colors-seg" role="group" aria-labelledby="colors-lbl">
- <button type="button" data-pal="sunset" class="on" aria-pressed="true">Sunset</button>
- <button type="button" data-pal="ocean" aria-pressed="false">Ocean</button>
- <button type="button" data-pal="neon" aria-pressed="false">Neon</button>
- </div>
- <p class="hb-hint">The colors from the bottom of each bar to its top.</p>
- </div>
- </div>
- </details>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add an audio visualizer to [your music player, podcast card or hero section]. Connect the playing audio to an analyzer that reports, many times a second, how loud each band of pitches is, and draw the bands on a canvas from bass to treble, in the style the settings choose, each sized by its loudness. Give higher bands wider slices of pitch, as hearing does, so the whole row moves. Let bands jump up at once and sink back as the settings choose. Start sound only when the visitor presses play, never use the microphone without asking, and draw fewer bars on phones. If the visitor has reduced motion turned on, keep the bars still until they press play. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Music players</li><li>Podcast pages</li><li>Radio and DJ sites</li><li>Voice notes</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Pages without sound</li><li>Reading pages</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const cvs=document.getElementById('cvs'),ctx=cvs.getContext('2d'),stage=cvs.parentElement,hear=document.getElementById('hear');
- const slowTog=document.getElementById('slow-tog'),peakTog=document.getElementById('peak-tog'),pauseBtn=document.getElementById('btn-pause');
- const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),phone=matchMedia('(max-width:600px),(max-height:500px)');
- // The tune: four bars at 100 beats a minute (a beat is 0.6 s, the loop 9.6 s), written as the beats each part plays on.
- // Bass and melody notes are [beat, length in beats, frequency in Hz].
- const BEAT=.6,LOOP=16*BEAT;
- const KICK=[0,1.5,2,4,5.5,6,8,9.5,10,12,13.5,14,15],SNARE=[1,3,5,7,9,11,13,15],HATS=[...Array(32)].map((_,i)=>i/2);
- const BASS=[[0,1.5,55],[1.5,.5,55],[2,1,55],[3,1,110],[4,1.5,43.65],[5.5,.5,43.65],[6,1,43.65],[7,1,87.3],[8,1.5,65.4],[9.5,.5,65.4],[10,1,65.4],[11,1,130.8],[12,1.5,49],[13.5,.5,49],[14,1,49],[15,1,98]];
- const MELODY=[[0,1,440],[1,1,523.3],[2,2,659.3],[4,1,587.3],[5,1,523.3],[6,2,440],[8,1,392],[9,1,440],[10,2,523.3],[12,1,493.9],[13,1,392],[14,2,329.6]];
- const PARTS=['kick','snare','bass','melody','hats'],PART_COLORS=['#ff5d5d','#ffa94d','#b07cff','#5cd18a','#4fc3f7'];
- const PALETTES={sunset:['#ff5f6d','#ffc371'],ocean:['#0083b0','#00e5ff'],neon:['#ff00a0','#00f0ff']};
- const LABELS={normal:'Bars from bass on the left to treble on the right, jumping to a beat and sinking back',
- inside:'The bars split by the parts of the tune that fill them, with a scale from bass to treble and the beat on top',
- compare:'Two rows of bars for the same tune: equal slices of pitch above, slices that widen for treble below'};
- let style='bars',count=64,fall=1.2,pal='sunset',mode='normal',paused=false;
- let W=0,H=0,raf=0,lastT=null,clock=.03,song=.03,rows=null,audio=null,insideTop=40;
- // On phones the bars start at the choice marked data-hb-phone (Some), pressed here before the shared script reads the settings
- if(phone.matches){const b=document.querySelector('#bars-seg [data-hb-phone]');count=+b.dataset.n;
- document.querySelectorAll('#bars-seg button').forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))})}
- const bars=()=>count;
- // How loud each part is at a time of the loop (s, in seconds): a hit dies away after it is struck, a note while it sounds
- const since=(beats,s)=>{let best=1e9;for(const b of beats){const d=s-b*BEAT;if(d>=0&&d<best)best=d;const w=s+LOOP-b*BEAT;if(w>=0&&w<best)best=w}return best};
- const note=(notes,s)=>{for(const [b,l,f] of notes){const d=s-b*BEAT;if(d>=0&&d<l*BEAT)return{f,amp:Math.exp(-d/(l*BEAT*1.2))}}return{f:0,amp:0}};
- function parts(s){
- return{kick:Math.exp(-since(KICK,s)/.12),snare:.8*Math.exp(-since(SNARE,s)/.15),hats:.55*Math.exp(-since(HATS,s)/.05),bass:note(BASS,s),melody:note(MELODY,s)};
- }
- // How strongly a part fills a band of pitches (lo to hi Hz), as an analyzer would measure it: the part's loudness averaged over
- // the band, its energy sitting around its own pitches, spread over a range (a drum) or over a note and its overtones
- // (pitches in octaves: lf is a sampled pitch of the band, c a part's own pitch, w how far its energy spreads)
- const near=(lf,c,w)=>{const d=(lf-c)/w;return Math.exp(-d*d)};
- const L62=Math.log2(62),L200=Math.log2(200),L1800=Math.log2(1800),L9000=Math.log2(9000);
- function fill(row,i,p,out){
- const lb=p.bass.amp?Math.log2(p.bass.f):0,lm=p.melody.amp?Math.log2(p.melody.f):0;
- const tone=(n,k,l,lf)=>n.amp?k*n.amp*(near(lf,l,.3)+.5*near(lf,l+1,.3)+.25*near(lf,l+1.585,.3)):0;
- out.fill(0);
- for(let j=0;j<6;j++){const lf=row.lf[i*6+j];
- out[0]+=p.kick*near(lf,L62,.9);out[1]+=p.snare*(.6*near(lf,L200,.6)+near(lf,L1800,1.6));out[2]+=tone(p.bass,1,lb,lf);out[3]+=tone(p.melody,.8,lm,lf);out[4]+=p.hats*near(lf,L9000,.9)}
- for(let k=0;k<5;k++)out[k]/=6;
- return out;
- }
- // A row of bands: Wider for treble splits 40 Hz to 16 kHz evenly by octave (each band wider in pitches than the last), Equal
- // slices into equal widths of 0 to 16 kHz. Each keeps its bars' heights and peak marks.
- function makeRow(even,n){
- const edges=[...Array(n+1)].map((_,i)=>even?16000*i/n:40*Math.pow(400,i/n)),lf=new Float32Array(n*6);
- // six pitches spread across each band, kept in octaves, at which the parts are measured
- for(let i=0;i<n;i++)for(let j=0;j<6;j++)lf[i*6+j]=Math.log2(Math.max(20,edges[i]+(edges[i+1]-edges[i])*(j+.5)/6));
- return{edges,lf,level:new Float32Array(n),peak:new Float32Array(n),hold:new Float32Array(n),split:[...Array(n)].map(()=>[0,0,0,0,0])};
- }
- // Normal and See inside draw the log row; Compare draws its own pair, each row half as many bars on phones. All three follow
- // the tune every frame, so a mode opens on the current beat.
- function build(){const n=bars(),c=phone.matches?n/2:n;rows={log:makeRow(false,n),lin:makeRow(true,c),cmp:makeRow(false,c)};
- for(const row of Object.values(rows))settle(row,aim(row,song,null),1e6)}
- // The heights a frame aims for: from the tune itself, or from the real sound once Hear it plays it
- function aim(row,s,freq){
- const p=parts(s),n=row.level.length,bin=freq?audio.ctx.sampleRate/2/freq.length:1,out=new Float32Array(n);
- for(let i=0;i<n;i++){
- const lo=row.edges[i],hi=row.edges[i+1],f=fill(row,i,p,row.split[i]),sum=f[0]+f[1]+f[2]+f[3]+f[4];
- for(let k=0;k<5;k++)f[k]=sum?f[k]/sum:0;
- if(freq){let a=0,c=0;for(let k=Math.floor(lo/bin);k<=Math.max(Math.floor(lo/bin),Math.floor(hi/bin));k++){a+=freq[k]||0;c++}out[i]=Math.min(1,a/c/210)}
- else out[i]=1-Math.exp(-1.6*sum);
- }
- return out;
- }
- // Bars jump up at once and sink back by How bars fall (heights a second, a third of it in slow motion); a peak mark holds for
- // 0.4 s, then falls slowly
- function settle(row,target,dt){
- const k=dt/1000,{level,peak,hold}=row;
- for(let i=0;i<level.length;i++){
- level[i]=target[i]>level[i]?target[i]:Math.max(target[i],level[i]-fall*k);
- if(level[i]>=peak[i]){peak[i]=level[i];hold[i]=.4}else if((hold[i]-=k)<0)peak[i]=Math.max(level[i],peak[i]-.35*k);
- }
- }
- // The sound's shape: the parts of the tune added together, a short stretch of time around now
- function wave(s,part){
- const p=parts(s),out=new Float32Array(160);
- for(let j=0;j<160;j++){const u=j/160*.03,ph=(s+u)*6.283;
- const v=[p.kick*Math.sin(ph*60),p.snare*.5*Math.sin(ph*3100+j*j),p.bass.amp*.8*Math.sin(ph*p.bass.f),p.melody.amp*.5*Math.sin(ph*p.melody.f),p.hats*.3*Math.sin(ph*9000+j*7)];
- out[j]=part===undefined?v.reduce((a,b)=>a+b,0)*.6:v[part]*.6}
- return out;
- }
- function grad(x0,y0,x1,y1){const g=ctx.createLinearGradient(x0,y0,x1,y1),[a,b]=PALETTES[pal];g.addColorStop(0,a);g.addColorStop(1,b);return g}
- // One row of bars in a rectangle; split: draw each bar in the colors of the parts filling it (See inside)
- // The palette's colors from the bottom of a bar to its top, drawn once into a strip one pixel wide; each bar copies the part of
- // the strip it reaches, which costs far less than filling bars with a gradient every frame
- let strip=null;
- function stripFor(h){
- if(strip&&strip.h===Math.round(h)&&strip.pal===pal)return strip.c;
- const c=document.createElement('canvas'),g=c.getContext('2d'),[a,b]=PALETTES[pal],gr=g.createLinearGradient(0,h,0,0);
- c.width=1;c.height=Math.max(1,Math.round(h));gr.addColorStop(0,a);gr.addColorStop(1,b);g.fillStyle=gr;g.fillRect(0,0,1,h);
- strip={c,h:Math.round(h),pal};return c;
- }
- // See inside fills the bars part by part, every bar of one color in one path, filled once
- function drawBars(row,x,y,w,h,split){
- const n=row.level.length,bw=w/n,gap=Math.min(3,bw*.25);
- if(!split){const c=stripFor(h);for(let i=0;i<n;i++){const bh=Math.max(2,row.level[i]*h);ctx.drawImage(c,0,c.height-bh,1,bh,x+i*bw+gap/2,y+h-bh,bw-gap,bh)}}
- else for(let k=0;k<5;k++){
- ctx.beginPath();
- for(let i=0;i<n;i++){const bh=Math.max(2,row.level[i]*h),sh=row.split[i][k];let under=0;for(let q=0;q<k;q++)under+=row.split[i][q];
- if(sh)ctx.rect(x+i*bw+gap/2,y+h-(under+sh)*bh,bw-gap,sh*bh)}
- ctx.fillStyle=PART_COLORS[k];ctx.fill();
- }
- if(peakTog.checked){ctx.beginPath();for(let i=0;i<n;i++)ctx.rect(x+i*bw+gap/2,y+h-row.peak[i]*h-3,bw-gap,2);ctx.fillStyle='#f4f4f2';ctx.fill()}
- }
- function drawCircle(row,cx,cy,r0,len,split){
- const n=row.level.length,bass=(row.level[0]+row.level[1]+row.level[2])/3,r=r0*(1+.18*bass),[ca,cb]=PALETTES[pal],g=ctx.createRadialGradient(cx,cy,r,cx,cy,r+len);
- g.addColorStop(0,ca);g.addColorStop(1,cb);
- ctx.lineWidth=Math.max(2,Math.min(8,6.283*r/n*.55));ctx.lineCap='round';
- for(let i=0;i<n;i++){const a=-Math.PI/2+i/n*6.283,c=Math.cos(a),s=Math.sin(a),l=Math.max(2,row.level[i]*len);
- if(split){let d=r;row.split[i].forEach((sh,k)=>{if(!sh)return;ctx.strokeStyle=PART_COLORS[k];ctx.beginPath();ctx.moveTo(cx+c*d,cy+s*d);d+=sh*l;ctx.lineTo(cx+c*d,cy+s*d);ctx.stroke()});continue}
- ctx.strokeStyle=g;ctx.beginPath();ctx.moveTo(cx+c*r,cy+s*r);ctx.lineTo(cx+c*(r+l),cy+s*(r+l));ctx.stroke()}
- ctx.strokeStyle='rgba(255,255,255,.25)';ctx.lineWidth=1.5;ctx.beginPath();ctx.arc(cx,cy,r-4,0,6.283);ctx.stroke();
- }
- function drawWave(pts,x,y,w,h,color,width){
- ctx.strokeStyle=color;ctx.lineWidth=width;ctx.lineJoin='round';ctx.beginPath();
- pts.forEach((v,j)=>{const px=x+j/(pts.length-1)*w,py=y+h/2-v*h*.42;j?ctx.lineTo(px,py):ctx.moveTo(px,py)});ctx.stroke();
- }
- function drawRow(row,x,y,w,h,split,s,live){
- if(style==='bars')drawBars(row,x,y,w,h,split);
- else if(style==='circle')drawCircle(row,x+w/2,y+h/2,Math.min(w,h)*.18,Math.min(w,h)*.3,split);
- else{if(split)PART_COLORS.forEach((c,k)=>drawWave(wave(s,k),x,y,w,h,c,1.5));drawWave(live||wave(s),x,y,w,h,split?'#fff':grad(x,0,x+w,0),split?2.5:3)}
- }
- // See inside's beat strip: the loop in half beats, the kicks in the kick's color and the snares in the snare's, and a mark that
- // moves with the tune
- function drawBeat(y){
- const x=10,w=W-20,cw=w/32;
- for(let b=0;b<32;b++){ctx.fillStyle=KICK.includes(b/2)?PART_COLORS[0]:SNARE.includes(b/2)?PART_COLORS[1]:'rgba(255,255,255,.14)';ctx.fillRect(x+b*cw+1,y,cw-2,10)}
- ctx.fillStyle='#fff';ctx.fillRect(x+song/LOOP*w-1.5,y-4,3,18);
- }
- function draw(){
- ctx.clearRect(0,0,W,H);
- const live=audio&&audio.ctx.state==='running'&&style==='wave'?toWave(audio.an):null;
- if(mode==='compare'){drawRow(rows.lin,8,34,W-16,H/2-44,false,song,live);drawRow(rows.cmp,8,H/2+26,W-16,H/2-36,false,song,live);
- ctx.fillStyle='rgba(255,255,255,.12)';ctx.fillRect(0,H/2-1,W,2)}
- else if(mode==='inside'){drawBeat(insideTop+30);drawRow(rows.log,10,insideTop+56,W-20,H-insideTop-96,true,song,live)}
- else drawRow(rows.log,10,58,W-20,H-68,false,song,live);
- }
- const toWave=an=>{const d=new Uint8Array(an.fftSize);an.getByteTimeDomainData(d);const out=new Float32Array(160);for(let j=0;j<160;j++)out[j]=(d[j*4]-128)/128*1.6;return out};
- // One frame: the tune moves on by the time that passed (a third of it in slow motion), the heights follow it (or the real
- // sound), and the sound is scheduled a little ahead
- function frame(dt){
- const rate=slowTog.checked?1/3:1;clock+=dt/1000*rate;song=clock%LOOP;
- // the real sound only once the browser plays it: a context it holds back (no sound device, or no permission) leaves the bars
- // on the tune's own heights
- let freq=null;if(audio&&audio.ctx.state==='running'){freq=new Uint8Array(audio.an.frequencyBinCount);audio.an.getByteFrequencyData(freq);schedule()}
- for(const row of Object.values(rows))settle(row,aim(row,song,freq),dt*rate);
- draw();
- }
- function loop(ts){
- raf=requestAnimationFrame(loop);
- if(lastT===null){lastT=ts;return}
- const dt=Math.min(ts-lastT,50);lastT=ts;frame(dt);
- }
- function start(){if(raf||paused)return;lastT=null;raf=requestAnimationFrame(loop)}
- // Hear it: the same tune played by the browser (oscillators and a burst of generated noise), made only on this press; the bars
- // then follow a real analyzer. Pause and a hidden tab suspend the sound; slow motion plays it at a third of the tempo.
- function startAudio(){
- const ac=new (window.AudioContext||window.webkitAudioContext)(),an=ac.createAnalyser(),out=ac.createGain();
- an.fftSize=2048;an.smoothingTimeConstant=.5;out.gain.value=.45;out.connect(an);an.connect(ac.destination);
- const noise=ac.createBuffer(1,ac.sampleRate,ac.sampleRate),d=noise.getChannelData(0);for(let i=0;i<d.length;i++)d[i]=Math.random()*2-1;
- audio={ctx:ac,an,out,noise,upTo:clock};
- ac.resume();
- }
- function play(kind,at,f,len){
- const {ctx:ac,out,noise}=audio,g=ac.createGain();g.connect(out);
- const env=(peak,dur)=>{g.gain.setValueAtTime(peak,at);g.gain.exponentialRampToValueAtTime(.001,at+dur)};
- if(kind==='kick'){const o=ac.createOscillator();o.frequency.setValueAtTime(150,at);o.frequency.exponentialRampToValueAtTime(45,at+.12);env(1,.35);o.connect(g);o.start(at);o.stop(at+.4)}
- else if(kind==='snare'||kind==='hats'){const s=ac.createBufferSource(),fl=ac.createBiquadFilter();s.buffer=noise;fl.type=kind==='hats'?'highpass':'bandpass';
- fl.frequency.value=kind==='hats'?7000:1800;env(kind==='hats'?.25:.6,kind==='hats'?.05:.18);s.connect(fl);fl.connect(g);s.start(at);s.stop(at+.3)}
- else{const o=ac.createOscillator();o.type=kind==='bass'?'sawtooth':'triangle';o.frequency.value=f;env(kind==='bass'?.3:.2,len);o.connect(g);o.start(at);o.stop(at+len+.05)}
- }
- // Every note whose time falls in the next tenth of a second of the tune is handed to the browser, at the time it should sound;
- // clock is the tune's time counted on, past the end of the loop
- function schedule(){
- const rate=slowTog.checked?1/3:1,{ctx:ac}=audio,from=audio.upTo,to=clock+.1;
- if(to<=from)return;
- const each=(b,fn)=>{const s0=b*BEAT;for(let o=s0+Math.floor((from-s0)/LOOP)*LOOP;o<to;o+=LOOP)if(o>=from)fn(Math.max(ac.currentTime,ac.currentTime+(o-clock)/rate))};
- for(const [list,kind] of [[KICK,'kick'],[SNARE,'snare'],[HATS,'hats']])for(const b of list)each(b,at=>play(kind,at,0,0));
- for(const [list,kind] of [[BASS,'bass'],[MELODY,'melody']])for(const [b,l,f] of list)each(b,at=>play(kind,at,f,l*BEAT/rate*.9));
- audio.upTo=to;
- }
- hear.addEventListener('click',()=>{
- if(audio){audio.ctx.close();audio=null;hear.setAttribute('aria-pressed','false');if(paused)draw();return}
- if(paused)pauseBtn.click(); // the sound follows the loop, so Hear it pressed while paused plays both
- startAudio();hear.setAttribute('aria-pressed','true');
- });
- // Registered at the top level: under reduced motion the shared script pauses the loop at once, on a kick
- document.addEventListener('hb:pause',e=>{
- paused=e.detail.paused;notes();
- if(audio)paused?audio.ctx.suspend():audio.ctx.resume();
- if(paused){cancelAnimationFrame(raf);raf=0;if(rows)draw()}else start();
- });
- document.addEventListener('visibilitychange',()=>{lastT=null;if(audio)document.hidden?audio.ctx.suspend():paused||audio.ctx.resume()});
- // The mode switch draws the mode at once, playing or paused
- document.addEventListener('hb:mode',e=>{mode=e.detail.mode;cvs.setAttribute('aria-label',LABELS[mode]);notes();place();if(rows)draw()});
- // See inside's beat strip sits under the key, which wraps onto more lines in a narrow box
- function place(){insideTop=stage.querySelector('.key').offsetHeight+20;stage.style.setProperty('--beat-y',insideTop+2+'px')}
- // The notes follow the settings and the loop: with Wave both rows of Compare match and See inside shows the parts of the wave;
- // Circle runs from the bass at the top round to the hi-hats; "Shown still" only while the loop is paused under reduced motion
- const said={inside:document.querySelector('[data-hb-for="inside"]').textContent};
- function notes(){
- const still=reduceMQ.matches&&paused,ins=document.querySelector('[data-hb-for="inside"]'),cmp=document.querySelector('[data-hb-for="compare"]');
- const where=style==='circle'?'kick and bass at the top, round to the hi-hats':'kick and bass on the left, hi-hats on the right';
- ins.textContent=style==='wave'?'Inside, each colored line is one part of the tune, and the white line is all of them added together: the shape a speaker moves to.'
- :still?`Shown still: each bar is split by the parts of the tune filling it, ${where}. The top strip marks the beat.`
- :style==='circle'?`Inside, each bar is split by the parts of the tune filling it, ${where}. The top strip marks the beat: each kick lifts the low bars.`:said.inside;
- cmp.textContent=style==='wave'?'Style is set to Wave, which draws the sound\'s shape, not its pitches, so Equal slices and Wider for treble match. Pick Bars or Circle in Try it to see the difference.'
- :(still?'Shown still: Equal slices crowds the bass into a few bars, while Wider for treble spreads the tune across the whole row.'
- :'Equal slices gives every bar the same share of pitches, so the bass crowds into a few bars. Wider for treble widens the slices as pitches rise, as we hear, so the whole row dances.');
- }
- function resize(){
- const w=stage.clientWidth,h=stage.clientHeight;if(!w||!h||(w===W&&h===H))return;W=w;H=h;
- const dpr=Math.min(devicePixelRatio||1,1.5);cvs.width=W*dpr;cvs.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0);
- if(!rows)build();
- place();draw();
- }
- // A setting shows at once, playing or paused
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);notes();if(rows)draw();
- }));
- }
- choices('style-seg',d=>{style=d.style;stage.classList.toggle('st-bars',style==='bars')});
- choices('bars-seg',d=>{count=+d.n;build()});
- choices('fall-seg',d=>{fall=+d.fall});
- choices('colors-seg',d=>{pal=d.pal});
- peakTog.addEventListener('change',()=>{if(rows)draw()});
- notes();
- new ResizeObserver(resize).observe(stage);
- resize();
- start();
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/06-3d-advanced/audio-visualizer/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/06-3d-advanced/audio-visualizer/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/06-3d-advanced/audio-visualizer/README.md`**
-
-````markdown
-# Audio Visualizer
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/audio-visualizer/)
-
-## What it is
-An audio visualizer turns sound into moving shapes: a row of bars from bass on the left to treble on the right, each as tall as its band of pitches is loud right now. The bars jump up when a sound starts and sink back as it fades, so a kick drum makes the low bars leap and the hi-hats flicker at the top. The same loudness can be drawn as bars, as a ring of bars around a circle, or as the wave the sound itself makes.
-
-## When to use it
-- Music players, from a site's own player to a band's page
-- Podcast and audiobook cards, to show that something is playing
-- Radio, DJ and event sites, as a lively header
-- Voice notes and recorders, as a sign that sound is coming in
-
-## How it works
-In a real player the page connects the playing audio to the Web Audio API's `AnalyserNode`, which reports many times a second how loud each slice of pitches is (`getByteFrequencyData`) or the shape of the sound (`getByteTimeDomainData`):
-
-```js
-const ctx = new AudioContext(), source = ctx.createMediaElementSource(audioElement), analyser = ctx.createAnalyser();
-analyser.fftSize = 2048;
-source.connect(analyser); analyser.connect(ctx.destination);
-const freq = new Uint8Array(analyser.frequencyBinCount);
-analyser.getByteFrequencyData(freq); // 0 to 255 for each slice of about 23 Hz
-```
-
-The analyzer's slices are all the same width in hertz, but hearing works in octaves: 40 to 80 Hz is as wide a step for the ear as 4,000 to 8,000 Hz. So the bars group the slices by octave, from 40 Hz to 16 kHz, each band wider than the one before, and each bar shows the average of its slices. With equal slices instead (the demo's Compare), the bass and the tune crowd into the first few bars and the rest only flicker.
-
-```js
-const edges = [...Array(n + 1)].map((_, i) => 40 * Math.pow(400, i / n)); // 40 Hz × 400 = 16 kHz
-```
-
-Each frame a bar jumps straight to a louder value and otherwise sinks by How bars fall, measured in bar heights a second, so it falls at the same speed on every screen; a peak mark holds the highest point for 0.4 seconds, then sinks slowly. The palette's two colors are drawn once into a strip one pixel wide, and each bar copies the part of the strip it reaches with `drawImage`, which costs far less than filling every bar with a gradient each frame.
-
-The demo plays no file and uses no microphone. Its tune is written in the page as notes (kick, snare, hi-hats, bass and a short melody, four bars at 100 beats a minute), and every frame the page works out how loud each band would be from the notes playing at that moment, so the bars move in silence, offline and on a muted phone. Hear it plays the same notes through the browser's own oscillators and a burst of generated noise, scheduled a tenth of a second ahead on the audio clock; only then do the bars read a real analyzer. The sound is made on that press and never before (browsers block sound that starts by itself); Pause and a hidden tab suspend it, and Slow motion plays the tune at a third of the tempo.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Style | Bars | Bars stand in a row from bass to treble; wave draws the sound's shape over a few hundredths of a second instead of its pitches; circle sets the bars around a ring that swells with the bass |
-| Number of bars | Many | Few is 16 bars, some 32 and many 64; phones start at some, and each row of Compare holds half as many bars on phones |
-| How bars fall | Gently | How fast a bar sinks after it jumps: quickly is 2.6 bar heights a second, gently 1.2 and slowly 0.45, like an old stereo |
-| Peak marks | on | A thin mark holds each bar's highest point for 0.4 seconds, then sinks slowly; off, only the bars show |
-| Colors | Sunset | The colors from the bottom of each bar to its top: sunset runs from coral to gold, ocean from deep blue to cyan, neon from pink to cyan |
-
-## Production notes
-- **Ask before sound.** Create the `AudioContext` inside the visitor's own press of play: browsers keep a context made earlier suspended and warn in the console. Never open the microphone without a clear reason and the visitor's yes.
-- **Group by octave.** Average the analyzer's slices into bands that widen with pitch, or most bars show only hiss. `smoothingTimeConstant` (0 to 1) smooths the analyzer's own values; the jump-and-fall of the bars is better done in your own code, by time.
-- **Light drawing.** One canvas and a few dozen copied rectangles a frame are cheap; a gradient filled over every bar each frame is not. Draw fewer bars on phones and stop the loop when the player is paused or out of view.
-- **Cross-origin audio.** An `<audio>` element playing a file from another site needs `crossorigin="anonymous"` and the right CORS headers, or the analyzer reads only zeros.
-- **Reduced motion.** Keep the bars still until the visitor presses play, and let them turn the movement off while the music plays.
-- **Libraries.** Wavesurfer.js draws waveforms and plays files; Tone.js schedules notes and synths on the Web Audio clock; audioMotion-analyzer is a ready-made bar analyzer with octave bands and peaks.
-
-## See also
-- [Starfield / Space Particles](../../07-ambient-background/starfield/) — a loop drawn by JavaScript every frame
-- [Abstract Geometric Motion](../../07-ambient-background/abstract-geometric-motion/) — a pattern for music players that ignores the sound
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: 07 Ambient & Background ── */` (the end of the 06 bespoke block):
-
-```css
-.pv-audioviz{background:radial-gradient(80% 70% at 50% 100%,#1a1430,#08080c 70%);display:flex;align-items:flex-end;justify-content:center;gap:2.2%;padding:0 9% 12%;overflow:hidden}
-.pv-audioviz i{flex:1;height:68%;border-radius:2px 2px 0 0;background:linear-gradient(0deg,#ff5f6d,#ffc371);transform-origin:50% 100%;transform:scaleY(.15);
- animation:audioviz-bar .6s cubic-bezier(.2,.6,.4,1) infinite}
-@keyframes audioviz-bar{0%{transform:scaleY(var(--hi,.9))}100%{transform:scaleY(.12)}}
-```
-
-(b) insert this line right after the line that starts with `case 'izoom':`:
-
-```js
- case 'audioviz': return [[.95,.6,0],[.9,.6,0],[.82,.6,0],[.7,.6,0],[.55,.45,-.1],[.62,.9,-.3],[.5,.3,-.05],[.58,1.2,-.4],[.45,.45,-.2],[.4,.3,-.15],[.5,.6,-.3],[.35,.3,0]].map(([h,d,o])=>'<i class="anim" style="--hi:'+h+';animation-duration:'+d+'s;animation-delay:'+o+'s"></i>').join('');
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-grep -c "pv-audioviz" index.html; grep -c "case 'audioviz':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: Prove the phone default test for Task 11, then put the test file back**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-sed -i "s/const PHONE_DEFAULTS = { /const PHONE_DEFAULTS = { 'audio-visualizer': ['bars-seg', 'Some'], /" tests/pages.test.js
-grep -c "'audio-visualizer'" tests/pages.test.js
-node --test tests/pages.test.js 2>&1 | grep -E "data-hb-phone|^ℹ (pass|fail)"
-git checkout -- tests/pages.test.js && git status --short tests/
-```
-
-Expected: `1` (the entry is in), then `✔ a setting that starts lower on phones marks that choice data-hb-phone, and the page script starts there from the mark` and `ℹ fail 0`, then nothing (the file is back as it was). If the grep prints `0`, the list's last entry changed since this plan: add `'audio-visualizer': ['bars-seg', 'Some']` in `PHONE_DEFAULTS` by hand, run, and put the file back the same way.
-
-- [ ] **Step 7: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8967: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8967/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L7 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-node $RUN/slot.mjs run ten-L7 -- node tools/check-pages.mjs --base http://127.0.0.1:8967 --out $TEN/checks/L7/1 animations/06-3d-advanced/audio-visualizer home > $TEN/checks/L7/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L7/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-node $RUN/slot.mjs run ten-L7 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8967 --short --out $TEN/checks/L7/short-1 animations/06-3d-advanced/audio-visualizer > $TEN/checks/L7/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L7/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L7/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L7/1.log; grep '^FAIL' $TEN/checks/L7/1.log; tail -2 $TEN/checks/L7/short-1.log`.
-
-Expected: `12` (six `ok` lines each for `audio-visualizer`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 8: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`) and for each choice of the settings that change only timing or show only while the demo moves (G1, G11): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-i=0; for sel in "" "#style-seg [data-style='wave']" "#style-seg [data-style='circle']" "#bars-seg [data-n='16']" "#bars-seg [data-n='32']" "#bars-seg [data-n='64']" "#fall-seg [data-fall='2.6']" "#fall-seg [data-fall='0.45']" "#colors-seg [data-pal='ocean']" "#colors-seg [data-pal='neon']" "#peak-tog"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L7 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8967 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L7/press-$i animations/06-3d-advanced/audio-visualizer || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L7/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L7/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-i=0; for sel in "" "#fall-seg [data-fall='2.6']" "#fall-seg [data-fall='0.45']"; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L7 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8967 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L7/clip-$i animations/06-3d-advanced/audio-visualizer || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L7/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L7/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 11 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 3 `== clip-…` lines, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders; for a timing choice, the same frames beside `clip-0`'s): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L7/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 9: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L7/<round>/06-audio-visualizer-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- The page is silent until Hear it is pressed: no sound and no console warning before; the browser makes no AudioContext until the press. Hear it then plays the beat and the bars follow the analyser; it is a toggle that keeps its name, pressed while the sound plays.
-- Pause stops the bars and the sound at once; Play brings both back; a hidden tab suspends the sound; Slow motion plays the tune at a third of the tempo; Hear it pressed while paused presses Play first.
-- Number of bars starts at Many on larger screens and Some on phones (the choice marked `data-hb-phone`), and every choice draws its own number at every size (each row of Compare holds half of it on phones); every setting changes Normal and both views.
-- See inside's Bass · Middle · Treble scale shows only with Bars; with Circle the inside note says kick and bass at the top, round to the hi-hats; the step numbers, chips, pressed buttons and Hear it use 06's accent, `#3fd6c4`.
-- Under reduced motion the loop starts paused and every view is a still from the paused state; the notes say "Shown still" only while it is paused, and after Play they describe what moves (lesson 16).
-
-Decisions already made in this page (keep them; a reviewer weighs them): Hear it pressed while paused presses Play first: the sound follows Pause. The legend has five parts (Snare added beside Kick, Bass, Melody and Hi-hats). The bars are copied from a one-pixel gradient strip and See inside draws one path per color, so the frames stay near 16.7 ms.
-
-- [ ] **Step 10: Frame times (required: a canvas or mask page)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-(node $RUN/slot.mjs run ten-L7 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8967 --modes normal,inside,compare animations/06-3d-advanced/audio-visualizer; node $RUN/slot.mjs run ten-L7 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8967 --phone --modes normal,inside,compare animations/06-3d-advanced/audio-visualizer; node $RUN/slot.mjs run ten-L7 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8967 animations/07-ambient-background/starfield; node $RUN/slot.mjs run ten-L7 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8967 --phone animations/07-ambient-background/starfield) > $TEN/checks/L7/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L7/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes, and no larger share of frames slower than 20 ms than Starfield / Space Particles measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: desktop 1 to 4 / 0 to 4 / 3 to 10%, phone 0 / 0 / 0%; Starfield / Space Particles 1% on a desktop and 16% on a phone. A page that misses lightens its per-frame work (a smaller grid, fewer dots, less drawn per frame) until it meets this, and says what it changed.
-
-- [ ] **Step 11: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L7 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L7 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 06.28 Audio Visualizer, with See inside and Compare from the start (lane 7)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/06-3d-advanced/audio-visualizer/README.md`, `A animations/06-3d-advanced/audio-visualizer/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/06-3d-advanced/README.md`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L7/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 12: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L7`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at nothing of Web Audio before the press; Pause and the hidden tab suspend the sound; the phone default read from `#bars-seg [data-hb-phone]`. It writes `$TEN/reports/L7/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 7 again (and the galleries, clips or frame times a fix touches), commits `fix: Audio Visualizer: <what>` after the branch check, writes `$TEN/reports/L7/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L7 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L7/`.
-
----
-
-### Task 8: L8 · 07.24 Ken Burns Effect (`ten/L8`, port 8968)
-
-Loop · step 1 "Watch it" · player bar: Pause (`data-hb-pause="css"`) and Slow motion (`data-hb-slowmo="css"`). See inside: the whole photo still, with the visible frame gliding from its dashed start frame to its dashed end frame. Compare: "Still photos" (a plain fading slideshow) beside "Zoom and pan". Spec: "8 · Ken Burns Effect (07.24)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/07-ambient-background/ken-burns/index.html` (323 lines), `animations/07-ambient-background/ken-burns/README.md`
-- Modify (by `$TEN/lanes.mjs 8`): `index.html` (the card after Game of Life's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 07's count 23 → 24, the catalog line), `animations/07-ambient-background/README.md` (its line and its Implementation summary row), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`, `animations/07-ambient-background/game-of-life/index.html` (its first Next link, to Ken Burns Effect)
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 07 bespoke block, `case 'kenburns':` in `pvMarkup()`
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js`; the page check of the new page, of Game of Life and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults and of the timing settings' choices
-- Write (run folder): `$TEN/checks/L8/` (logs, screenshots, kit output), `$TEN/reports/L8/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L8` on `ten/L8`, its server on port 8968 (started and stopped by the coordinator), `$TEN/lanes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses nothing on a loop after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L8`: the card `['ken-burns','Ken Burns Effect','Photos slowly zoom and pan, then fade into the next. Best for hero slideshows.']` (07.24), `PV` key `'ken-burns':'kenburns'`, `PLACES` `['imgcard','bg','intro']`, `FIND` `'ken-burns':['card background','loop load','grow slide fade']`; Previous: Game of Life (final), and Game of Life's Next link to Ken Burns Effect; no Next link yet. The reports in `$TEN/reports/L8/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-node $TEN/lanes.mjs 8 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 8 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/07-ambient-background/README.md`, ` M animations/07-ambient-background/game-of-life/index.html`, ` M index.html`; then these 7 failing tests and `ℹ fail 7`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ 07-ambient-background/game-of-life uses the guided-steps page correctly`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, and Game of Life's new Next link opens a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/07-ambient-background/ken-burns/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Ken Burns Effect — Animation Handbook</title>
- <meta name="description" content="Photos slowly zoom and pan, then fade into the next. Best for hero slideshows.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/ken-burns/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Ken Burns Effect — Animation Handbook">
- <meta property="og:description" content="Photos slowly zoom and pan, then fade into the next. Best for hero slideshows.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/ken-burns/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Ken Burns Effect — Animation Handbook">
- <meta name="twitter:description" content="Photos slowly zoom and pan, then fade into the next. Best for hero slideshows.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Ken Burns Effect", "name": "Ken Burns Effect", "description": "Photos slowly zoom and pan, then fade into the next. Best for hero slideshows.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/ken-burns/", "inLanguage": "en", "articleSection": "Ambient & Background", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Ambient & Background, Ken Burns Effect"}</script>
- <style>
- :root{--ui-accent:#ffce5a}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- /* --T: the time on each photo; --Z: the strongest zoom, the size each photo is drawn at so it is only ever scaled down */
- .stage{position:relative;overflow:hidden;background:#07080b;--T:7s;--Z:1.5}
- /* A reel of three slides. Each slide runs one timeline of three photos' length: it fades in over the one before (on top,
- z-index 2) for a seventh of its time, shows, lets the next fade in over it (z-index 1) and is hidden until its turn.
- Its photo moves from --from to --to over the whole time it shows, so the motion never stops. */
- .reel{position:absolute;inset:0;overflow:hidden;isolation:isolate}
- .slide{position:absolute;inset:0;opacity:0;animation:kb-fade calc(var(--T)*3) linear infinite;animation-delay:var(--d)}
- .s1{--d:calc(var(--T)*-.15)}.s2{--d:calc(var(--T)*.85)}.s3{--d:calc(var(--T)*1.85)}
- .photo{position:absolute;left:0;top:0;width:calc(100%*var(--Z));height:calc(100%*var(--Z));transform-origin:0 0;
- animation:kb-move calc(var(--T)*3) linear infinite;animation-delay:var(--d)}
- .photo svg,.fit svg{display:block;width:100%;height:100%}
- @keyframes kb-fade{0%{opacity:0;z-index:2}4.76%{opacity:1}33.33%{z-index:2}33.34%{z-index:1}38.1%{opacity:1}38.11%,100%{opacity:0;z-index:1}}
- @keyframes kb-move{0%{transform:var(--from)}38.1%,100%{transform:var(--to)}}
- .cap{display:none;position:absolute;left:14px;bottom:12px;padding:6px 12px;border-radius:8px;background:rgba(7,8,11,.62);
- color:#fff;font:600 clamp(13px,1.6vw,16px)/1.3 var(--hb-font)}
- .stage.caps .cap{display:block}
- /* See inside and Compare. Labels are plain words on a dark backing. */
- .fit,.in-part,.half{display:none}
- .kb-lbl{position:absolute;z-index:3;padding:3px 8px;border-radius:6px;background:rgba(7,8,11,.9);color:#f4f4f2;
- font:600 13px/1.25 var(--hb-font);white-space:nowrap;pointer-events:none}
- /* See inside: the whole photo held still and dimmed, and over it the frame the visitor sees, gliding from the dashed start
- frame to the dashed end frame along the arrow. The frame's timeline is the photo's turned inside out, from the same
- numbers (--ffrom, --fto). The moving parts stay rendered in every mode (hidden, not removed), so they keep time. */
- .stage[data-hb-mode="inside"] .photo{visibility:hidden}
- .stage[data-hb-mode="inside"] .fit{display:block;position:absolute;inset:0}
- .in-part{display:block;visibility:hidden;position:absolute;left:0;top:0;width:100%;height:100%;transform-origin:0 0;pointer-events:none}
- .stage[data-hb-mode="inside"] .in-part{visibility:visible}
- .frame{outline:3px solid #fff;box-shadow:0 0 0 3000px rgba(5,6,9,.6);animation:kb-frame calc(var(--T)*3) linear infinite;animation-delay:var(--d)}
- .fs,.fe{outline:2px dashed rgba(255,255,255,.9);outline-offset:-1px}
- .fs{transform:var(--ffrom)}.fe{transform:var(--fto)}
- .fl{animation:kb-fl calc(var(--T)*3) linear infinite;animation-delay:var(--d)}
- .fl .tags{position:absolute;inset:0}
- .fl .kb-lbl{left:0;top:14px;transform:translateX(-50%)}
- .tags{animation:kb-tags calc(var(--T)*3) linear infinite;animation-delay:var(--d)}
- .le{transform:translateX(-100%)}
- .arrow{overflow:visible}
- .arrow path{fill:none;stroke:var(--ui-accent);stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
- @keyframes kb-frame{0%{transform:var(--ffrom)}38.1%,100%{transform:var(--fto)}}
- @keyframes kb-fl{0%{transform:var(--lfrom)}38.1%,100%{transform:var(--lto)}}
- /* A slide's labels show only while it is the photo on top, never while the next fades in over it */
- @keyframes kb-tags{0%,4.76%{opacity:0}4.77%,38.1%{opacity:1}38.11%,100%{opacity:0}}
- /* Compare: on the left a copy whose photos never move, only fade; on the right the reel itself. The copy stays rendered,
- unseen, in the other modes, so its fades keep time with the reel's. */
- .copy{visibility:hidden}
- .copy .photo{animation:none;transform:var(--from)}
- .stage[data-hb-mode="compare"] .copy{visibility:visible;right:50%;border-right:2px solid #07080b}
- .stage[data-hb-mode="compare"] .reel:not(.copy){left:50%}
- .stage[data-hb-mode="compare"] .half{display:block}
- .half{top:10px}.half.first{left:10px}.half.second{left:calc(50% + 10px)}
- @media(max-width:360px){
- .stage[data-hb-mode="compare"] .copy{right:0;bottom:50%;border-right:0;border-bottom:2px solid #07080b}
- .stage[data-hb-mode="compare"] .reel:not(.copy){left:0;top:50%}
- .half.second{left:10px;top:calc(50% + 10px)}
- }
- /* Under reduced motion each photo holds the end of its move and the photos only fade; the frame waits at the end too. The
- loop starts paused with the first photo shown a second and a half before the next fades in, so Play soon shows a fade. */
- @media(prefers-reduced-motion:reduce){
- .s1{--d:calc(var(--T)*-1 + 1.5s)}.s2{--d:1.5s}.s3{--d:calc(var(--T) + 1.5s)}
- .photo{animation:none;transform:var(--to)}
- .frame{animation:none;transform:var(--fto)}
- .fl{animation:none;transform:var(--lto)}
- }
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="loop">
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../game-of-life/" rel="prev" aria-label="Previous: Game of Life"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Game of Life</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">07.24 · Ambient &amp; Background</p>
- <h1>Ken Burns Effect</h1>
- <p class="hb-lede">Photos slowly zoom and pan, then fade into the next. Best for hero slideshows.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Watch it</h2><p>It moves by itself. Pause it, or turn on slow motion to follow each drift.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage" id="stage" role="img" aria-label="Three drawn photos, each slowly zooming and drifting, then fading into the next"></div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-pause" data-hb-pause="css" data-state="playing"><svg class="hb-ic hb-i-pause" viewBox="0 0 24 24" aria-hidden="true"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg><svg class="hb-ic hb-i-play" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3l14 9-14 9z"/></svg><span class="hb-pause-label">Pause</span></button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo="css" autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, the whole photo stays still and the bright frame is what the visitor sees: it glides from the dashed start frame to the dashed end frame, then the next photo fades in.</p>
- <p data-hb-for="compare" hidden>Still photos only fade from one to the next, like a plain slideshow. Zoom and pan drifts and zooms each photo as it fades, so still pictures feel alive.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and see the difference as it moves.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="zoom-lbl">Which way it zooms</p>
- <div class="seg" id="zoom-seg" role="group" aria-labelledby="zoom-lbl">
- <button type="button" data-zoom="in" aria-pressed="false">In</button>
- <button type="button" data-zoom="out" aria-pressed="false">Out</button>
- <button type="button" data-zoom="both" class="on" aria-pressed="true">Both</button>
- </div>
- <p class="hb-hint">Both changes direction from photo to photo.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="move-lbl">How much it moves</p>
- <div class="seg" id="move-seg" role="group" aria-labelledby="move-lbl">
- <button type="button" data-move="subtle" aria-pressed="false">Subtle</button>
- <button type="button" data-move="medium" class="on" aria-pressed="true">Medium</button>
- <button type="button" data-move="strong" aria-pressed="false">Strong</button>
- </div>
- <p class="hb-hint">Subtle feels calm; strong feels like film.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="time-lbl">Time on each photo</p>
- <div class="seg" id="time-seg" role="group" aria-labelledby="time-lbl">
- <button type="button" data-time="5" aria-pressed="false">Short</button>
- <button type="button" data-time="7" class="on" aria-pressed="true">Medium</button>
- <button type="button" data-time="10" aria-pressed="false">Long</button>
- </div>
- <p class="hb-hint">Longer is calmer.</p>
- </div>
- </div>
- <details class="hb-options">
- <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
- <div class="hb-settings">
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Shows a caption</span><input class="hb-switch" type="checkbox" role="switch" id="cap-tog" autocomplete="off"></label>
- <p class="hb-hint">The caption stays still while the photo moves.</p>
- </div>
- </div>
- </details>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add a Ken Burns effect to [your hero photo or slideshow]. Slowly zoom and pan each photo, the way a documentary camera moves over a still print, and crossfade to the next photo before its move ends, so the motion never stops. Give each photo its own start and end framing that drifts toward a point of interest, at an even, unhurried pace. Keep the photo larger than its frame at every moment so no edge ever shows, move it with transforms only, and keep any text on top still and readable. If the visitor has reduced motion turned on, show each photo still and change photos with a slow fade. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Hero photos</li><li>Slideshows</li><li>Travel and property sites</li><li>Story pages</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Product photos people inspect</li><li>Pictures of text</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const stage=document.getElementById('stage');
- const ZMAX=1.5; // the strongest zoom: each photo is drawn this much larger than the box and only ever scaled down from there
- // Three drawn photos (1600 by 1000, cropped to fill the box), each with where its move starts and its point of interest, as
- // shares of the photo's width and height. id keeps the gradients of each copy apart.
- const PHOTOS=[
- {name:'Ashfall Ridge at dawn',start:[.38,.62],poi:[.69,.48],svg:id=>`<defs><linearGradient id="a${id}" x2="0" y2="1"><stop offset="0" stop-color="#1b2a4a"/><stop offset=".45" stop-color="#8a5a86"/><stop offset=".62" stop-color="#f29a62"/><stop offset=".7" stop-color="#ffd38a"/></linearGradient><linearGradient id="b${id}" x2="0" y2="1"><stop offset="0" stop-color="#f3a46c"/><stop offset="1" stop-color="#2b2b44"/></linearGradient></defs>
- <rect width="1600" height="760" fill="url(#a${id})"/><circle cx="1100" cy="505" r="190" fill="#ffe6a8" opacity=".25"/><circle cx="1100" cy="505" r="74" fill="#fff4cf"/>
- <path fill="#8f7397" d="M0 640L180 520 330 590 520 450 700 560 860 470 1010 560 1200 430 1380 540 1600 470V760H0Z"/>
- <path fill="#4c4466" d="M0 700L240 600 420 660 640 560 820 650 1040 590 1260 660 1440 600 1600 640V780H0Z"/>
- <rect y="760" width="1600" height="240" fill="url(#b${id})"/><g fill="#ffe2a6" opacity=".75"><rect x="1010" y="790" width="180" height="6" rx="3"/><rect x="1040" y="820" width="120" height="5" rx="2.5"/><rect x="1068" y="848" width="64" height="4" rx="2"/></g>
- <path fill="#23233a" d="M0 780H1600V830Q1200 800 900 840T0 820Z"/><path fill="#1b1b2e" d="M120 790l26-90 26 90zM190 790l20-66 20 66zM1380 790l24-80 24 80zM1440 790l18-58 18 58z"/>`},
- {name:'Lantern Cove at dusk',start:[.34,.58],poi:[.76,.44],svg:id=>`<defs><linearGradient id="a${id}" x2="0" y2="1"><stop offset="0" stop-color="#271b48"/><stop offset=".5" stop-color="#b5527a"/><stop offset=".72" stop-color="#f7a55b"/></linearGradient><linearGradient id="b${id}" x2="0" y2="1"><stop offset="0" stop-color="#3b4b7a"/><stop offset="1" stop-color="#101a33"/></linearGradient></defs>
- <rect width="1600" height="720" fill="url(#a${id})"/><rect y="700" width="1600" height="300" fill="url(#b${id})"/>
- <path fill="#2a2440" d="M1060 760Q1140 640 1280 650T1500 760Z"/><path fill="#f1ece4" d="M1196 660L1214 420H1262L1280 660Z"/><path fill="#c8463f" d="M1206 590H1272L1268 540H1210ZM1213 490H1264L1262 455H1215Z"/>
- <rect x="1206" y="392" width="64" height="30" fill="#2a2440"/><circle cx="1238" cy="400" r="18" fill="#ffe7a0"/><circle cx="1238" cy="400" r="70" fill="#ffd27a" opacity=".22"/>
- <path fill="#1d1830" d="M0 600H90V560L130 530 170 560V600H230V540H330V610H420V580L470 550 520 580V700H0Z"/>
- <g fill="#ffd27a"><rect x="40" y="620" width="14" height="18"/><rect x="150" y="575" width="12" height="16"/><rect x="270" y="560" width="14" height="18"/><rect x="460" y="600" width="12" height="16"/></g>
- <path fill="#1d1830" d="M560 760H700L680 785H580ZM620 760V690L660 752Z"/><path fill="#ffd9a0" opacity=".55" d="M1180 720h120v6h-120zM1200 750h80v5h-80zM1218 780h44v4h-44z"/>`},
- {name:'Quellmarrow Road under the stars',start:[.56,.66],poi:[.5,.4],svg:id=>{let st='';for(let i=0;i<70;i++){const x=(i*397)%1600,y=(i*173)%560,r=(i%5?1.6:2.8);st+=`<circle cx="${x}" cy="${y}" r="${r}"/>`}
- return `<defs><linearGradient id="a${id}" x2="0" y2="1"><stop offset="0" stop-color="#050914"/><stop offset=".6" stop-color="#16285a"/><stop offset="1" stop-color="#4a3468"/></linearGradient></defs>
- <rect width="1600" height="640" fill="url(#a${id})"/><g fill="#f6f2ff" opacity=".85">${st}</g><circle cx="1220" cy="190" r="48" fill="#fff6d8"/><circle cx="1244" cy="176" r="44" fill="#0a1124"/>
- <path fill="#3a2a4a" d="M0 640L120 560H300L340 600H560L600 580H760L800 640Z"/><path fill="#30223e" d="M980 640L1040 540H1240L1290 600H1420L1470 560H1600V640Z"/>
- <rect y="630" width="1600" height="370" fill="#241a2c"/><path fill="#14101a" d="M520 1000L792 632H808L1080 1000Z"/>
- <path fill="#ffd27a" d="M798 650h4l3 30h-10zM795 720h10l5 60h-20zM790 840h20l8 100h-36z"/>`}}
- ];
- // How far each photo zooms (its zoom at the start and the end of a zoom in) and how far it drifts toward its point of interest
- const MOVES={subtle:{z:[1.04,1.16],k:.45},medium:{z:[1.06,1.3],k:.75},strong:{z:[1.08,1.5],k:1}};
- let zoom='both',move='medium';
- const LABELS={normal:'Three drawn photos, each slowly zooming and drifting, then fading into the next',
- inside:'The whole photo held still, with a bright frame gliding from where the view starts to where it ends',
- compare:'Two slideshows of the same photos: still photos that only fade, and photos that zoom and drift'};
- // Both reels are made in one go, so their timelines start together: the reel, with the frame, dashed frames, arrow and labels of
- // See inside in each slide, and Compare's copy, whose photos never move (no ids of its own, out of reach of the keyboard).
- const slideOf=(k,id,inside)=>`<div class="slide s${k+1}"><div class="photo"><svg viewBox="0 0 1600 1000" preserveAspectRatio="xMidYMid slice">${PHOTOS[k].svg(id)}</svg></div>`+
- `<p class="cap">${PHOTOS[k].name}</p>`+(inside?`<div class="fit"><svg viewBox="0 0 1600 1000" preserveAspectRatio="xMidYMid slice">${PHOTOS[k].svg('f'+id)}</svg></div>`+
- `<i class="in-part fs"></i><i class="in-part fe"></i><svg class="in-part arrow"><path/></svg><i class="in-part frame"></i>`+
- `<div class="in-part tags"><span class="kb-lbl ls" data-hb-caption>Start</span><span class="kb-lbl le" data-hb-caption>End</span></div>`+
- `<div class="in-part fl"><div class="tags"><span class="kb-lbl" data-hb-caption>Frame · what the visitor sees</span></div></div>`:'')+`</div>`;
- stage.innerHTML=`<div class="reel copy" inert aria-hidden="true">${PHOTOS.map((_,k)=>slideOf(k,'c'+k,false)).join('')}</div>`+
- `<div class="reel">${PHOTOS.map((_,k)=>slideOf(k,k,true)).join('')}</div>`+
- `<p class="kb-lbl half first" data-hb-caption>Still photos</p><p class="kb-lbl half second" data-hb-caption>Zoom and pan</p>`;
- const slides=[...stage.querySelectorAll('.reel:not(.copy) .slide')],copies=[...stage.querySelectorAll('.copy .slide')];
- // A framing: the zoom z and the point (x, y) of the photo at the middle of the box, kept far enough from the photo's edges that
- // the photo covers the box. The photo's transform shows that framing; the frame's is the same framing turned inside out: the
- // part of the whole photo that the box shows. Both are straight lines between two framings, so every moment between two that
- // cover the box covers it too.
- const fit=(z,[x,y])=>{const h=.5/z;return{z,x:Math.min(1-h,Math.max(h,x)),y:Math.min(1-h,Math.max(h,y))}};
- const pct=v=>(v*100).toFixed(3)+'%';
- const photoT=f=>`translate(${pct((.5-f.x*f.z)/ZMAX)},${pct((.5-f.y*f.z)/ZMAX)}) scale(${(f.z/ZMAX).toFixed(4)})`;
- const frameT=f=>`translate(${pct(f.x-.5/f.z)},${pct(f.y-.5/f.z)}) scale(${(1/f.z).toFixed(4)})`;
- const centerT=f=>`translate(${pct(f.x)},${pct(f.y)})`;
- // Each photo zooms in (or out, or every other one with Both) and drifts from its start toward its point of interest; zooming out
- // starts close on that point and pulls back
- function framings(k){
- const m=MOVES[move],p=PHOTOS[k],into=zoom==='in'||(zoom==='both'&&k!==1);
- const near=[p.start[0]+(p.poi[0]-p.start[0])*m.k,p.start[1]+(p.poi[1]-p.start[1])*m.k];
- return into?[fit(m.z[0],p.start),fit(m.z[1],near)]:[fit(m.z[1],near),fit(m.z[0],p.start)];
- }
- function apply(){
- slides.forEach((el,k)=>{
- const [a,b]=framings(k);
- for(const s of [el,copies[k]]){s.style.setProperty('--from',photoT(a));s.style.setProperty('--to',photoT(b))}
- el.style.setProperty('--ffrom',frameT(a));el.style.setProperty('--fto',frameT(b));
- el.style.setProperty('--lfrom',centerT(a));el.style.setProperty('--lto',centerT(b));
- // Start sits inside the start frame's top left corner and End inside the end frame's top right one; the moving frame's own
- // label rides just below its middle, so none of them meets another or the caption (the box's lower left corner)
- const ls=el.querySelector('.ls'),le=el.querySelector('.le');
- ls.style.left=`calc(${pct(a.x-.5/a.z)} + 8px)`;ls.style.top=`calc(${pct(a.y-.5/a.z)} + 8px)`;
- le.style.left=`calc(${pct(b.x+.5/b.z)} - 8px)`;le.style.top=`calc(${pct(b.y-.5/b.z)} + 8px)`;
- el.ab=[a,b];
- });
- drawArrows();
- }
- // The arrow from the middle of the start frame to the middle of the end frame, drawn in the box's own pixels
- function drawArrows(){
- const W=stage.clientWidth,H=stage.clientHeight;
- slides.forEach(el=>{
- const [a,b]=el.ab,svg=el.querySelector('.arrow'),x1=a.x*W,y1=a.y*H,x2=b.x*W,y2=b.y*H,ang=Math.atan2(y2-y1,x2-x1),h=10;
- svg.setAttribute('viewBox',`0 0 ${W} ${H}`);
- svg.firstChild.setAttribute('d',Math.hypot(x2-x1,y2-y1)<4?'':`M${x1} ${y1}L${x2} ${y2}M${x2-h*Math.cos(ang-.5)} ${y2-h*Math.sin(ang-.5)}L${x2} ${y2}L${x2-h*Math.cos(ang+.5)} ${y2-h*Math.sin(ang+.5)}`);
- });
- }
- // The mode switch: the styles show the mode at once and every timeline keeps running (or stays paused); the picture is renamed
- document.addEventListener('hb:mode',e=>{stage.setAttribute('aria-label',LABELS[e.detail.mode])});
- // The notes say what the box shows: the markup's words, or under reduced motion a still while the loop is paused and, while it
- // plays, photos that only fade. Registered at the top level: the shared script sends hb:pause at once under reduced motion.
- const said={inside:document.querySelector('[data-hb-for="inside"]').textContent,compare:document.querySelector('[data-hb-for="compare"]').textContent};
- const REDUCED={still:{inside:'Shown still, at the end of the move: the bright frame is the part the visitor sees, and the dashed frames show where the view starts and ends.',
- compare:'Shown still: Still photos keeps the first view of the photo, while Zoom and pan has drifted and zoomed to the end of its move.'},
- playing:{inside:'Inside, the bright frame is the part the visitor sees, held at the end of its move, with dashed frames where it starts and ends. Under reduced motion the photos only fade.',
- compare:'Still photos keeps the first view of each photo, while Zoom and pan shows the end of each move. Under reduced motion both only fade from one photo to the next.'}};
- let paused=false;
- function notes(){
- const reduced=matchMedia('(prefers-reduced-motion: reduce)').matches;
- for(const k of ['inside','compare'])document.querySelector(`[data-hb-for="${k}"]`).textContent=reduced?REDUCED[paused?'still':'playing'][k]:said[k];
- }
- document.addEventListener('hb:pause',e=>{paused=e.detail.paused;notes()});
- notes();
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);
- }));
- }
- choices('zoom-seg',d=>{zoom=d.zoom;apply()});
- choices('move-seg',d=>{move=d.move;apply()});
- choices('time-seg',d=>{stage.style.setProperty('--T',d.time+'s')});
- document.getElementById('cap-tog').addEventListener('change',e=>stage.classList.toggle('caps',e.target.checked));
- new ResizeObserver(drawArrows).observe(stage);
- apply();
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/07-ambient-background/ken-burns/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/07-ambient-background/ken-burns/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/07-ambient-background/ken-burns/README.md`**
-
-````markdown
-# Ken Burns Effect
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/ken-burns/)
-
-## What it is
-The Ken Burns effect brings still photos to life by slowly zooming and panning across them, the way a documentary camera moves over a printed photograph. Each photo drifts toward something worth looking at, and the next one fades in before the move ends, so the picture never stops moving. It is named after the filmmaker who made the technique famous in his documentaries.
-
-## When to use it
-- Hero slideshows on travel, hotel and property sites
-- Story and about pages that walk through a few photos
-- Event and wedding pages with a handful of strong pictures
-- Slow backgrounds behind a heading, where a still photo would feel flat
-
-## How it works
-Each photo is drawn larger than its frame (here one and a half times, the strongest zoom any setting uses) and is only ever scaled down from there, so it stays sharp. One CSS keyframe timeline per photo moves it from a start framing to an end framing with transforms only; the two framings are custom properties that the script works out from the settings:
-
-```css
-.slide { animation: kb-fade calc(var(--T) * 3) linear infinite; animation-delay: var(--d); }
-.photo { width: calc(100% * var(--Z)); height: calc(100% * var(--Z)); transform-origin: 0 0;
- animation: kb-move calc(var(--T) * 3) linear infinite; animation-delay: var(--d); }
-@keyframes kb-move { 0% { transform: var(--from); } 38.1%, 100% { transform: var(--to); } }
-@keyframes kb-fade { 0% { opacity: 0; z-index: 2; } 4.76% { opacity: 1; } 33.33% { z-index: 2; } 33.34% { z-index: 1; }
- 38.1% { opacity: 1; } 38.11%, 100% { opacity: 0; z-index: 1; } }
-```
-
-Three slides share one cycle three photos long, each starting a photo's time after the one before. A slide fades in on top of the previous one for a seventh of its time, shows, then stays underneath while the next one fades in over it, and is hidden until its turn comes again; its photo keeps moving the whole time it can be seen. A framing is a zoom and the point of the photo that sits in the middle of the frame. That point is kept far enough from the photo's edges that the photo always covers the frame, and because the transform moves in a straight line between two framings that both cover it, every moment in between covers it too:
-
-```js
-const fit = (z, [x, y]) => { const h = .5 / z; return { z, x: Math.min(1 - h, Math.max(h, x)), y: Math.min(1 - h, Math.max(h, y)) }; };
-const photoT = f => `translate(${(.5 - f.x * f.z) / ZMAX * 100}%, ${(.5 - f.y * f.z) / ZMAX * 100}%) scale(${f.z / ZMAX})`;
-```
-
-Zooming in starts near the photo's middle and ends closer on its point of interest; zooming out does the reverse. Pause and Slow motion simply hold or slow every CSS animation in the box. Under reduced motion each photo holds the end of its move and the photos only fade from one to the next.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Which way it zooms | Both | In zooms every photo in, toward its point of interest; out starts close and pulls back; both zooms the first and third photos in and the second out |
-| How much it moves | Medium | Subtle zooms from 1.04 to 1.16 times and drifts less than half of the way toward the point of interest; medium zooms from 1.06 to 1.3 times and drifts three quarters of the way; strong zooms from 1.08 to 1.5 times and drifts all the way |
-| Time on each photo | Medium | Short is 5 seconds, medium 7 seconds and long 10 seconds; each fade takes a seventh of that, about a second at medium |
-| Shows a caption | off | On, each photo's name sits in the lower left corner and stays still while the photo moves |
-
-## Production notes
-- **Draw big, scale down.** A browser draws a layer once and then scales it; scaling it up past the size it was drawn at makes it soft. Give the photo the size it reaches at the strongest zoom and scale it down from there, or use a picture with enough pixels for the closest framing.
-- **Never let an edge show.** Keep the zoom above one and the framing's center at least half a frame away from the photo's edges, at both ends of the move.
-- **Keep text still.** Put headings and captions in a layer of their own above the moving photo, never inside it, so they stay sharp and easy to read.
-- **One timeline, many photos.** Driving every photo from the same cycle with its own delay keeps the fades and moves in step with no script running each frame; changing the time only changes one custom property.
-- **Reduced motion.** Hold each photo still and change photos with a slow fade.
-- **Library equivalents.** GSAP: `gsap.fromTo(photo, { scale: 1.06, xPercent: 0 }, { scale: 1.3, xPercent: -8, duration: 8, ease: "none" })` in a timeline that crossfades the slides. Framer Motion: animate `scale`, `x` and `y` on the photo with `transition={{ duration: 8, ease: "linear" }}` and wrap the slides in `AnimatePresence`.
-
-## See also
-- [Aurora / Northern Lights](../aurora/) — a calm loop made of CSS keyframes
-- [Infinite Zoom](../../06-3d-advanced/infinite-zoom/) — an endless dive into pictures inside pictures
-- [Zoom Into Image](../../01-scroll-based/zoom-into-image/) — a picture that opens up as you scroll
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: added demos ── */` (the end of the 07 bespoke block):
-
-```css
-.pv-kenburns{background:#07080b;overflow:hidden}
-.pv-kenburns i{position:absolute;inset:-12%;opacity:0;animation:kenburns-pv 10s linear infinite}
-.pv-kenburns .p1{background:radial-gradient(circle at 68% 48%,#fff4cf 0 4%,#ffe6a855 7%,#0000 15%),linear-gradient(172deg,#0000 58%,#4c4466 58.5% 70%,#0000 70.5%),linear-gradient(#1b2a4a,#8a5a86 40%,#f29a62 58%,#ffd38a 64%,#2b2b44 65%);--a:translate(4%,3%) scale(1);--b:translate(-5%,-2%) scale(1.16)}
-.pv-kenburns .p2{background:radial-gradient(circle at 74% 40%,#ffe7a0 0 2.5%,#ffd27a44 5%,#0000 11%),linear-gradient(90deg,#0000 71%,#f1ece4 71.5% 75%,#0000 75.5%),linear-gradient(#271b48,#b5527a 45%,#f7a55b 64%,#3b4b7a 65%,#101a33);animation-delay:-5s;--a:translate(-4%,-2%) scale(1.16);--b:translate(3%,2%) scale(1)}
-@keyframes kenburns-pv{0%{opacity:0;transform:var(--a)}8%,50%{opacity:1}58%,100%{opacity:0;transform:var(--b)}}
-```
-
-(b) insert this line right before the line that starts with `case 'aurora':` (after the end of the `case 'life':` block):
-
-```js
- case 'kenburns': return '<i class="p1 anim"></i><i class="p2 anim"></i>';
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-grep -c "pv-kenburns" index.html; grep -c "case 'kenburns':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8968: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8968/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L8 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-node $RUN/slot.mjs run ten-L8 -- node tools/check-pages.mjs --base http://127.0.0.1:8968 --out $TEN/checks/L8/1 animations/07-ambient-background/ken-burns animations/07-ambient-background/game-of-life home > $TEN/checks/L8/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L8/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-node $RUN/slot.mjs run ten-L8 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8968 --short --out $TEN/checks/L8/short-1 animations/07-ambient-background/ken-burns > $TEN/checks/L8/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L8/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L8/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L8/1.log; grep '^FAIL' $TEN/checks/L8/1.log; tail -2 $TEN/checks/L8/short-1.log`.
-
-Expected: `18` (six `ok` lines each for `ken-burns`, `game-of-life`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 7: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`) and for each choice of the settings that change only timing or show only while the demo moves (G1, G11): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-i=0; for sel in "" "#zoom-seg [data-zoom='in']" "#zoom-seg [data-zoom='out']" "#move-seg [data-move='subtle']" "#move-seg [data-move='strong']" "#time-seg [data-time='5']" "#time-seg [data-time='10']" "#cap-tog"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L8 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8968 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L8/press-$i animations/07-ambient-background/ken-burns || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L8/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L8/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-i=0; for sel in "" "#time-seg [data-time='5']" "#time-seg [data-time='10']"; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L8 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8968 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L8/clip-$i animations/07-ambient-background/ken-burns || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L8/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L8/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 8 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 3 `== clip-…` lines, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders; for a timing choice, the same frames beside `clip-0`'s): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L8/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 8: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L8/<round>/07-ken-burns-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- Each photo drifts and zooms slowly, then the next fades in; no edge of a photo shows at any moment of any setting (the photos are drawn at their largest size and only scaled down).
-- Pause holds every photo, frame and fade where it is; Play goes on; Slow motion slows everything three times; going back to Normal while paused gives the first picture back.
-- Every setting changes Normal and both views; under reduced motion the loop starts paused and Play fades within 1.5 s; Compare's still shows the start framing beside the end framing; after Play the notes say the photos only fade (lesson 16).
-- The labels: Start at the start frame's top left, End at the end frame's top right, the moving label under the frame's middle; none overlaps at 320.
-
-Decisions already made in this page (keep them; a reviewer weighs them): Under reduced motion the delays are shifted so a press of Play starts a fade within 1.5 s; Compare's still pairs the start framing with the end framing (no dashed start there). The notes never say left or right: the halves stack on phones.
-
-- [ ] **Step 9: Frame times (optional: a page moved by transforms)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-(node $RUN/slot.mjs run ten-L8 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8968 --modes normal,inside,compare animations/07-ambient-background/ken-burns; node $RUN/slot.mjs run ten-L8 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8968 --phone --modes normal,inside,compare animations/07-ambient-background/ken-burns; node $RUN/slot.mjs run ten-L8 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8968 animations/07-ambient-background/aurora; node $RUN/slot.mjs run ten-L8 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8968 --phone animations/07-ambient-background/aurora) > $TEN/checks/L8/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L8/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes, and no larger share of frames slower than 20 ms than Aurora / Northern Lights measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: desktop 0 / 0 / 0%, phone 0 / 0 / 1%; Aurora / Northern Lights 0% at both sizes. Report the numbers; nothing to change unless a mode is clearly worse than the closest page.
-
-- [ ] **Step 10: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L8 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L8 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 07.24 Ken Burns Effect, with See inside and Compare from the start (lane 8)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/07-ambient-background/ken-burns/README.md`, `A animations/07-ambient-background/ken-burns/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/07-ambient-background/README.md`, `M animations/07-ambient-background/game-of-life/index.html`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L8/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 11: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L8`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at never display:none on a moving element (its animation would restart); no edge showing; the paused picture after a mode change. It writes `$TEN/reports/L8/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 6 again (and the galleries, clips or frame times a fix touches), commits `fix: Ken Burns Effect: <what>` after the branch check, writes `$TEN/reports/L8/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L8 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L8/`.
-
----
-
-### Task 9: L9 · 07.25 Fire Effect (`ten/L9`, port 8969)
-
-Loop · step 1 "Watch it" · player bar: Pause and Slow motion (the page pauses and slows itself). See inside: the heat grid as squares, white the hottest, with the always-hot bottom row. Compare: "Flickers in place" (random heat every step) beside "Heat rises". Spec: "9 · Fire Effect (07.25)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/07-ambient-background/fire-effect/index.html` (345 lines), `animations/07-ambient-background/fire-effect/README.md`
-- Modify (by `$TEN/lanes.mjs 9`): `index.html` (the card after Game of Life's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 07's count 23 → 24, the catalog line), `animations/07-ambient-background/README.md` (its line and its Implementation summary row), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 07 bespoke block, `case 'fire':` in `pvMarkup()`
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js`; the page check of the new page and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults; frame times
-- Write (run folder): `$TEN/checks/L9/` (logs, screenshots, kit output), `$TEN/reports/L9/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L9` on `ten/L9`, its server on port 8969 (started and stopped by the coordinator), `$TEN/lanes.mjs`, `$TEN/frametimes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses nothing on a loop after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L9`: the card `['fire-effect','Fire Effect','Flames flicker and rise as heat climbs and cools. Best for game and event pages.']` (07.25), `PV` key `'fire-effect':'fire'`, `PLACES` `['bg','intro']`, `FIND` `'fire-effect':['background','loop','glitch color drift']`; Previous: Game of Life (for now: Task 11 points it at the page before it in the section); no Next link yet. The reports in `$TEN/reports/L9/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-node $TEN/lanes.mjs 9 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 9 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/07-ambient-background/README.md`, ` M index.html`; then these 6 failing tests and `ℹ fail 6`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, from a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/07-ambient-background/fire-effect/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Fire Effect — Animation Handbook</title>
- <meta name="description" content="Flames flicker and rise as heat climbs and cools. Best for game and event pages.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/fire-effect/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Fire Effect — Animation Handbook">
- <meta property="og:description" content="Flames flicker and rise as heat climbs and cools. Best for game and event pages.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/fire-effect/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Fire Effect — Animation Handbook">
- <meta name="twitter:description" content="Flames flicker and rise as heat climbs and cools. Best for game and event pages.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Fire Effect", "name": "Fire Effect", "description": "Flames flicker and rise as heat climbs and cools. Best for game and event pages.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/fire-effect/", "inLanguage": "en", "articleSection": "Ambient & Background", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Ambient & Background, Fire Effect"}</script>
- <style>
- :root{--ui-accent:#ffce5a}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{position:relative;overflow:hidden;background:#070608}
- /* Each fire is a small canvas of one pixel per heat cell, stretched over its part of the box by the browser (smoothly, so the
- flames look soft); See inside draws on a canvas of the box's own size */
- .fire,#cvs{position:absolute;display:block;width:100%;height:100%;left:0;top:0}
- .fire.half,#cvs,.divide{display:none}
- .stage[data-hb-mode="inside"] .fire,.stage[data-hb-mode="compare"] .fire.whole{display:none}
- .stage[data-hb-mode="inside"] #cvs,.stage[data-hb-mode="compare"] .fire.half{display:block}
- .divide{position:absolute;left:calc(50% - 1px);top:0;width:2px;height:100%;background:#000}
- .stage[data-hb-mode="compare"] .divide{display:block}
- /* See inside and Compare: plain words over the picture */
- .fx-lbl{display:none;position:absolute;padding:3px 8px;border-radius:6px;background:rgba(7,6,8,.88);color:#f4f4f2;
- font:600 13px/1.25 var(--hb-font);white-space:nowrap;pointer-events:none}
- .stage[data-hb-mode="inside"] .in,.stage[data-hb-mode="compare"] .half{display:block}
- .in.what{left:10px;top:10px;white-space:normal;max-width:min(60%,330px)}
- .half{top:10px}.half.first{left:10px}.half.second{left:calc(50% + 10px)}
- @media(max-width:360px){.half.second{left:10px;top:calc(50% + 10px)}.divide{left:0;top:calc(50% - 1px);width:100%;height:2px}}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="loop">
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../game-of-life/" rel="prev" aria-label="Previous: Game of Life"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Game of Life</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">07.25 · Ambient &amp; Background</p>
- <h1>Fire Effect</h1>
- <p class="hb-lede">Flames flicker and rise as heat climbs and cools. Best for game and event pages.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Watch it</h2><p>It moves by itself. Pause it, or turn on slow motion to watch the heat rise.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage" role="img" aria-label="Flames flickering along the bottom of a dark box, with sparks drifting up">
- <canvas id="cvs" aria-hidden="true"></canvas><i class="divide" aria-hidden="true"></i>
- <p class="fx-lbl in what" aria-hidden="true" data-hb-caption>Each square holds one heat value: white is hottest</p>
- <p class="fx-lbl in" id="l-base" aria-hidden="true" data-hb-caption>Always full heat</p>
- <p class="fx-lbl in" id="l-up" aria-hidden="true" data-hb-caption>Heat moves up a row each step</p>
- <p class="fx-lbl in" id="l-cool" aria-hidden="true" data-hb-caption>It cools as it rises</p>
- <p class="fx-lbl half first" aria-hidden="true" data-hb-caption>Flickers in place</p>
- <p class="fx-lbl half second" aria-hidden="true" data-hb-caption>Heat rises</p>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-pause" data-hb-pause data-state="playing"><svg class="hb-ic hb-i-pause" viewBox="0 0 24 24" aria-hidden="true"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg><svg class="hb-ic hb-i-play" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3l14 9-14 9z"/></svg><span class="hb-pause-label">Pause</span></button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, each square is one heat value, white the hottest: the hidden bottom row is always hot, heat moves up a row each step with a little sideways wobble, and it cools as it rises.</p>
- <p data-hb-for="compare" hidden>Flickers in place gives each spot new random heat every step, so it looks like static. Heat rises lifts heat from below and cools it on the way up, so it forms flames.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and see the difference as it moves.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="height-lbl">Flame height</p>
- <div class="seg" id="height-seg" role="group" aria-labelledby="height-lbl">
- <button type="button" data-h="low" aria-pressed="false">Low</button>
- <button type="button" data-h="medium" class="on" aria-pressed="true">Medium</button>
- <button type="button" data-h="tall" aria-pressed="false">Tall</button>
- </div>
- <p class="hb-hint">Tall flames cool more slowly as they rise.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="shape-lbl">Fire shape</p>
- <div class="seg" id="shape-seg" role="group" aria-labelledby="shape-lbl">
- <button type="button" data-shape="edge" class="on" aria-pressed="true">Along the edge</button>
- <button type="button" data-shape="camp" aria-pressed="false">Campfire</button>
- </div>
- <p class="hb-hint">Campfire heats only the middle, so the flames meet in a point.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="color-lbl">Colors</p>
- <div class="swatches" id="color-sw" role="group" aria-labelledby="color-lbl">
- <button type="button" class="on" aria-pressed="true" aria-label="Orange" data-col="orange" style="background:#f5781a"></button>
- <button type="button" aria-pressed="false" aria-label="Blue" data-col="blue" style="background:#2a8cf0"></button>
- <button type="button" aria-pressed="false" aria-label="Green" data-col="green" style="background:#50c828"></button>
- </div>
- <p class="hb-hint">The color of the heat.</p>
- </div>
- </div>
- <details class="hb-options">
- <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="wind-lbl">Wind</p>
- <div class="seg" id="wind-seg" role="group" aria-labelledby="wind-lbl">
- <button type="button" data-w="0" class="on" aria-pressed="true">None</button>
- <button type="button" data-w="-1" aria-pressed="false">Left</button>
- <button type="button" data-w="1" aria-pressed="false">Right</button>
- </div>
- <p class="hb-hint">Leans the flames to one side.</p>
- </div>
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Sparks</span><input class="hb-switch" type="checkbox" role="switch" id="spark-tog" checked autocomplete="off"></label>
- <p class="hb-hint">Small sparks drift up from the flames.</p>
- </div>
- </div>
- </details>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add a fire effect to [the dark section or edge you want to set alight]. Keep a small grid of heat values whose bottom row always holds full heat. Many times a second, give each cell the heat of a cell just below it, nudged sideways and cooled a little at random, so heat rises, flickers and dies out. Color each cell by its heat with the palette the settings choose, dark when cool and brightest when hot, and draw the grid on a small canvas stretched over the area so the flames look soft. Step the grid at a fixed rate on every screen, coarser on phones. If the visitor has reduced motion turned on, show still flames. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Game sites</li><li>Sale and event banners</li><li>Night and festival themes</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Reading pages</li><li>Light themes</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const cvs=document.getElementById('cvs'),ctx=cvs.getContext('2d'),stage=cvs.parentElement,divide=stage.querySelector('.divide');
- const slowTog=document.getElementById('slow-tog'),sparkTog=document.getElementById('spark-tog');
- const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),phone=matchMedia('(max-width:600px),(max-height:500px)');
- const narrow=matchMedia('(max-width:360px)'); // where the Compare halves stack, as the labels do
- const FRAME=1000/60,SEED=11,WARM=200; // one step is a 60th of a second; a new fire is run 200 steps from a fixed seed, so it starts full
- const HEIGHT={low:.32,medium:.52,tall:.78}; // the share of the box the flames reach
- const PALETTES={orange:[[7,6,8],[96,10,6],[196,44,10],[245,120,26],[255,204,80],[255,250,226]],
- blue:[[7,6,8],[8,14,70],[24,60,180],[42,140,240],[150,222,255],[238,250,255]],
- green:[[7,6,8],[6,44,14],[24,124,34],[80,200,40],[196,250,120],[246,255,224]]};
- const LABELS={normal:'Flames flickering along the bottom of a dark box, with sparks drifting up',
- inside:'The fire as a grid of gray squares, one heat value each, with the always-hot bottom row, rising arrows and a bar that cools upward',
- compare:'Two fires side by side: random flicker that stays in place, and heat that rises into flames'};
- let height='medium',shape='edge',color='orange',wind=0,mode='normal',paused=false;
- let W=0,H=0,raf=0,lastT=null,acc=0,lut=null,main=null,pair=null;
- // A seeded random sequence (32 random bits a call), so a new fire is the same fire every time; rand() gives 0 to 1
- function rng(s){let x=s|0||1;return()=>{x^=x<<13;x^=x>>>17;x^=x<<5;return x>>>0}}
- // The palette as 256 colors, from cool (dark) to hot (near white), as the pixels of an ImageData want them
- function makeLut(){
- const stops=PALETTES[color],out=new Uint32Array(256);
- for(let i=0;i<256;i++){const p=i/255*(stops.length-1),k=Math.min(stops.length-2,Math.floor(p)),f=p-k,a=stops[k],b=stops[k+1];
- out[i]=255<<24|Math.round(a[2]+(b[2]-a[2])*f)<<16|Math.round(a[1]+(b[1]-a[1])*f)<<8|Math.round(a[0]+(b[0]-a[0])*f)}
- return out;
- }
- // One fire in a rectangle of the box (in shares of its size): cols × rows heat values, the last row hidden below the box, drawn
- // on a small canvas of one pixel per cell that the browser stretches over the rectangle. flicker: the common mistake, new random
- // heat in place every step.
- function Fire(rect,cols,flicker,seed,half){
- const cell=rect.w*W/cols,rows=Math.max(8,Math.round(rect.h*H/cell))+1,small=document.createElement('canvas'),bits=rng(seed);
- small.width=cols;small.height=rows-1;small.className='fire '+(half?'half':'whole');small.setAttribute('aria-hidden','true');
- Object.assign(small.style,{left:rect.x*100+'%',top:rect.y*100+'%',width:rect.w*100+'%',height:rect.h*100+'%'});
- divide.before(small);
- return {cols,rows,flicker,half,h:new Float32Array(cols*rows),bits,rand:()=>bits()/4294967296,sparks:[],sctx:small.getContext('2d'),img:new ImageData(cols,rows-1)};
- }
- const base=(f,x)=>shape==='edge'?1:Math.max(0,1-Math.abs(x+.5-f.cols/2)/(f.cols*.16));
- // One step: the hidden bottom row gets full heat (only its middle for a campfire); every other cell takes the heat of the cell
- // below it, written one cell to the side at random (and more often toward the wind), and half the time a little cooler, so heat
- // moves up a row each step, runs out at the chosen height and leaves hotter streaks where it happened to cool less
- function step(f){
- const {cols:c,rows:r,h,rand,bits}=f;
- if(f.flicker){for(let y=0;y<r-1;y++){const k=Math.pow(y/(r-2),2.2);for(let x=0;x<c;x++)h[y*c+x]=rand()*k*base(f,x)}return}
- for(let x=0;x<c;x++)h[(r-1)*c+x]=base(f,x);
- const cool=2/((r-1)*HEIGHT[height]);
- // one draw of random bits a cell: two for the sideways step (left, stay, stay, right), one for cooling, one for the wind
- for(let y=1;y<r;y++)for(let x=0,i=y*c;x<c;x++,i++){
- const n=bits(),q=n&3;let nx=x+(q===3?0:q-1)+(wind&&n&16?wind:0);
- nx=nx<0?0:nx>=c?c-1:nx;
- const v=h[i]-(n&8?cool:0);
- h[i-c-x+nx]=v>0?v:0;
- }
- }
- // Sparks rise from the hot cells and fade, moved by the time that passed (s seconds); fewer on phones and in each Compare half
- function sparks(f,s){
- const {rand}=f,rate=(phone.matches?10:24)*(f.half?.5:1);
- if(sparkTog.checked&&rand()<rate*s){let x=rand()*f.cols;if(base(f,Math.floor(x))<.5)x=f.cols/2+(rand()-.5)*f.cols*.2;
- f.sparks.push({x:x/f.cols,y:1-HEIGHT[height]*(.25+rand()*.45),vy:.18+rand()*.22,ph:rand()*6.28,life:1.2+rand()*1.2,age:0})}
- for(const p of f.sparks){p.age+=s;p.y-=p.vy*s;p.x+=Math.sin(p.ph+p.age*3)*.02*s+wind*.03*s}
- f.sparks=f.sparks.filter(p=>p.age<p.life&&p.y>0);
- }
- // A new fire for every rectangle of the current mode, run WARM steps from its seed, so it is full from the first frame
- function build(){
- stage.querySelectorAll('.fire').forEach(c=>c.remove());
- const stack=narrow.matches,max=phone.matches?96:160;
- // about one cell per five pixels, at most 160 across (96 on phones); a Compare half covers half the box, so half the cells
- const make=(rect,flicker,seed,half)=>{const f=Fire(rect,Math.max(16,Math.min(max,Math.round(rect.w*W/5))),flicker,seed,half);
- for(let i=0;i<WARM;i++){step(f);sparks(f,FRAME/1000)}return f};
- main=make({x:0,y:0,w:1,h:1},false,SEED,false);
- const halves=stack?[{x:0,y:0,w:1,h:.5},{x:0,y:.5,w:1,h:.5}]:[{x:0,y:0,w:.5,h:1},{x:.5,y:0,w:.5,h:1}];
- pair=halves.map((rect,i)=>make(rect,i===0,SEED+i,true));
- }
- // A fire's picture: its heat as colors, then its sparks as soft dots (a cell wide, at their own place between cells)
- function paint(f){
- const {cols:c,rows:r,h,img,sctx}=f,px=new Uint32Array(img.data.buffer);
- // each pixel blends a cell with its two side neighbors, which softens the grain across and keeps the streaks that rise
- for(let y=0;y<r-1;y++)for(let x=0,i=y*c;x<c;x++,i++)px[i]=lut[Math.min(255,(h[i-(x>0)]+2*h[i]+h[i+(x<c-1)])*63.75|0)];
- sctx.putImageData(img,0,0);
- sctx.fillStyle=`rgb(${PALETTES[color][5].join()})`;
- for(const p of f.sparks){sctx.globalAlpha=1-p.age/p.life;sctx.fillRect(p.x*c-.5,p.y*(r-1)-.5,1,1)}
- sctx.globalAlpha=1;
- }
- // See inside: the same fire as big squares in grays (one heat value each, white the hottest), its hidden bottom row shown and
- // white, rising arrows with a sideways wobble (toward the wind), and at the side a bar in the fire's colors that cools upward
- // The squares are one pixel each on a small canvas, drawn up with smoothing off, and the gaps between them one path on top
- const grid=document.createElement('canvas'),gctx=grid.getContext('2d');let gimg=null;
- function paintInside(){
- const f=main,{cols:c,rows:r,h}=f,B=phone.matches?6:5,bc=Math.ceil(c/B),s=W/bc,br=Math.ceil(H/s);
- if(!gimg||gimg.width!==bc||gimg.height!==br){grid.width=bc;grid.height=br;gimg=gctx.createImageData(bc,br)}
- const px=new Uint32Array(gimg.data.buffer);
- for(let j=0;j<br;j++)for(let i=0;i<bc;i++){const y=r-1-j*B,g=Math.round(18+(y<0?0:h[y*c+Math.min(c-1,i*B+(B>>1))])*237);px[(br-1-j)*bc+i]=0xff000000|g<<16|g<<8|g}
- gctx.putImageData(gimg,0,0);ctx.imageSmoothingEnabled=false;ctx.drawImage(grid,0,H-br*s,W,br*s);
- ctx.strokeStyle='#111014';ctx.lineWidth=2;ctx.beginPath();
- for(let i=0;i<=bc;i++){ctx.moveTo(i*s,0);ctx.lineTo(i*s,H)}
- for(let j=0;j<=br;j++){ctx.moveTo(0,H-j*s);ctx.lineTo(W,H-j*s)}
- ctx.stroke();
- for(const p of f.sparks){ctx.fillStyle='#fff';ctx.fillRect(p.x*W-1.5,p.y*H-1.5,3,3)}
- ctx.lineCap='round';ctx.lineJoin='round';
- for(const k of [.22,.5,.78]){const x=k*W,y=H-1.5*s,d=wind*s*.5;
- for(const [w,col] of [[6,'#111014'],[2.5,'#ffce5a']]){ctx.strokeStyle=col;ctx.lineWidth=w;ctx.beginPath();
- ctx.moveTo(x,y);ctx.lineTo(x-s*.5+d,y-s);ctx.lineTo(x+s*.5+d,y-2*s);ctx.lineTo(x+d,y-3*s);
- ctx.moveTo(x+d-6,y-3*s+7);ctx.lineTo(x+d,y-3*s);ctx.lineTo(x+d+6,y-3*s+7);ctx.stroke()}}
- const top=H*(1-HEIGHT[height]),bar=ctx.createLinearGradient(0,H-s,0,top),st=PALETTES[color];
- st.forEach((col,i)=>bar.addColorStop(1-i/(st.length-1),`rgb(${col.join()})`));
- ctx.fillStyle='#111014';ctx.fillRect(W-30,top-2,18,H-s-top+4);ctx.fillStyle=bar;ctx.fillRect(W-28,top,14,H-s-top);
- place(document.getElementById('l-base'),12,H-s-34);
- // on a short, wide box the squares are big and the arrows reach the top: the label goes under the one at the top left
- const what=stage.querySelector('.in.what');
- place(document.getElementById('l-up'),.5*W-110,Math.max(H-4.5*s-30,what.offsetTop+what.offsetHeight+6));
- const cool=document.getElementById('l-cool');place(cool,W-40-cool.offsetWidth,top+(H-s-top)*.35);
- }
- const place=(el,x,y)=>{el.style.left=Math.max(6,Math.min(W-el.offsetWidth-6,x))+'px';el.style.top=Math.max(6,Math.min(H-el.offsetHeight-6,y))+'px'};
- function draw(){
- if(mode==='inside')paintInside();
- else (mode==='compare'?pair:[main]).forEach(paint);
- }
- // The loop takes fixed steps of a 60th of a second from the time that passed (a third of it in slow motion), at most two a
- // frame, and draws every frame, as the sparks move by the time itself. Compare steps its own two fires, so Normal's waits as it was.
- function loop(ts){
- raf=requestAnimationFrame(loop);
- if(lastT===null){lastT=ts;return}
- const dt=Math.min(ts-lastT,50)*(slowTog.checked?1/3:1);lastT=ts;acc+=dt;
- const fires=mode==='compare'?pair:[main];let n=0;
- while(acc>=FRAME-1&&n<2){fires.forEach(step);acc-=FRAME;n++}
- if(acc>FRAME)acc=0;
- fires.forEach(f=>sparks(f,dt/1000));
- draw();
- }
- function start(){if(raf||paused)return;lastT=null;acc=0;raf=requestAnimationFrame(loop)}
- // Registered at the top level: under reduced motion the shared script pauses the loop at once, and the full fire stays still
- document.addEventListener('hb:pause',e=>{paused=e.detail.paused;notes();if(paused){cancelAnimationFrame(raf);raf=0}else start()});
- document.addEventListener('visibilitychange',()=>{lastT=null;acc=0});
- // The mode switch draws the mode at once, playing or paused; each mode keeps its own fire, so Normal comes back as it was
- document.addEventListener('hb:mode',e=>{mode=e.detail.mode;stage.setAttribute('aria-label',LABELS[mode]);if(W)draw()});
- // A real change of the box's size builds new fires for it (a phone's address bar sliding leaves it as it was); the box is watched
- // itself, so its size once the page's styles have loaded counts too
- function resize(){
- const w=stage.clientWidth,h=stage.clientHeight;if(!w||!h||(w===W&&h===H))return;W=w;H=h;
- const dpr=Math.min(devicePixelRatio||1,2);cvs.width=W*dpr;cvs.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0);
- build();draw();
- }
- // A setting changes the fire as it plays; while paused it builds the fire again with the new setting, so the change shows
- function changed(rebuild){if(paused&&rebuild)build();if(W)draw()}
- function choices(id,pick,rebuild){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);changed(rebuild);
- }));
- }
- choices('height-seg',d=>{height=d.h},true);
- choices('shape-seg',d=>{shape=d.shape},true);
- choices('color-sw',d=>{color=d.col;lut=makeLut()},false);
- choices('wind-seg',d=>{wind=+d.w},true);
- sparkTog.addEventListener('change',()=>changed(true));
- // Under reduced motion the loop starts paused on a full fire, and the notes say so while it is paused; playing, the fire burns
- // as it does without reduced motion, and the markup's words hold
- const said={inside:document.querySelector('[data-hb-for="inside"]').textContent,compare:document.querySelector('[data-hb-for="compare"]').textContent};
- const STILL={inside:'Shown still: each square is one heat value, white the hottest; the hidden bottom row is always hot, heat moves up a row each step, and it cools as it rises. Press Play to watch.',
- compare:'Shown still: Flickers in place gives each spot new random heat every step, like static; Heat rises lifts heat from below and cools it, so it forms flames. Press Play to watch.'};
- function notes(){const still=reduceMQ.matches&&paused;for(const k of ['inside','compare'])document.querySelector(`[data-hb-for="${k}"]`).textContent=still?STILL[k]:said[k]}
- notes();
- lut=makeLut();
- resize();
- new ResizeObserver(resize).observe(stage);
- start();
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/07-ambient-background/fire-effect/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/07-ambient-background/fire-effect/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/07-ambient-background/fire-effect/README.md`**
-
-````markdown
-# Fire Effect
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/fire-effect/)
-
-## What it is
-A fire effect fills the bottom of a dark area with flames that flicker, rise and die out, with sparks drifting up. It is made from a small grid of heat values: the bottom row is always as hot as it gets, heat climbs one row at a time with a little sideways wobble, and it cools on the way up, so the hot base turns into tongues of flame. It is the classic fire of early computer games, drawn soft.
-
-## When to use it
-- Game sites and launch pages for games
-- Sale, countdown and event banners that want urgency
-- Night, festival and campfire themes
-- Short intros where a burst of energy fits the brand
-
-## How it works
-The fire is a grid of numbers between 0 (cold) and 1 (hottest), about one cell per five pixels of the box. The bottom row sits just below the box and is set to full heat every step (only its middle, for a campfire). Every other cell takes the heat of the cell below it, written straight up half the time and one cell to the left or the right the rest (more often toward the wind) and, half the time, a little cooler. So heat moves up a row each step, runs out about where the flame height says, and leaves hotter streaks where it happened to cool less:
-
-```js
-for (let x = 0; x < cols; x++) heat[(rows - 1) * cols + x] = base(x); // the hidden row: always full heat
-const cool = 2 / ((rows - 1) * HEIGHT[height]); // the average loss per row
-for (let y = 1; y < rows; y++) for (let x = 0; x < cols; x++) {
- const r = rand(), dx = (r < .25 ? -1 : r < .75 ? 0 : 1) + (wind && rand() < .5 ? wind : 0); // left, stay, stay, right
- const nx = Math.min(cols - 1, Math.max(0, x + dx));
- heat[(y - 1) * cols + nx] = Math.max(0, heat[y * cols + x] - (rand() < .5 ? 0 : cool));
-}
-```
-
-Each heat value, blended with its two side neighbors to soften the grain, picks one of 256 colors from the palette, dark when cool and near white when hot. The colors are written into a small canvas with one pixel per cell, and that canvas is the picture: its CSS size is the box's, so the browser stretches it smoothly, which is what makes the flames soft instead of blocky, and costs the script nothing:
-
-```js
-for (let y = 0; y < rows - 1; y++) for (let x = 0, i = y * cols; x < cols; x++, i++)
- pixels[i] = palette[Math.min(255, (heat[i - (x > 0)] + 2 * heat[i] + heat[i + (x < cols - 1)]) * 63.75 | 0)];
-small.getContext('2d').putImageData(image, 0, 0); // small: a canvas element sized 100% of the box in CSS
-```
-
-The grid takes fixed steps of a 60th of a second from the time that has passed (at most two a frame), so the fire burns at the same speed on a 60 Hz and a 120 Hz screen; slow motion counts a third of the time. Sparks are drawn into the same small canvas as soft dots that rise from the hot cells, sway and fade, moved by the time itself. A new fire is run 200 steps from a fixed seed before it is first drawn, so it starts full; under reduced motion it waits paused on that full fire.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| Flame height | Medium | Where the heat runs out, as a share of the box's height: low is about a third, medium about half and tall about four fifths; taller flames lose less heat per row |
-| Fire shape | Along the edge | Along the edge heats the whole bottom row, so flames burn across the box; campfire heats only its middle third, fading to the sides, so the flames lean in and meet in a point |
-| Colors | Orange | The palette from cool to hot: orange runs from dark red to yellow and white, blue from deep navy to pale blue, green from dark green to pale yellow |
-| Wind | None | Left or right moves half of the heat one extra cell to that side each step, so the flames lean that way |
-| Sparks | on | About 24 sparks a second rise from the flames and fade within one to two and a half seconds (10 a second on phones) |
-
-## Production notes
-- **Keep the grid small.** A grid of about 160 cells across is plenty when it is stretched with smoothing; a cell per pixel costs twenty-five times as much for flames that look the same. The demo uses at most 96 across on phones and half the cells in each half of Compare.
-- **Fixed steps.** A grid that moves one row per frame burns twice as fast on a 120 Hz screen. Step it at a fixed rate from an accumulator, and cap the steps per frame so a slow device slows down instead of falling behind.
-- **One small canvas, stretched by the browser.** Write the colors with `putImageData` into a canvas of one pixel per cell and give the canvas the box's CSS size: the browser scales it on its own, far cheaper than drawing a rectangle per cell or scaling it up with `drawImage` every frame.
-- **Pause out of view.** A fire on a page section that has scrolled away still costs every frame: stop the loop with an `IntersectionObserver` and when the tab is hidden.
-- **Reduced motion.** Show still flames; let the visitor start them with a play control.
-- **Libraries and shaders.** The same fire is a few lines of a WebGL fragment shader with a noise function (for example in Three.js or PixiJS), which suits a full-screen fire; for a small banner, a canvas grid like this one is lighter. Lottie or a short looping video are the usual choices when the fire must look painted.
-
-## See also
-- [Game of Life](../game-of-life/) — a grid of cells that steps by simple rules
-- [Cloth / Soft-Body Simulation](../../06-3d-advanced/cloth-simulation/) — fixed steps at the same rate on every screen
-- [Volumetric Smoke / 3D Noise](../../06-3d-advanced/volumetric-smoke/) — smoke that drifts and curls
-- [Fireworks](../fireworks/) — sparks that rise, burst and fade
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: added demos ── */` (the end of the 07 bespoke block):
-
-```css
-.pv-fire{background:radial-gradient(70% 40% at 50% 100%,#5a1a0866,#0000),#070608;overflow:hidden;container-type:size}
-.pv-fire i{position:absolute;bottom:-6%;width:30%;height:66%;border-radius:50% 50% 42% 42%/72% 72% 28% 28%;transform-origin:50% 100%;
- background:radial-gradient(60% 52% at 50% 92%,#fffbe0 0 14%,#ffd250 30%,#f5781a 52%,#c42c0a 70%,#0000 74%);mix-blend-mode:screen;animation:fire-tongue 1.6s ease-in-out infinite alternate}
-.pv-fire .t1{left:6%;height:52%}.pv-fire .t2{left:26%;animation-delay:-.5s}.pv-fire .t3{left:46%;height:72%;animation-delay:-1s}.pv-fire .t4{left:66%;height:56%;animation-delay:-1.3s}
-.pv-fire b{position:absolute;bottom:24%;width:1.4%;aspect-ratio:1;border-radius:50%;background:#ffd250;opacity:0;animation:fire-spark 2.4s linear infinite}
-.pv-fire .k1{left:22%}.pv-fire .k2{left:47%;animation-delay:-.8s}.pv-fire .k3{left:71%;animation-delay:-1.6s}
-@keyframes fire-tongue{0%{transform:scaleY(.86) skewX(-4deg)}100%{transform:scaleY(1.08) skewX(5deg)}}
-@keyframes fire-spark{0%{opacity:0;transform:translate(0,0)}15%{opacity:1}100%{opacity:0;transform:translate(1.5cqw,-58cqh)}}
-```
-
-(b) insert this line right before the line that starts with `case 'aurora':` (after the end of the `case 'life':` block):
-
-```js
- case 'fire': return [1,2,3,4].map(k=>'<i class="t'+k+' anim"></i>').join('')+[1,2,3].map(k=>'<b class="k'+k+' anim"></b>').join('');
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-grep -c "pv-fire" index.html; grep -c "case 'fire':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8969: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8969/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L9 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-node $RUN/slot.mjs run ten-L9 -- node tools/check-pages.mjs --base http://127.0.0.1:8969 --out $TEN/checks/L9/1 animations/07-ambient-background/fire-effect home > $TEN/checks/L9/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L9/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-node $RUN/slot.mjs run ten-L9 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8969 --short --out $TEN/checks/L9/short-1 animations/07-ambient-background/fire-effect > $TEN/checks/L9/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L9/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L9/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L9/1.log; grep '^FAIL' $TEN/checks/L9/1.log; tail -2 $TEN/checks/L9/short-1.log`.
-
-Expected: `12` (six `ok` lines each for `fire-effect`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 7: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-i=0; for sel in "" "#height-seg [data-h='low']" "#height-seg [data-h='tall']" "#shape-seg [data-shape='camp']" "#color-sw [data-col='blue']" "#color-sw [data-col='green']" "#wind-seg [data-w='-1']" "#wind-seg [data-w='1']" "#spark-tog"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L9 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8969 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L9/press-$i animations/07-ambient-background/fire-effect || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L9/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L9/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-i=0; for sel in ""; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L9 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8969 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L9/clip-$i animations/07-ambient-background/fire-effect || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L9/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L9/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 9 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 1 `== clip-…` line, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L9/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 8: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L9/<round>/07-fire-effect-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- Flames flicker and rise, with sparks; Pause freezes them at once and Play goes on; Slow motion slows the steps three times; a hidden tab stops the loop.
-- Under reduced motion the loop starts paused on a full fire made from a fixed seed run a fixed number of steps, and every mode's still is that frame; going back to Normal while paused gives the same picture; after Play the notes describe the moving fire (lesson 16).
-- Every setting changes Normal and both views, Sparks both halves of Compare (one difference between them: lesson 17); the halves sit side by side above 360px and stack below; See inside's labels sit clear of each other on the short screens.
-
-Decisions already made in this page (keep them; a reviewer weighs them): Each fire is its own small canvas, one pixel per cell, stretched by CSS: a scaled drawImage every frame cost too much. The stage size is read with a ResizeObserver (a window resize misses the first size), and the halves stack below 360px. The notes never say left or right: the halves stack on narrow phones. See inside's squares are one pixel each on a small canvas drawn up with smoothing off, and the gaps between them one path on top: drawn as some 900 separate squares, its frames were 16 to 31% slow on a desktop while the machine was busy.
-
-- [ ] **Step 9: Frame times (required: a canvas or mask page)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-(node $RUN/slot.mjs run ten-L9 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8969 --modes normal,inside,compare animations/07-ambient-background/fire-effect; node $RUN/slot.mjs run ten-L9 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8969 --phone --modes normal,inside,compare animations/07-ambient-background/fire-effect; node $RUN/slot.mjs run ten-L9 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8969 animations/07-ambient-background/fireworks; node $RUN/slot.mjs run ten-L9 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8969 --phone animations/07-ambient-background/fireworks) > $TEN/checks/L9/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L9/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes, and no larger share of frames slower than 20 ms than Fireworks measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: desktop 0 / 3 / 0% (2% in Normal and Compare with the machine busy), phone 0 / 0 / 0%, after See inside's squares were drawn as one small picture (before: 16 to 31% in See inside on a desktop); Fireworks 0% on a desktop and 0 to 1% on a phone. A page that misses lightens its per-frame work (a smaller grid, fewer dots, less drawn per frame) until it meets this, and says what it changed.
-
-- [ ] **Step 10: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L9 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L9 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 07.25 Fire Effect, with See inside and Compare from the start (lane 9)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/07-ambient-background/fire-effect/README.md`, `A animations/07-ambient-background/fire-effect/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/07-ambient-background/README.md`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L9/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 11: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L9`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at fixed steps from an accumulator; the reduced-motion still from a fixed seed; the per-frame work at phone size and See inside's on a desktop. It writes `$TEN/reports/L9/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 6 again (and the galleries, clips or frame times a fix touches), commits `fix: Fire Effect: <what>` after the branch check, writes `$TEN/reports/L9/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L9 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L9/`.
-
----
-
-### Task 10: L10 · 07.26 Lightning (`ten/L10`, port 8970)
-
-Loop · step 1 "Watch it" · player bar: Pause and Slow motion (the page pauses and slows itself). See inside: a bolt drawn round by round (a line, split again and again with each middle pushed aside by less, then forks and glow), with numbers. Compare: "Even zigzag" beside "Random splits". Spec: "10 · Lightning (07.26)" in `docs/superpowers/specs/2026-10-13-ten-new-animations-design.md`.
-
-**Files:**
-- Create: `animations/07-ambient-background/lightning/index.html` (376 lines), `animations/07-ambient-background/lightning/README.md`
-- Modify (by `$TEN/lanes.mjs 10`): `index.html` (the card after Game of Life's, the `PV` key, the `PLACES` row, the `FIND` row (the finder is on the branch), every count 166 → 167), `README.md` (counts, 07's count 23 → 24, the catalog line), `animations/07-ambient-background/README.md` (its line and its Implementation summary row), `.github/ISSUE_TEMPLATE/config.yml`, `404.html`
-- Modify (Step 4, by hand): `index.html`: the preview's CSS at the end of the 07 bespoke block, `case 'lightning':` in `pvMarkup()`, a `STILL` point
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/` (their tools)
-- Test: `tests/*.test.js`; the page check of the new page and of the home page; the review kit's short screens, a gallery for the defaults and for each other choice in Try it, clips of the defaults and of the timing settings' choices; frame times
-- Write (run folder): `$TEN/checks/L10/` (logs, screenshots, kit output), `$TEN/reports/L10/build.md`, `fix-<k>.md`; the reviewer `review-<k>.md`
-
-**Interfaces:**
-- Consumes: Task 0's worktree `.claude/worktrees/ten-L10` on `ten/L10`, its server on port 8970 (started and stopped by the coordinator), `$TEN/lanes.mjs`, `$TEN/frametimes.mjs`, the shared-file version N in the ledger; Phase 0's shared files, its mode press (the shared script presses nothing on a loop after See inside or Compare) and its page check; the rollout's review kit and wait tool.
-- Produces: branch `ten/L10`: the card `['lightning','Lightning','Jagged bolts strike from the clouds and light up the sky. Best for dramatic intros.']` (07.26), `PV` key `'lightning':'lightning'`, `PLACES` `['bg','intro']`, `FIND` `'lightning':['background shape','loop click','glitch color']`; Previous: Game of Life (for now: Task 11 points it at the page before it in the section); no Next link yet. The reports in `$TEN/reports/L10/`, which the rollout's final review (part 9) reads too.
-
-- [ ] **Step 1: The lane's shared edits (the failing tests)**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-node $TEN/lanes.mjs 10 .
-git status --short
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)" | head -10
-```
-
-Expected: `lane 10 shared edits applied to .`; then ` M .github/ISSUE_TEMPLATE/config.yml`, ` M 404.html`, ` M README.md`, ` M animations/07-ambient-background/README.md`, ` M index.html`; then these 6 failing tests and `ℹ fail 6`: `✖ make-famous: on the real home page every card builds, but the eight whose previews need a script or animate in SVG`, `✖ the answers keep the rules every page of a kind shares: transitions answer newpage, loops loop, scroll pages scroll`, `✖ the Full catalog in the root README lists every card once, in home order, linked to its live page`, `✖ the counts written in the issue template, the 404 page and the sitemap match the cards`, `✖ the skill and llms.txt are what tools/make-skill.mjs writes from the pages and the home page now`, `✖ llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files`. (Famous effects' test builds every card's preview, which Step 4 adds; the finder's reads each page's kind, from a page that is not there yet; this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave exactly these.) If `lanes.mjs` stops with `not found (…)`, stop and tell the coordinator, who alone edits `$TEN/lanes.mjs`; before running it again, put the worktree back with `git checkout -- .` (this step makes no other changes; the tool refuses a second run on a changed tree).
-
-- [ ] **Step 2: Write the page: `animations/07-ambient-background/lightning/index.html`**
-
-```html
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Lightning — Animation Handbook</title>
- <meta name="description" content="Jagged bolts strike from the clouds and light up the sky. Best for dramatic intros.">
- <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/lightning/">
- <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
- <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
- <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
- <meta property="og:type" content="article">
- <meta property="og:site_name" content="Animation Handbook">
- <meta property="og:title" content="Lightning — Animation Handbook">
- <meta property="og:description" content="Jagged bolts strike from the clouds and light up the sky. Best for dramatic intros.">
- <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/lightning/">
- <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:title" content="Lightning — Animation Handbook">
- <meta name="twitter:description" content="Jagged bolts strike from the clouds and light up the sky. Best for dramatic intros.">
- <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
- <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Lightning", "name": "Lightning", "description": "Jagged bolts strike from the clouds and light up the sky. Best for dramatic intros.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/lightning/", "inLanguage": "en", "articleSection": "Ambient & Background", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Ambient & Background, Lightning"}</script>
- <style>
- :root{--ui-accent:#ffce5a}
- *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
- .stage{position:relative;overflow:hidden;background:linear-gradient(#0b1020,#1a2236 55%,#262c40)}
- /* The storm in layers: clouds (moved by the script), the rain on one canvas, the bolts on another, the hills in front, and
- the light of the sky as a white layer whose opacity the script sets (never above 30%) */
- .clouds{position:absolute;left:0;top:-4%;width:200%;height:44%;background-size:50% 100%;background-repeat:repeat-x;pointer-events:none}
- .c1{background-image:radial-gradient(30% 46% at 18% 30%,#3a4258,#0000 70%),radial-gradient(26% 38% at 52% 20%,#323a50,#0000 70%),radial-gradient(34% 44% at 84% 34%,#3a4258,#0000 70%)}
- .c2{top:4%;opacity:.8;background-image:radial-gradient(24% 34% at 30% 46%,#2a3146,#0000 70%),radial-gradient(30% 40% at 72% 40%,#2e354b,#0000 70%)}
- #cvs,.rain{position:absolute;inset:0;width:100%;height:100%;display:block}
- .rain{pointer-events:none}
- #cvs:focus-visible{outline:2px solid var(--ui-accent);outline-offset:-3px}
- .hills{position:absolute;left:0;bottom:0;width:100%;height:30%;display:block;pointer-events:none}
- .flash{position:absolute;inset:0;background:#fff;opacity:0;pointer-events:none}
- /* See inside and Compare: plain words over the picture */
- .lt-lbl{display:none;position:absolute;max-width:46%;padding:3px 8px;border-radius:6px;background:rgba(8,10,18,.9);color:#f4f4f2;
- font:600 13px/1.25 var(--hb-font);pointer-events:none}
- .stage[data-hb-mode="inside"] .in,.stage[data-hb-mode="compare"] .half{display:block}
- .half{top:10px}.half.first{left:10px}.half.second{left:calc(50% + 10px)}
- </style>
- <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
- <script src="../../../assets/js/demo-page.js?v=10" defer></script>
-</head>
-<body class="hb" data-hb-kind="loop">
-<nav class="hb-bar" aria-label="Animation Handbook">
- <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../game-of-life/" rel="prev" aria-label="Previous: Game of Life"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Game of Life</span></a></span>
- <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>
-</nav>
-<main class="hb-page">
- <header class="hb-head">
- <p class="hb-cat">07.26 · Ambient &amp; Background</p>
- <h1>Lightning</h1>
- <p class="hb-lede">Jagged bolts strike from the clouds and light up the sky. Best for dramatic intros.</p>
- </header>
-
- <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">1</span>
- <div><h2 id="hb-watch-title">Watch it</h2><p>It moves by itself. Click or tap the sky to make a bolt strike there.</p></div>
- </div>
- <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>
- <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>
- <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>
- <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>
- </div>
- <div class="stage">
- <i class="clouds c1" aria-hidden="true"></i><i class="clouds c2" aria-hidden="true"></i>
- <canvas class="rain" aria-hidden="true"></canvas>
- <canvas id="cvs" role="img" tabindex="0" aria-label="A storm over dark hills where a bolt strikes every few seconds. Click, or press Enter or Space, to make one strike."></canvas>
- <svg class="hills" viewBox="0 0 1000 300" preserveAspectRatio="none" aria-hidden="true"><path fill="#141a2a" d="M0 120Q140 40 300 110T620 90T1000 110V300H0Z"/><path fill="#0b0f1a" d="M0 190Q200 130 380 180T760 160T1000 170V300H0Z"/></svg>
- <i class="flash" aria-hidden="true"></i>
- <p class="lt-lbl in" id="l-straight" aria-hidden="true" data-hb-caption>Starts straight</p>
- <p class="lt-lbl in" id="l-split" aria-hidden="true" data-hb-caption>Each split pushes the middle aside, less each time</p>
- <p class="lt-lbl in" id="l-fork" aria-hidden="true" data-hb-caption>Forks branch off</p>
- <p class="lt-lbl in" id="l-glow" aria-hidden="true" data-hb-caption>Glow · a wide, faint copy</p>
- <p class="lt-lbl half first" aria-hidden="true" data-hb-caption>Even zigzag</p>
- <p class="lt-lbl half second" aria-hidden="true" data-hb-caption>Random splits</p>
- </div>
- <div class="hb-player">
- <button class="hb-play" type="button" id="btn-pause" data-hb-pause data-state="playing"><svg class="hb-ic hb-i-pause" viewBox="0 0 24 24" aria-hidden="true"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg><svg class="hb-ic hb-i-play" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3l14 9-14 9z"/></svg><span class="hb-pause-label">Pause</span></button>
- <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>
- </div>
- <div class="hb-mode-notes" aria-live="polite">
- <p data-hb-for="inside" hidden>Inside, each bolt is drawn round by round: a straight line, split again and again with each middle pushed aside by less, then forks and a soft glow.</p>
- <p data-hb-for="compare" hidden>On the left, Even zigzag bends in equal steps, so it looks drawn. On the right, Random splits pushes each split aside by less, so it has big bends and fine jitter.</p>
- </div>
- </section>
-
- <section class="hb-step hb-try" aria-labelledby="hb-try-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">2</span>
- <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and see the difference as it moves.</p></div>
- </div>
- <div class="hb-settings">
- <div class="hb-setting">
- <p class="hb-setting-name" id="often-lbl">How often</p>
- <div class="seg" id="often-seg" role="group" aria-labelledby="often-lbl">
- <button type="button" data-often="rarely" aria-pressed="false">Rarely</button>
- <button type="button" data-often="sometimes" class="on" aria-pressed="true">Sometimes</button>
- <button type="button" data-often="often" aria-pressed="false">Often</button>
- </div>
- <p class="hb-hint">Rarely keeps it calm behind text.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="forks-lbl">Branches</p>
- <div class="seg" id="forks-seg" role="group" aria-labelledby="forks-lbl">
- <button type="button" data-forks="2" aria-pressed="false">Few</button>
- <button type="button" data-forks="4" class="on" aria-pressed="true">Some</button>
- <button type="button" data-forks="7" aria-pressed="false">Many</button>
- </div>
- <p class="hb-hint">How many thinner forks split off.</p>
- </div>
- <div class="hb-setting">
- <p class="hb-setting-name" id="color-lbl">Bolt color</p>
- <div class="swatches" id="color-sw" role="group" aria-labelledby="color-lbl">
- <button type="button" class="on" aria-pressed="true" aria-label="White" data-rgb="235,240,255" style="background:#ebf0ff"></button>
- <button type="button" aria-pressed="false" aria-label="Blue" data-rgb="140,196,255" style="background:#8cc4ff"></button>
- <button type="button" aria-pressed="false" aria-label="Violet" data-rgb="200,164,255" style="background:#c8a4ff"></button>
- </div>
- <p class="hb-hint">The bolt and its glow.</p>
- </div>
- </div>
- <details class="hb-options">
- <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
- <div class="hb-settings">
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Lights up the sky</span><input class="hb-switch" type="checkbox" role="switch" id="sky-tog" checked autocomplete="off"></label>
- <p class="hb-hint">The sky glows softly with each strike.</p>
- </div>
- <div class="hb-setting">
- <label class="hb-switch-row"><span>Rain</span><input class="hb-switch" type="checkbox" role="switch" id="rain-tog" checked autocomplete="off"></label>
- <p class="hb-hint">Light rain falls through the storm.</p>
- </div>
- </div>
- </details>
- </section>
-
- <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
- <div class="hb-step-head">
- <span class="hb-num" aria-hidden="true">3</span>
- <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
- </div>
- <div class="hb-card">
- <p class="hb-prompt">Add lightning to [the dark section or storm scene you want it in]. Every so often, draw a jagged bolt from the clouds to the ground on a canvas: start from a straight line, split it again and again, pushing each new midpoint sideways at random by less each time, and let thinner forks branch off. Draw a wide, faint stroke under a thin bright one for the glow; the bolt flickers once and fades within half a second. When the settings include it, light the sky softly, never more than twice a second. A click or tap strikes where the visitor points. If the visitor has reduced motion turned on, show a still bolt with no flash. Match the settings listed below.</p>
- <div class="hb-chips-box" hidden>
- <p class="hb-chips-title">Your settings</p>
- <ul class="hb-chips"></ul>
- </div>
- <div class="hb-copy-row">
- <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
- <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
- </div>
- </div>
- <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>
- </section>
-
- <section class="hb-about" aria-labelledby="hb-what-title">
- <div class="hb-what">
- <h2 id="hb-what-title">What it is</h2>
- <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
- </div>
- <div class="hb-fit">
- <h2>Good for</h2>
- <ul class="hb-tags hb-good"><li>Game sites</li><li>Storm and weather themes</li><li>Dramatic intros</li></ul>
- <h3>Avoid on</h3>
- <ul class="hb-tags hb-avoid"><li>Reading pages</li><li>Calm or health sites</li></ul>
- </div>
- </section>
-
- <section class="hb-related" aria-labelledby="hb-related-title" hidden>
- <h2 id="hb-related-title">Similar animations</h2>
- <div class="hb-rel-list"></div>
- </section>
-</main>
-<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>
-<script>
- const cvs=document.getElementById('cvs'),ctx=cvs.getContext('2d'),stage=cvs.parentElement,rain=stage.querySelector('.rain'),rctx=rain.getContext('2d');
- const clouds=[...stage.querySelectorAll('.clouds')],flash=stage.querySelector('.flash');
- const slowTog=document.getElementById('slow-tog'),skyTog=document.getElementById('sky-tog'),rainTog=document.getElementById('rain-tog');
- const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),phone=matchMedia('(max-width:600px),(max-height:500px)');
- const FRAME=1000/60,GAP=1500; // safety: strikes start at least 1.5 s apart, whatever is pressed, so at most two flashes in any second
- const EVERY={rarely:[5000,8000],sometimes:[2600,4400],often:[1600,2400]}; // the wait between strikes, in ms, picked at random
- const LABELS={normal:'A storm over dark hills where a bolt strikes every few seconds. Click, or press Enter or Space, to make one strike.',
- inside:'The bolt drawn round by round: a straight line split again and again, its forks numbered and its glow. Click, or press Enter or Space, to strike.',
- compare:'Two bolts strike together: an even zigzag on the left and random splits on the right. Click, or press Enter or Space, to strike.'};
- let often='sometimes',forks=4,rgb=[235,240,255],mode='normal',paused=false;
- let W=0,H=0,raf=0,lastT=null,t=0,lastStrike=-1e9,nextAt=900,pending=null,strike=null,drops=[],shownKey='';
- let seed=5;const rand=()=>{seed=seed+0x6D2B79F5|0;let x=Math.imul(seed^seed>>>15,1|seed);x=x+Math.imul(x^x>>>7,61|x)^x;return((x^x>>>14)>>>0)/4294967296};
- // A bolt from (x0, y0) to (x1, y1), split rounds times: each segment's midpoint is pushed sideways at random by up to off,
- // and off halves every round. Every round is kept, so See inside can draw them one after another.
- function split(x0,y0,x1,y1,rounds,off){
- let pts=[[x0,y0],[x1,y1]];const steps=[pts];
- for(let k=0;k<rounds;k++,off/=2){
- const next=[pts[0]];
- for(let i=1;i<pts.length;i++){const [ax,ay]=pts[i-1],[bx,by]=pts[i],l=Math.hypot(bx-ax,by-ay)||1,o=(rand()*2-1)*off;
- next.push([(ax+bx)/2-(by-ay)/l*o,(ay+by)/2+(bx-ax)/l*o],pts[i])}
- steps.push(pts=next);
- }
- return steps;
- }
- // The common mistake: the same line bent in equal steps, from side to side, like an icon
- function zigzag(x0,y0,x1,y1){
- const n=8,l=Math.hypot(x1-x0,y1-y0),a=l*.06,pts=[];
- for(let i=0;i<=n;i++){const s=i%2?a:-a,k=i/n,e=i===0||i===n?0:s;pts.push([x0+(x1-x0)*k-(y1-y0)/l*e,y0+(y1-y0)*k+(x1-x0)/l*e])}
- return [pts];
- }
- // A whole strike in a rectangle (x, w): the main bolt from the clouds to (tx, ty), and its forks from points along it (fp: where
- // along the bolt each fork starts, its side and its length as a share of the bolt's); even: the mistake, zigzags in equal steps
- function makeBolt(x,w,tx,ty,even,fp){
- const sx=Math.min(x+w-8,Math.max(x+8,tx+(rand()-.5)*w*.25)),sy=H*.1,len=Math.hypot(tx-sx,ty-sy);
- const main=even?zigzag(sx,sy,tx,ty):split(sx,sy,tx,ty,7,len*.22),line=main[main.length-1],fk=[];
- for(const [at,side,k] of fp){const p=line[Math.floor(at*(line.length-1))],fl=len*k,ex=p[0]+side*fl*.6,ey=p[1]+fl*.8;
- fk.push(even?zigzag(p[0],p[1],ex,ey):split(p[0],p[1],ex,ey,5,fl*.2))}
- return {main,forks:fk};
- }
- // The bolts of a strike that lands at (tx, ty): one for Normal and See inside, and for Compare one in each half, at the same place
- // in its half, with forks in the same places. A resize or a new number of branches draws them again for the same spot, keeping
- // the strike's time.
- function bolts(tx,ty){
- const half=W/2,u=tx/W,fp=[...Array(forks)].map(()=>[.18+.55*rand(),rand()<.5?-1:1,.22+.2*rand()]);
- return {tx,ty,bolt:makeBolt(0,W,tx,ty,false,fp),left:makeBolt(0,half,u*half,ty,true,fp),right:makeBolt(half,half,half+u*half,ty,false,fp)};
- }
- // A strike where the visitor pointed, or on the ground under a random spot
- function strikeNow(at){
- strike={at:t,still:false,full:false,...bolts(at?at.x:W*(.25+.5*rand()),at?at.y:H*(.74+.06*rand()))};
- lastStrike=t;nextAt=t+EVERY[often][0]+rand()*(EVERY[often][1]-EVERY[often][0]);
- placeLabels();
- }
- function redrawBolts(){if(strike){Object.assign(strike,bolts(strike.tx,strike.ty));placeLabels()}draw()}
- // How bright a strike is, age ms after it began: a flicker (bright, dim, bright) that fades within half a second; under reduced
- // motion a soft fade in and out with no flicker
- function bright(age){
- if(reduceMQ.matches)return age<250?age/250:age<600?1:age<1100?1-(age-600)/500:0;
- return age<60?1:age<120?.35:age<180?.9:age<500?.9*(1-(age-180)/320):0;
- }
- const col=a=>`rgba(${rgb.join()},${a})`;
- let numFont='700 12px sans-serif'; // the site font for the forks' numbers, read once the page's styles are in (resize)
- function stroke(pts,w,style,dash){ctx.lineWidth=w;ctx.strokeStyle=style;ctx.setLineDash(dash||[]);ctx.beginPath();pts.forEach(([x,y],i)=>i?ctx.lineTo(x,y):ctx.moveTo(x,y));ctx.stroke()}
- // A bolt as it looks: a wide, faint stroke for the glow under a thin bright one (no shadow blur); forks thinner, all of them in
- // one path, so a frame of a flash strokes four paths a bolt
- function strokeAll(lines,w,style){ctx.lineWidth=w;ctx.strokeStyle=style;ctx.setLineDash([]);ctx.beginPath();for(const pts of lines)pts.forEach(([x,y],i)=>i?ctx.lineTo(x,y):ctx.moveTo(x,y));ctx.stroke()}
- function drawBolt(b,a){
- if(a<=0)return;
- const main=[b.main[b.main.length-1]],forks=b.forks.map(f=>f[f.length-1]);
- strokeAll(main,11,col(.18*a));strokeAll(forks,6.5,col(.18*a));strokeAll(main,2.2,`rgba(255,255,255,${a})`);strokeAll(forks,1.3,`rgba(255,255,255,${a})`);
- }
- // See inside: the bolt round by round (the straight line dashed, each later round lighter, the pushed points dotted), then the
- // forks numbered, then the glow. A strike builds it a round every 110 ms; between strikes the last drawing stays, faint.
- function drawRounds(b,age){
- const shown=age===null?99:age/110,f=age===null||age>1800?.7:1,main=b.main;
- main.forEach((pts,k)=>{if(k>shown)return;
- if(k===0)stroke(pts,1.5,`rgba(220,226,240,${.8*f})`,[6,6]);
- else stroke(pts,k===7?2.2:1.2,k===7?`rgba(255,255,255,${f})`:`rgba(${rgb.join()},${(.15+.08*k)*f})`);
- if(k>0&&k<5){ctx.fillStyle=`rgba(255,206,90,${.9*f})`;pts.forEach((p,i)=>{if(i%2){ctx.beginPath();ctx.arc(p[0],p[1],k<3?3:2,0,6.283);ctx.fill()}})}});
- if(shown>8)b.forks.forEach((fk,i)=>{const pts=fk[fk.length-1],q=pts[Math.floor(pts.length*.55)];stroke(pts,1.2,col(.8*f));
- // the fork's number sits a little way along the fork, clear of the main bolt
- ctx.fillStyle=`rgba(8,10,18,${.9*f})`;ctx.beginPath();ctx.arc(q[0],q[1],9,0,6.283);ctx.fill();
- ctx.fillStyle=`rgba(255,255,255,${f})`;ctx.font=numFont;ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText(i+1,q[0],q[1]+.5)});
- if(shown>9)stroke(main[7],11,col(.18*f));
- }
- // The rain has its own canvas, drawn every frame; the bolts' canvas is drawn only when it changes
- function drawRain(){
- rctx.clearRect(0,0,W,H);
- if(!rainTog.checked)return;
- rctx.strokeStyle=mode==='inside'?'rgba(170,190,230,.15)':'rgba(170,190,230,.35)';rctx.lineWidth=1;rctx.beginPath();
- for(const d of drops){rctx.moveTo(d.x,d.y);rctx.lineTo(d.x-2,d.y+d.l)}rctx.stroke();
- }
- function drawBolts(){
- ctx.clearRect(0,0,W,H);
- // a still bolt (paused, under reduced motion or after a click while paused) shows at full strength with no light in the sky
- const age=strike?t-strike.at:1e9,a=strike?(strike.still?1:bright(age)):0;
- ctx.lineCap=ctx.lineJoin='round';
- if(mode==='inside'&&strike)drawRounds(strike.bolt,age<2000&&!strike.still&&!strike.full?age:null);
- else if(mode==='compare'&&strike){
- // each half's bolt stays inside its own half, even where its bends or forks reach toward the other
- [strike.left,strike.right].forEach((b,i)=>{ctx.save();ctx.beginPath();ctx.rect(i?W/2+1:0,0,W/2-1,H);ctx.clip();drawBolt(b,a);if(a<=0)drawBolt(b,.3);ctx.restore()});
- ctx.fillStyle='#05070d';ctx.fillRect(W/2-1,0,2,H)}
- else if(strike)drawBolt(strike.bolt,a);
- flash.style.opacity=mode!=='inside'&&skyTog.checked&&!reduceMQ.matches&&strike&&!strike.still?(.3*a).toFixed(3):0;
- }
- function draw(){drawRain();drawBolts();shownKey=boltKey()}
- // What the bolts' canvas shows, as a key that changes every frame while a strike flashes and once a round (every 110 ms)
- // while See inside builds it; the loop draws the canvas again only when the key changes
- function boltKey(){
- if(!strike||strike.still)return mode+'still';
- const age=t-strike.at;
- if(mode==='inside')return strike.full||age>=2000?'built':'round'+Math.floor(age/110);
- return age<(reduceMQ.matches?1100:600)?'flash'+t:'after';
- }
- // See inside's labels beside the parts they name, on the side of the bolt and its forks where the box has more room
- function placeLabels(){
- if(!strike)return;
- const pts=[...strike.bolt.main[7],...strike.bolt.forks.flatMap(fk=>fk[fk.length-1])],xs=pts.map(p=>p[0]);
- const lo=Math.min(...xs),hi=Math.max(...xs),right=W-hi>lo,f=strike.bolt.forks[0];
- // each label at its height, or just under the one above when that one wraps onto more lines
- let below=0;
- const put=(id,y)=>{const el=document.getElementById(id),w=el.offsetWidth,top=Math.max(8,below+6,Math.min(H-el.offsetHeight-8,y));
- el.style.left=Math.max(8,Math.min(W-w-8,right?hi+20:lo-20-w))+'px';el.style.top=top+'px';below=top+el.offsetHeight};
- put('l-straight',H*.08);put('l-split',H*.3);put('l-fork',f?Math.min(H*.58,Math.max(H*.5,f[0][0][1]-10)):H*.52);put('l-glow',H*.72);
- }
- // The rain falls by the time that passed; fewer drops on phones
- function makeRain(){drops=Array.from({length:phone.matches?70:160},()=>({x:rand()*(W+40),y:rand()*H,l:8+rand()*10,v:.5+rand()*.3}))}
- // The loop moves the rain and the clouds and keeps the strikes by the time that passed (a third of it in slow motion). A strike
- // the visitor asked for waits until the gap since the last one is over.
- function loop(ts){
- raf=requestAnimationFrame(loop);
- if(lastT===null){lastT=ts;return}
- const dt=Math.min(ts-lastT,50)*(slowTog.checked?1/3:1);lastT=ts;t+=dt;
- if(t-lastStrike>=GAP&&(pending||t>=nextAt)){strikeNow(pending);pending=null}
- for(const d of drops){d.y+=d.v*dt;d.x-=d.v*dt*.12;if(d.y>H){d.y=-d.l;d.x=rand()*(W+40)}}
- clouds.forEach((c,i)=>{c.style.transform=`translateX(${-((t*(i?.006:.01))%W).toFixed(1)}px)`});
- drawRain();
- const key=boltKey();
- if(key!==shownKey){drawBolts();shownKey=key}
- }
- function start(){if(raf||paused)return;lastT=null;raf=requestAnimationFrame(loop)}
- // Registered at the top level: under reduced motion the shared script pauses the loop at once, on a still bolt
- // A still bolt starts fading when the loop plays again
- document.addEventListener('hb:pause',e=>{
- paused=e.detail.paused;notes();
- if(paused){cancelAnimationFrame(raf);raf=0;draw();return}
- if(strike&&strike.still){strike.still=false;strike.at=t-(reduceMQ.matches?600:180)}
- start();
- });
- document.addEventListener('visibilitychange',()=>{lastT=null});
- // The mode switch draws the mode at once; See inside opened while paused shows the last bolt's whole drawing
- document.addEventListener('hb:mode',e=>{mode=e.detail.mode;if(paused&&strike)strike.full=true;cvs.setAttribute('aria-label',LABELS[mode]);placeLabels();draw()});
- // A click, a tap, or Enter or Space on the box asks for a strike there (the middle, from the keyboard). While paused it draws a
- // new still bolt there at once, with no flash.
- function ask(at){
- if(!paused){pending=at;return}
- strikeNow(at);strike.still=true;lastStrike=-1e9;draw();
- }
- cvs.addEventListener('click',e=>{const r=cvs.getBoundingClientRect();ask({x:e.clientX-r.left,y:Math.max(H*.3,e.clientY-r.top)})});
- cvs.addEventListener('keydown',e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();ask({x:W/2,y:H*.62})}});
- function resize(){
- const w=stage.clientWidth,h=stage.clientHeight;if(!w||!h||(w===W&&h===H))return;
- const sx=W?w/W:1,sy=H?h/H:1;W=w;H=h;
- // thin lines stay sharp enough at one and a half pixels per CSS pixel, which spares a phone almost half the work
- const dpr=Math.min(devicePixelRatio||1,1.5);
- for(const [c,g] of [[cvs,ctx],[rain,rctx]]){c.width=W*dpr;c.height=H*dpr;g.setTransform(dpr,0,0,dpr,0,0)}
- numFont='700 12px '+getComputedStyle(stage).getPropertyValue('--hb-font');
- makeRain();
- if(strike){strike.tx*=sx;strike.ty*=sy}
- redrawBolts();
- }
- function choices(id,pick){
- const buttons=document.querySelectorAll('#'+id+' button');
- buttons.forEach(b=>b.addEventListener('click',()=>{
- buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
- pick(b.dataset);
- }));
- }
- // Branches and colors show at once, on the bolt on screen; How often counts from the next strike
- choices('often-seg',d=>{often=d.often;nextAt=Math.min(nextAt,lastStrike+EVERY[often][1])});
- choices('forks-seg',d=>{forks=+d.forks;redrawBolts()});
- choices('color-sw',d=>{rgb=d.rgb.split(',').map(Number);draw()});
- skyTog.addEventListener('change',draw);
- rainTog.addEventListener('change',draw);
- new ResizeObserver(resize).observe(stage);
- resize();
- // Under reduced motion the loop starts paused on a still bolt, and the notes say so while it is paused; playing, the markup's
- // words hold
- const said={inside:document.querySelector('[data-hb-for="inside"]').textContent,compare:document.querySelector('[data-hb-for="compare"]').textContent};
- const STILL={inside:'Shown still: the bolt is a straight line split again and again, each middle pushed aside by less, with its forks numbered and a soft glow.',
- compare:'Shown still: on the left, Even zigzag bends in equal steps, so it looks drawn; on the right, Random splits has big bends and fine jitter.'};
- function notes(){const still=reduceMQ.matches&&paused;for(const k of ['inside','compare'])document.querySelector(`[data-hb-for="${k}"]`).textContent=still?STILL[k]:said[k]}
- if(reduceMQ.matches){strikeNow({x:W*.62,y:H*.78});strike.still=true;lastStrike=-1e9;draw()}
- notes();
- start();
-</script>
-</body>
-</html>
-```
-
-Then give it the shared-file version the branch uses (the ledger's N; nothing changes when N is 10):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-N=$(grep -o 'shared files ?v=[0-9]*' $TEN/ledger.md | head -1 | grep -o '[0-9]*$')
-sed -i "s/demo-page\.css?v=10/demo-page.css?v=$N/; s/demo-page\.js?v=10/demo-page.js?v=$N/" animations/07-ambient-background/lightning/index.html
-grep -c "demo-page\.css?v=$N\|demo-page\.js?v=$N" animations/07-ambient-background/lightning/index.html
-```
-
-Expected: `2`.
-
-- [ ] **Step 3: Write the README: `animations/07-ambient-background/lightning/README.md`**
-
-````markdown
-# Lightning
-
-[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/lightning/)
-
-## What it is
-Lightning draws jagged bolts that strike from the clouds to the ground every few seconds, flicker once and fade, while the sky lights up softly behind them. Each bolt is new: it starts as a straight line that is split again and again, every split pushing its middle aside by a little less, which gives the big bends and the fine jitter of real lightning. A click or tap makes a bolt strike where the visitor points.
-
-## When to use it
-- Game sites and trailers that want a dramatic opening
-- Storm, weather and night themes
-- Event and launch intros with a burst of energy
-- Halloween and fantasy pages
-
-## How it works
-A bolt is built once per strike, by midpoint displacement. It starts as one segment from a point in the clouds to the spot it strikes. Each round splits every segment in two and pushes the new midpoint sideways, at random, by up to a set distance; that distance halves every round. Seven rounds turn the straight line into 129 points: the first rounds make the large bends, the later ones the fine jitter. Every round is kept, so the demo's See inside can draw them one after another:
-
-```js
-function split(x0, y0, x1, y1, rounds, off) {
- let pts = [[x0, y0], [x1, y1]]; const steps = [pts];
- for (let k = 0; k < rounds; k++, off /= 2) {
- const next = [pts[0]];
- for (let i = 1; i < pts.length; i++) {
- const [ax, ay] = pts[i - 1], [bx, by] = pts[i], l = Math.hypot(bx - ax, by - ay) || 1, o = (rand() * 2 - 1) * off;
- next.push([(ax + bx) / 2 - (by - ay) / l * o, (ay + by) / 2 + (bx - ax) / l * o], pts[i]);
- }
- steps.push(pts = next);
- }
- return steps;
-}
-```
-
-The first push is about a fifth of the bolt's length. Forks start at points along the finished bolt and are split five times on their own, shorter and thinner. Each bolt is drawn twice on the canvas, with no shadow blur: a wide, faint stroke in the bolt's color for the glow, then a thin white one on top. Its brightness follows the time since the strike: full, dim, full again within a fifth of a second, then a fade to nothing by half a second. The sky's light is a white layer over the scene whose opacity is that brightness times 0.3, so it is never more than 30% white. Rain is a set of short lines moved by the time that passed; the clouds are two soft layers slid sideways with transforms.
-
-**Safety.** A strike starts at least 1.5 seconds after the one before, whatever is pressed: a click that comes sooner waits its turn. One strike flashes twice (bright, dim, bright), so the scene never flashes more than twice in any second, well within the limit of three that keeps flashing content safe for people with photosensitive epilepsy.
-
-## Key parameters
-| Parameter | Default | Effect |
-|-----------|---------|--------|
-| How often | Sometimes | The wait between strikes, picked at random: rarely is 5 to 8 seconds, sometimes 2.6 to 4.4 seconds and often 1.6 to 2.4 seconds; never less than 1.5 seconds |
-| Branches | Some | How many thinner forks split off the bolt: few is 2, some 4 and many 7 |
-| Bolt color | White | The color of the glow around the white core: white, blue or violet |
-| Lights up the sky | on | The sky turns at most 30% white with each strike and follows its flicker; off, only the bolt flashes |
-| Rain | on | 160 thin raindrops fall at a slant (70 on phones); off, the sky is clear of rain |
-
-## Production notes
-- **Flash safely.** Keep strikes at least a second and a half apart, cap the sky's light (here 30% white) and never flash a large area at full white. Under reduced motion, show a still bolt and fade bolts in and out with no flicker and no sky light.
-- **No shadow blur.** Canvas `shadowBlur` on a long path is slow on phones; a wide, faint stroke under the bright one gives the glow for the cost of one more line.
-- **Build once per strike.** The bolt's points are worked out when it strikes, not every frame; each frame only draws the saved lines.
-- **Layers that need no redraw.** The clouds and hills are elements of their own, moved with transforms or not at all; only the rain and the bolt are drawn on the canvas each frame.
-- **Libraries.** Three.js and PixiJS draw the same polylines as lines or meshes with additive blending; GSAP can drive the flicker and the sky's opacity with a short timeline.
-
-## See also
-- [Fireworks](../fireworks/) — bright strokes with a soft glow on a canvas
-- [Snow / Rain](../snow-rain/) — rain and snow falling over a scene
-- [Flash / Light Leak Transition](../../03-page-transitions/flash-transition/) — a flash kept within safe limits
-````
-
-- [ ] **Step 4: The home page preview**
-
-In the worktree's `index.html`: (a) insert these lines, and one empty line after them, right before the line `/* ── bespoke: added demos ── */` (the end of the 07 bespoke block):
-
-```css
-.pv-lightning{background:linear-gradient(#0b1020,#1a2236 60%,#262c40);overflow:hidden}
-.pv-lightning .hl{position:absolute;left:0;right:0;bottom:0;height:30%;background:radial-gradient(70% 90% at 25% 100%,#141a2a 60%,#0000 61%),radial-gradient(80% 100% at 85% 100%,#0b0f1a 60%,#0000 61%)}
-.pv-lightning .bt{position:absolute;inset:0;width:100%;height:100%;opacity:0;animation:lightning-bolt 3s linear infinite}
-.pv-lightning .bt path{fill:none;stroke-linecap:round;stroke-linejoin:round}
-.pv-lightning .g{stroke:rgba(200,215,255,.28);stroke-width:5}.pv-lightning .c{stroke:#fff;stroke-width:1.4}.pv-lightning .f{stroke-width:.9}
-.pv-lightning .fl{position:absolute;inset:0;background:#fff;opacity:0;animation:lightning-sky 3s linear infinite}
-@keyframes lightning-bolt{0%{opacity:0}1.5%{opacity:1}3%{opacity:.35}4.5%{opacity:.9}14%,100%{opacity:0}}
-@keyframes lightning-sky{0%{opacity:0}1.5%{opacity:.22}3%{opacity:.08}4.5%{opacity:.2}14%,100%{opacity:0}}
-```
-
-(b) insert this line right before the line that starts with `case 'aurora':` (after the end of the `case 'life':` block):
-
-```js
- case 'lightning': return '<span class="hl"></span><svg class="bt anim" viewBox="0 0 160 100"><path class="g" d="M96 6L88 22 94 30 80 46 86 52 74 70 78 76 70 88"/><path class="g" d="M86 52L98 62 96 72"/><path class="c" d="M96 6L88 22 94 30 80 46 86 52 74 70 78 76 70 88"/><path class="c f" d="M86 52L98 62 96 72"/></svg><span class="fl anim"></span>';
-```
-
-(c) in `const STILL={`, the map's last line ends with `izoom:.02` (the line before `};`): make it end with `izoom:.02,lightning:.016` (the middle of its loop is not a clear frame; reduced motion holds the preview there).
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-grep -c "pv-lightning" index.html; grep -c "case 'lightning':" index.html
-```
-
-Expected: a number above 1 (the preview's CSS rules), then `1` (its case).
-
-- [ ] **Step 5: Write the generated files, then the tests pass**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `ℹ fail 0` (this plan's run of every lane on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there, gave it: 1717 pass). If only `tests/finder.test.js` fails (its case 9 waits for Task 11 when the finder has changed since), note the failing lines in your report for Task 11 (lanes never change `tests/`) and go on; any other failure names what to fix in this lane's files.
-
-- [ ] **Step 6: The page check and the short screens (each a background command, waited on)**
-
-The coordinator's server for this lane answers on port 8970: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8970/` prints `200` (if not, ask the coordinator). The review kit finds pages under its own folder's root, so it runs from a copy in the worktree (`.superpowers/` is ignored by git):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/checks/L10 && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | grep -c superpowers
-```
-
-Expected: `0` (git does not see the copy). Then start these two, each as its own background command (the round number `1`, then `2`, `3` after fixes):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-node $RUN/slot.mjs run ten-L10 -- node tools/check-pages.mjs --base http://127.0.0.1:8970 --out $TEN/checks/L10/1 animations/07-ambient-background/lightning home > $TEN/checks/L10/1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L10/1.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-node $RUN/slot.mjs run ten-L10 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8970 --short --out $TEN/checks/L10/short-1 animations/07-ambient-background/lightning > $TEN/checks/L10/short-1.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L10/short-1.log
-```
-
-Wait on each with `node $RUN/wait-log.mjs $TEN/checks/L10/1.log` and `… short-1.log` (again while it says `still running`), then: `grep -c '^ok' $TEN/checks/L10/1.log; grep '^FAIL' $TEN/checks/L10/1.log; tail -2 $TEN/checks/L10/short-1.log`.
-
-Expected: `12` (six `ok` lines each for `lightning`, the home page), no `FAIL` line, and `27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed` with `EXIT=0` (this plan's runs gave exactly these). A `FAIL` line or a cut or overlapping label names the problem (the real branch may differ from the copy this plan was checked on; the ledger's first line says how): fix it in this lane's files, keeping the page's behavior, and run both again as round 2, 3; every round after a change ends with all lines `ok`.
-
-- [ ] **Step 7: Every choice in Try it, in both views (acceptance 7), and the motion in clips**
-
-Two background commands. The first runs the kit's gallery (pictures only: Normal, See inside and Compare at 1280 and 375) once with the defaults (`press-0`) and once for each choice that is not a default and each switch in Try it (never Loop, Slow motion, Pause or Play: playback is not a setting), each into its own folder. The second records the clips (Normal, See inside and Compare at 1280, about seven seconds each, frames kept) with the defaults (`clip-0`) and for each choice of the settings that change only timing or show only while the demo moves (G1, G11): the stills never show a run's middle.
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-i=0; for sel in "" "#often-seg [data-often='rarely']" "#often-seg [data-often='often']" "#forks-seg [data-forks='2']" "#forks-seg [data-forks='7']" "#color-sw [data-rgb='140,196,255']" "#color-sw [data-rgb='200,164,255']" "#sky-tog" "#rain-tog"; do echo "== press-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L10 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8970 --gallery ${sel:+--press "$sel"} --out $TEN/checks/L10/press-$i animations/07-ambient-background/lightning || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L10/press.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L10/press.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-i=0; for sel in "" "#often-seg [data-often='rarely']" "#often-seg [data-often='often']" "#sky-tog"; do echo "== clip-$i ${sel:-defaults}"; node $RUN/slot.mjs run ten-L10 -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8970 --only clips --keep-frames ${sel:+--press "$sel"} --out $TEN/checks/L10/clip-$i animations/07-ambient-background/lightning || echo "run $i failed"; i=$((i+1)); done > $TEN/checks/L10/clips.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L10/clips.log
-```
-
-Wait on each log with `node $RUN/wait-log.mjs`. Expected: 9 `== press-…` lines, each run ending `done 6 pictures, 0 clips and 0 comparisons made, 0 skipped, 0 failed`, and 4 `== clip-…` lines, each ending `done 0 pictures, 3 clips and 0 comparisons made, 0 skipped, 0 failed`; no `failed` line, no `was not found`, `EXIT=0` (the kit's lines as this plan's runs printed them). Read each gallery's See inside and Compare pictures at 1280 beside `press-0`'s: each choice visibly changes Normal and both views. Read three frames from the middle of each See inside and Compare clip (the log's `frames kept in <folder>` lines name the folders; for a timing choice, the same frames beside `clip-0`'s): the views move as the spec says, nothing jumps or covers the stage in mid-run (this plan's clips found See inside's small copy filling Pixelate Transition's stage while the blocks were small, a fault no still showed). A choice that changes nothing in a view is a fix (the owner's rule: every setting and control visibly changes the stage and both views). Then remove the frame folders: `grep -o 'frames kept in .*' $TEN/checks/L10/clips.log | sed 's/^frames kept in //' | while read -r f; do rm -rf "$f"; done`.
-
-- [ ] **Step 8: Look at the screenshots and check by hand**
-
-Open `$TEN/checks/L10/<round>/07-lightning-{desktop,phone,phone-reduced}-{inside,compare}.png`, the Normal ones and the short screens' pictures: both views read as the spec says, no label covers another or the part it names, nothing overflows at 320. Then, in the served page (a headless run through the pool, or by reading the code where a run cannot show it):
-
-- Bolts strike from the clouds and light the sky; a click or tap strikes there (a click, so a swipe that scrolls the page strikes nothing), and Enter or Space on the focused box strikes from its middle.
-- In Compare each half's bolt stays inside its half (both drawn clipped), and Branches reaches both halves: the even zigzag gets as many forks, short even zigzags from the same points (lesson 17).
-- Strikes start at least 1.5 s apart whatever is pressed, so never more than two flashes in any second: count the flash peaks at How often Often under clicks every 90 ms for 10 s (this plan's count: strikes 1.517 s apart, at most two peaks in any second); the sky light is at most 30% white.
-- Pause stops the strike timers and freezes rain, clouds and any bolt where they are; a click while paused draws a still bolt with no flash.
-- Under reduced motion the loop starts paused with a still bolt and no flash; See inside opened while paused draws a whole bolt; after Play the notes describe what moves (lesson 16).
-
-Decisions already made in this page (keep them; a reviewer weighs them): Compare's halves sit side by side at every width, so its note says left and right. Still bolts (paused clicks, reduced motion) never flash; the canvases are drawn at no more than 1.5 device pixels per CSS pixel. The rain has its own canvas, drawn every frame; the bolts' canvas is drawn again only when what it shows changes (every frame while a strike flashes, once a round while See inside builds it), which took a phone's slow frames in the views from about a third to 2%. A bolt is four paths (the glow and the core of the main line, then of all the forks together): with Compare's halves clipped and the zigzag given its forks, stroking each fork alone made 8 to 12% of a phone's frames in Compare slow.
-
-- [ ] **Step 9: Frame times (required: a canvas or mask page)**
-
-One background command, waited on with `wait-log.mjs`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-(node $RUN/slot.mjs run ten-L10 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8970 --modes normal,inside,compare animations/07-ambient-background/lightning; node $RUN/slot.mjs run ten-L10 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8970 --phone --modes normal,inside,compare animations/07-ambient-background/lightning; node $RUN/slot.mjs run ten-L10 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8970 animations/07-ambient-background/fireworks; node $RUN/slot.mjs run ten-L10 -- node $TEN/frametimes.mjs --base http://127.0.0.1:8970 --phone animations/07-ambient-background/fireworks) > $TEN/checks/L10/frames.log 2>&1; echo "EXIT=$?" >> $TEN/checks/L10/frames.log
-```
-
-Expected: a median of 16.7 ms in every mode at both sizes, and no larger share of frames slower than 20 ms than Fireworks measured the same way, within a few points (the machine's other work moves these numbers; run again when one looks off). This plan's runs: desktop 1 / 0 / 0%, phone 0 / 0 / 2% (up to 5% in Compare with the machine busy), after the bolts' canvas was made to redraw only when it changes (before: 30 to 37% in See inside and Compare on a phone) and a bolt's forks were stroked together (before: 8 to 12% in Compare on a phone); Fireworks 0% and 0 to 1%. A page that misses lightens its per-frame work (a smaller grid, fewer dots, less drawn per frame) until it meets this, and says what it changed.
-
-- [ ] **Step 10: Commit, and the build report**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-L10 || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = ten/L10 ] || exit 1
-git add -A && git status --short
-git commit -m "feat: 07.26 Lightning, with See inside and Compare from the start (lane 10)"
-git log --oneline -1
-```
-
-Expected before the commit: `A animations/07-ambient-background/lightning/README.md`, `A animations/07-ambient-background/lightning/index.html`, `M .github/ISSUE_TEMPLATE/config.yml`, `M 404.html`, `M README.md`, `M animations/07-ambient-background/README.md`, `M index.html`, `M llms.txt`, `M sitemap.xml` and the changed files under `skills/animation-handbook/`; nothing else (the kit's copy is ignored; logs and pictures are in `$TEN`). Then write `$TEN/reports/L10/build.md`: first line `RESULT: built <commit>`, then the line count, the page check's `ok` count and its round, the short screens' last line, the galleries and clips looked at (one line per choice: what changes in each view; one line per clip: what moves), the tests' pass and fail line, the frame times, the hand checks' results, every place the page departs from the spec or this task and why, and any shared-file need (the coordinator appends it to `$RUN/shared-wishes.md`; there should be none). Reply to the coordinator in at most three lines.
-
-- [ ] **Step 11: Review, at most three fix rounds**
-
-The coordinator dispatches a reviewer (strongest model, never the builder) with: the spec's section, this task, the builder's report, `git -C $REPO diff feat/ten-animations...ten/L10`, the newest check round and its screenshots, the short screens, the galleries, the clips and the frame times. The reviewer reads CLAUDE.md, the Global Constraints, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md` and, once it holds the owner's verdict, `$RUN/rulings-159.md`, and checks the diff against them, the rollout's acceptance list (section 1 of the rollout spec), the spec's section and the per-frame work, looking hard at the flash limit by count, not by reading; Pause stopping timers; the bolt kept inside the box and each Compare bolt inside its half; the paths a flash strokes each frame. It writes `$TEN/reports/L10/review-<k>.md`: first line `RESULT: approved` or `RESULT: changes <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines. Each fix round: the builder fixes, runs Steps 5 and 6 again (and the galleries, clips or frame times a fix touches), commits `fix: Lightning: <what>` after the branch check, writes `$TEN/reports/L10/fix-<k>.md` (`RESULT: built <commit>`), and the reviewer re-reviews only the fix. After three rounds the coordinator steps in. When approved, the coordinator stops the lane's server and adds the ledger line `<date time> L10 approved at <commit>; check rounds <k>; frames <numbers>; departures: <none or a list>; reports reports/L10/`.
-
----
-
-### Task 11: Integration: late rulings, the rollout's progress, the ten lanes in order, links, counts 176, test entries, finder rows, See also, every check (coordinator)
-
-The coordinator runs this task itself (coordination rule 6: it alone settles overlaps). A conflict `resolve.mjs` does not settle, any conflict outside `index.html`, `README.md` and `animations/*/README.md`, and every fix made here by hand get a fresh agent's review (strongest model) before their commit. Every block sets its own variables and checks its `cd` and, before a commit, the branch: a failed `cd` would otherwise run the rest in the main checkout, on the rollout's branch.
-
-**Files:**
-- Merge into `feat/ten-animations` (worktree `.claude/worktrees/ten-int`, served on port 8971): `feat/see-inside-compare`, then `ten/L1` … `ten/L10`
-- Modify (by `$TEN/integrate.mjs`): the pager lines of `magnifier-lens`, `card-deck-swipe`, `audio-visualizer`, `fire-effect`, `lightning` (Previous) and `before-after-slider`, `magnifier-lens`, `water-ripple`, `ken-burns`, `fire-effect` (Next); every count in `index.html`, `README.md`, `.github/ISSUE_TEMPLATE/config.yml`, `404.html`; `tests/pages.test.js` (`KEYBOARD_PAGES`, `PHONE_DEFAULTS`); `index.html` `FIND` and `tests/finder.test.js` case 9 (the finder is on the branch); See also: one line each in the READMEs of `clip-path-reveal`, `dissolve`, `spotlight-hover`, `swipe-to-dismiss`, `ambient-ripple`, `abstract-geometric-motion`, `infinite-zoom`, `fireworks` and `snow-rain` (the coordination file's "nine page READMEs, one See also line each"), and six between new pages (Before/After Slider and Magnifier Lens, Fire Effect and Lightning, Fire Effect and Water Ripple, each both ways); `CHANGELOG.md`; the ten pages' `?v=N`
-- Regenerate: `sitemap.xml`, `llms.txt`, `skills/animation-handbook/`, `og-image.png` (coordinator), `famous/index.html` blocks (once `famous/` exists)
-- Test: the tests; the page check of the ten new pages, the five old last pages, the eight other pages whose See also changed, `home` and `famous` (once it exists)
-- Write: `$TEN/checks/int/`, `$TEN/reports/rulings-check.md` (when Step 1 needs it), ledger lines
-
-**Interfaces:**
-- Consumes: the ten approved lanes (`ten/L<n>`, each with its ledger line `L<n> approved at <commit>` and its reports in `$TEN/reports/L<n>/`); `$TEN/resolve.mjs <file>...` (exit 0 when every overlap is settled, 1 when one is left for a person; it settles only conflicts written with their base, `-c merge.conflictStyle=diff3`); `$TEN/integrate.mjs <root>`; the build reports' notes for this task (a finder test a lane saw fail); the rollout's ledger line for the owner's first-batch verdict.
-- Produces: `feat/ten-animations` with 176 pages, linked, counted, committed and checked, ready for Task 12; ledger lines.
-
-- [ ] **Step 1: The ten approvals, and the owner's first-batch rules**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-grep -o ' L[0-9]* approved at' $TEN/ledger.md | sort -u | wc -l
-for n in 1 2 3 4 5 6 7 8 9 10; do a=$(grep " L$n approved at" $TEN/ledger.md | tail -1 | sed 's/.*approved at \([0-9a-f]*\).*/\1/'); [ -n "$a" ] && [ "$(git -C $REPO rev-parse "$a^{commit}")" = "$(git -C $REPO rev-parse ten/L$n)" ] && echo "L$n tip approved" || echo "L$n: its tip is not the approved commit"; done
-grep "^First batch approved by the owner on .*rulings-159\.md:" $RUN/ledger.md; grep " coord rulings check:" $TEN/ledger.md | tail -1
-```
-
-Expected: `10`; ten `L<n> tip approved` lines (a lane whose tip is not its approved commit goes back to its review first); then the rollout's verdict line (on 2026-10-15: `First batch approved by the owner on 2026-10-15; shared files at v=10; rulings-159.md: 0 rules`) and the last rulings check, if any. When the verdict line is there and `$TEN/ledger.md` has no `rulings check:` line yet, check all ten pages (no ledger time is needed): if the verdict says `rulings-159.md: 0 rules`, as it did, there is nothing to apply, and the coordinator writes `<date time> coord rulings check: none (0 rules)`; otherwise dispatch a fresh reviewer (strongest model) with `$RUN/rulings-159.md`, the rules it added to `$RUN/lessons.md` (`Owner (first batch) R<k>`), the ten pages (`git -C $REPO show ten/L<n>:<page folder>/index.html`) and their newest pictures in `$TEN/checks/L<n>/`. It writes `$TEN/reports/rulings-check.md`: first line `RESULT: none` or `RESULT: changes <count>`, then for each page what a rule changes. Each change goes through its lane's fix loop (the lane task's last step: the builder fixes and checks, the reviewer re-reviews, a new approval line); then the ledger line `<date time> coord rulings check: <none | L<n>, … fixed>` and this step again. While the verdict waits, go on: Task 12 Step 7 makes this check when it lands. A rule the owner gives later (a new `Owner …` line in `$RUN/lessons.md`) goes the same way.
-
-- [ ] **Step 2: The integration worktree, and the rollout's progress merged in first**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-git -C $REPO worktree add $REPO/.claude/worktrees/ten-int feat/ten-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = feat/ten-animations ] || exit 1
-git -c merge.conflictStyle=diff3 merge --no-ff --no-commit feat/see-inside-compare
-git status --short | grep -E '^(UU|AA|DU|UD) ' || echo "no conflicts"
-```
-
-Expected: `Automatic merge went well; stopped before committing as requested` (or `Already up to date.` when the rollout has not moved since Task 0), then `no conflicts` (nothing on `feat/ten-animations` changed since Task 0 cut it, unless Task 0 Step 3a took a project in). A conflict: settle it by coordination rule 6 (each project keeps its own lines), with a fresh agent's review of any resolution beyond keeping both sides. Then write the generated files and commit the merge, only if one was made:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = feat/ten-animations ] || exit 1
-node tools/update-sitemap.mjs && node tools/make-skill.mjs && ([ -f tools/make-famous.mjs ] && node tools/make-famous.mjs || true)
-if git rev-parse -q --verify MERGE_HEAD >/dev/null; then git add -A && git commit -m "Merge feat/see-inside-compare into feat/ten-animations before the lanes; generated files written again"; elif [ -n "$(git status --porcelain)" ]; then git add -A && git commit -m "Write the generated files again before the lanes"; else echo "nothing new on feat/see-inside-compare"; fi
-git status --short | wc -l
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: the merge commit; or, when the rollout had nothing new but the tools still wrote something (its page commits move the sitemap's dates), `Write the generated files again before the lanes`, a commit of its own (never an amend of the rollout's commit); or `nothing new on feat/see-inside-compare`. Then `0` and `ℹ fail 0` (this plan's runs: on its scratch base, `Already up to date.`, `no conflicts`, the generated files' commit for the sitemap's 167 dates, `0`; on a copy of `feat/ten-animations` at `ece2689`, `Already up to date.`, `no conflicts`, `famous/index.html: 23 cards, 22 previews` (make-famous's line), `nothing new on feat/see-inside-compare`, `0`).
-
-- [ ] **Step 3: Merge the ten lanes in table order, settling the expected overlaps**
-
-The lanes of one section added lines at the same places (cards, `PLACES` and `FIND` rows, previews, catalog and table lines) and changed the same lines (the `PV` keys, the `STILL` points, 07's last `PLACES` row, 07's Implementation summary, the Categories table's neighboring rows); `resolve.mjs` keeps both sides, the earlier lane's first, and puts both additions into a line both changed. It runs only on `index.html`, `README.md` and the category READMEs; generated files take our side and are written again; any other conflict stops the loop for the coordinator. Run, stopping at the first lane that does not end with `merged L<n>`:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = feat/ten-animations ] || exit 1
-GEN='^(sitemap\.xml|llms\.txt|skills/|og-image\.png|famous/)'; OWN='^(index\.html|README\.md|animations/[^/]+/README\.md)$'
-for n in 1 2 3 4 5 6 7 8 9 10; do
- if ! git -c merge.conflictStyle=diff3 merge --no-ff --no-stat ten/L$n -m "Merge ten/L$n into feat/ten-animations"; then
- git rev-parse -q --verify MERGE_HEAD >/dev/null || { echo "STOP at L$n: the merge did not start"; break; }
- files=$(git diff --name-only --diff-filter=U)
- gen=$(echo "$files" | grep -E "$GEN" || true); own=$(echo "$files" | grep -E "$OWN" || true)
- other=$(echo "$files" | grep -vE "$GEN" | grep -vE "$OWN" || true)
- [ -n "$other" ] && { echo "STOP at L$n: for the coordinator by hand: $other"; break; }
- [ -n "$gen" ] && git checkout --ours -- $gen
- if [ -n "$own" ] && ! node $TEN/resolve.mjs $own; then echo "STOP at L$n: an overlap is left for a person"; break; fi
- if [ -n "$own" ] && git grep -nE '^(<{7}|\|{7}|>{7})( |$)' -- $own; then echo "STOP at L$n: conflict markers remain"; break; fi
- git add -A && git commit --no-edit > /dev/null
- fi
- git merge-base --is-ancestor ten/L$n HEAD || { echo "STOP at L$n: not merged"; break; }
- node tools/update-sitemap.mjs > /dev/null && node tools/make-skill.mjs > /dev/null && ([ -f tools/make-famous.mjs ] && node tools/make-famous.mjs > /dev/null || true) || { echo "STOP at L$n: a tool failed"; break; }
- [ "$(git rev-parse -q --verify HEAD^2)" = "$(git rev-parse ten/L$n)" ] && [ -n "$(git status --porcelain)" ] && git add -A && git commit --amend --no-edit > /dev/null
- echo "merged L$n"
-done
-git status --short | wc -l
-```
-
-Expected (this plan's run on a copy of `feat/ten-animations` at `ece2689`, the finder and Famous effects there): each merge prints its `CONFLICT` lines (the generated files every time: they take our side and are written again), then `resolve.mjs`'s lines and `merged L<n>`: L1 none; L2 and L3 `README.md: 1 resolved` (the Categories table's neighboring rows); L4 `README.md: 2 resolved`, `animations/04-micro-interactions/README.md: 1 resolved`, `index.html: 6 resolved` (cards, `PLACES` and `FIND` rows, previews, `PV` keys); L5 the same with `index.html: 7 resolved` (the `STILL` line too); L6 `index.html: 1 resolved` (the `PV` lines side by side); L7 `README.md: 1 resolved`, `animations/06-3d-advanced/README.md: 1 resolved`, `index.html: 6 resolved`; L8 `README.md: 1 resolved`; L9 `README.md: 2 resolved`, `animations/07-ambient-background/README.md: 1 resolved`, `index.html: 6 resolved`; L10 `README.md: 2 resolved`, `animations/07-ambient-background/README.md: 2 resolved`, `index.html: 7 resolved`; ten `merged` lines, then `0` (on its scratch base without the finder, `index.html` counted one less in L4, L5, L7, L9 and L10). If the loop stopped, the coordinator settles the named file by hand under the same rule (both sides, the earlier lane first; a line both changed keeps both additions), a fresh agent reviews the resolution, then `git add` it, `git commit --no-edit` after the branch check, and the loop runs again (the merged lanes print `Already up to date.`; the stopped lane's generated files are written and folded into its merge).
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1
-grep -c "^ \['\(ink-spread-reveal\|pixelate-transition\|before-after-slider\|magnifier-lens\|card-deck-swipe\|water-ripple\|audio-visualizer\|ken-burns\|fire-effect\|lightning\)'," index.html
-grep -o "izoom:[^}]*" index.html
-grep -n "light rays, game of life" animations/07-ambient-background/README.md | grep -o "game of life.*"
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: `10`; `izoom:.02,pixelate:.34,deckswipe:.4,lightning:.016`; `game of life, fire, lightning |`; and only the three count tests fail, the counts still saying 167: `the counts written on the home page match its cards`, `the counts written in the root README match the cards`, `the counts written in the issue template, the 404 page and the sitemap match the cards` (this plan's run on `ece2689`: 1822 pass, 3 fail). Where the rollout moved the shared files past the lanes' number since Task 0, `every guided-steps page and the home page link the same version of the shared files` fails too, until Step 4.
-
-- [ ] **Step 4: The integration's edits, committed**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = feat/ten-animations ] || exit 1
-node $TEN/integrate.mjs .
-node tools/update-sitemap.mjs && node tools/make-skill.mjs && ([ -f tools/make-famous.mjs ] && node tools/make-famous.mjs || true)
-node --test "tests/*.test.js" 2>&1 | grep -E "^✖|^ℹ (pass|fail)"
-```
-
-Expected: ten link lines (`Magnifier Lens: Previous is Before/After Slider`, `Before/After Slider: Next is Magnifier Lens`, … `Fire Effect: Next is Lightning`), the count lines (`home: 176 Web Animation Techniques` … `404: 176`, with 04 at 44, 06 at 28 and 07 at 26), `KEYBOARD_PAGES 04`, `KEYBOARD_PAGES 06`, `PHONE_DEFAULTS`; `already: FIND rows after …` five times (each lane added its own row) and `finder case 9 takes Ink Spread Reveal`; fifteen `See also in …` lines (the nine existing pages, then six between new pages), `CHANGELOG`, ten lines on the shared files' version (`already: <page> at ?v=10`, or `<page> now at ?v=<N>` where the rollout moved on); then the tools' lines, make-famous's `famous/index.html: 23 cards, 22 previews` among them. Then `ℹ fail 0` (this plan's run on `ece2689`: 1825 pass, 0 fail; on `fce3a2b`, before Famous effects, 1763; on its scratch base without the finder, 1700). Run a second time, it prints only `already: …` lines (this plan's run did). Then commit, so the checks and any later lane merge start from a clean tree:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1
-[ "$(git rev-parse --abbrev-ref HEAD)" = feat/ten-animations ] || exit 1
-git add -A && git commit -m "Integrate the ten new animations: the split sections linked, every count 176, the test entries, the finder rows, See also lines and the CHANGELOG"
-git status --short | wc -l
-```
-
-Expected: one commit; `0`.
-
-- [ ] **Step 5: The social image (coordinator)**
-
-Start the worktree's server as a background command, `cd $REPO/.claude/worktrees/ten-int && python -m http.server 8971 --bind 127.0.0.1` (with the variables first), and check it: `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8971/` prints `200`. Then, as a background command:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1; mkdir -p $TEN/checks/int; node $RUN/slot.mjs run ten-int -- node tools/make-social-image.mjs --base http://127.0.0.1:8971 > $TEN/checks/int/social.log 2>&1; echo "EXIT=$?" >> $TEN/checks/int/social.log
-```
-
-Wait with `node $RUN/wait-log.mjs $TEN/checks/int/social.log`. Expected: the tool reports `og-image.png` written and `EXIT=0`; `git -C $REPO/.claude/worktrees/ten-int status --short` prints ` M og-image.png`. Open `og-image.png`: the pill says 176. Commit it after the branch check: `git add og-image.png && git commit -m "Draw the social image again: 176 animations"`.
-
-- [ ] **Step 6: Every check (each part a background command, waited on)**
-
-Start these four, each as its own background command (two at a time while the rollout's pages are being built), and wait on each log with `node $RUN/wait-log.mjs` (again while it says `still running`):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1; node $RUN/slot.mjs run ten-int-a -- node tools/check-pages.mjs --base http://127.0.0.1:8971 --out $TEN/checks/int/a animations/02-entrance-and-exit/ink-spread-reveal animations/03-page-transitions/pixelate-transition animations/04-micro-interactions/before-after-slider animations/04-micro-interactions/magnifier-lens animations/04-micro-interactions/card-deck-swipe > $TEN/checks/int/a.log 2>&1; echo "EXIT=$?" >> $TEN/checks/int/a.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1; node $RUN/slot.mjs run ten-int-b -- node tools/check-pages.mjs --base http://127.0.0.1:8971 --out $TEN/checks/int/b animations/06-3d-advanced/water-ripple animations/06-3d-advanced/audio-visualizer animations/07-ambient-background/ken-burns animations/07-ambient-background/fire-effect animations/07-ambient-background/lightning > $TEN/checks/int/b.log 2>&1; echo "EXIT=$?" >> $TEN/checks/int/b.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1; node $RUN/slot.mjs run ten-int-c -- node tools/check-pages.mjs --base http://127.0.0.1:8971 --out $TEN/checks/int/c home animations/02-entrance-and-exit/shatter-effect animations/03-page-transitions/cube-transition animations/04-micro-interactions/dynamic-island animations/06-3d-advanced/infinite-zoom animations/07-ambient-background/game-of-life $( [ -d famous ] && echo famous ) > $TEN/checks/int/c.log 2>&1; echo "EXIT=$?" >> $TEN/checks/int/c.log
-```
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1; node $RUN/slot.mjs run ten-int-d -- node tools/check-pages.mjs --base http://127.0.0.1:8971 --out $TEN/checks/int/d animations/02-entrance-and-exit/clip-path-reveal animations/03-page-transitions/dissolve animations/04-micro-interactions/spotlight-hover animations/04-micro-interactions/swipe-to-dismiss animations/07-ambient-background/ambient-ripple animations/07-ambient-background/abstract-geometric-motion animations/07-ambient-background/fireworks animations/07-ambient-background/snow-rain > $TEN/checks/int/d.log 2>&1; echo "EXIT=$?" >> $TEN/checks/int/d.log
-```
-
-Then `cat $TEN/checks/int/?.log | grep -c '^ok'; cat $TEN/checks/int/?.log | grep '^FAIL'`. Expected: `144` (the ten new pages, the five old last pages, the eight other pages whose See also changed and `home`, six setups each; 150 with `famous`), no `FAIL` line and `EXIT=0` in each log (this plan's run gave all 144). A `FAIL` on a new page goes back to its lane's fix loop; once the fix is approved, Step 3's loop merges the lane again (the others print `Already up to date.`), Step 4 runs again (its edits print `already: …`) and its commit becomes `fix: integration after L<n>'s fix`, and the failed part is checked again. A `FAIL` the merge caused is fixed here (a fresh agent reviews the fix), committed after the branch check, and named in the ledger.
-
-- [ ] **Step 7: Ledger, hand over**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-int || exit 1
-git status --short | wc -l; git log --oneline -3
-```
-
-Expected: `0`, then the social image's commit, the integration's commit and the last lane's merge. Ledger: `<date time> int integrated at <commit>; tests <pass>/0; checks 144 ok; FIND added; version ?v=<N>` (the finder is on the branch: `integrate.mjs` keeps the lanes' rows and sets finder case 9). Stop the server (Step 5's background command). The worktree stays for Task 12's integration fixes. Task 12 starts.
-
----
-
-### Task 12: Final review in three parts, fixes, the whole-site check, the owner's look, the hand-over, late rulings and fixes after joining (coordinator)
-
-**Files:**
-- Read: a detached checkout of `feat/ten-animations` (`.claude/worktrees/ten-rev`, port 8972), moved to the branch's new tip after each fix wave
-- Modify: only what a review finds, on the lane branch that owns it (a page) or on `feat/ten-animations` in `ten-int` (port 8971; integration's edits), each fix reviewed, merged and checked
-- Write: `$TEN/final/part-<1|2|3>.md` and `$TEN/final/part-<k>/` (the reviewers' runs), `$TEN/checks/site/`, `$TEN/kit/`, ledger lines
-- Test: the tests, the page check of every page a fix touched, the whole site in parts (or the rollout's own check after its merge), the review kit's pictures and clips of the ten pages
-
-**Interfaces:**
-- Consumes: Task 11's commits on `feat/ten-animations` and its worktree `ten-int`; the rollout's review kit (`$KIT/record.mjs` and `kit-lib.mjs`, as the rollout's Task 5 left them), copied into `ten-rev` because the kit reads pages under its own root; the rollout plan's Task 12 Step 1 (it merges this branch) and Task 13 (its part 9 reviews the ten pages and sends findings back here).
-- Produces: `feat/ten-animations` reviewed, fixed and checked; the owner's verdict; the hand-over ledger line the rollout's Task 12 Step 1 reads; fixes after joining.
-
-- [ ] **Step 1: Freeze a checkout, copy the kit into it, serve it**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-KIT=$REPO/.superpowers/sdd/2026-10-13-learn-pilot/review-kit
-git -C $REPO worktree add --detach $REPO/.claude/worktrees/ten-rev feat/ten-animations
-cd $REPO/.claude/worktrees/ten-rev || exit 1
-git log --oneline -1
-mkdir -p .superpowers/sdd/kit/review-kit $TEN/final && cp $KIT/record.mjs $KIT/kit-lib.mjs .superpowers/sdd/kit/review-kit/ && git status --short | wc -l
-```
-
-Expected: Task 11's last commit (the social image), then `0` (`.superpowers/` is ignored by git). Start the server as a background command, `cd $REPO/.claude/worktrees/ten-rev && python -m http.server 8972 --bind 127.0.0.1` (with the variables first); `curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8972/` prints `200`.
-
-- [ ] **Step 2: Three reviewers at once (strongest model; none of them built or reviewed a page)**
-
-Each reads CLAUDE.md, this plan's Global Constraints, the ten-animations spec, the rollout spec's section 1 and acceptance list, `$RUN/lessons.md`, `$RUN/briefs/RULINGS.md`, `$RUN/brief-rulings.md`, `$RUN/briefs/OPEN-QUESTIONS.md`, `$RUN/rulings-159.md` once it holds the owner's verdict, `$TEN/ledger.md` and the lanes' reports (`$TEN/reports/L<n>/`), and works on the frozen checkout (`http://127.0.0.1:8972/`). Each may run, from `cd $REPO/.claude/worktrees/ten-rev || exit 1` and through the pool, the page check and the kit's copy (`node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8972 …`: `--short`, `--gallery --press "<selector>"`, `--only clips --keep-frames`, then the frame folders removed), each run a background command with its log in `$TEN/final/part-<k>/` ending in an `EXIT=` line and waited on with `node $RUN/wait-log.mjs`; never the browser pane. Each writes `$TEN/final/part-<k>.md`: first line `RESULT: clear` or `RESULT: findings <count>`, then numbered findings (Critical, Important, Minor), and replies in at most three lines.
-- **Part 1, pages 02 to 04:** Ink Spread Reveal, Pixelate Transition, Before/After Slider, Magnifier Lens, Card Deck Swipe, and the links from Shatter Effect, Cube Transition and Dynamic Island: each page against its spec section, its task's hand checks, the twelve acceptance lines, both views at 1280, 375 and 375 with reduced motion and on the short screens, every setting in both views, the clips, the per-frame work, the README's six sections and Key parameters (each setting's demo values in plain words).
-- **Part 2, pages 06 and 07:** Water Ripple, Audio Visualizer, Ken Burns Effect, Fire Effect, Lightning, and the links from Infinite Zoom and Game of Life: the same, plus Audio Visualizer's silence before Hear it (no console warning, no AudioContext), Lightning's flash count (the method in its task), Fire Effect's and Water Ripple's fixed steps.
-- **Part 3, integration:** the home page (cards in order, `PLACES`, `PV`, `FIND`, the ten previews at rest and under reduced motion, every count 176), the root README (catalog in home order, counts, the Categories table), the five category READMEs (lists, 06's Browser requirements, 07's Implementation summary), `config.yml`, `404.html`, `CHANGELOG.md`, the See also lines, the test entries, the generated files (written by the tools, not by hand), `og-image.png`, and the split sections' Previous and Next links on all ten pages.
-
-Expected: three files; the coordinator writes one ledger line per part (`<date time> coord final part <k>: <clear | findings n>`).
-
-- [ ] **Step 3: One fix wave, then a scoped re-review**
-
-Integration findings first: the coordinator fixes them in `ten-int` (with the variables, `cd $REPO/.claude/worktrees/ten-int || exit 1` and the branch check), a fresh agent reviews each fix, and they are committed (`fix: integration: <what>`) before any lane is merged again, so a merge never folds them in. Page findings: the lane's builder fixes on `ten/L<n>` in its worktree as in its task's fix rounds (Steps 5 and the check step again, the galleries, clips or frame times the fix touches, a `fix:` commit after the branch check, `$TEN/reports/L<n>/fix-<k>.md`), the lane's reviewer re-reviews the fix, and the coordinator writes its new approval line. Then, in `ten-int`: Task 11 Step 1's approval check (each tip its approved commit), Task 11 Step 3's loop (each fixed lane merges, the others print `Already up to date.`), Task 11 Step 4 (`integrate.mjs` prints `already: …` for every edit already made; the tests `ℹ fail 0`; its commit only if something changed), and Task 11 Step 5 again if a count or the home page's top changed. Then move the frozen checkout to the new tip and check from it:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-rev || exit 1
-git checkout --detach feat/ten-animations && git log --oneline -1
-```
-
-Expected: `feat/ten-animations`' new tip. Then the page check of every page a fix touched (and `home` if the home page changed), as a background command from `ten-rev` against port 8972 into `$TEN/checks/rev-<k>/` with its log, waited on: six `ok` lines each; and the kit's `--short` for a page whose layout or notes changed (`27 short-screen pictures checked, 0 with labels cut or overlapping, 0 skipped, 0 failed`). The part's reviewer re-reviews only the fixes, on `ten-rev`, and adds `$TEN/final/part-<k>-re.md` (first line `RESULT: clear` or `RESULT: findings <count>`). Expected: no Critical or Important finding left; Minor findings fixed or written in the ledger as the owner's to decide.
-
-- [ ] **Step 4: The whole-site check (here, or the rollout's after its merge)**
-
-While the rollout's pages are still being built, leave the whole-site check to the rollout's Task 12 Step 7, which checks all 176 pages after its merge, and say so in Step 6's ledger line. Otherwise run it here, one background command per category and one for `home` and `famous`, at most two at once, each waited on with `node $RUN/wait-log.mjs` (the category's log; again while it says `still running`):
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-rev || exit 1; mkdir -p $TEN/checks/site; c=01-scroll-based; node $RUN/slot.mjs run ten-site -- node tools/check-pages.mjs --base http://127.0.0.1:8972 --out $TEN/checks/site/$c animations/$c > $TEN/checks/site/$c.log 2>&1; echo "EXIT=$?" >> $TEN/checks/site/$c.log
-```
-
-The same with `c=` each of `02-entrance-and-exit`, `03-page-transitions`, `04-micro-interactions`, `05-text-typography`, `06-3d-advanced`, `07-ambient-background`, and once with `c=home` and the targets `home $( [ -d famous ] && echo famous )` in place of `animations/$c`. Then `cat $TEN/checks/site/*.log | grep -c '^ok'; cat $TEN/checks/site/*.log | grep '^FAIL'`. Expected: `1062` (176 pages and the home page, six setups each; 1068 with `famous`) and no `FAIL` line. A rollout page that fails because its views are still being built is the rollout's (a line in both ledgers); a page this project changed is fixed as in Step 3.
-
-- [ ] **Step 5: The owner's look**
-
-The review kit's pictures and clips of the ten pages, as a background command, waited on:
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-cd $REPO/.claude/worktrees/ten-rev || exit 1; node $RUN/slot.mjs run ten-kit -- node .superpowers/sdd/kit/review-kit/record.mjs --base http://127.0.0.1:8972 --out $TEN/kit animations/02-entrance-and-exit/ink-spread-reveal animations/03-page-transitions/pixelate-transition animations/04-micro-interactions/before-after-slider animations/04-micro-interactions/magnifier-lens animations/04-micro-interactions/card-deck-swipe animations/06-3d-advanced/water-ripple animations/06-3d-advanced/audio-visualizer animations/07-ambient-background/ken-burns animations/07-ambient-background/fire-effect animations/07-ambient-background/lightning > $TEN/kit.log 2>&1; echo "EXIT=$?" >> $TEN/kit.log
-```
-
-Expected: the log's last lines `done 90 pictures, 30 clips and 0 comparisons made, 0 skipped, 0 failed` and `EXIT=0`; the gallery is `$TEN/kit/index.html`. Give the owner the gallery and the ten addresses on `http://127.0.0.1:8972/` to open in the browser pane themselves (the agents never drive the pane), and ask them to press Hear it on Audio Visualizer there. Write the owner's verdict in the ledger; what they ask for is a fix as in Step 3, then their look again at what changed. If the owner does not like Hear it, it comes out in one small change (the button, its listener and its README lines), as the spec's ruling allows.
-
-- [ ] **Step 6: Hand over to the rollout**
-
-The merge into `feat/see-inside-compare` is the rollout plan's Task 12 Step 1 (its `?v` step where the higher number wins, its `176` and `data-hb-modes` checks, `og-image.png` taken from this branch); this plan does not restate it. Hand over with the ledger line `<date time> coord ready to join: feat/ten-animations at <commit>; ten pages approved; final review clear; owner's look <verdict>; reports in reports/ and final/; whole-site check <done here | left to the rollout's Task 12 Step 7>; FIND added; took in: <none | feat/famous-effects at <commit>>`, and the same news where the rollout looks for it, one line appended to its ledger: `printf '%s\n' "Ten new animations ready to join: feat/ten-animations at <commit>; run folder .superpowers/sdd/2026-10-14-ten-new-animations/; took in: <none | feat/famous-effects at <commit>>" >> $RUN/ledger.md` (the rollout's Task 12 Step 1 and its part 9 read this project's ledger and reports from that folder; a project taken in reaches the rollout through this merge). Ask that step to draw `og-image.png` again if its merge touched the home page's top. The finder's rows come with the branch (each lane added its own, and Task 11 set finder case 9), so that merge needs nothing more for the finder.
-
-- [ ] **Step 7: The owner's first-batch rules, if they land after Task 11 Step 1**
-
-When the rollout's ledger has `First batch approved by the owner on …; rulings-159.md: …` and `$TEN/ledger.md` no `rulings check:` line yet (or the owner gives a rule later): the rulings check of Task 11 Step 1 on all ten pages (nothing to apply for `0 rules`; otherwise a fresh reviewer, `$TEN/reports/rulings-check.md`), each change through its lane's fix loop, then Step 3's merge, check and re-review, and the ledger line `<date time> coord rulings check: <none | L<n>, … fixed>`. Before the hand-over this goes into Step 6's line; after it, as Step 8.
-
-- [ ] **Step 8: Fixes after joining**
-
-A finding on one of the ten pages from the rollout's final review (its Task 13, part 9) or the owner's final look comes back to the page's lane: re-create its worktree if Step 9 has run (`git -C $REPO worktree add $REPO/.claude/worktrees/ten-L<n> ten/L<n>`, with the variables first); otherwise it is still there, the coordinator serves it on 8960 + n, the builder fixes as in its task's fix rounds, its reviewer re-reviews, and the coordinator writes the approval line; then Task 11 Step 1's approval check, Step 3's loop and Step 4 in `ten-int` (re-created the same way on `feat/ten-animations` if needed), the checks of Step 3 above, and the ledger line `<date time> coord fix after joining: L<n> at <commit>; feat/ten-animations at <commit>`. The rollout's coordinator merges `feat/ten-animations` on again by its own plan.
-
-- [ ] **Step 9: Clean up, only after the rollout's Task 13 has merged**
-
-```bash
-REPO=/c/Users/matin/OneDrive/Desktop/Projects/animation-handbook; RUN=$REPO/.superpowers/sdd/2026-10-13-see-inside-compare; TEN=$REPO/.superpowers/sdd/2026-10-14-ten-new-animations
-for n in 1 2 3 4 5 6 7 8 9 10; do git -C $REPO worktree remove $REPO/.claude/worktrees/ten-L$n; done
-git -C $REPO worktree remove $REPO/.claude/worktrees/ten-rev
-git -C $REPO worktree remove $REPO/.claude/worktrees/ten-int
-git -C $REPO worktree list | grep -c 'ten-' || true
-ls -d /c/Users/matin/AppData/Local/Temp/hb-chrome-* /c/Users/matin/AppData/Local/Temp/hb-kit-chrome-* 2>/dev/null
-```
-
-Expected: `0` worktrees left with `ten-` in their path (the kit's copies are ignored files, which do not stop `worktree remove`); the branches stay until the release. Every server of this project is stopped. The last command lists leftover Chrome profile folders (this plan's own checks left `hb-chrome-UTFiH6` and `hb-kit-chrome-NHI5vA`, which Chrome held when the runs ended): ask the owner before removing any of them, and remove them only with their OK.
-
----
-
-## Self-review
-
-**Spec coverage** (`2026-10-13-ten-new-animations-design.md`, section by section):
-- Owner rulings: the mode press plays the demo once and never under reduced motion (Global Constraints; each do-it and plays-once page's Show me or Replay ends on its posed rest; the loops are never pressed); the box keeps its size on phones (each page; the page check's size check); Audio Visualizer silent by default with Hear it (Task 7, its hand checks and review focus); built without the new tabs (the top bars are copied from neighbors).
-- The pages table (kinds, player bars, difficulty): Tasks 1 to 10, one each; Previous and Next: `lanes.mjs` gives the five old last pages their Next links (Tasks 1, 2, 3, 6, 8) and Task 11's `integrate.mjs` links the split sections.
-- What all ten share: starting points, top bar, drawn pictures with made-up names, transforms or canvas, frame loops by elapsed time and fixed steps for Fire Effect and Water Ripple, reduced motion read in the loops, Show me two to four seconds ending at rest, 44px in the box, both views with captions and posed stills, notes that stay true after every press, each Compare half inside its half and different in one thing, plain words, READMEs with six sections: in each page's code, its hand checks, its kit runs (short screens, a gallery per choice, clips) and its review.
-- Sections 1 to 10: each page's code, README, preview, Try it settings with the spec's defaults, prompt, tags and both views; the places where a page settles or departs from its section are listed in its task ("Decisions already made").
-- Lists, counts and generated files: lanes at 167 with their own catalog, category README and table lines (`lanes.mjs`); the 176 counts, the per-section counts, `CHANGELOG.md`, the See also lines from the closest pages and between the new pages, the `FIND` rows and finder case 9, the test entries (`KEYBOARD_PAGES` for four pages, `PHONE_DEFAULTS` for Audio Visualizer) and the generated files including `og-image.png` (Task 11, `integrate.mjs`, Step 5); generated files never merged by hand (Task 11 Step 3's loop; the rollout's Task 12 Step 1).
-- Building it: the branch, the owner's answer on the finder and Famous effects with both paths, run folder, every lane's shared edits tried, finder rows' check and worktrees (Task 0); builder and reviewer per lane with report files and at most three fix rounds (each lane's last step); late rulings before integration (Task 11 Step 1, Task 12 Step 7); integration by the coordinator as in the special-animations precedent (Task 11); the final review in three parts on a frozen checkout, one fix wave, a scoped re-review, the whole-site check (here or the rollout's), the owner's look, the hand-over and fixes after joining (Task 12); the machine rules (Global Constraints); release with the rollout on the owner's word.
-- Acceptance: tests with the final gate, six `ok` lines per new and edited page, home and Famous effects (Task 11 Step 6, Task 12 Steps 3 and 4); the kit's short screens with no label cut or overlapping (each lane, Task 12 Step 3); reviewer verdicts (each lane, Task 12); frame times, Lightning's flash count and Audio Visualizer's silent start (Tasks 10 and 7, Task 12 part 2); every count 176 and the generated files (Task 11); the owner's look and nothing published before (Task 12).
-
-**Placeholder scan:** every page, README, preview and tool is given in full; commands and expected outputs are exact. The only values a step fills in are the ones only known at run time (a date, a commit hash, a measured number, the ledger's version N), each named where it is used.
-
-**Consistency:** the tools' names and options (`lanes.mjs <n> <root>`, `frametimes.mjs --base … [--phone] [--modes …] <page>`, `resolve.mjs <file>...`, `integrate.mjs <root> [--finder-check]`) are the same in Task 0, the lanes and Tasks 11 and 12; preview keys, slugs, titles, ledes, places and finder rows match between `lanes.mjs`, `integrate.mjs` and each lane's Interfaces; ports are 8960 + n for the lanes, 8971 for `ten-int` and 8972 for `ten-rev` (the coordination file's Ten new row); every command block sets `REPO`, `RUN` and `TEN` and checks its `cd`; every Chrome run is a pool run in the background with an `EXIT=` line, waited on with `wait-log.mjs`; the kit always runs from a copy inside the worktree it pictures; report files start with a `RESULT:` line and only the coordinator writes the ledger.
-
-**Pre-flight reviews:** `plan-review-A.md` (the process), `plan-review-B.md` (the lanes) and the re-review `plan-rereview.md` were applied; `plan-fixes.md` in the run folder lists each finding, what changed, and the checks run again.
diff --git a/tests/pages.test.js b/tests/pages.test.js
index d2e0a3d4..75c4a9b1 100644
--- a/tests/pages.test.js
+++ b/tests/pages.test.js
@@ -291,7 +291,7 @@ for (const d of steps) {
});
test(`${d.slug}: the home page card uses the page's title, or the shorter name an owner ruling keeps`, () => {
- // Four 3D & Advanced cards keep a shorter name than their page title (docs/superpowers/plans/2026-09-29-3d-content.md).
+ // Four 3D & Advanced cards keep a shorter name than their page title, by an owner ruling.
const SHORTER = { 'fluid-simulation': 'Fluid Simulation', 'ray-marching-sdf': 'Ray Marching / SDF', 'cloth-simulation': 'Cloth Simulation', 'volumetric-smoke': 'Volumetric Smoke' };
const h1 = decode(pageOf(d).match(/<h1>([^<]*)<\/h1>/)[1]);
const entry = HOME.match(new RegExp(`\\['${d.slug}','((?:[^'\\\\]|\\\\.)*)',`));