Skip to content

Stars API

Stars

Extends Effect.

Factory Function

typescript
createStars(config?: StarsConfig)

Methods

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


StarsConfig

typescript
interface StarsConfig {
    mode?: StarMode;
    starCount?: number;
    shootingInterval?: [number, number];
    shootingSpeed?: number;
    twinkleSpeed?: number;
    color?: string;
    shootingColor?: string;
    trailLength?: number;
    scale?: number;
}
PropertyTypeDefaultDescription
modeStarMode'both'Which layers to display.
starCountnumber150Number of twinkling background stars. Automatically halved on small screens.
shootingInterval[number, number][120, 360]Tick range between shooting star spawns.
shootingSpeednumber1Shooting star speed multiplier.
twinkleSpeednumber1Twinkle animation speed multiplier.
colorstring'#ffffff'Star color (hex string).
shootingColorstring'#ffffff'Shooting star color (hex string).
trailLengthnumber15Number of trail points per shooting star.
scalenumber1Global scale factor.

StarMode

typescript
type StarMode = 'sky' | 'shooting' | 'both';
ModeDescription
skyOnly twinkling background stars.
shootingOnly shooting stars with trails.
bothBoth twinkling stars and shooting stars.