Build a Scroll-Triggered Reveal Demo with Fade, Slide and Zoom Entrances

Get one self-contained HTML page that demonstrates fade, slide and zoom scroll reveals using IntersectionObserver, with live stagger and duration controls and a reusable attribute pattern.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
Act as a senior front-end developer who writes clean, dependency-free motion code. Build a single-page demo called "Unfold: Scroll Reveal Kit" that shows fade, slide and zoom section entrances triggered by scrolling and teaches a reusable attribute pattern. Use IntersectionObserver only, no libraries. Rules:
1. Elements opt in with data-reveal set to fade, slide-up, slide-left, slide-right or zoom. Optional data-reveal-delay in milliseconds and data-reveal-threshold between 0 and 1. A parent with data-reveal-stagger staggers the children that enter together, in DOM order.
2. Create one observer per distinct threshold, reveal by adding an is-visible class, and unobserve after reveal unless a "Repeat on re-entry" toggle is on.
3. A sticky toolbar holds sliders for stagger (0-300 ms) and duration (200-1500 ms), the repeat toggle, a Replay button and a live "revealed X of Y" counter.
4. Sections: hero with an attribute legend, fade cards, slide-up list, left/right split, zoom gallery of CSS-drawn tiles, a nine-item stagger grid, a threshold comparison row (0, 0.5, 1) and a copyable code snippet of the pattern.
5. Warm paper background, ink text, one coral accent, system font stack, clear type scale, fully responsive from 360 to 1280 px.
6. Under prefers-reduced-motion, drop transforms and use a short opacity fade. All content stays in the DOM and readable.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Unfold, a scroll reveal kit with live controls.

Scroll down to watch cards fade, lists slide up, split panels slide in from both sides and gallery tiles zoom into place. Use the sticky toolbar to change the stagger delay and duration, and switch on Repeat to make sections re-animate each time they re-enter. Press Replay to reset everything. The threshold row shows when 0, 50% and 100% visibility fire. Copy the attribute snippet at the bottom to reuse the pattern.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Naming the exact data attributes gives the model a concrete, reusable API instead of ad-hoc classes, so the pattern drops straight into other sites.
  • Batch-based stagger and one observer per threshold avoid the common bugs where grid rows lag or thresholds are ignored.
  • Listing every section and toolbar control up front means the first result is a complete, testable demo page, not a sketch.

Paste into ChatGPT, Claude or Gemini. Save the returned code as unfold.html and open it in any browser, or view it in the chat's preview/canvas. Then copy the data-reveal attributes into your own site.

Common edits

  • Add new effects such as rotate-in or blur-in by adding a data-reveal value and one CSS rule for its starting transform.
  • Change the palette or easing curve in the CSS variables at the top to match your brand's motion style.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Animations & Effects