AnimationEffectUpdated in v15

Confetti

A confetti burst you fire from code.

Installation

Import the class. This entry point has no stylesheet.

import { WrConfetti } from 'ngwr/bits/confetti';

Playground

Inject WrConfetti and call fire().

Fire confettiTopBottomLeftRightTop leftTop rightBottom leftBottom right
private readonly confetti = inject(WrConfetti);

onWin(): void {
  this.confetti.fire({
    count: 80,
    spread: 60,
    velocity: 12,
    gravity: 0.35,
  });
}

Customize

Count
80
Spread (°)
60 °
Velocity
12
Gravity
0.35

API

NameDescriptionTypeDefault
WrConfetti.fire(opts?)Fires a confetti burst. Options: count, spread, angle (90 = up, 0 = right), velocity, gravity, drag, origin, colors (any CSS colour or token; the theme intents by default, read at fire time so dark mode recolours), size, ttl.service method—

See also