# ParticleSystem

#### new Cesium.ParticleSystem(options)
engine/Source/Scene/ParticleSystem.js 58

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.
`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.
`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.
`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.
`sizeInMeters` | boolean |  | optional Sets if the size of particles is in meters or pixels. `true` to size the particles in meters; otherwise, the size is 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.
`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.

##### Demo:

- Particle Systems Tutorial
- Particle Systems Tutorial Demo
- Particle Systems Fireworks Demo

### Members

#### bursts : Array.<ParticleBurst>
engine/Source/Scene/ParticleSystem.js 209

An array of `ParticleBurst`, emitting bursts of particles at periodic times.

Default Value: `undefined`

#### complete : Event
engine/Source/Scene/ParticleSystem.js 522

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

#### emissionRate : number
engine/Source/Scene/ParticleSystem.js 330

The number of particles to emit per second.

Default Value: `5`

#### emitter : ParticleEmitter
engine/Source/Scene/ParticleSystem.js 192

The particle emitter for this

Default Value: `CircleEmitter`

#### emitterModelMatrix : Matrix4
engine/Source/Scene/ParticleSystem.js 243

The 4x4 transformation matrix that transforms the particle system emitter within the particle systems local coordinate system.

Default Value: `Matrix4.IDENTITY`

#### endColor : Color
engine/Source/Scene/ParticleSystem.js 279

The color of the particle at the end of its life.

Default Value: `Color.WHITE`

#### endScale : number
engine/Source/Scene/ParticleSystem.js 313

The final scale to apply to the image of the particle at the end of its life.

Default Value: `1.0`

#### image : object
engine/Source/Scene/ParticleSystem.js 87

The URI, HTMLImageElement, or HTMLCanvasElement to use for the billboard.

Default Value: `undefined`

#### isComplete : boolean
engine/Source/Scene/ParticleSystem.js 532

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

#### lifetime : number
engine/Source/Scene/ParticleSystem.js 506

How long the particle system will emit particles, in seconds.

Default Value: `Number.MAX_VALUE`

#### loop : boolean
engine/Source/Scene/ParticleSystem.js 80

Whether the particle system should loop it's bursts when it is complete.

Default Value: `true`

#### maximumImageSize : Cartesian2
engine/Source/Scene/ParticleSystem.js 470

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)`

#### maximumMass : number
engine/Source/Scene/ParticleSystem.js 434

Sets the maximum mass of particles in kilograms.

Default Value: `1.0`

#### maximumParticleLife : number
engine/Source/Scene/ParticleSystem.js 399

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
engine/Source/Scene/ParticleSystem.js 365

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

Default Value: `1.0`

#### minimumImageSize : Cartesian2
engine/Source/Scene/ParticleSystem.js 451

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)`

#### minimumMass : number
engine/Source/Scene/ParticleSystem.js 417

Sets the minimum mass of particles in kilograms.

Default Value: `1.0`

#### minimumParticleLife : number
engine/Source/Scene/ParticleSystem.js 382

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
engine/Source/Scene/ParticleSystem.js 348

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

Default Value: `1.0`

#### modelMatrix : Matrix4
engine/Source/Scene/ParticleSystem.js 224

The 4x4 transformation matrix that transforms the particle system from model to world coordinates.

Default Value: `Matrix4.IDENTITY`

#### show : boolean
engine/Source/Scene/ParticleSystem.js 66

Whether to display the particle system.

Default Value: `true`

#### sizeInMeters : boolean
engine/Source/Scene/ParticleSystem.js 489

Gets or sets if the particle size is in meters or pixels. `true` to size particles in meters; otherwise, the size is in pixels.

Default Value: `false`

#### startColor : Color
engine/Source/Scene/ParticleSystem.js 262

The color of the particle at the beginning of its life.

Default Value: `Color.WHITE`

#### startScale : number
engine/Source/Scene/ParticleSystem.js 296

The initial scale to apply to the image of the particle at the beginning of its life.

Default Value: `1.0`

#### updateCallback : ParticleSystem.updateCallback
engine/Source/Scene/ParticleSystem.js 73

An array of force callbacks. The callback is passed a `Particle` and the difference from the last time

Default Value: `undefined`

### Methods

#### destroy()
engine/Source/Scene/ParticleSystem.js 892

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:

- ParticleSystem#isDestroyed

#### isDestroyed() → boolean
engine/Source/Scene/ParticleSystem.js 876

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:

- ParticleSystem#destroy

### Type Definitions

#### Cesium.ParticleSystem.updateCallback(particle, dt)
engine/Source/Scene/ParticleSystem.js 898

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) {
       const position = particle.position;
       const 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);
    }

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.