Skip to content
party.js logoparty.js logo

ReferenceEffectsFunction

confetti()

Emits a burst of confetti.

function confetti(target: EffectTarget, options?: ConfettiOptions): Effect;

Fires a burst of confetti in a cone, upwards by default, from the specified target.

The confetti shoots out of the middle of the target, fast and mostly along angle. Drag slows it down within a fraction of a second, and it then flutters down slowly like paper, swaying as it tumbles. It grows to its full size over its first 0.03 seconds, fades out over its last second, and is lit with a glossy sheen (peak: 1.5).

targetEffectTarget

The target the confetti bursts out of. Its position and size are read once, when the effect starts.

optionsoptionalConfettiOptions

Overrides of the default options. See ConfettiOptions for all fields.

Effect

A handle to the running effect.

button.addEventListener("click", () => confetti(button, { spread: 70 }));