SpriteSequence3D QML Type
为雪碧粒子提供图像序列特征。更多
| Import Statement: | import QtQuick3D.Particles3D |
| Since: | Qt 6.2 |
| Inherits: |
属性
- AnimationDirection : enumeration
- animationDirection : AnimationDirection
- duration : int
- durationVariation : int
- frameCount : int
- frameIndex : int
- interpolate : bool
- randomStart : bool
详细说明
SpriteSequence3D 元素支持多帧动画图像。这些帧应在图像中水平对齐,第一帧在左,最后一帧在右。
要使SpriteParticle3D 成为动画序列,请设置其spriteSequence 属性。
属性文档
AnimationDirection : enumeration
定义序列的动画播放方向。
| 常数 | 说明 |
|---|---|
SpriteSequence3D.Normal | 从第一帧到最后一帧的动画。到达最后一帧时,跳回到第一帧。 |
SpriteSequence3D.Reverse | 从最后一帧到第一帧的动画。当到达第一帧时,跳回到最后一帧。 |
SpriteSequence3D.Alternate | 从第一帧到最后一帧的动画。当到达最后一帧或第一帧时,切换动画方向。这样,即使第一帧和最后一帧不匹配,序列动画也会很流畅。 |
SpriteSequence3D.AlternateReverse | 从最后一帧到第一帧的动画。当到达最后一帧或第一帧时,切换动画方向。这样,即使第一帧和最后一帧不匹配,序列动画也会很流畅。 |
SpriteSequence3D.SingleFrame | 不为帧设置动画。当randomStart 为假时,将渲染frameIndex 帧。当randomStart 为 true 时,每个粒子会随机渲染一帧。 |
animationDirection : AnimationDirection
该属性定义序列的动画方向。
默认值为SpriteSequence3D.Normal 。
另请参阅 randomStart 。
duration : int
该属性以毫秒为单位定义精灵序列动画的持续时间。例如,如果持续时间为400 ,frameCount 为 8,则每帧将显示 50 毫秒。当值为-1 时,将使用粒子寿命作为持续时间。
默认值为-1 。
durationVariation : int
该属性以毫秒为单位定义持续时间的变化。动画的实际持续时间介于duration -durationVariation 和duration +durationVariation 之间。
默认值为0 (无变化)。
frameCount : int
该属性定义了sprite 中的图像帧数。粒子在动画过程中会经过这些帧,duration 。这些帧应水平排列在同一图像文件中。例如,精灵可以是512x64 图像,frameCount ,8 。这将使每个粒子帧的大小为64x64 像素。
默认值为1 。
注: 如果您的图像只有单个精灵帧,则根本无需定义spriteSequence 属性。
另请参阅 interpolate 。
frameIndex : int
该属性定义了帧的初始索引。这是动画开始的帧间位置。例如,当frameIndex 为 5,animationDirection 为Normal 时,第一个渲染帧为 5。如果animationDirection 为Reverse ,则第一个渲染帧为 4。
frameIndex 的值必须介于 0 和frameCount -1 之间。当animationDirection 为SingleFrame ,randomStart 为false 时,所有粒子都将以frameIndex 渲染精灵。
默认值为0 。
另请参阅 randomStart 和animationDirection 。
interpolate : bool
该属性定义了是否在帧与帧之间对精灵进行插值(混合),以使动画看起来更平滑。
默认值为true 。
另请参见 frameCount 。
randomStart : bool
此属性定义动画是否应从0 和frameCount -1 之间的随机帧开始。这样,动画开始时就不会看起来像是刚刚开始。
默认值为false 。
另请参见 animationDirection 。
© 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.