Qt3DAnimation::QKeyframeAnimation Class
class Qt3DAnimation::QKeyframeAnimationUna classe che implementa una semplice animazione con fotogrammi chiave per un QTransform. Per saperne di più...
| Intestazione: | #include <qkeyframeanimation.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3danimation) target_link_libraries(mytarget PRIVATE Qt6::3danimation) |
| qmake: | QT += 3danimation |
| In QML: | KeyframeAnimation |
| Eredita da: | Qt3DAnimation::QAbstractAnimation |
| Stato: | Anteprima tecnologica |
Questa classe è in anteprima tecnologica ed è soggetta a modifiche.
Tipi pubblici
| enum | RepeatMode { None, Constant, Repeat } |
Proprietà
|
|
Funzioni pubbliche
| 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 |
Slot pubblici
| 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) |
Segnali
| 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) |
Descrizione dettagliata
Una classe Qt3DAnimation::QKeyframeAnimation implementa una semplice animazione basata su fotogrammi chiave che può essere utilizzata per animare QTransform. I fotogrammi chiave sono costituiti da più QTransforms temporizzati, che vengono interpolati e applicati all’ QTransform. Tra un fotogramma chiave e l’altro viene utilizzato QEasingCurve per controllare l’interpolatore. È possibile impostare RepeatMode per i casi in cui la posizione impostata su QKeyframeAnimation sia inferiore o superiore ai valori definiti nelle posizioni dei fotogrammi chiave.
Documentazione sui tipi dei membri
enum QKeyframeAnimation::RepeatMode
Questa enumerazione specifica come vengono gestiti i valori di posizione al di fuori dei valori dei fotogrammi chiave.
| Costante | Valore | Descrizione |
|---|---|---|
Qt3DAnimation::QKeyframeAnimation::None | 0 | L'animazione non viene applicata alla trasformazione di destinazione. |
Qt3DAnimation::QKeyframeAnimation::Constant | 1 | Viene utilizzato il valore del fotogramma chiave di bordo. |
Qt3DAnimation::QKeyframeAnimation::Repeat | 2 | L'animazione viene ripetuta. |
Documentazione delle proprietà
easing : QEasingCurve
Contiene la curva di attenuazione dell'interpolatore tra i fotogrammi chiave.
Funzioni di accesso:
| QEasingCurve | easing() const |
| void | setEasing(const QEasingCurve &easing) |
Segnale di notifica:
| void | easingChanged(const QEasingCurve &easing) |
endMode : RepeatMode
Mantiene la modalità di ripetizione per i valori di posizione superiori alla posizione dell'ultimo fotogramma.
Funzioni di accesso:
| Qt3DAnimation::QKeyframeAnimation::RepeatMode | endMode() const |
| void | setEndMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode) |
Segnale di notifica:
| void | endModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode endMode) |
framePositions : QList<float>
Contiene le posizioni dei fotogrammi chiave. Ogni voce dell'elenco specifica la posizione del fotogramma chiave corrispondente con lo stesso indice. I valori devono essere in ordine crescente. I valori possono essere positivi o negativi e non hanno alcuna unità predefinita.
Funzioni di accesso:
| QList<float> | framePositions() const |
| void | setFramePositions(const QList<float> &positions) |
Segnale di notifica:
| void | framePositionsChanged(const QList<float> &positions) |
startMode : RepeatMode
Mantiene la modalità di ripetizione per i valori di posizione inferiori alla posizione del primo fotogramma.
Funzioni di accesso:
| Qt3DAnimation::QKeyframeAnimation::RepeatMode | startMode() const |
| void | setStartMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode) |
Segnale di notifica:
| void | startModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode startMode) |
target : Qt3DCore::QTransform*
Contiene l'QTransform i cui è applicata l'animazione.
Funzioni di accesso:
| Qt3DCore::QTransform * | target() const |
| void | setTarget(Qt3DCore::QTransform *target) |
Segnale di notifica:
| void | targetChanged(Qt3DCore::QTransform *target) |
targetName : QString
Contiene il nome della trasformazione di destinazione. Si tratta di una proprietà di comodità che facilita l'abbinamento della trasformazione di destinazione all'animazione dei fotogrammi chiave. Il nome è solitamente lo stesso dell'entità padre della trasformazione di destinazione, ma non è obbligatorio che lo sia.
Funzioni di accesso:
| QString | targetName() const |
| void | setTargetName(const QString &name) |
Segnale di notifica:
| void | targetNameChanged(const QString &name) |
Documentazione delle funzioni membro
[explicit] QKeyframeAnimation::QKeyframeAnimation(QObject *parent = nullptr)
Crea un oggetto `QKeyframeAnimation` con ` parent`.
void QKeyframeAnimation::addKeyframe(Qt3DCore::QTransform *keyframe)
Aggiunge un nuovo " keyframe " alla fine dell'animazione. L'QTransform può essere aggiunto all'animazione più volte.
QList<Qt3DCore::QTransform *> QKeyframeAnimation::keyframeList() const
Restituisce l'elenco dei fotogrammi chiave.
void QKeyframeAnimation::removeKeyframe(Qt3DCore::QTransform *keyframe)
Rimuove un elemento " keyframe " dall'animazione. Se lo stesso elemento " QTransform " viene impostato più volte come fotogramma chiave, tutte le occorrenze vengono rimosse.
void QKeyframeAnimation::setKeyframes(const QList<Qt3DCore::QTransform *> &keyframes)
Imposta l'keyframes e dell'animazione. I vecchi fotogrammi chiave vengono cancellati.
© 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.