Background

Fireworks

Autonomous firework bursts with configurable timing.

fireworks.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/fireworks.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/fireworks.json

3

Turn on the motion

npx @prequelui/cli@latest animate fireworks

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

fireworks.tsx
import { FireworksBackground } from "@/components/prequelui/backgrounds/fireworks";

export default function Demo() {
  return (
    <div className="relative h-96 overflow-hidden rounded-xl">
      <FireworksBackground />
    </div>
  );
}
import { Fireworks } from "@/components/prequelui/fireworks";

export function Variant() {
  return (
    <Fireworks tempo={1.2}>
      …
    </Fireworks>
  );
}

Animation

Rockets leave the bottom edge with a short trail and explode when they reach their target. Each explosion releases a ring of particles that slows down, falls under a light gravity and fades; clicking the scene launches another rocket from the click point.

  • Default particles: 64 per burst, 0.8–3.2 px, decay 0.006–0.018 per frame.
  • Rockets launch every 380–1000 ms, divided by the population prop.
  • Particles are composited in lighter mode so overlaps glow.
  • Reduced motion draws three frozen bursts instead of animating.
64 sparks380–1000 mslighter blendclick to launch

API Reference

Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.

FireworksBackground

PropTypeDefault
interactivebooleantrue
populationnumber1
colorsstring[]six-colour palette
particleCountnumber64
speednumber1
pausedbooleanfalse
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026