A controller class for animations. More...
Header: | #include <QAnimationController> |
CMake: | find_package(Qt6 COMPONENTS 3danimation REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::3danimation) |
qmake: | QT += 3danimation |
Since: | Qt 5.9 |
Instantiated By: | AnimationController |
Inherits: | QObject |
|
|
QAnimationController(QObject *parent = nullptr) | |
int | activeAnimationGroup() const |
void | addAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroup) |
QList<Qt3DAnimation::QAnimationGroup *> | animationGroupList() |
Qt3DCore::QEntity * | entity() const |
int | getAnimationIndex(const QString &name) const |
Qt3DAnimation::QAnimationGroup * | getGroup(int index) const |
float | position() const |
float | positionOffset() const |
float | positionScale() const |
bool | recursive() const |
void | removeAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroup) |
void | setAnimationGroups(const QList<Qt3DAnimation::QAnimationGroup *> &animationGroups) |
void | setActiveAnimationGroup(int index) |
void | setEntity(Qt3DCore::QEntity *entity) |
void | setPosition(float position) |
void | setPositionOffset(float offset) |
void | setPositionScale(float scale) |
void | setRecursive(bool recursive) |
void | activeAnimationGroupChanged(int index) |
void | entityChanged(Qt3DCore::QEntity *entity) |
void | positionChanged(float position) |
void | positionOffsetChanged(float offset) |
void | positionScaleChanged(float scale) |
void | recursiveChanged(bool recursive) |
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.
Holds the currectly active animation group.
Access functions:
int | activeAnimationGroup() const |
void | setActiveAnimationGroup(int index) |
Notifier signal:
void | activeAnimationGroupChanged(int index) |
Holds the entity animations are gathered and grouped from. If the controller already holds animations, they are cleared.
Access functions:
Qt3DCore::QEntity * | entity() const |
void | setEntity(Qt3DCore::QEntity *entity) |
Notifier signal:
void | entityChanged(Qt3DCore::QEntity *entity) |
Holds the current position of the animation. When the position is set, it is scaled and offset with positionScale/positionOffset and propagated to the active animation group.
Access functions:
float | position() const |
void | setPosition(float position) |
Notifier signal:
void | positionChanged(float position) |
Holds the position offset of the animation.
Access functions:
float | positionOffset() const |
void | setPositionOffset(float offset) |
Notifier signal:
void | positionOffsetChanged(float offset) |
Holds the position scale of the animation.
Access functions:
float | positionScale() const |
void | setPositionScale(float scale) |
Notifier signal:
void | positionScaleChanged(float scale) |
Holds whether the recursively search the entity tree when gathering animations from the entity. If set to true, the animations are searched also from the child entities of the entity. If set to false, only the entity passed to the controller is searched.
Access functions:
bool | recursive() const |
void | setRecursive(bool recursive) |
Notifier signal:
void | recursiveChanged(bool recursive) |
Constructs a new QAnimationController with parent.
Adds the given animationGroup to the controller.
Returns the list of animation groups the conroller is currently holding.
[invokable]
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.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
Qt3DAnimation::QAnimationGroup *QAnimationController::getGroup(int index) const
Returns the AnimationGroup with the given index.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Removes the given animationGroup from the controller.
Sets the animationGroups for the controller. Old groups are cleared.
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qt3danimation-qanimationcontroller.html