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

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

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

Example: Bright Moment, a confetti and fireworks layer for success screens.

The page opens on a "Payment received" card, with a small confetti burst already playing. Click Confetti, Fireworks or Both, or press C, F or Space. Switch palettes with the four swatches or keys 1-4, and drag the Burst size slider up to Huge. Click empty background to launch a rocket at that spot. Watch the particle counter fall back to "Idle" once everything has cleaned itself up. M toggles sound.

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

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.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Animations & Effects