IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QKeyframeAnimation Class

A class implementing simple keyframe animation to a QTransform.

This class was introduced in Qt 5.9.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QKeyframeAnimation Class

  • Header: QKeyframeAnimation

  • Since: Qt 5.9

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS 3danimation)

    target_link_libraries(mytarget PRIVATE Qt6::3danimation)

  • qmake: QT += 3danimation

  • Inherited By:

  • Instantiated By: qml-qt3d-animation-keyframeanimation.xml

  • Inherits: Qt3DAnimation::QAbstractAnimation

Detailed Description

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.

Member Type Documentation

 

enum QKeyframeAnimation::RepeatMode

This enumeration specifies how position values outside keyframe values are handled.

Constant

Value

Description

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.

Property Documentation

 

easing : QEasingCurve

Holds the easing curve of the interpolator between keyframes.

Access functions:

  • easing() const

  • void setEasing(const &easing)

Notifier signal:

  • void easingChanged(const &easing)

endMode : RepeatMode

Holds the repeat mode for the position values greater than the last frame position.

Access functions:

  • endMode() const

  • void setEndMode( mode)

Notifier signal:

  • void endModeChanged( endMode)

framePositions : QList<float>

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.

Access functions:

  • <float> framePositions() const

  • void setFramePositions(const <float> &positions)

Notifier signal:

  • void framePositionsChanged(const <float> &positions)

startMode : RepeatMode

Holds the repeat mode for the position values less than the first frame position.

Access functions:

  • startMode() const

  • void setStartMode( mode)

Notifier signal:

  • void startModeChanged( startMode)

target : Qt3DCore::QTransform*

Holds the target QTransform the animation is applied to.

Access functions:

  • *target() const

  • void setTarget( *target)

Notifier signal:

  • void targetChanged( *target)

targetName : QString

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.

Access functions:

  • targetName() const

  • void setTargetName(const &name)

Notifier signal:

  • void targetNameChanged(const &name)

Member Function Documentation

 

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

Constructs an QKeyframeAnimation with parent.

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

Adds new keyframe at the end of the animation. The QTransform can be added to the animation multiple times.

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

Returns the list of keyframes.

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

Removes a keyframe from the animation. If the same QTransform is set as keyframe multiple times, all occurrences are removed.

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

Sets the keyframes of the animation. Old keyframes are cleared.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+