Build a Confetti and Fireworks Celebration Effect in a Single HTML File
A ready-to-paste prompt that builds a reusable canvas confetti and fireworks layer with color theme presets, burst size control, Web Audio pops and automatic particle cleanup.
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 specializes in lightweight canvas animation. Build "Bright Moment", a reusable confetti and fireworks celebration layer shown on top of a mock payment-success screen. All particles are drawn on one full-window canvas with simple physics: gravity, air drag, flutter and 3D-style rotation for paper confetti, and rising rockets that explode into radial sparks.
Rules:
1. The success card has three buttons: Confetti (two cannons firing from the bottom corners), Fireworks (staggered rockets) and Both. Keys: C, F, Space, 1-4 for themes, M to mute. Clicking empty background launches a firework at that point.
2. Offer four color theme presets (Festival, Sunset, Mint, Gold) as round swatch buttons using aria-pressed, plus a Burst size slider labeled Small, Medium, Large, Huge.
3. Automatic cleanup: remove particles once they fade or leave the screen, cap the total count, stop requestAnimationFrame and clear the canvas when nothing is left, and show a live particle count.
4. The canvas is fixed with pointer-events none, sharp on high-DPI screens, resizes with the window and uses delta time so speed is frame-rate independent.
5. Under prefers-reduced-motion, skip rockets and use fewer, slower particles.
6. Synthesize pop, whistle and boom sounds with the Web Audio API, created on first interaction, at low volume, with a visible mute toggle.
Use a dark navy palette with one yellow accent and readable contrast.
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
- One fixed canvas with pointer-events none sits over any page, so the effect drops onto a success screen without blocking clicks.
- Removing particles and stopping the animation loop when the canvas is empty keeps it light enough to trigger again and again.
- Delta-time physics, a DPR-aware canvas and a reduced-motion path keep it smooth, sharp and comfortable on any device.
Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as celebrate.html and open it in any browser, or run it in the chat's preview or canvas panel. No setup is needed.
Common edits
- Swap the theme arrays for your brand colors, or change the success card copy to match a signup or checkout flow.
- Raise the particle cap or the Huge multiplier for bigger launches, or delete the boom sound for a quieter office-friendly version.
Keep exploring
More like this
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 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 an Interactive Particle Network Background with Live Controls in HTML
A prompt that produces one HTML file with a cursor-reactive canvas particle network and live sliders for density, link distance, color and speed.
Build an Animated Beating Heart Diagram With Blood Flow in One HTML File
A ready-to-paste prompt that builds an animated heart cross-section with color-coded blood flow, opening and closing valves, a heart rate slider and a soft synthesized lub-dub.
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 a Parallax Starfield Night Sky Hero Section on Canvas in One HTML File
A prompt that produces a single HTML hero section with a three-layer canvas starfield, pointer and tilt parallax, shooting stars, a density slider and a calm mode.