Effects Fancy Stable

FireworksHdr

GPU fireworks background with a deterministic, DOM-free physics core (rockets, peony/willow/ring/glyph shells, sparks, embers, smoke) rendered by a WebGPU engine into a wide-gamut, extended-tone-mapping canvas so bursts and comet trails burn brighter than SDR white on HDR displays, degrading silently through a WebGL2 fallback and a soft-knee SDR path everywhere else

Preview

Installation

pnpm add fancy-ui-svelte
import { FireworksHdr } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { FireworksHdr } from 'fancy-ui-svelte';
</script>

<FireworksHdr />

Examples

Basic Usage

Ambient shells run on their own; tap the sky or use the handle to launch one. Brightest on an HDR display in a WebGPU browser, and safe (soft-knee SDR) everywhere else.

Pattern shells

Shells that break into a figure: the built-in heart and star, or any closed outline you pass as points. The burst is cut from the figure, so it draws itself in the sky and then droops.

Props

PropTypeDefaultDescription
palette string[]["#ff2fd6","#a142ff","#3d5bff","#42cfff"]Brand hues (hex); order-independent, sorted cool→warm for the shell sweep
hdr booleantrueOpt into the GPU engine (WebGPU HDR first, then a WebGL2 fallback); when false, no engine boots
exposure number2.2Display exposure multiplier, clamped to [1, 4]
ambient booleantrueRun the ambient auto-scheduler (Poisson-timed background shells)
ambientIntensity number0.35Ambient energy [0,1] — scales shell size
interactive booleantrueLaunch a shell toward the pointer on pointerdown
quality "auto" | "high" | "mid" | "low""auto"Particle budget; auto picks from the render level and device pixel ratio
respectReducedMotion booleantrueForce ambient off under prefers-reduced-motion (explicit launches still work)
class string""Extra classes on the canvas wrapper
ambientShells ShellKind[]-Restrict the ambient scheduler to these shells, picked uniformly — including the pattern shells 'heart' and 'star'; defaults to a weighted peony/willow/ring mix ('glyph' and 'shape' are ignored, they need caller-supplied points)
onReady (handle: FireworksHandle) => void-Fired when the engine is live with an imperative handle, and again with a fresh handle after a recovered GPU context loss; never fired when no GPU renderer comes up
onLost () => void-Fired once when a GPU context loss could not be recovered; the component has torn itself down and any handle it gave out is inert