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

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

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

Example: Page Turns, a transition playground for a fictional ceramics studio site.

Pick Wipe, Curtain or Morph, set a duration, then click the site tabs or the in-page buttons. The fake address bar and the back/forward buttons track your history. Keys 1–4 open pages, ←/→ step through them, and W/C/M switch styles. Turn on Preview reduced motion to see the calm crossfade fallback.

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

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 in Animations & Effects