Skip to content

Lightning API ​

Lightning ​

Extends Effect.

Factory Function ​

typescript
createLightning(config?: LightningConfig)

Methods ​

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


LightningConfig ​

typescript
interface LightningConfig {
    frequency?: number;
    color?: string;
    branches?: boolean;
    flash?: boolean;
    scale?: number;
}
PropertyTypeDefaultDescription
frequencynumber1Bolt spawn rate multiplier. 1 means roughly one bolt every 3 seconds.
colorstring'#b4c8ff'Hex color string for the bolt glow. The inner line is always white.
branchesbooleantrueEnable smaller branch bolts forking off the main bolt.
flashbooleantrueEnable a brief white screen flash when a bolt strikes.
scalenumber1Global scale factor for line widths.