clear Particles

Stop the particle effect currently displaying at a sprite.

mySpriteclear effects on
JavaScript
function effects.clearParticles(anchor: Sprite | particles.ParticleAnchor): void;
Python
def effects.clear_particles(anchor: unknown): None

Particle effects, when started, are set for a sprite. You can stop the effect early, if a duration was set, or stop it from displaying continuously if no duration was set.

Parameters

  • anchor: the sprite that the effect is displaying at.

Example

Spray the confetti

Start a confetti effect on the blob sprite for 5 seconds but then stop it after just 2 seconds.

0spriteof kindblobject50002000blobjectclear effects onpausemsstartconfettieffectformssetblobjecttoon start

Campfire

Show a fire effect coming from a sprite image of firewood. When button A is pressed, the campfire goes out and the blizzard with the bubble effect simulates the fire smoldering.

logslogs750logs2000startbubbleseffectformsstartblizzardeffectformsclear effects ononAbuttonpressed0spriteof kindlogsstartfireeffectsetlogstoon start

Immediately clear all particles

The clear particles block gets rid of the sources, but if you want to immediately get rid of all particles on the screen you need to also call particles.clearAll(), which is currently only available in text coding.

let logs: Sprite = null controller.A.onEvent(ControllerButtonEvent.Pressed, function () { effects.clearParticles(logs) logs.startEffect(effects.blizzard, 750) logs.startEffect(effects.bubbles, 2000) }) controller.B.onEvent(ControllerButtonEvent.Pressed, function () { effects.clearParticles(logs) particles.clearAll() }) logs = sprites.create(img` . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . e . . . . . e e . . . . . . . e e . . . . . . e e e . . . e e d e . . . . . . e d e e e . e d e e . . . . . . e e d d e e d d e . . . . . . . . . e e d d e e . . . . . . . . e e d e e d d e . . . . . . . e e d d e e e d d e e . . . . . e d d e e . e e e d e e . . . . e e e . . . . . e e e . . . . . . . . . . . . . . . . . . . `, 0) logs.startEffect(effects.fire)

See also

start effect