Scroll Effects · Component Template
Stacking Cards
Five enamel-colored cards come up one at a time, tip into place, and are pushed back into the deck as the next ones land. Each one's spec sheet assembles as it arrives.
Live demo
Scroll inside the demo to stack the cards. Scroll back up to watch it all reverse.
The Prompt
Build a "stacking cards" process section in which the scroll does all the animating and JavaScript does none. Five large enamel-colored cards come up one at a time. Each tips up into place like a card being laid on a table, sticks a little lower than the last, and is then pushed back into the deck (smaller, darker) as the cards after it land. Inside each card a small spec sheet assembles as the card arrives: a nine-week strip fills in that stage's weeks and the figures slide up. A thin rail at the edge fills with progress. The content is the five stages of a hand-built bicycle from Ostler Cycles. Match my project's existing stack, conventions, and design tokens. If there are none, output a single HTML file with inline CSS and JavaScript and zero dependencies. CSS scroll-driven animations only.
LOOK
- Page #0A0A0C, text #F2F2F5, accent brass #E9B44C. ui-sans-serif, system-ui; display weight 640, letter-spacing -0.05em.
- Cards take their colors from frame enamel: oxblood #7A1F2B with cream text, racing green #0F4D3A with pale green text, cream #EFE6D0 with near-black text, sky #8EC5E8 with navy text, black #16171B with cream text. Each sets --paper and --on.
- Card: max 1180px wide, min(74vh, 660px) tall, radius clamp(24px, 3vw, 40px), a top highlight line and a deep upward shadow so each casts onto the one beneath. Two columns: text, and a spec half with a soft radial highlight. On phones the spec sits on top, shows only its first two rows, and the numeral moves to the corner.
- Text half: a huge outlined numeral (clamp(64px, 11vw, 190px), transparent with a 1.5px stroke) at the top; at the bottom a title at clamp(28px, 3.6vw, 60px), two lines of copy and a small line of timing.
- Cards have a pool of light that follows the pointer. Film grain at 9%.
- Fixed header blended with difference: "Ostler Cycles" and "Book a fitting".
CONTENT
- Intro, 82svh, text at the bottom: "One steel bicycle, built for one rider, in five stages." and a short paragraph ending "Scroll to follow one through."
- 01 Measure, Week 1. 02 Draw, Weeks 2 and 3. 03 Braze, Weeks 4 and 5. 04 Paint, Weeks 6 and 7. 05 Ride, Week 9. One or two sentences each in a dry workshop voice ("It takes two days and it cannot be hurried, so we do not take calls."). Braze says the brass flows at 1,650°F.
- Spec sheets, in the card's text color: a small uppercase line "Week" and "of 9", a strip of nine numbered cells (1px outlines at 32%, the stage's weeks solid in the text color with the number knocked out in the card color), then four rows of label and figure on hairlines, figures in tabular numerals. Measure: Saddle height 754 mm, Reach 392 mm, Stack 586 mm, On the jig 60 min. Draw: Seat angle 73.5°, Head angle 72.0°, Top tube 556 mm, Wheelbase 1,012 mm. Braze: Tubes 11, Brass flows at 1,650°F, Bare frame 4.6 lb, Hours at the bench 16. Paint: Coats of enamel 4, Clear coats 2, Cure 48 h, Lettering By hand. Ride: Test ride 1 h, Adjustments Free, Frame number 0412, Warranty Lifetime.
- Outro: "Nine weeks from today." and a pill.
THE STACK
- The section has view-timeline: --stack block and perspective 1400px. Each card is position: sticky with top: calc(10vh + var(--i) * 18px) and a 26vh bottom margin, and carries its index in --i; the section knows the count in --n.
- Two animations per card, on two different timelines, declared as comma-separated lists.
- "arrive", on the card's own view() timeline, range entry 10% to entry 110%: from rotateX(-16deg) translateY(8vh) scale(0.94) to rest, with transform-origin at the top edge.
- "recede", on --stack, range contain calc((var(--i) + 0.42) / var(--n) * 100%) to contain 100%: to scale calc(1 - var(--left) * 0.045) and filter brightness(calc(1 - var(--left) * 0.13)) saturate(calc(1 - var(--left) * 0.08)), where --left is the number of cards still to come, n - 1 - i. Keyframes read the element's own custom properties, so one rule serves all five and the first card ends smallest.
- Use the individual scale property for receding so it composes with the transform used for arriving.
ASSEMBLED BY THE SCROLL
- On the card's own view() timeline, the filled week cells grow up from their bottom edge (scale 1 0 to 1 1, range entry 45% to cover 42%) and the spec rows rise 14px and fade in (range entry 50% to cover 46%), so the sheet completes just as the card settles.
THE RAIL
- A 4px by 26vh track fixed at the right edge. Its fill scales from 0 to 1 on --stack. The rail itself fades in and out at the ends of the section.
- The rail lives outside the section, so declare timeline-scope: --stack on the body to make the name visible to it.
MOTION
- Load: intro heading words rise from clipping boxes and the paragraph sharpens from a blur on a CSS spring easing. That is the only time-based animation on the page.
- Everything else is position-based and reverses exactly when scrolling back.
FALLBACK AND ACCESSIBILITY
- Browsers without scroll timelines still get the sticky stack, just without tipping, receding or the spec sheets assembling. Nothing breaks.
- The section is labeled; each card is an article with a real heading. Numerals and the week strips are aria-hidden. The spec rows are real definition lists.
- prefers-reduced-motion: no animations at all; cards simply stick.
NEVER
- No scroll listener, IntersectionObserver or animation loop for the stack.
- No fading cards out as they are covered. They stay in the deck, visible at the top edge.
- No horizontal movement, parallax backgrounds or scroll snapping.
- No photographs or illustrations. The figures are the art.
- CopyThe full prompt, one click.
- PasteInto Cursor, Claude Code, or any agent.
- CompareAgainst the live demo above.