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
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
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 like this
Build an Animated SVG Wave and Liquid Fill Background Generator
A single HTML file that generates layered, seamlessly looping SVG waves with live controls and exports ready-to-use animated SVG and CSS code.
Build a Beat-Synced Kinetic Typography Quote Animation in One HTML File
A prompt that produces Beatline, a single HTML page animating a short quote word by word on a tempo grid, with varied entrances, replay and a clean recording mode.
Build a Click-to-Launch Fireworks Celebration Animation in One HTML File
A prompt that produces a single HTML page where clicks, taps or keys launch fireworks with gravity, fading trails, soft synthesized pops and a mute toggle.
Build a Gallery of Ten Looping Pure-CSS Loading Spinners in One HTML File
You get a single HTML page showing ten original pure-CSS loading animations in a tidy grid, each with a reveal-and-copy code snippet.
Build a Self-Drawing SVG Lighthouse Line Animation in One HTML File
You get a single HTML page where a hand-built SVG lighthouse draws itself stroke by stroke with staggered timing, then fades in its colors, with replay and speed controls.
Build an Animated Dawn-to-Night Landscape Scene in a Single HTML File
You get one HTML file that draws a canvas valley village whose sky, sun, moon, stars, clouds and window lights all follow a single time-of-day scrubber with autoplay.