QAnimationController Class

class Qt3DAnimation::QAnimationController

A controller class for animations. More...

Header: #include <QAnimationController>
qmake: QT += 3danimation
Since: Qt 5.9
Instantiated By: AnimationController

This class was introduced in Qt 5.9.

Public Functions

QAnimationController(QObject *parent = nullptr)
void addAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroup)
QVector<Qt3DAnimation::QAnimationGroup *> animationGroupList()
int getAnimationIndex(const QString &name) const
Qt3DAnimation::QAnimationGroup *getGroup(int index) const
void removeAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroup)
void setAnimationGroups(const QVector<Qt3DAnimation::QAnimationGroup *> &animationGroups)

Detailed Description

Qt3DAnimation::QAnimationController class controls the selection and playback of animations. The class can be used to find all animations from Qt3DCore::QEntity tree and create QAnimationGroups from the animations with the same name. The user can select which animation group is currently controlled with the animation controller by setting the active animation. The animation position is then propagated to that group after scaling and offsetting the provided position value with the positionScale and positionOffset values.

Note: that the animation controller doesn't have internal timer, but instead the user is responsible for updating the position property in timely manner.

Member Function Documentation

QAnimationController::QAnimationController(QObject *parent = nullptr)

Constructs a new QAnimationController with parent.

void QAnimationController::addAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroup)

Adds the given animationGroup to the controller.

QVector<Qt3DAnimation::QAnimationGroup *> QAnimationController::animationGroupList()

Returns the list of animation groups the conroller is currently holding.

int QAnimationController::getAnimationIndex(const QString &name) const

Returns the index of the animation with name. Returns -1 if no AnimationGroup with the given name is found.

Qt3DAnimation::QAnimationGroup *QAnimationController::getGroup(int index) const

Returns the AnimationGroup with the given index.

void QAnimationController::removeAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroup)

Removes the given animationGroup from the controller.

void QAnimationController::setAnimationGroups(const QVector<Qt3DAnimation::QAnimationGroup *> &animationGroups)

Sets the animationGroups for the controller. Old groups are cleared.