粒子系统管理粒子集合的更新和显示.
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
下列属性的对象 :
|
Members
bursts : Array.<ParticleBurst>
An array of
ParticleBurst, emitting bursts of particles at periodic times.
-
Default Value:
undefined
complete : Event
当粒子系统到达生命的尽头时,会发射一个事件.
每秒发射颗粒的数量.
-
Default Value:
5
emitter : ParticleEmitter
此粒子发射器
-
Default Value:
CircleEmitter
emitterModelMatrix : Matrix4
4x4变换矩阵,在粒子系统局部坐标系统内转换粒子系统发射器.
-
Default Value:
Matrix4.IDENTITY
endColor : Color
粒子末期的颜色.
-
Default Value:
Color.WHITE
最终尺度适用于粒子生命末期的图像.
-
Default Value:
1.0
用于公告牌的 NT 0 ,HTML ImageElement,或HTML CanvasElement.
-
Default Value:
undefined
当 NT 0 real NT 1 时,粒子系统已到达寿命结束; NT 2 false NT 3 否则.
粒子系统会发射粒子多久,以秒计.
-
Default Value:
-NT=0=- 翻译:
粒子系统是否应该循环,当它完成时它就会爆发.
-
Default Value:
true
maximumImageSize : Cartesian2
按高度设置最大约束,宽度,在下方以像素随机标出粒子图像的尺寸.
-
Default Value:
new Cartesian2(1.0, 1.0)
设定以公斤计的粒子的最大质量.
-
Default Value:
1.0
设定粒子寿命可能持续时间的最大约束数以秒为单位,在下方随机选择粒子的实际寿命.
-
Default Value:
5.0
设定最大约束, 以每秒米计, 下方将随机选择一个粒子的实际速度 .
-
Default Value:
1.0
minimumImageSize : Cartesian2
设置最小的边框,宽度按高度排列,在高度之上可以随机对粒子图像的维度进行像素的缩放.
-
Default Value:
new Cartesian2(1.0, 1.0)
设定以公斤计的颗粒最小质量.
-
Default Value:
1.0
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
设置最小约束, 以每秒米计, 将随机选择一个粒子的实际速度 .
-
Default Value:
1.0
modelMatrix : Matrix4
将粒子系统从模型转化为世界坐标的4x4变换矩阵.
-
Default Value:
Matrix4.IDENTITY
是否显示粒子系统 .
-
Default Value:
true
如果粒子大小是米数或像素,则获取或设定.
Treal 以米表示颗粒大小;否则,大小为像素.
-
Default Value:
false
startColor : Color
粒子初生时的颜色.
-
Default Value:
Color.WHITE
初始尺度适用于粒子生命初期的图像.
-
Default Value:
1.0
updateCallback : ParticleSystem.updateCallback
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
释放 WebGL 资源,而不是依赖垃圾收集器来摧毁此对象.
Once an object is destroyed, it should not be used; calling any function other than
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.
如果此对象被销毁, 返回真实; 否则, 错误 .
If this object was destroyed, it should not be used; calling any function other than
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.
Type Definitions
一个函数,用于在每个时间步修改粒子的属性. 这可以包括改变力,
颜色,尺寸等.
| 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);
}