A ParticleSystem manages the updating and display of a collection of particles.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional
Object with the following properties:
|
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
-
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
-
The URI, HTMLImageElement, or HTMLCanvasElement to use for the billboard.
-
Default Value:
undefined
-
When
true
, the particle system has reached the end of its lifetime;false
otherwise. -
How long the particle system will emit particles, in seconds.
-
Default Value:
Number.MAX_VALUE
-
Whether the particle system should loop it's bursts when it is complete.
-
Default Value:
true
-
Sets the maximum height of particles in pixels.
-
Default Value:
1.0
-
Sets the maximum life of particles in seconds.
-
Default Value:
5.0
-
Sets the maximum mass of particles in kilograms.
-
Default Value:
1.0
-
Sets the maximum speed in meters per second.
-
Default Value:
1.0
-
Sets the maximum width of particles in pixels.
-
Default Value:
1.0
-
Sets the minimum height of particles in pixels.
-
Default Value:
1.0
-
Sets the minimum life of particles in seconds.
-
Default Value:
5.0
-
Sets the minimum mass of particles in kilograms.
-
Default Value:
1.0
-
Sets the minimum speed in meters per second.
-
Default Value:
1.0
-
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
-
The number of particles to emit per second.
-
Default Value:
5
-
Whether to display the particle system.
-
Default Value:
true
-
startColor : Color
-
The color of a particle when it is born.
-
Default Value:
Color.WHITE
-
The scale of the particle when it is born.
-
Default Value:
1.0
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 thanisDestroyed
will result in aDeveloperError
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.
-
-
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other thanisDestroyed
will result in aDeveloperError
exception.Returns:
true
if this object was destroyed; otherwise,false
.
Type Definitions
-
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); }