konfeti - v0.6.0
    Preparing search index...

    Type Alias AttractOptions

    Attractor / Repulsor Settings. Pulls every particle toward a target — the pointer, an element or a point — or pushes it away with a negative strength. The target is looked up once per frame, so it can move.

    Konfeti.fire({ physics: { attract: true } }); // pulled toward the pointer
    Konfeti.fire({ physics: { attract: { target: basket, strength: 1500 } } }); // into an element
    Konfeti.fire({ physics: { attract: { target: "pointer", strength: -2000, radius: 150 } } }); // pushed away
    type AttractOptions = {
        falloff?: AttractFalloff;
        radius?: Pixels;
        strength?: Range<PixelsPerSecondSquared>;
        target?: EmitterTarget;
    }
    Index
    falloff?: AttractFalloff

    Distance Falloff.

    "constant"

    radius?: Pixels

    Reach. Particles farther than this from the target are not affected. Infinity reaches the whole canvas.

    Infinity

    Unit: pixels (CSS px).

    Pull Strength. Acceleration toward the target; a negative value pushes particles away (a repulsor). Sampled per particle, so a range makes some pieces react more than others.

    900

    Unit: pixels per second squared. Gravity and drag still apply, so a pull weaker than gravity slows the fall rather than lifting particles.

    target?: EmitterTarget

    Target. An element (its center, measured every frame), "pointer" (no pull until the pointer moves over the page) or a normalized point { x, y } (0–1 of the canvas).

    "pointer"

    Worker instances follow the pointer or element on the main thread and send every new place to the worker.