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
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
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 like this
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 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 SVG World Clock with Sweeping Hands and Five Time Zones
A single HTML file with a crisp SVG analog clock whose hands glide continuously and ease smoothly between five world cities, each with a labeled UTC offset.
Build an Interactive Particle Network Background With Mouse and Touch Controls
A single HTML file with a full-screen canvas particle network that links nearby dots, reacts to mouse and touch, and has density, color and low-power controls.
Build a Button Micro-Interaction Showcase with Ripple, Magnetic Hover and Checkmark
You get one self-contained HTML page with three accessible button micro-interactions: ripple, magnetic hover and a success checkmark. Each card has a copyable standalone code snippet.