Autonomous firework bursts with configurable timing.
Installation
Install the packages
npm install @prequelui/react motion@prequelui/react reuses the primitive library your components already depend on.
Add the component
npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/fireworks.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/fireworks.json
Turn on the motion
npx @prequelui/cli@latest animate fireworksThe 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.
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.
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
| Prop | Type | Default |
|---|---|---|
| interactive | boolean | true |
| population | number | 1 |
| colors | string[] | six-colour palette |
| particleCount | number | 64 |
| speed | number | 1 |
| paused | boolean | false |
| className | string | — |