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.

Add implementation plan for fly-in-fly-out-contact-list animation

matin3278a8714cc3
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
new file mode 100644
index 00000000..0528f330
--- /dev/null
+++ b/docs/superpowers/plans/2026-05-20-fly-in-fly-out-contact-list.md
@@ -0,0 +1,617 @@
+# 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)`. ✓