ParticleEmitter class final

Confetti, stars or emoji the node bursts with on cue.

Each particle leaves from the origin at speed (55–115%) in a direction within spread of direction, slows by drag, falls by gravity no faster than terminalVelocity, sways sway px side to side, spins and turns over (flutter), and fades out over the last fadeOut ms of its lifetime.

Annotations
  • @immutable

Constructors

ParticleEmitter({int count = 40, int emit = 0, List<Color> colors = defaultColors, List<ParticleShape> shapes = const [ParticleShape.square, ParticleShape.strip, ParticleShape.circle], double size = 10, double originX = 0, double originY = 0, double originWidth = 0, double direction = 0, double spread = 60, double speed = 700, double gravity = 900, int lifetime = 2600, bool playOnAppear = false, String? playKey, String image = '', int delay = 0, double drag = 0, double terminalVelocity = 0, double sway = 0, double flutter = 8, double spin = 515, int fadeOut = 500, bool mirror = false, String glyph = ''})
const

Properties

colors → List<Color>
final
count → int
final
delay → int
Wait after the cue before the first particle leaves (ms).
final
direction → double
final
drag → double
Air resistance: the speed falls by e^(-drag) each second (0: none).
final
emit → int
Over how long the particles leave (ms; 0 all at once).
final
fadeOut → int
The last part of its life over which a particle fades out (ms).
final
flutter → double
How fast each particle turns over in 3D (radians per second, up to; 0 keeps it flat).
final
glyph → String
What ParticleShape.emoji particles draw (bindable as particles.glyph).
final
gravity → double
final
hashCode → int
The hash code for this object.
no setterinherited
image → String
The image image particles draw (a URL; petals, seeds, raindrops), size wide, spinning as they fly.
final
lifetime → int
final
mirror → bool
Every other particle leaves mirrored across the node's vertical middle (its origin and direction flipped): two cannons facing each other.
final
originWidth → double
final
originX → double
final
originY → double
final
playKey → String?
A cue the node's bindings set (particles.playKey): the particles burst each time it changes.
final
playOnAppear → bool
final
props → List<Object?>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shapes → List<ParticleShape>
final
size → double
final
speed → double
final
spin → double
The fastest a particle spins (degrees per second).
final
spread → double
final
sway → double
How far each particle sways side to side as it goes (px).
final
terminalVelocity → double
The fastest a particle falls (px/s; 0: no limit). Paper floats.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Json
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

fromJson(Object? json) → ParticleEmitter?

Constants

defaultColors → const List<Color>