Build an Animated Headline Text Reveal Playground in a Single HTML File

A one-file playground where you type a headline, preview typewriter, letter stagger, mask wipe or scramble reveals, and copy clean code for the chosen effect.

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 "Headline Reveal Lab", a single-page tool for previewing animated headline reveals and copying the code. The user types a headline into a text field, prefilled with "Ship the story, not the slide deck", with three sample-headline chips below it. They pick one of four effects and watch it play in a large preview card:
- Typewriter: characters appear one at a time behind a blinking caret.
- Letter stagger: each letter rises into place with an even delay.
- Mask wipe: a clip-path mask opens left to right, led by an accent bar.
- Scramble: random glyphs lock into the real letters from left to right.

Rules:
1. Effect buttons use aria-pressed. A duration slider runs from 400 to 3000 ms. The Replay button, clicking the preview, Enter in the field, or the R key replays the effect. Keys 1-4 switch effects.
2. Below the preview, show a self-contained snippet (HTML, CSS and JS) for only the selected effect. Bake in the user's text and duration and update the snippet live as they change.
3. Add a Copy button. It tries the Clipboard API first, then falls back to execCommand. If both fail, it selects the code and says so in a live status line.
4. The preview and every snippet respect prefers-reduced-motion by showing the final text.
5. Use a warm palette: cream background, near-black ink and one burnt-orange accent. Use system fonts and a bold headline sized with clamp. Use two columns above 880px and stack them below that. Make it work from 360 to 1280px wide, with visible focus rings and AA contrast.
6. Use no external resources, storage or alerts, and wrap the script in an IIFE.

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: Headline Reveal Lab, a playground for four headline reveal animations.

Type a headline or tap a sample chip, then pick Typewriter, Letter stagger, Mask wipe or Scramble. Drag the duration slider and press Replay, click the preview, or hit R. Keys 1-4 switch effects. The code panel rebuilds a standalone snippet for that one effect with your text baked in. Press Copy code and paste it into any page.

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

Tips and common edits

Why this works

  • Naming all four effects with their exact visual behavior stops the model from guessing and keeps the preview and the copied code in sync.
  • Asking for a layered copy fallback (Clipboard API, execCommand, then select) makes the Copy button work even inside sandboxed previews.
  • Baking the user's text and duration into each snippet produces code that can be pasted into a page and run as is.

Paste the prompt into ChatGPT, Claude or Gemini. Save the code it returns as headline-lab.html and open it in any browser, or run it in the chat's preview or canvas. Then type your own headline and copy the snippet.

Common edits

  • Swap the burnt-orange accent and cream background for your brand colors, or add a fifth effect such as a word-by-word blur fade.
  • Add easing presets (snappy, smooth, bouncy) next to the duration slider and include the chosen curve in the generated CSS.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Animations & Effects