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

RotationAnimator QML Type

The RotationAnimator type animates the rotation of an Item.

This type was introduced in Qt 5.2.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

RotationAnimator QML Type

  • Import Statement: import QtQuick

  • Since:: Qt 5.2

  • Inherits:: Animator

  • Group: RotationAnimator is part of qtquick-transitions-animations

Detailed Description

Animator types are different from normal Animation types. When using an Animator, the animation can be run in the render thread and the property value will jump to the end when the animation is complete.

The value of Item::rotation is updated after the animation has finished.

The following snippet shows how to use a RotationAnimator together with a Rectangle item.

 
Sélectionnez
Rectangle {
    id: rotatingBox
    width: 50
    height: 50
    color: "lightsteelblue"
    RotationAnimator {
        target: rotatingBox;
        from: 0;
        to: 360;
        duration: 1000
        running: true
    }
}

It is also possible to use the on keyword to tie the RotationAnimator directly to the rotation property of an Item instance.

 
Sélectionnez
Rectangle {
    width: 50
    height: 50
    color: "lightsteelblue"
    RotationAnimator on rotation {
        from: 0;
        to: 360;
        duration: 1000
    }
}

See Also

Property Documentation

 

direction : enumeration

This property holds the direction of the rotation.

Possible values are:

  • RotationAnimator.Numerical (default) - Rotate by linearly interpolating between the two numbers. A rotation from 10 to 350 will rotate 340 degrees clockwise.

  • RotationAnimator.Clockwise - Rotate clockwise between the two values

  • RotationAnimator.Counterclockwise - Rotate counterclockwise between the two values

  • RotationAnimator.Shortest - Rotate in the direction that produces the shortest animation path. A rotation from 10 to 350 will rotate 20 degrees counterclockwise.

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