QAbstractAnimationClip Class
class Qt3DAnimation::QAbstractAnimationClipQAbstractAnimationClip ist die Basisklasse für Typen, die Keyframe-Animationsdaten bereitstellen. Mehr...
Kopfzeile: | #include <QAbstractAnimationClip> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3danimation) target_link_libraries(mytarget PRIVATE Qt6::3danimation) |
qmake: | QT += 3danimation |
Vererbt: | Qt3DCore::QNode |
Vererbt von: | Qt3DAnimation::QAnimationClip und Qt3DAnimation::QAnimationClipLoader |
Status: | Veraltet |
Eigenschaften
- duration : const float
Öffentliche Funktionen
virtual | ~QAbstractAnimationClip() |
float | duration() const |
Signale
void | durationChanged(float duration) |
Detaillierte Beschreibung
Um das Keyframe-Animations-Framework im Modul Qt 3D Animation zu nutzen, muss die verwendete Animator-Komponente mit den Keyframe-Animationsdaten versorgt werden. Die Animationsdaten werden von einer der konkreten Unterklassen von QAbstractAnimationClip bereitgestellt:
QAnimationClip sollte verwendet werden, wenn Sie die Animationsdaten programmatisch in Ihrer Anwendung erstellen wollen. Die eigentlichen Daten werden mit einem QAnimationClipData Werttyp gesetzt.
Wenn Sie die gebackenen Animationsdaten aus einer Datei laden, z. B. wie sie von einem Künstler erstellt wurden, dann verwenden Sie die Klasse QAnimationClipLoader und setzen Sie deren Eigenschaft source
.
Sobald der Animationsclip mit Hilfe der oben genannten Methoden mit Daten gefüllt wurde, wird die schreibgeschützte Eigenschaft "Dauer" durch das Backend von Qt 3D Animation aktualisiert.
Die typische Verwendung von Animationsclips ist:
auto animator = new QClipAnimator(); auto clip = new QAnimationClipLoader(); clip->setSource(QUrl::fromLocalFile("bounce.json")); animator->setClip(clip); animator->setChannelMapper(...); animator->setRunning(true);
Animationsclips werden auch als Blattknotenwerte in Animationsmischbäumen verwendet:
// 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);
Siehe auch Qt3DAnimation::QAnimationClip und Qt3DAnimation::QAnimationClipLoader.
Dokumentation der Eigenschaft
[read-only]
duration : const float
Enthält die Dauer des Animationsclips in Sekunden. Wird aktualisiert, sobald die Animationsdaten mit Hilfe einer der konkreten Unterklassen an Qt 3D übermittelt werden.
Zugriffsfunktionen:
float | duration() const |
Benachrichtigungssignal:
void | durationChanged(float 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.