Skip to content
party.js logoparty.js logo

ReferenceEffectsFunction

sparkles()

Bursts twinkling golden sparkles out in all directions.

function sparkles(target: EffectTarget, options?: SparklesOptions): Effect;

Bursts twinkling, four-pointed stars, golden by default, out of the specified target, in all directions.

The sparkles appear in four quick bursts from the middle of the target, each spread evenly around it. They shoot outwards, slow down quickly and hover, settling slightly downwards while they turn slowly. Occasionally each sparkle catches the light: it briefly grows and flashes towards white, see twinkle(). Most sparkles are small, with a few big ones among them. They pop in almost instantly and shrink away over their last quarter of a second.

targetEffectTarget

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

optionsoptionalSparklesOptions

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

Effect

A handle to the running effect.

button.addEventListener("click", () => sparkles(button, { count: 12 }));