RotationAnimator QML Type
RotationAnimator 类型用于为项目的旋转制作动画。更多
Import Statement: | import QtQuick |
Inherits: |
属性
- direction : enumeration
详细说明
Animator 类型不同于普通的动画类型。使用 Animator 时,动画可以在呈现线程中运行,动画完成后,属性值将跳转到末尾。
Item::rotation 的值会在动画结束后更新。
下面的代码段展示了如何将 RotationAnimator 与 Rectangle 项结合使用。
Rectangle { id: rotatingBox width: 50 height: 50 color: "lightsteelblue" RotationAnimator { target: rotatingBox; from: 0; to: 360; duration: 1000 running: true } }
也可以使用on
关键字将 RotationAnimator 直接与项目实例的rotation
属性绑定。
Rectangle { width: 50 height: 50 color: "lightsteelblue" RotationAnimator on rotation { from: 0; to: 360; duration: 1000 } }
另请参阅 Item::transformOrigin 和ScaleAnimator 。
属性文档
direction : enumeration |
该属性表示旋转的方向。
可能的值有
常量 | 说明 |
---|---|
RotationAnimator.Numerical | (默认)通过对两个数字进行线性插值来旋转。从 10 到 350 的旋转将顺时针旋转 340 度。 |
RotationAnimator.Clockwise | 在两个数值之间顺时针旋转 |
RotationAnimator.Counterclockwise | 在两个数值之间逆时针旋转 |
RotationAnimator.Shortest | 沿产生最短动画路径的方向旋转。从 10 旋转到 350 将逆时针旋转 20 度。 |
© 2025 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.