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.
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.
startColor Color Color.WHITE optional The color of a particle when it is born.
endColor Color Color.WHITE optional The color of a particle when it dies.
startScale Number 1.0 optional The scale of the particle when it is born.
endScale Number 1.0 optional The scale of the particle when it dies.
rate 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 it's bursts when it is complete.
speed Number optional Sets the minimum and maximum speed in meters per second
minimumSpeed Number 1.0 optional Sets the minimum speed in meters per second.
maximumSpeed Number 1.0 optional Sets the maximum speed in meters per second.
life Number optional Sets the minimum and maximum life of particles in seconds.
minimumLife Number 5.0 optional Sets the minimum life of particles in seconds.
maximumLife Number 5.0 optional Sets the maximum life of particles in seconds.
mass Number optional Sets the minimum and maximum mass of particles in kilograms.
minimumMass Number 1.0 optional Sets the minimum mass of particles in kilograms.
maximumMass Number 1.0 optional Sets the maximum mass of particles in kilograms.
image Object optional The URI, HTMLImageElement, or HTMLCanvasElement to use for the billboard.
width Number optional Sets the minimum and maximum width of particles in pixels.
minimumWidth Number 1.0 optional Sets the minimum width of particles in pixels.
maximumWidth Number 1.0 optional Sets the maximum width of particles in pixels.
height Number optional Sets the minimum and maximum height of particles in pixels.
minimumHeight Number 1.0 optional Sets the minimum height of particles in pixels.
maximumHeight Number 1.0 optional Sets the maximum height of particles in pixels.
lifeTime Number Number.MAX_VALUE optional How long the particle system will emit particles, in seconds.
Demo:

Members

complete : Event

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

emitter : ParticleEmitter

The particle emitter for this
Default Value: CricleEmitter

emitterModelMatrix : Matrix4

The 4x4 transformation matrix that transforms the particle system emitter within the particle systems local coordinate system.
Default Value: Matrix4.IDENTITY

endColor : Color

The color of a particle when it dies.
Default Value: Color.WHITE

endScale : Number

The scale of the particle when it dies.
Default Value: 1.0

forces : Array.<ParticleSystem~applyForce>

An array of force callbacks. The callback is passed a Particle and the difference from the last time
Default Value: undefined

image : Object

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

loop : Boolean

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.
Default Value: 1.0

maximumLife : Number

Sets the maximum life of particles in seconds.
Default Value: 5.0

maximumMass : Number

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

maximumSpeed : Number

Sets the maximum speed in meters per second.
Default Value: 1.0

maximumWidth : Number

Sets the maximum width of particles in pixels.
Default Value: 1.0

minimumHeight : Number

Sets the minimum height of particles in pixels.
Default Value: 1.0

minimumLife : Number

Sets the minimum life of particles in seconds.
Default Value: 5.0

minimumMass : Number

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

minimumSpeed : Number

Sets the minimum speed in meters per second.
Default Value: 1.0

minimumWidth : Number

Sets the minimum width of particles in pixels.
Default Value: 1.0

modelMatrix : Matrix4

The 4x4 transformation matrix that transforms the particle system from model to world coordinates.
Default Value: Matrix4.IDENTITY

rate : Number

The number of particles to emit per second.
Default Value: 5

show : Boolean

Whether to display the particle system.
Default Value: true

startColor : Color

The color of a particle when it is born.
Default Value: Color.WHITE

startScale : Number

The scale of the particle when it is born.
Default Value: 1.0

Methods

destroy()undefined

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.
Returns:
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.
Name Type Description
particle Particle The particle to apply the force to.
dt Number The time 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);
}