Emitter Class
A particle emitter.
Constructor
Emitter
-
particleParent
-
[particleImages]
-
[config]
Parameters:
-
particleParent
pixi.display.DisplayObjectContainerThe display object to add the particles to.
-
[particleImages]
Arrayoptional A texture or array of textures to use for the particles.
-
[config]
Dynamic optionalA configuration object containing settings for the emitter.
Item Index
Methods
Properties
- _posChanged
- acceleration
- addAtBack
- angleStart
- customEase
- emitterLifetime
- endAlpha
- endColor
- endScale
- endSpeed
- extraData
- frequency
- maxLifetime
- maxParticles
- maxRotationSpeed
- maxStartRotation
- minimumScaleMultiplier
- minLifetime
- minRotationSpeed
- ownerPos
- parent
- particleBlendMode
- particleImages
- particleSpacing
- particlesPerWave
- rotation
- spawnCircle
- spawnPos
- spawnRect
- spawnType
- startAlpha
- startScale
- startSpeed
Methods
cleanup
()
Kills all active particles immediately.
destroy
()
Destroys the emitter and all of its particles.
init
-
particleImages
-
config
Sets up the emitter based on the config settings.
Parameters:
-
particleImages
ArrayA texture or array of textures to use for the particles.
-
config
DynamicA configuration object containing settings for the emitter.
recycle
-
particle
Recycles an individual particle.
Parameters:
-
particle
ParticleThe particle to recycle.
resetPositionTracking
()
Prevents emitter position interpolation in the next update. This should be used if you made a major position change of your emitter's owner that was not normal movement.
rotate
-
newRot
Sets the rotation of the emitter to a new value.
Parameters:
-
newRot
FloatThe new rotation, in degrees.
update
-
delta
Updates all particles spawned by this emitter and emits new ones.
Parameters:
-
delta
FloatTime elapsed since the previous frame, in seconds.
updateOwnerPos
-
x
-
y
Changes the position of the emitter's owner. You should call this if you are adding particles to the world display object that your emitter's owner is moving around in.
Parameters:
-
x
FloatThe new x value of the emitter's owner.
-
y
FloatThe new y value of the emitter's owner.
updateSpawnPos
-
x
-
y
Changes the spawn position of the emitter.
Parameters:
-
x
FloatThe new x value of the spawn position for the emitter.
-
y
FloatThe new y value of the spawn position for the emitter.
Properties
_posChanged
Bool
If either ownerPos or spawnPos has changed since the previous update.
acceleration
pixi.geom.Point
Acceleration to apply to particles. Using this disables any interpolation of particle speed. If the particles do not have a rotation speed, then they will be rotated to match the direction of travel.
Default: null
addAtBack
Bool
If particles should be added at the back of the display list instead of the front.
angleStart
Float
Angle at which to start spawning particles in a burst.
Default: 0
customEase
Void->Void
An easing function for nonlinear interpolation of values. Accepts a single parameter of time as a value from 0-1, inclusive. Expected outputs are values from 0-1, inclusive.
emitterLifetime
Float
The amount of time in seconds to emit for before setting emit to false. A value of -1 is an unlimited amount of time.
Default: -1
endAlpha
Float
The ending alpha of all particles.
Default: 1
endColor
ArrayThe ending color of all particles, as red, green, and blue uints from 0-255.
endScale
Float
The ending scale of all particles.
Default: 1
endSpeed
Float
The ending speed of all particles.
Default: 0
extraData
Dynamic
Extra data for use in custom particles. The emitter doesn't look inside, but passes it on to the particle to use in init().
frequency
Float
Time between particle spawns in seconds.
maxLifetime
Float
The maximum lifetime for a particle, in seconds.
maxParticles
Int
Maximum number of particles to keep alive at a time. If this limit is reached, no more particles will spawn until some have died.
Default: 1000
maxRotationSpeed
Float
The maximum rotation speed for a particle, in degrees per second. This only visually spins the particle, it does not change direction of movement.
maxStartRotation
Float
The maximum start rotation for a particle, in degrees. This value is ignored if the spawn type is "burst" or "arc".
minimumScaleMultiplier
Float
A minimum multiplier for the scale of a particle at both start and end. A value between minimumScaleMultiplier and 1 is randomly generated and multiplied with startScale and endScale to provide the actual startScale and endScale for each particle.
Default: 1
minLifetime
Float
The minimum lifetime for a particle, in seconds.
minRotationSpeed
Float
The minimum rotation speed for a particle, in degrees per second. This only visually spins the particle, it does not change direction of movement.
ownerPos
pixi.geom.Point
The world position of the emitter's owner, to add spawnPos to when spawning particles. To change this, use updateSpawnOrigin().
Default: {x:0, y:0}
parent
pixi.display.DisplayObjectContainer
The display object to add particles to.
particleBlendMode
Int
The blend mode for all particles, as named by PIXI.blendModes.
particleImages
ArrayAn array of PIXI Texture objects.
particleSpacing
Float
Spacing between particles in a burst. 0 gives a random angle for each particle.
Default: 0
particlesPerWave
Int
Float of particles to spawn each wave in a burst.
Default: 1
rotation
Float
Rotation of the emitter or emitter's owner in degrees. This is added to the calculated spawn angle. To change this, use rotate().
Default: 0
spawnCircle
pixi.geom.Circle
A circle relative to spawnPos to spawn particles inside if the spawn type is "circle".
spawnPos
pixi.geom.Point
Position at which to spawn particles, relative to the emitter's owner's origin. For example, the flames of a rocket travelling right might have a spawnPos of {x:-50, y:0}. to spawn at the rear of the rocket. To change this, use updateSpawnPos().
spawnRect
pixi.geom.Rectangle
A rectangle relative to spawnPos to spawn particles inside if the spawn type is "rect".
spawnType
String
How the particles will be spawned. Valid types are "point", "rectangle", "circle", "burst".
startAlpha
Float
The starting alpha of all particles.
Default: 1
startScale
Float
The starting scale of all particles.
Default: 1
startSpeed
Float
The starting speed of all particles.
Default: 0