konfeti - v0.6.0
    Preparing search index...

    Type Alias FireOptions

    FireOptions: BurstHooks & {
        angle?: Range<Degrees>;
        delay?: Milliseconds;
        emission?: EmissionOptions;
        formation?: FormationOptions;
        lifetime?: Range<Milliseconds>;
        origin?: Origin;
        paper?: PaperStyle;
        particleCount?: number;
        physics?: PhysicsOptions;
        seed?: number;
        shapes?: readonly ShapeOptions[];
        spread?: Degrees;
        startVelocity?: Range<PixelsPerSecond>;
    }

    Options for a Single Burst. Everything is optional — Konfeti.fire() with no arguments produces a classic confetti pop.

    Type Declaration

    • Optional Readonlyangle?: Range<Degrees>

      Launch Direction. 90 shoots straight up, 0 right, 180 left, 270 down.

      90

    • Optional Readonlydelay?: Milliseconds

      Start Delay. Waits this long after fire() before the burst starts. Give the entries of a list different delays to choreograph them: a cannon shot, then a message, then a finale.

      0

      Konfeti.fire([
      { origin: { x: 0, y: 0.8 }, angle: 60 },
      { origin: { x: 1, y: 0.8 }, angle: 120, delay: 250 },
      { formation: { text: "HOORAY" }, delay: 600 },
      ]);

      Unit: milliseconds; must be zero or more. Paused time does not count, and the handle resolves once the delayed burst has finished.

    • Optional Readonlyemission?: EmissionOptions

      Emission Timing.

      { mode: "burst" }

    • Optional Readonlyformation?: FormationOptions

      Formation. The particles first form a text or an image, hold it, then burst apart. The shape is centered on origin; startVelocity becomes the speed at which the particles fly outward, and particleCount (if set) only caps the count the shape needs.

      none (a regular burst)
      
      Konfeti.fire({ formation: { text: "TEBRİKLER" }, origin: { x: 0.5, y: 0.4 } });
      Konfeti.fire({ formation: { image: "/logo.png", mode: "appear", hold: 1500 } });

      Needs emission: { mode: "burst" } (the default). With konfeti/lite, call enableFormations() once first.

    • Optional Readonlylifetime?: Range<Milliseconds>

      Particle Lifetime. Particles are removed after this time (and earlier once they fall below the canvas, unless a floor is set).

      [2800, 3600]

    • Optional Readonlyorigin?: Origin

      Spawn Origin.

      { x: 0.5, y: 0.6 }

      Origin

    • Optional Readonlypaper?: PaperStyle

      Paper Style (and base style for every shape).

    • Optional ReadonlyparticleCount?: number

      Number of Particles. For "interval" emission this is per shot. Rounded down; negative values become 0. Capped by the instance's maxParticles.

      60

    • Optional Readonlyphysics?: PhysicsOptions

      Motion Physics.

    • Optional Readonlyseed?: number

      Random Seed. The same seed with the same options and canvas size reproduces the exact same burst.

      random
      
    • Optional Readonlyshapes?: readonly ShapeOptions[]

      Shape Mix. Each particle picks one entry (respecting weight). Omitted = paper only.

      [{ type: "paper" }]

      shapes: [
      { type: "paper", weight: 4 },
      { type: "star", colors: "gold" },
      { type: "emoji", emoji: ["🎉", "🥳"] },
      ]
    • Optional Readonlyspread?: Degrees

      Launch Cone Width. Total opening angle around angle. 360 shoots in every direction.

      60

    • Optional ReadonlystartVelocity?: Range<PixelsPerSecond>

      Launch Speed. For a formation, the speed at which the particles burst apart from the shape.

      [1000, 1800] ([300, 700] with a formation)

    Konfeti.fire({
    particleCount: 120,
    angle: 60,
    spread: 55,
    origin: { x: 0, y: 0.7 },
    paper: { colors: ["#bb0000", "#ffffff"] },
    shapes: [{ type: "paper", weight: 3 }, { type: "emoji", emoji: "🎉" }],
    });