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.

8.7 KB
Raw Blame

Fly-in Fly-out Contact List — Design Spec

Date: 2026-05-20 Category: 01-scroll-based Slug: fly-in-fly-out-contact-list Path: animations/01-scroll-based/fly-in-fly-out-contact-list/


Overview

A scrollable contact list where each row flies in from below (fade + translate + scale) as it enters the viewport and flies out upward as it exits. The effect is continuous and bidirectional — scrubbed to scroll position, not a one-time reveal. An IntersectionObserver limits transform updates to only the rows currently near the viewport.


Files

animations/01-scroll-based/fly-in-fly-out-contact-list/
  index.html    — single self-contained demo
  README.md     — 6-section explanation per CLAUDE.md template

Visual Aesthetic

Dark Atlas — consistent with existing atlas entries.

Element Style
Stage background #0d1117
Row background #161b22
Row border 1px solid #21262d
Row border-radius 8px
Avatar 36×36px circle, initials, deterministic bg color per name
Name #e6edf3, monospace, 12px
Sub-line #8b949e, monospace, 10px
Meta online dot (green #3fb950 / gray #8b949e) + time, OR badge count

Contact Data (15 entries, generated by JS)

const CONTACTS = [
  { initials:'SK', name:'Sara Klein',    sub:'Design lead · Berlin',  meta:'now',    badge:0,  online:true  },
  { initials:'MR', name:'Marco Rossi',   sub:'Engineering · Milan',   meta:'2h',     badge:3,  online:false },
  { initials:'YT', name:'Yuki Tanaka',   sub:'Product · Tokyo',       meta:'1d',     badge:0,  online:false },
  { initials:'AO', name:'Amara Okafor',  sub:'Research · Lagos',      meta:'now',    badge:0,  online:true  },
  { initials:'LP', name:'Lena Park',     sub:'UX · Seoul',            meta:'5m',     badge:1,  online:true  },
  { initials:'JB', name:'Jules Bernard', sub:'Data · Paris',          meta:'3h',     badge:0,  online:false },
  { initials:'RM', name:'Ravi Mehta',    sub:'Infra · Mumbai',        meta:'2d',     badge:0,  online:false },
  { initials:'CF', name:'Clara Ferreira',sub:'Brand · São Paulo',     meta:'30m',    badge:7,  online:true  },
  { initials:'SO', name:'Sam O\'Brien',  sub:'Mobile · Dublin',       meta:'now',    badge:0,  online:true  },
  { initials:'NW', name:'Nia Williams',  sub:'Growth · London',       meta:'1h',     badge:2,  online:false },
  { initials:'DK', name:'Dae-Jung Kim',  sub:'Security · Busan',      meta:'4h',     badge:0,  online:false },
  { initials:'HZ', name:'Hana Zhao',     sub:'ML · Shanghai',         meta:'now',    badge:0,  online:true  },
  { initials:'TN', name:'Tariq Nassar',  sub:'Strategy · Dubai',      meta:'2d',     badge:0,  online:false },
  { initials:'EV', name:'Elena Vasquez', sub:'Finance · Mexico City', meta:'45m',    badge:4,  online:false },
  { initials:'IB', name:'Ivan Brykov',   sub:'Platform · Kyiv',       meta:'now',    badge:0,  online:true  },
];

Deterministic avatar color from initials hash:

const COLORS = ['#1a3a5c','#2d1b3d','#1e3a1e','#3d2000','#1a3a3a',
                '#3a1a1a','#1a2a3d','#2d1a3d','#1e2d1e','#3a2a00'];
function avatarColor(initials) {
  return COLORS[(initials.charCodeAt(0) + initials.charCodeAt(1)) % COLORS.length];
}

Page Structure

<body>
  <header>            — animation name + 1-sentence description
  <div.layout>        — flex row on desktop, column on mobile
    <div.stage>         — 620px, overflow-y:scroll, hidden scrollbar
      <div.contact-list>  — contains 15 .row divs + zone overlay
        <div.zone-overlay>  — pointer-events:none, absolute, hidden by default
        <div.row> × 15    — generated by JS
    <aside>           — controls panel

Zone Math

For each tracked row, computed in the rAF callback:

const viewportH = stage.clientHeight;
const pos = (row.offsetTop - stage.scrollTop) / viewportH;
// pos = 0: row top at viewport top
// pos = 1: row top at viewport bottom
// pos < 0: row has scrolled off the top

Three zones (Z = zone size, default 0.25):

Zone Condition t formula opacity translateY scale
Exit (top) pos < Z t = pos / Z lerp(0, 1, t) lerp(-DIST, 0, t) lerp(SCALE, 1, t)
Active Z ≤ pos ≤ 1−Z — 1 0 1
Entry (bottom) pos > 1−Z t = (1 − pos) / Z lerp(0, 1, t) lerp(DIST, 0, t) lerp(SCALE, 1, t)

Rows where pos < −rowHeight/viewportH (fully above) or pos > 1 (fully below): not tracked by IntersectionObserver, keep last computed transform frozen.


IntersectionObserver

const io = new IntersectionObserver(entries => {
  entries.forEach(e => {
    if (e.isIntersecting) visible.add(e.target);
    else visible.delete(e.target);
  });
}, { root: stage, rootMargin: '25% 0px', threshold: 0 });

rows.forEach(row => io.observe(row));

visible is a Set<HTMLElement>. The rAF callback only iterates visible, not all 15 rows.


Effect Parameters

Parameter ID Range Default Effect
Translate distance #dist-slider 0–80px 40px How far rows travel
Scale delta #scale-slider 0.80–1.00 0.94 Shrink at edges
Zone size #zone-slider 10%–40% 25% Height of enter/exit zones

Effect Mode Toggle

Three-way toggle (radio buttons or segmented control):

  • All combined (default): opacity + translateY + scale
  • Translate only: opacity always 1, scale always 1
  • Fade only: translateY always 0, scale always 1

Under prefers-reduced-motion: force "fade only" mode with range opacity 0.3 → 1 (no translate, no scale).


Zone Preview Overlay

A position:absolute div covering the stage viewport:

[Entry zone band: bottom 25%, rgba(63,185,80,0.08)]  ← green
[Active zone band: middle 50%, transparent]
[Exit zone band: top 25%, rgba(248,81,73,0.08)]      ← red

pointer-events: none. Shown/hidden by "Preview zones" checkbox. Zone bands resize live when the zone-size slider changes.


Controls Panel

Layout: right of stage on desktop (clamp(200px,22vw,240px) wide), stacks below on mobile.

Control Type Behavior
Educational note <p> Static
Scroll progress readout scrollTop / max × 100
Visible rows readout visible.Set.size
Translate distance range 0–80 Updates DIST
Scale delta range 80–100 (mapped to 0.80–1.00) Updates SCALE
Zone size range 10–40 (mapped to 0.10–0.40) Updates Z
Effect mode radio/segmented Sets mode flag
Preview zones checkbox Shows/hides overlay
Reset button Restores defaults, scrolls to top

CSS Variables

--bg: #060a10; --ui-bg: #0d1117; --ui-border: #21262d;
--ui-accent: #58a6ff; --ui-text: #c9d1d9; --ui-muted: #8b949e;
--row-bg: #161b22;

Responsiveness (CLAUDE.md)

Breakpoint Layout
Desktop ≥1025px Stage + aside side-by-side
Tablet 601–1024px Same layout, controls 44px touch targets
Mobile ≤600px Layout stacks, aside below stage
  • Avatar: 36px → 32px on mobile
  • Row min-height: 56px always (touch target)
  • Sliders: min-height: 44px
  • clamp() on header typography
  • Touch scroll drives the effect (passive scroll listener on .stage)
  • prefers-reduced-motion: fade only, opacity 0.3→1 at edges

Performance

  • will-change: transform, opacity on .row
  • IntersectionObserver root: stage, rootMargin: '25% 0px'
  • visible Set: only iterated rows in rAF callback
  • motionMQ.matches re-read live in the rAF callback
  • No layout reads inside rAF beyond stage.scrollTop (which is cached once per frame)

README Sections

  1. What it is — continuous bidirectional fly-in/fly-out via piecewise zone interpolation
  2. When to use it — contact lists, activity feeds, inbox views, any vertically scrollable list
  3. How it works — zone math, pos = (offsetTop - scrollTop) / viewportH, piecewise lerp
  4. Key parameters — DIST, SCALE, Z, effect mode
  5. Production notes — continuous vs one-time reveal; IntersectionObserver + transform-only pattern; iOS Contacts, Telegram, Notion sidebar; GSAP ScrollTrigger per item, Framer Motion useScroll; vestibular risk from scale+translate, prefers-reduced-motion
  6. See also — cover-card-to-fixed-header (same single-progress model), parallax-scrolling

Constraints

  • Single HTML file, under 300 lines (contacts generated by JS)
  • No external dependencies, offline-capable
  • Touch targets ≥44px
  • Touch scroll works (passive listener)
  • prefers-reduced-motion respected