ParticleSystem

new Cesium.ParticleSystem(options)

A ParticleSystem manages the updating and display of a collection of particles.
Name Type Description
options Object optional Object with the following properties:
Name Type Default Description
show Boolean true optional Whether to display the particle system.
forces Array.<ParticleSystem~applyForce> optional An array of force callbacks. This has been deprecated. Use updateCallback instead.
updateCallback ParticleSystem~updateCallback optional The callback function to be called each frame to update a particle.
emitter ParticleEmitter new CircleEmitter(0.5) optional The particle emitter for this system.
modelMatrix Matrix4 Matrix4.IDENTITY optional The 4x4 transformation matrix that transforms the particle system from model to world coordinates.
emitterModelMatrix Matrix4 Matrix4.IDENTITY optional The 4x4 transformation matrix that transforms the particle system emitter within the particle systems local coordinate system.
rate Number 5 optional The number of particles to emit per second. This has been deprecated. Use emissionRate instead.
emissionRate Number 5 optional The number of particles to emit per second.
bursts Array.<ParticleBurst> optional An array of ParticleBurst, emitting bursts of particles at periodic times.
loop Boolean true optional Whether the particle system should loop its bursts when it is complete.
scale Number 1.0 optional Sets the scale to apply to the image of the particle for the duration of its particleLife.
startScale Number optional The initial scale to apply to the image of the particle at the beginning of its life.
endScale Number optional The final scale to apply to the image of the particle at the end of its life.
color Color Color.WHITE optional Sets the color of a particle for the duration of its particleLife.
startColor Color optional The color of the particle at the beginning of its life.
endColor Color optional The color of the particle at the end of its life.
image Object optional The URI, HTMLImageElement, or HTMLCanvasElement to use for the billboard.
width Number 1.0 optional Sets the minimum and maximum width of particles in pixels. This has been deprecated. Use imageSize's x component instead.
minimumWidth Number optional Sets the minimum width of particles in pixels. This has been deprecated. Use minimumImageSize's x component instead.
maximumWidth Number optional Sets the maximum width of particles in pixels. This has been deprecated. Use maximumImageSize's x component instead.
height Number 1.0 optional Overwrites the minimum and maximum height of particles in pixels. This has been deprecated. Use imageSize's y component instead.
minimumHeight Number optional Sets the minimum height of particles in pixels. This has been deprecated. Use minimumImageSize's y component instead.
maximumHeight Number optional Sets the maximum height of particles in pixels. This has been deprecated. Use maximumImageSize's y component instead.
imageSize Cartesian2 new Cartesian2(1.0, 1.0) optional If set, overrides the minimumImageSize and maximumImageSize inputs that scale the particle image's dimensions in pixels.
minimumImageSize Cartesian2 optional Sets the minimum bound, width by height, above which to randomly scale the particle image's dimensions in pixels.
maximumImageSize Cartesian2 optional Sets the maximum bound, width by height, below which to randomly scale the particle image's dimensions in pixels.
speed Number 1.0 optional If set, overrides the minimumSpeed and maximumSpeed inputs with this value.
minimumSpeed Number optional Sets the minimum bound in meters per second above which a particle's actual speed will be randomly chosen.
maximumSpeed Number optional Sets the maximum bound in meters per second below which a particle's actual speed will be randomly chosen.
lifeTime Number Number.MAX_VALUE optional How long the particle system will emit particles, in seconds. This has been deprecated. Use lifetime instead.
lifetime Number Number.MAX_VALUE optional How long the particle system will emit particles, in seconds.
life Number 5.0 optional If set, overrides the minimumLife and maximumLife inputs with this value. This has been deprecated. Use particleLife instead.
minimumLife Number optional Sets the minimum life of particles in seconds. This has been deprecated. Use minimumParticleLife instead.
maximumLife Number optional Sets the maximum life of particles in seconds. This has been deprecated. Use maximumParticleLife instead.
particleLife Number 5.0 optional If set, overrides the minimumParticleLife and maximumParticleLife inputs with this value.
minimumParticleLife Number optional Sets the minimum bound in seconds for the possible duration of a particle's life above which a particle's actual life will be randomly chosen.
maximumParticleLife Number optional Sets the maximum bound in seconds for the possible duration of a particle's life below which a particle's actual life will be randomly chosen.
mass Number 1.0 optional Sets the minimum and maximum mass of particles in kilograms.
minimumMass Number optional Sets the minimum bound for the mass of a particle in kilograms. A particle's actual mass will be chosen as a random amount above this value.
maximumMass Number optional Sets the maximum mass of particles in kilograms. A particle's actual mass will be chosen as a random amount below this value.
Tutorials:
Demo:

Members

Fires an event when the particle system has reached the end of its lifetime.

emissionRate : Number

The number of particles to emit per second.
Default Value: 5
The particle emitter for this
Default Value: CircleEmitter

emitterModelMatrix : Matrix4

The 4x4 transformation matrix that transforms the particle system emitter within the particle systems local coordinate system.
Default Value: Matrix4.IDENTITY
The color of the particle at the end of its life.
Default Value: Color.WHITE

endScale : Number

The final scale to apply to the image of the particle at the end of its life.
Default Value: 1.0
The URI, HTMLImageElement, or HTMLCanvasElement to use for the billboard.
Default Value: undefined

isComplete : Boolean

When true, the particle system has reached the end of its lifetime; false otherwise.

lifetime : Number

How long the particle system will emit particles, in seconds.
Default Value: Number.MAX_VALUE

lifeTime : Number

How long the particle system will emit particles, in seconds. This has been deprecated. Use ParticleSystem#lifetime instead.
Deprecated: true Default Value: Number.MAX_VALUE
Whether the particle system should loop it's bursts when it is complete.
Default Value: true

maximumHeight : Number

Sets the maximum height of particles in pixels. This has been deprecated. Use ParticleSystem#maximumImageSize instead.
Deprecated: true Default Value: 1.0
Sets the maximum bound, width by height, below which to randomly scale the particle image's dimensions in pixels.
Default Value: new Cartesian2(1.0, 1.0)

maximumLife : Number

Sets the maximum life of particles in seconds. This has been deprecated. Use ParticleSystem#maximumParticleLife instead.
Deprecated: true Default Value: 5.0

maximumMass : Number

Sets the maximum mass of particles in kilograms.
Default Value: 1.0

maximumParticleLife : Number

Sets the maximum bound in seconds for the possible duration of a particle's life below which a particle's actual life will be randomly chosen.
Default Value: 5.0

maximumSpeed : Number

Sets the maximum bound in meters per second below which a particle's actual speed will be randomly chosen.
Default Value: 1.0

maximumWidth : Number

Sets the maximum width of particles in pixels. This has been deprecated. Use ParticleSystem#maximumImageSize instead.
Deprecated: true Default Value: 1.0

minimumHeight : Number

Sets the minimum height of particles in pixels. This has been deprecated. Use ParticleSystem#minimumImageSize instead.
Deprecated: true Default Value: 1.0
Sets the minimum bound, width by height, above which to randomly scale the particle image's dimensions in pixels.
Default Value: new Cartesian2(1.0, 1.0)

minimumLife : Number

Sets the minimum life of particles in seconds. This has been deprecated. Use ParticleSystem#minimumParticleLife instead.
Deprecated: true Default Value: 5.0

minimumMass : Number

Sets the minimum mass of particles in kilograms.
Default Value: 1.0

minimumParticleLife : Number

Sets the minimum bound in seconds for the possible duration of a particle's life above which a particle's actual life will be randomly chosen.
Default Value: 5.0

minimumSpeed : Number

Sets the minimum bound in meters per second above which a particle's actual speed will be randomly chosen.
Default Value: 1.0

minimumWidth : Number

Sets the minimum width of particles in pixels. This has been deprecated. Use ParticleSystem#minimumImageSize instead.
Deprecated: true Default Value: 1.0
The 4x4 transformation matrix that transforms the particle system from model to world coordinates.
Default Value: Matrix4.IDENTITY
The number of particles to emit per second. This has been deprecated. Use ParticleSystem#emissionRate instead.
Deprecated: true Default Value: 5
Whether to display the particle system.
Default Value: true
The color of the particle at the beginning of its life.
Default Value: Color.WHITE

startScale : Number

The initial scale to apply to the image of the particle at the beginning of its life.
Default Value: 1.0
An array of force callbacks. The callback is passed a Particle and the difference from the last time
Default Value: undefined

Methods

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

Once an object is destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception. Therefore, assign the return value (undefined) to the object as done in the example.
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
See:

isDestroyed()Boolean

Returns true if this object was destroyed; otherwise, false.

If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.
Returns:
true if this object was destroyed; otherwise, false.
See:

Type Definitions

applyForce(particle, dt)

A function used to apply a force to the particle on each time step. This has been deprecated because forces[] was deprecated. Use updateCallback instead.
Name Type Description
particle Particle The particle to apply the force to.
dt Number The time since the last update.
Deprecated: true
Example:
function applyGravity(particle, dt) {
   var position = particle.position;
   var gravityVector = Cesium.Cartesian3.normalize(position, new Cesium.Cartesian3());
   Cesium.Cartesian3.multiplyByScalar(gravityVector, GRAVITATIONAL_CONSTANT * dt, gravityVector);
   particle.velocity = Cesium.Cartesian3.add(particle.velocity, gravityVector, particle.velocity);
}

updateCallback(particle, dt)

A function used to modify attributes of the particle at each time step. This can include force modifications, color, sizing, etc.
Name Type Description
particle Particle The particle being updated.
dt Number The time in seconds since the last update.
Example:
function applyGravity(particle, dt) {
   var position = particle.position;
   var gravityVector = Cesium.Cartesian3.normalize(position, new Cesium.Cartesian3());
   Cesium.Cartesian3.multiplyByScalar(gravityVector, GRAVITATIONAL_CONSTANT * dt, gravityVector);
   particle.velocity = Cesium.Cartesian3.add(particle.velocity, gravityVector, particle.velocity);
}
See: