Skip to content

Fireflies API

Fireflies

Extends Effect.

Factory Function

typescript
createFireflies(config?: FirefliesConfig)

Methods

See Effect for the full method reference: mount(), start(), pause(), resume(), configure(), withFade(), and destroy().


FirefliesConfig

typescript
interface FirefliesConfig {
    count?: number;
    color?: string;
    size?: number;
    speed?: number;
    glowSpeed?: number;
    scale?: number;
}
PropertyTypeDefaultDescription
countnumber60Number of fireflies. Automatically halved on small screens.
colorstring'#b4ff6a'CSS color string for the glow color.
sizenumber6Maximum glow radius in pixels (before scale).
speednumber1Movement speed multiplier.
glowSpeednumber1Glow pulsing speed multiplier.
scalenumber1Scales all firefly sizes proportionally.

Firefly

Internal representation of a firefly particle.

typescript
type Firefly = {
    x: number;       // Normalized X position (0-1)
    y: number;       // Normalized Y position (0-1)
    size: number;    // Glow radius in pixels
    phase: number;   // Glow phase offset
    glowSpeed: number; // Individual glow speed
};