ParticleSystem3D QML Type
一个包含粒子、发射器和影响器类型的系统。更多...
| Import Statement: | import QtQuick3D.Particles3D |
| Since: | Qt 6.2 |
| Inherits: |
属性
- logging : bool
- loggingData : ParticleSystem3DLogging
- paused : bool
- running : bool
- seed : int
- startTime : int
- time : int
- useRandomSeed : bool
方法
- void reset()
详细说明
该元素是粒子系统的根节点,负责处理系统的计时,并将所有其他相关元素(如粒子、发射器和影响器)聚合在一起。要将系统元素聚合起来,它们需要是 ParticleSystem3D 的直接子节点,如下所示:
ParticleSystem3D {
ParticleEmitter3D {
...
}
SpriteParticle3D {
...
}
}或者,如果系统元素不是直接子节点,则需要使用system 属性来指定它们所属的ParticleSystem3D,如下所示:
ParticleSystem3D {
id: psystem
}
ParticleEmitter3D {
system: psystem
...
}
SpriteParticle3D {
system: psystem
...
}属性文档
logging : bool
将此属性设置为 true 可收集loggingData 。
注意:此 属性会对性能产生一定影响,因此不应在发布版本中启用。
默认值为false 。
另请参阅 loggingData 。
loggingData : ParticleSystem3DLogging [read-only]
此属性包含日志数据,在开发和优化粒子效果时可能会派上用场。
注意: 只有当“logging ”设置为“true ”,且粒子系统正在运行时,此 属性才会包含正确的数据。
另请参阅 logging 。
paused : bool
该属性用于定义系统当前是否处于暂停状态。如果将“paused”设置为true ,粒子系统将不会继续模拟。当“paused”再次设置为false 时,模拟将从暂停时的同一位置继续。
默认值为false 。
running : bool
该属性用于定义系统当前是否正在运行。如果将“running”属性设置为false ,粒子系统将停止模拟。当系统再次设置为运行状态时,所有粒子都将被销毁。
在手动修改/动画化“time ”属性时,应将“Running”设置为false 。
默认值为true 。
seed : int
此属性定义了用于粒子随机化的种子值。使用相同的种子值时,每次运行中的粒子效果将完全一致。当需要确定性行为而非随机行为时,此功能非常有用。
当“useRandomSeed ”设置为false 时,其默认值为0 ;当“useRandomSeed ”设置为true 时,其默认值则介于1..INT32_MAX 之间。
注意: 在粒子动画播放期间不应修改此 属性。
另请参阅 useRandomSeed 。
startTime : int
该属性定义了系统开始运行时的时间(单位为毫秒)。这有助于对系统进行预热,确保此时已发射出一组粒子。 例如,如果将 startTime 设置为 2000,而系统time 的动画范围为 0 到 1000,那么实际显示的粒子动画时间范围将是 2000 到 3000 毫秒。
默认值为0 。
time : int
此属性用于定义系统的时长(以毫秒为单位)。
注意: 修改 time 属性时 ,通常应将running 设置为false 。
以下是一个示例,展示如何手动以半速循环动画化系统 3 秒:
ParticleSystem3D {
running: false
NumberAnimation on time {
loops: Animation.Infinite
from: 0
to: 3000
duration: 6000
}
}useRandomSeed : bool
此属性用于定义粒子系统的初始值(seed)应为随机值还是用户自定义值。当设置为“true ”时,每次重启粒子系统都会为“seed ”生成一个新的随机值。
默认值为true 。
注意: 在粒子动画播放期间不应修改此 属性。
另请参阅 seed 。
方法文档
void reset()
该方法将粒子系统的内部状态重置为初始状态。当running 属性设置为false 时,可调用此方法来重置系统。running 为true 时,由于系统会自行管理内部状态,因此无需调用此方法;但当该属性设置为false 时,则需要告知系统何时应进行重置。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.