SpriteSequence3D QML Type
为 Sprite 粒子提供图像序列功能。更多...
| 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 为false时,渲染frameIndex 帧;当randomStart 为true时,每个粒子渲染一帧随机帧。 |
animationDirection : AnimationDirection
此属性定义了序列的动画方向。
默认值为SpriteSequence3D.Normal 。
另请参阅 randomStart 。
duration : int
该属性定义了精灵序列完成动画所需的时长(以毫秒为单位)。例如,如果时长为400 ,且frameCount 为8,则每帧将显示50毫秒。当该值为-1时,将使用粒子的lifeSpan作为时长。
默认值为-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.