A Particle is a simple object owned and controlled by a Particle Emitter.
It encapsulates all of the properties required to move and update according to the Emitters operations.
new Particle(emitter)
name | type | description |
---|---|---|
emitter | Phaser.GameObjects.Particles.ParticleEmitter |
The Emitter to which this Particle belongs. |
The x acceleration of this Particle.
The y acceleration of this Particle.
The alpha value of this Particle.
The angle of this Particle in degrees.
The Animation State component of this Particle.
This component provides features to apply animations to this Particle. It is responsible for playing, loading, queuing animations for later playback, mixing between animations and setting the current animation frame to this Particle.
The bounciness, or restitution, of this Particle.
A rectangle that holds the bounds of this Particle after a call to
the Particle.getBounds
method has been made.
The data used by the ease equation.
The delay applied to this Particle upon emission, in ms.
The Emitter to which this Particle belongs.
A Particle can only belong to a single Emitter and is created, updated and destroyed by it.
The texture frame used by this Particle when it renders.
The hold applied to this Particle before it expires, in ms.
The lifespan of this Particle in ms.
The current life of this Particle in ms.
The normalized lifespan T value, where 0 is the start and 1 is the end.
The maximum horizontal velocity this Particle can travel at.
The maximum vertical velocity this Particle can travel at.
The angle of this Particle in radians.
The horizontal scale of this Particle.
The vertical scale of this Particle.
A reference to the Scene to which this Game Object belongs.
Game Objects can only belong to one Scene.
You should consider this property as being read-only. You cannot move a Game Object to another Scene by simply changing it.
The texture used by this Particle when it renders.
The tint applied to this Particle.
The x velocity of this Particle.
The y velocity of this Particle.
The coordinates of this Particle in world space.
Updated as part of computeVelocity
.
The x coordinate of this Particle.
The y coordinate of this Particle.
An internal method that calculates the velocity of the Particle and its world position. It also runs it against any active Processors that are set on the Emitter.
name | type | description |
---|---|---|
emitter | Phaser.GameObjects.Particles.ParticleEmitter |
The Emitter that is updating this Particle. |
delta | number |
The delta time in ms. |
step | number |
The delta value divided by 1000. |
processors | Array.<Phaser.GameObjects.Particles.ParticleProcessor> |
An array of all active Particle Processors. |
t | number |
The current normalized lifetime of the particle, between 0 (birth) and 1 (death). |
Destroys this Particle.
The Event Emitter proxy.
Passes on all parameters to the ParticleEmitter
to emit directly.
name | type | arguments | description |
---|---|---|---|
event | string | Symbol |
The event name. |
|
a1 | any | <optional> |
Optional argument 1. |
a2 | any | <optional> |
Optional argument 2. |
a3 | any | <optional> |
Optional argument 3. |
a4 | any | <optional> |
Optional argument 4. |
a5 | any | <optional> |
Optional argument 5. |
true
if the event had listeners, else false
.
Starts this Particle from the given coordinates.
name | type | arguments | description |
---|---|---|---|
x | number | <optional> |
The x coordinate to launch this Particle from. |
y | number | <optional> |
The y coordinate to launch this Particle from. |
true
if the Particle is alive, or false
if it was spawned inside a DeathZone.
Gets the bounds of this particle as a Geometry Rectangle, factoring in any transforms of the parent emitter and anything else above it in the display list.
Once calculated the bounds can be accessed via the Particle.bounds
property.
name | type | arguments | description |
---|---|---|---|
matrix | Phaser.GameObjects.Components.TransformMatrix | <optional> |
Optional transform matrix to apply to this particle. |
A Rectangle containing the transformed bounds of this particle.
Checks to see if this Particle is alive and updating.
true
if this Particle is alive and updating, otherwise false
.
Kills this particle. This sets the lifeCurrent
value to 0, which forces
the Particle to be removed the next time its parent Emitter runs an update.
Sets the position of this particle to the given x/y coordinates.
If the parameters are left undefined, it resets the particle back to 0x0.
name | type | arguments | description |
---|---|---|---|
x | number | <optional> |
The x coordinate to set this Particle to. |
y | number | <optional> |
The y coordinate to set this Particle to. |
This is a NOOP method and does nothing when called.
The main update method for this Particle.
Updates its life values, computes the velocity and repositions the Particle.
name | type | description |
---|---|---|
delta | number |
The delta time in ms. |
step | number |
The delta value divided by 1000. |
processors | Array.<Phaser.GameObjects.Particles.ParticleProcessor> |
An array of all active Particle Processors. |
Returns true
if this Particle has now expired and should be removed, otherwise false
if still active.