new Cesium.ParticleSystem(options)

粒子系统管理粒子集合的更新和显示.
Name Type Description
options object optional 下列属性的对象 :
Name Type Default Description
show boolean true optional Whether to display the particle system.
updateCallback ParticleSystem.updateCallback optional 调用函数要称为每个帧以更新一个粒子.
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 设定在粒子寿命期间适用于粒子图像的尺度.
startScale number optional 初始尺度适用于粒子生命初期的图像.
endScale number optional 最终尺度适用于粒子生命末期的图像.
color Color Color.WHITE optional Sets the color of a particle for the duration of its particleLife.
startColor Color optional 粒子初生时的颜色.
endColor Color optional 粒子末期的颜色.
image object optional 用于公告牌的 NT 0 ,HTML ImageElement,或HTML CanvasElement.
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 设置最小的边框,宽度按高度排列,在高度之上可以随机对粒子图像的维度进行像素的缩放.
maximumImageSize Cartesian2 optional 按高度设置最大约束,宽度,在下方以像素随机标出粒子图像的尺寸.
sizeInMeters boolean optional 如果粒子的大小是米数或像素,则设定。 NT 0 true NT 1 以米表示颗粒大小;否则,大小为像素.
speed number 1.0 optional 如果设定,则以该值覆盖最小Speed和最大Speed输入.
minimumSpeed number optional 设置最小约束, 以每秒米计, 将随机选择一个粒子的实际速度 .
maximumSpeed number optional 设定最大约束, 以每秒米计, 下方将随机选择一个粒子的实际速度 .
lifetime number Number.MAX_VALUE optional How long the particle system will emit particles, in seconds.
particleLife number 5.0 optional 如果设定,则以该值覆盖最小粒子生命和最大粒子生命输入.
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 设定粒子寿命可能持续时间的最大约束数以秒为单位,在下方随机选择粒子的实际寿命.
mass number 1.0 optional 设定以公斤计的颗粒的最低和最大质量.
minimumMass number optional 设定以公斤计的粒子质量的最低约束值。 一个粒子的实际质量会被选为这个值之上的随机量.
maximumMass number optional 设定以公斤计的粒子的最大质量。 一个粒子的实际质量会被选为低于这个值的随机量.
Demo:

Members

bursts : Array.<ParticleBurst>

An array of ParticleBurst, emitting bursts of particles at periodic times.
Default Value: undefined

complete : Event

当粒子系统到达生命的尽头时,会发射一个事件.

emissionRate : number

每秒发射颗粒的数量.
Default Value: 5

emitter : ParticleEmitter

此粒子发射器
Default Value: CircleEmitter

emitterModelMatrix : Matrix4

4x4变换矩阵,在粒子系统局部坐标系统内转换粒子系统发射器.
Default Value: Matrix4.IDENTITY

endColor : Color

粒子末期的颜色.
Default Value: Color.WHITE

endScale : number

最终尺度适用于粒子生命末期的图像.
Default Value: 1.0

image : object

用于公告牌的 NT 0 ,HTML ImageElement,或HTML CanvasElement.
Default Value: undefined

isComplete : boolean

当 NT 0 real NT 1 时,粒子系统已到达寿命结束; NT 2 false NT 3 否则.

lifetime : number

粒子系统会发射粒子多久,以秒计.
Default Value: -NT=0=- 翻译:

loop : boolean

粒子系统是否应该循环,当它完成时它就会爆发.
Default Value: true

maximumImageSize : Cartesian2

按高度设置最大约束,宽度,在下方以像素随机标出粒子图像的尺寸.
Default Value: new Cartesian2(1.0, 1.0)

maximumMass : number

设定以公斤计的粒子的最大质量.
Default Value: 1.0

maximumParticleLife : number

设定粒子寿命可能持续时间的最大约束数以秒为单位,在下方随机选择粒子的实际寿命.
Default Value: 5.0

maximumSpeed : number

设定最大约束, 以每秒米计, 下方将随机选择一个粒子的实际速度 .
Default Value: 1.0

minimumImageSize : Cartesian2

设置最小的边框,宽度按高度排列,在高度之上可以随机对粒子图像的维度进行像素的缩放.
Default Value: new Cartesian2(1.0, 1.0)

minimumMass : number

设定以公斤计的颗粒最小质量.
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

设置最小约束, 以每秒米计, 将随机选择一个粒子的实际速度 .
Default Value: 1.0

modelMatrix : Matrix4

将粒子系统从模型转化为世界坐标的4x4变换矩阵.
Default Value: Matrix4.IDENTITY

show : boolean

是否显示粒子系统 .
Default Value: true

sizeInMeters : boolean

如果粒子大小是米数或像素,则获取或设定. Treal 以米表示颗粒大小;否则,大小为像素.
Default Value: false

startColor : Color

粒子初生时的颜色.
Default Value: Color.WHITE

startScale : number

初始尺度适用于粒子生命初期的图像.
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

destroy()

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic 释放 WebGL 资源,而不是依赖垃圾收集器来摧毁此对象.

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

如果此对象被销毁, 返回真实; 否则, 错误 .

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

Cesium.ParticleSystem.updateCallback(particle, dt)

一个函数,用于在每个时间步修改粒子的属性. 这可以包括改变力, 颜色,尺寸等.
Name Type Description
particle Particle 粒子正在更新.
dt number 上次更新后的几秒钟.
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.