Qt3DAnimation::QAbstractAnimation Class

class Qt3DAnimation::QAbstractAnimation

Qt3D 动画的抽象基类。更多

头文件: #include <QAbstractAnimation>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3danimation)
target_link_libraries(mytarget PRIVATE Qt6::3danimation)
qmake: QT += 3danimation
在 QML 中: AbstractAnimation
继承: QObject
继承于

Qt3DAnimation::QKeyframeAnimation,Qt3DAnimation::QMorphingAnimation, 和Qt3DAnimation::QVertexBlendAnimation

状态:已废弃

公共类型

enum AnimationType { KeyframeAnimation, MorphingAnimation, VertexBlendAnimation }

属性

公共功能

QString animationName() const
Qt3DAnimation::QAbstractAnimation::AnimationType animationType() const
float duration() const
float position() const

公共插槽

void setAnimationName(const QString &name)
void setPosition(float position)

信号

void animationNameChanged(const QString &name)
void durationChanged(float duration)
void positionChanged(float position)

受保护功能

void setDuration(float duration)

详细说明

Qt3DAnimation::QAbstractAnimation 是所有动画的抽象基类。 不能直接实例化,而是通过其子类。QAbstractAnimation 为所有 Qt3D 动画指定了通用属性,如动画名称和类型、当前位置和动画持续时间,而将实际动画操作留给了子类。Qt3DAnimation::QAbstractAnimation

成员类型文档

enum QAbstractAnimation::AnimationType

该枚举指定了动画的类型

常量描述
Qt3DAnimation::QAbstractAnimation::KeyframeAnimation1简单的关键帧动画实现,用于QTransform
Qt3DAnimation::QAbstractAnimation::MorphingAnimation2混合形状变形动画
Qt3DAnimation::QAbstractAnimation::VertexBlendAnimation3顶点混合动画

属性文档

animationName : QString

保存动画的名称。

访问功能:

QString animationName() const
void setAnimationName(const QString &name)

通知信号

void animationNameChanged(const QString &name)

[read-only] animationType : const AnimationType

动画类型。

访问功能:

Qt3DAnimation::QAbstractAnimation::AnimationType animationType() const

[read-only] duration : const float

保存动画的持续时间。

访问功能

float duration() const

通知信号:

void durationChanged(float duration)

position : float

保持动画的当前位置。

访问功能

float position() const
void setPosition(float position)

通知信号:

void positionChanged(float position)

成员函数 文档

[protected] void QAbstractAnimation::setDuration(float duration)

设置动画的duration

另请参阅 duration().

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