Qt 4.8
|
The RotationAnimation element animates changes in rotation values. More...
The RotationAnimation element animates changes in rotation values.
RotationAnimation is a specialized PropertyAnimation that gives control over the direction of rotation during an animation.
By default, it rotates in the direction of the numerical change; a rotation from 0 to 240 will rotate 240 degrees clockwise, while a rotation from 240 to 0 will rotate 240 degrees counterclockwise. The direction property can be set to specify the direction in which the rotation should occur.
In the following example we use RotationAnimation to animate the rotation between states via the shortest path:
Notice the RotationAnimation did not need to set a target value. As a convenience, when used in a transition, RotationAnimation will rotate all properties named "rotation" or "angle". You can override this by providing your own properties via PropertyAnimation::properties{properties} or PropertyAnimation::property{property}.
Also, note the Rectangle will be rotated around its default Item::transformOrigin (which is Item.Center
). To use a different transform origin, set the origin in the PropertyChanges object and apply the change at the start of the animation using PropertyAction. See the PropertyAction documentation for more details.
Like any other animation element, a RotationAnimation can be applied in a number of ways, including transitions, behaviors and property value sources. The QML Animation and Transitions documentation shows a variety of methods for creating animations.