Sur cette page

Qt3DAnimation::QKeyframeAnimation Class

class Qt3DAnimation::QKeyframeAnimation

Une classe implémentant une animation simple par image clé sur un site QTransform. Plus....

En-tête : #include <QKeyframeAnimation>
CMake : find_package(Qt6 REQUIRED COMPONENTS 3danimation)
target_link_libraries(mytarget PRIVATE Qt6::3danimation)
qmake : QT += 3danimation
En QML : KeyframeAnimation
Hérite : Qt3DAnimation::QAbstractAnimation
Statut : Déclassé

Types publics

enum RepeatMode { None, Constant, Repeat }

Propriétés

Fonctions publiques

QKeyframeAnimation(QObject *parent = nullptr)
void addKeyframe(Qt3DCore::QTransform *keyframe)
QEasingCurve easing() const
Qt3DAnimation::QKeyframeAnimation::RepeatMode endMode() const
QList<float> framePositions() const
QList<Qt3DCore::QTransform *> keyframeList() const
void removeKeyframe(Qt3DCore::QTransform *keyframe)
void setKeyframes(const QList<Qt3DCore::QTransform *> &keyframes)
Qt3DAnimation::QKeyframeAnimation::RepeatMode startMode() const
Qt3DCore::QTransform *target() const
QString targetName() const

Emplacements publics

void setEasing(const QEasingCurve &easing)
void setEndMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode)
void setFramePositions(const QList<float> &positions)
void setStartMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode)
void setTarget(Qt3DCore::QTransform *target)
void setTargetName(const QString &name)

Signaux

void easingChanged(const QEasingCurve &easing)
void endModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode endMode)
void framePositionsChanged(const QList<float> &positions)
void startModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode startMode)
void targetChanged(Qt3DCore::QTransform *target)
void targetNameChanged(const QString &name)

Description détaillée

La classe Qt3DAnimation::QKeyframeAnimation met en œuvre une animation simple par images clés qui peut être utilisée pour animer QTransform. Les images-clés consistent en de multiples QTransformations temporisées, qui sont interpolées et appliquées à la cible QTransform. QEasingCurve est utilisé entre les images-clés pour contrôler l'interpolateur. RepeatMode peut être défini lorsque la position définie dans la QKeyframeAnimation est inférieure ou supérieure aux valeurs définies dans les positions des images-clés.

Documentation sur les types de membres

enum QKeyframeAnimation::RepeatMode

Cette énumération spécifie comment les valeurs de position en dehors des valeurs d'images clés sont traitées.

ConstanteValeurDescription
Qt3DAnimation::QKeyframeAnimation::None0L'animation n'est pas appliquée à la transformation cible.
Qt3DAnimation::QKeyframeAnimation::Constant1La valeur de l'image clé du bord est utilisée.
Qt3DAnimation::QKeyframeAnimation::Repeat2L'animation est répétée.

Documentation sur les propriétés

easing : QEasingCurve

Détient la courbe d'assouplissement de l'interpolateur entre les images clés.

Fonctions d'accès :

QEasingCurve easing() const
void setEasing(const QEasingCurve &easing)

Signal de notification :

void easingChanged(const QEasingCurve &easing)

endMode : RepeatMode

Maintient le mode de répétition pour les valeurs de position supérieures à la dernière position de l'image.

Fonctions d'accès :

Qt3DAnimation::QKeyframeAnimation::RepeatMode endMode() const
void setEndMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode)

Signal de notification :

void endModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode endMode)

framePositions : QList<float>

Contient les positions des images clés. Chaque position de la liste spécifie la position de l'image clé correspondante ayant le même index. Les valeurs doivent être classées par ordre croissant. Les valeurs peuvent être positives ou négatives et n'ont pas d'unité prédéfinie.

Fonctions d'accès :

QList<float> framePositions() const
void setFramePositions(const QList<float> &positions)

Signal de notification :

void framePositionsChanged(const QList<float> &positions)

startMode : RepeatMode

Maintient le mode de répétition pour les valeurs de position inférieures à la première position de l'image.

Fonctions d'accès :

Qt3DAnimation::QKeyframeAnimation::RepeatMode startMode() const
void setStartMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode)

Signal de notification :

void startModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode startMode)

target : Qt3DCore::QTransform*

Détient la cible QTransform à laquelle l'animation est appliquée.

Fonctions d'accès :

Qt3DCore::QTransform *target() const
void setTarget(Qt3DCore::QTransform *target)

Signal de notification :

void targetChanged(Qt3DCore::QTransform *target)

targetName : QString

Contient le nom de la transformation cible. Il s'agit d'une propriété de commodité qui permet de faire correspondre plus facilement la transformation cible à l'animation de l'image clé. Le nom est généralement identique au nom de l'entité mère de la transformation cible, mais ce n'est pas obligatoire.

Fonctions d'accès :

QString targetName() const
void setTargetName(const QString &name)

Signal de notification :

void targetNameChanged(const QString &name)

Member Function Documentation

[explicit] QKeyframeAnimation::QKeyframeAnimation(QObject *parent = nullptr)

Construit une QKeyframeAnimation avec parent.

void QKeyframeAnimation::addKeyframe(Qt3DCore::QTransform *keyframe)

Ajoute un nouveau keyframe à la fin de l'animation. Le QTransform peut être ajouté plusieurs fois à l'animation.

QList<Qt3DCore::QTransform *> QKeyframeAnimation::keyframeList() const

Renvoie la liste des images clés.

void QKeyframeAnimation::removeKeyframe(Qt3DCore::QTransform *keyframe)

Supprime une keyframe de l'animation. Si le même QTransform est défini comme image clé plusieurs fois, toutes les occurrences sont supprimées.

void QKeyframeAnimation::setKeyframes(const QList<Qt3DCore::QTransform *> &keyframes)

Définit le site keyframes de l'animation. Les anciennes images-clés sont effacées.

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