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.
Reverse-Scrolling Columns — Design Spec
Date: 2026-05-20
Category: 01-scroll-based
Slug: reverse-scrolling-columns
Path: animations/01-scroll-based/reverse-scrolling-columns/
Overview
A 620px-tall scroll stage containing three equal-width columns. The center column scrolls downward (normal direction) while the two flanking columns scroll upward (reverse direction). All three loop infinitely. A control panel lets the user adjust the side-column speed multiplier to feel how ratio changes affect the illusion.
Files
animations/01-scroll-based/reverse-scrolling-columns/
index.html — single self-contained demo
README.md — 6-section explanation per CLAUDE.md template
No build step. No external dependencies. Works offline.
Card Visual Style
Style A — Icon + Label + Meta
Each card contains:
- A 28×28px icon box (tinted background matching the card's accent color)
- Inline SVG icon (~14×14px), one of: grid, circle, triangle, diamond, cross, arc, zigzag, etc.
- A label line (project name, monospace, 11px)
- A meta line (category · year, 9px, muted color)
12 unique cards per set, generated by JavaScript from a CARDS data array:
const CARDS = [
{ shape: 'grid', label: 'Project Alpha', meta: 'Design · 2024', accent: '#58a6ff' },
{ shape: 'circle', label: 'Studio Work', meta: 'Motion · 2023', accent: '#bf91f3' },
{ shape: 'triangle', label: 'Concept 03', meta: 'Dev · 2024', accent: '#3fb950' },
{ shape: 'diamond', label: 'Brand Atlas', meta: 'Identity · 2023',accent: '#f78166' },
{ shape: 'cross', label: 'Interface V2', meta: 'UX · 2024', accent: '#ffa657' },
{ shape: 'arc', label: 'Motion Reel', meta: 'Video · 2022', accent: '#79c0ff' },
{ shape: 'zigzag', label: 'Type Study', meta: 'Type · 2023', accent: '#d2a8ff' },
{ shape: 'dot', label: 'Data Viz', meta: 'Research · 2024',accent: '#56d364' },
{ shape: 'line', label: 'Scroll Kit', meta: 'Library · 2023', accent: '#58a6ff' },
{ shape: 'hex', label: 'Space UI', meta: 'Design · 2024', accent: '#bf91f3' },
{ shape: 'wave', label: 'Sound Tools', meta: 'Audio · 2023', accent: '#3fb950' },
{ shape: 'ring', label: 'Orbit System', meta: 'Motion · 2024', accent: '#f78166' },
];
Card HTML (generated by JS):
<div class="card">
<div class="icon-box" style="--accent:#58a6ff"><!-- SVG --></div>
<div class="card-text">
<div class="card-label">Project Alpha</div>
<div class="card-meta">Design · 2024</div>
</div>
</div>
Page Structure
<body>
<header> — animation name + 1-sentence description
<div.layout> — CSS Grid: [stage] [aside] on desktop, stacked on mobile
<div.stage> — 620px tall, overflow-y:scroll, hidden scrollbar
<div.scene> — 2000px tall (scroll travel; max scroll = 1380px)
<div.columns> — position:sticky; top:0; height:620px; display:flex; gap
<div.col> × 3 — flex:1; overflow:hidden; height:620px
<div.col-inner> — contains two identical card sets stacked
<aside> — controls panel
Infinite Loop Mechanic
Each col-inner contains two identical card sets stacked vertically:
[set A — 12 cards] ← singleSetH px
[set B — 12 cards] ← singleSetH px
Total height = 2 × singleSetH
singleSetH is measured from the DOM after card generation:
const singleSetH = colInner.firstElementChild.offsetHeight;
Side columns (scroll UP — left and right)
col-inner starts at natural position (no margin offset).
const rawOffset = scrollTop * Math.abs(mult);
const offset = rawOffset % singleSetH; // 0 → singleSetH
translateY = -offset; // negative = upward
At offset = 0: set A visible (y=0), set B below.
At offset = singleSetH: inner moved up by one full set → set B is now at y=0, identical to set A → seamless wrap → offset modulos back toward 0.
When mult > 0 (user drags slider to positive): side columns move DOWN instead. Formula becomes translateY = +offset (downward). The DOM structure is the same; the sign changes.
Center column (scroll DOWN)
col-inner has margin-top: calc(-1 * var(--single-set-h)) applied via CSS custom property set by JS.
centerInner.style.setProperty('--single-set-h', singleSetH + 'px');
.col-inner.center { margin-top: calc(-1 * var(--single-set-h)); }
const offset = scrollTop % singleSetH; // 0 → singleSetH
translateY = +offset; // positive = downward
At offset = 0: set B visible (set A is margin-top'd above viewport). As offset grows, inner moves down, set A slides into view from the top. At offset = singleSetH → wraps back to 0 → set B is in view again. Seamless. ✓
Direction summary at mult = −1.0 (default)
| Column | Direction | Formula |
|---|---|---|
| Left | UP | translateY = -(scrollTop % singleSetH) |
| Center | DOWN | translateY = +(scrollTop % singleSetH) |
| Right | UP | translateY = -(scrollTop % singleSetH) |
Speed Multiplier
Slider range: −2.0 to +2.0, step 0.1, default −1.0.
mult < 0— side columns go UP (reverse, classic effect)mult = 0— side columns stationarymult > 0— side columns go DOWN (same direction as center; effect breaks)mult = −1.0— side columns match center speed exactly but opposite direction
Side column offset formula (unified):
const magnitude = Math.abs(mult);
const rawOffset = scrollTop * magnitude;
const offset = rawOffset % singleSetH;
const direction = mult >= 0 ? 1 : -1;
translateY = direction * offset; // ±offset
// Note: center col DOM uses margin-top trick; side col DOM does not.
// For mult > 0, side col inner moves DOWN from y=0 — no wrap-around from above,
// but scroll range (1380px) gives 1+ full loops for mult ≤ 1.0, which is enough for demo.
Controls Panel
Layout: right of stage on desktop (clamp(200px, 22vw, 240px) wide), stacks below on mobile.
Contents (top to bottom):
- Educational note — "The illusion of the side columns 'flowing the other way' is purely visual — they're scrolling 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."
- Scroll progress — live
%readout - Offset table — Left / Center / Right current
pxoffset (3 rows) - Speed multiplier slider —
<input type="range" min="-200" max="200" step="10" value="-100">, displayed as(value/100).toFixed(1) + '×' - "Match direction" toggle — when checked, forces
mult = +1.0; uncheck restores slider - Reset button — snaps
stage.scrollTop = 0, restores mult to −1.0, unchecks toggle
CSS Variables
--bg: #060a10;
--ui-bg: #0d1117;
--ui-border: #21262d;
--ui-accent: #58a6ff;
--ui-text: #c9d1d9;
--ui-muted: #8b949e;
--card-bg: #161b22;
Responsiveness (CLAUDE.md mandatory)
| Breakpoint | Layout |
|---|---|
| Desktop ≥1025px | 3 columns, aside right |
| Tablet 601–1024px | 3 columns, aside right, slider touch target 44px |
| Mobile ≤600px | 2 columns (left + center only), aside stacks below |
- Typography:
clamp()on header and sidebar labels - All sliders and buttons: ≥44px touch target
prefers-reduced-motion: setmult = 0(side columns frozen); center column also frozen; show static layout
Performance
- All transforms via
translate3d(0, Xpx, 0)— GPU compositor path will-change: transformon each.col-inner- rAF dirty-flag pattern (
tickingboolean), passive scroll listener motionMQ.matchesre-read on every scroll event (live, not snapshot)
README Sections
- What it is — center column scrolls normally; flanking columns scroll in reverse; all three loop infinitely
- When to use it — hero layouts, editorial features, portfolio showcases, visual interest without content density
- How it works — two-set DOM structure, modulo offset math,
translate3d - Key parameters —
mult(−2 to +2),singleSetH, scene height, card count - Production notes — infinite loops require modulo/wrap; vestibular risk at high |mult| (use −0.3 to −1.0 in production); GSAP/Locomotive Scroll equivalents;
prefers-reduced-motionmust freeze side columns (opposing motion is a known vestibular trigger) - See also — links to parallax-scrolling and parallax-depth-of-field
Constraints
- Single HTML file, under 300 lines (cards generated by JS, not hardcoded HTML)
- No external dependencies, offline-capable
- Touch targets ≥44px
- Works with touch scroll (passive listener on
.stage) prefers-reduced-motionrespected: freeze all columns