ParticleEmitter class
A declarative description of how particles are spawned and how they behave over their lifetime.
A ParticleEmitter is a reusable preset: the same instance can be shared by any number of emitter components. All distances are in the emitter component's local units, all angles in radians, and all times in seconds.
Constructors
-
ParticleEmitter({int maxParticles = 1024, double rate = 0, List<
EmitterBurst> bursts = const [], double? duration, bool loop = false, ParticleRange lifespan = (1, 1), EmitterShape shape = const PointEmitterShape(), ParticleRange speed = (0, 0), double direction = 0, double spread = tau, Vector2? gravity, double drag = 0, ParticleRange size = (8, 8), ParticleRange rotation = (0, 0), ParticleRange spin = (0, 0), bool rotateToVelocity = false, ParticleCurve? scaleOverLife, ParticleCurve? opacityOverLife, ColorRamp? colorOverLife}) - Creates an emitter preset.
Properties
-
bursts
→ List<
EmitterBurst> -
One-off releases of particles at fixed times on the emission timeline.
final
- colorOverLife → ColorRamp?
-
The particle's color over its lifetime. When null, particles are
white; with texture renderers this leaves the texture untinted.
final
- direction → double
-
The center of the emission direction, in radians. Zero points along
the positive x-axis;
-tau / 4points up.final - drag → double
-
Velocity damping: each second, velocity is scaled by roughly
1 / (1 + drag). Zero means no damping.final - duration → double?
-
How long emission lasts. When null, a rate-based emitter emits
forever, and a burst-only emitter finishes after its last burst.
final
- emissionEndTime → double
-
The time at which emission naturally ends: duration when set,
infinity for an endless rate-based emitter, and the time of the last
burst for a burst-only emitter.
no setter
- gravity → Vector2
-
A constant acceleration applied to every particle, in local units per
second squared.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- lifespan → ParticleRange
-
The lifespan of each particle, in seconds.
final
- loop → bool
-
Whether the emission timeline restarts after duration.
final
- maxParticles → int
-
The maximum number of simultaneous particles. Storage for all of them
is allocated up front; spawns beyond this limit are dropped until
older particles die.
final
- opacityOverLife → ParticleCurve?
-
How the particle's opacity changes over its lifetime, as a multiplier
of the alpha from colorOverLife (or of full opacity when
colorOverLife is null). Values are clamped to 0...1.
final
- rate → double
-
Particles spawned per second, continuously. Zero means burst-only.
final
- rotateToVelocity → bool
-
When true, each particle is rotated to point along its velocity,
which suits directional particles such as sparks or arrows.
final
- rotation → ParticleRange
-
The initial rotation of each particle, in radians. Ignored when
rotateToVelocity is true.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleOverLife → ParticleCurve?
-
How the particle's size scales over its lifetime, as a multiplier of
its spawn size. When null the size stays constant.
final
- shape → EmitterShape
-
The area in which particles spawn, relative to the emitter's position.
final
- size → ParticleRange
-
The rendered size (width and height) of each particle when it spawns,
in local units.
final
- speed → ParticleRange
-
The initial speed of each particle, in local units per second.
final
- spin → ParticleRange
-
The angular velocity of each particle, in radians per second. Ignored
when rotateToVelocity is true.
final
- spread → double
-
The angle, in radians, over which emission directions are spread,
centered on direction. The default
tauemits in all directions.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited