Skip to content

Leaves API

Leaves

Extends Effect.

Factory Function

typescript
createLeaves(config?: LeavesConfig)

Methods

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


LeavesConfig

typescript
interface LeavesConfig {
    count?: number;
    colors?: string[];
    size?: number;
    speed?: number;
    wind?: number;
    scale?: number;
}
PropertyTypeDefaultDescription
countnumber80Number of leaves. Automatically halved on small screens.
colorsstring[]Autumn palette (10 colors)Array of CSS color strings for leaf colors.
sizenumber30Maximum leaf size in pixels (before scale).
speednumber1Fall speed multiplier.
windnumber0.15Horizontal wind strength. Positive = right, negative = left.
scalenumber1Scales all leaf sizes proportionally.