SpriteSequence3D QML Type

为雪碧粒子提供图像序列特征。更多

Import Statement: import QtQuick3D.Particles3D
Since: Qt 6.2
Inherits:

QtObject

属性

详细说明

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

该属性定义了精灵序列动画的持续时间(以毫秒为单位)。例如,如果持续时间为400frameCount 为 8,则每帧将显示 50 毫秒。当值为-1 时,将使用粒子寿命作为持续时间。

默认值为-1


durationVariation : int

该属性以毫秒为单位定义持续时间的变化。动画的实际持续时间介于duration -durationVariationduration +durationVariation 之间。

默认值为0 (无变化)。


frameCount : int

该属性以sprite 为单位定义图像帧的数量。粒子会在duration 期间通过这些帧进行动画。这些帧应水平排列在同一图像文件中。例如,精灵可以是512x64 图像,frameCount8 。这样,每个粒子帧的大小为64x64 像素。

默认值为1

注: 如果您的图像只有单个精灵帧,则根本无需定义spriteSequence 属性。

另请参阅 interpolate


frameIndex : int

该属性定义了帧的初始索引。这是动画开始的帧间位置。例如,当frameIndex 为 5,animationDirectionNormal 时,第一个渲染帧为 5。如果animationDirectionReverse ,则第一个渲染帧为 4。

frameIndex 的值必须介于 0 和frameCount -1 之间。当animationDirectionSingleFramerandomStartfalse 时,所有粒子都将以frameIndex 渲染精灵。

默认值为0

另请参阅 randomStartanimationDirection


interpolate : bool

该属性定义了是否在帧与帧之间插值(混合)精灵,以使动画看起来更平滑。

默认值为true

另请参见 frameCount


randomStart : bool

该属性定义动画是否应从0frameCount -1 之间的随机帧开始。这样,动画开始时就不会看起来像刚开始一样。

默认值为false

另请参见 animationDirection


© 2025 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.