- Qt 6.9
- Qt 3D
- C++ Classes
- Qt3DAnimation (Deprecated)
- QAbstractAnimationClip
- Qt 6.9.1 Reference Documentation

# Qt3DAnimation::QAbstractAnimationClip Class

class Qt3DAnimation::QAbstractAnimationClip

QAbstractAnimationClip is the base class for types providing key frame animation data. More...

Header: | `#include <QAbstractAnimationClip>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS 3danimation)` `target_link_libraries(mytarget PRIVATE Qt6::3danimation)`
qmake: | `QT += 3danimation`
Inherits: | Qt3DCore::QNode
Inherited By: | Qt3DAnimation::QAnimationClip and Qt3DAnimation::QAnimationClipLoader
Status: | Deprecated

- List of all members, including inherited members

## Properties

- duration : const float

## Public Functions

virtual | ~QAbstractAnimationClip()
float | duration() const

## Signals

void | durationChanged(float duration)

## Detailed Description

To utilise the key frame animation framework in the Qt 3D Animation module the animator component in use needs to be provided with the key frame animation data. The animation data is provided by one of the concrete subclasses of QAbstractAnimationClip:

- Qt3DAnimation::QAnimationClip
- Qt3DAnimation::QAnimationClipLoader

QAnimationClip should be used when you want to create the animation data programmatically within your application. The actual data is set with a QAnimationClipData value type.

If you are loading baked animation data from a file, e.g. as created by an artist, then use the QAnimationClipLoader class and set its `source` property.

Once the animation clip has been populated with data using the above methods, the read-only duration property will be updated by the Qt 3D Animation backend.

The typical usage of animation clips is:

     auto animator = new QClipAnimator();
     auto clip = new QAnimationClipLoader();
     clip->setSource(QUrl::fromLocalFile("bounce.json"));
     animator->setClip(clip);
     animator->setChannelMapper(...);
     animator->setRunning(true);

Animation clips are also used as the leaf node values in animation blend trees:

     // Create leaf nodes of blend tree
     auto slideClipValue = new QClipBlendValue(
         new QAnimationClipLoader(QUrl::fromLocalFile("slide.json")));
     auto bounceClipValue = new QClipBlendValue(
         new QAnimationClipLoader(QUrl::fromLocalFile("bounce.json")));

     // Create blend tree inner node
     auto additiveNode = new QAdditiveClipBlend();
     additiveNode->setBaseClip(slideClipValue);
     additiveNode->setAdditiveClip(bounceClipValue);
     additiveNode->setAdditiveFactor(0.5f);

     // Run the animator
     auto animator = new QBlendedClipAnimator();
     animator->setBlendTree(additiveNode);
     animator->setChannelMapper(...);
     animator->setRunning(true);

See also Qt3DAnimation::QAnimationClip and Qt3DAnimation::QAnimationClipLoader.

## Property Documentation

### `[read-only]` duration : const float

Holds the duration of the animation clip in seconds. Gets updated once the animation data is provided to Qt 3D using one of the concrete subclasses.

Access functions:

float | duration() const

Notifier signal:

void | durationChanged(float duration)

## Member Function Documentation

### `[virtual noexcept]` QAbstractAnimationClip::~QAbstractAnimationClip()

Destroys this animation clip.