Skip to content
party.js logoparty.js logo

ReferenceEffectsType

EffectTarget

An element or point that an effect bursts out of.

type EffectTarget = HTMLElement | Vec2;

What an effect bursts out of: an element on the page, or a point.

For an element, the built-in effects burst out of a small area in its middle, which grows with the element’s size. For a point, they spawn exactly there, in page coordinates, i.e. in pixels from the top-left corner of the document, with +y pointing down. Either way, the position is read only once, when the effect starts; moving or scrolling afterwards does not move the effect.

confetti(document.querySelector("#submit")!);
confetti({ x: event.pageX, y: event.pageY });