A class implementing simple keyframe animation to a QTransform . 更多...
头: | #include <QKeyframeAnimation> |
CMake: |
find_package(Qt6 COMPONENTS 3danimation REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::3danimation) |
qmake: | QT += 3danimation |
Since: | Qt 5.9 |
实例化: | KeyframeAnimation |
继承: | Qt3DAnimation::QAbstractAnimation |
enum | RepeatMode { None, Constant, Repeat } |
|
|
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 |
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 ) |
void | easingChanged (const QEasingCurve & easing ) |
void | endModeChanged (QKeyframeAnimation::RepeatMode endMode ) |
void | framePositionsChanged (const QList<float> & positions ) |
void | startModeChanged (QKeyframeAnimation::RepeatMode startMode ) |
void | targetChanged (Qt3DCore::QTransform * target ) |
void | targetNameChanged (const QString & name ) |
A Qt3DAnimation::QKeyframeAnimation class implements simple keyframe animation that can be used to animate QTransform . The keyframes consists of multiple timed QTransforms, which are interpolated and applied to the target QTransform . QEasingCurve is used between keyframes to control the interpolator. RepeatMode can be set for when the position set to the QKeyframeAnimation is below or above the values defined in the keyframe positions.
This enumeration specifies how position values outside keyframe values are handled.
常量 | 值 | 描述 |
---|---|---|
Qt3DAnimation::QKeyframeAnimation::None
|
0
|
The animation is not applied to the target transform. |
Qt3DAnimation::QKeyframeAnimation::Constant
|
1
|
The edge keyframe value is used. |
Qt3DAnimation::QKeyframeAnimation::Repeat
|
2
|
The animation is repeated. |
Holds the easing curve of the interpolator between keyframes.
访问函数:
QEasingCurve | easing () const |
void | setEasing (const QEasingCurve & easing ) |
通知程序信号:
void | easingChanged (const QEasingCurve & easing ) |
Holds the repeat mode for the position values greater than the last frame position.
访问函数:
Qt3DAnimation::QKeyframeAnimation::RepeatMode | endMode () const |
void | setEndMode (Qt3DAnimation::QKeyframeAnimation::RepeatMode mode ) |
通知程序信号:
void | endModeChanged (QKeyframeAnimation::RepeatMode endMode ) |
Holds the positions of the keyframes. Each position in the list specifies the position of the corresponding keyframe with the same index. The values must be in an ascending order. Values can be positive or negative and do not have any predefined unit.
访问函数:
QList<float> | framePositions () const |
void | setFramePositions (const QList<float> & positions ) |
通知程序信号:
void | framePositionsChanged (const QList<float> & positions ) |
Holds the repeat mode for the position values less than the first frame position.
访问函数:
Qt3DAnimation::QKeyframeAnimation::RepeatMode | startMode () const |
void | setStartMode (Qt3DAnimation::QKeyframeAnimation::RepeatMode mode ) |
通知程序信号:
void | startModeChanged (QKeyframeAnimation::RepeatMode startMode ) |
Holds the target QTransform the animation is applied to.
访问函数:
Qt3DCore::QTransform * | target () const |
void | setTarget (Qt3DCore::QTransform * target ) |
通知程序信号:
void | targetChanged (Qt3DCore::QTransform * target ) |
Holds the name of the target transform. This is a convenience property making it easier to match the target transform to the keyframe animation. The name is usually same as the name of the parent entity of the target transform, but does not have to be.
访问函数:
QString | targetName () const |
void | setTargetName (const QString & name ) |
通知程序信号:
void | targetNameChanged (const QString & name ) |
Constructs an QKeyframeAnimation with parent .
Adds new keyframe at the end of the animation. The QTransform can be added to the animation multiple times.
Returns the list of keyframes.
Removes a keyframe from the animation. If the same QTransform is set as keyframe multiple times, all occurrences are removed.
设置 keyframes of the animation. Old keyframes are cleared.