Components

Fireworks Background

fireworks x burst

Fireworks particle background animation. From Animate UI.

backgroundfireworksparticlesanimateui

Fireworks

Code

bg-fireworks.tsx
/* Index-derived positions — see StarsBackground for why this must not be random. */
const SPARKS = Array.from({ length: 12 }, (_, i) => ({
  left: 10 + ((i * 29) % 80),
  top: 20 + ((i * 43) % 60),
  delay: i * 0.4,
}));

export function FireworksBackground({ children }: { children: React.ReactNode }) {
  return (
    <div className="relative grid h-40 place-items-center overflow-hidden rounded-xl">
      <div className="absolute inset-0" aria-hidden>
        {SPARKS.map((s, i) => (
          <span key={i} className="absolute size-1 animate-[firework_2s_ease-out_infinite] rounded-full bg-white"
            style={{ left: `${s.left}%`, top: `${s.top}%`, animationDelay: `${s.delay}s` }} />
        ))}
      </div>
      <div className="relative">{children}</div>
    </div>
  );
}

globals.css: @keyframes firework { 0% { transform: scale(0); opacity: 1 } 50% { transform: scale(3); opacity: 0.6 } 100% { transform: scale(0); opacity: 0 } }

Use it in another build

Paste the code into a component file, keep your project tokens (background, brand, radius) and it themes itself. Or tell Claude Code: “add the Fireworks Background component and wire it to my accent.”