Build a Page Transition Demo with Wipe, Curtain and Morph Effects in One HTML File
A single HTML file that simulates a four-page website and animates every page change with wipe, curtain or morph transitions, plus an adjustable duration and a reduced-motion crossfade.
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 and motion designer. Build Page Turns, a page-transition playground. Inside one HTML file, simulate a small four-page website for a fictional ceramics studio called Driftwood Atelier, with Home, Collection, Process and Visit views, real-sounding copy, and CSS-drawn pots instead of images.
Rules:
1. Show a fake browser frame with back and forward buttons, an address bar that updates the path, and site tabs. Keep an internal history stack so back and forward work.
2. Offer three transition styles as pressed-state buttons. Wipe: a colored panel sweeps across, and its direction follows page order. Curtain: two striped panels close and then reopen. Morph: the clicked tab's pill shape grows to fill the stage, then fades into the new page. Use the Web Animations API.
3. Add a duration slider from 300 to 1600 ms with a live readout. Block new navigation while a transition is running.
4. If prefers-reduced-motion is set, or a 'Preview reduced motion' toggle is on, replace every effect with a short crossfade and explain why in a visible note.
5. Keyboard: 1-4 open pages, left and right arrows go to the previous or next page, W, C and M choose a style. Move focus to the new page heading and announce it in an aria-live region.
6. Use a warm, small palette with a different accent per page, readable contrast, and a layout that fits 360-1280px.
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
- Views sit stacked in one stage and are swapped while the effect covers the screen, so you never see a half-loaded page or a layout jump.
- The Web Animations API returns promises, which makes each two-phase effect (cover, swap, reveal) easy to sequence without timing bugs.
- A busy lock plus a forced crossfade for reduced motion keeps fast clicking and accessibility settings from breaking the demo.
Paste the prompt into ChatGPT, Claude or Gemini. Copy the returned code into a file such as page-turns.html and open it in any modern browser, or use the chat's preview or canvas view to try it immediately.
Common edits
- Swap the ceramics studio for your own site's pages and accent colors, and the transitions keep working unchanged.
- Add a fourth style, such as a diagonal slice or a circular iris, by writing one more async function next to wipe and curtain.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build a Gallery of 12 Pure-CSS Loading Spinners with Copyable Code
You get a single HTML page showing 12 live CSS-only loaders, each with its own isolated CSS, a copy button, and a reduced-motion fallback that pulses gently instead of spinning.
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 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 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.
Build an Animated Gradient Glitch Title Hero Header in One HTML File
A ready-to-paste prompt for a website hero header with a shifting gradient headline, a subtle glitch flicker, three switchable color presets and a reduced-motion fallback.
Build an Animated Nonprofit Impact Stats Counter Section in One HTML File
Get a polished nonprofit impact section where six key figures count up with easing on scroll, with formatted thousands, percentages and currency plus believable captions.