RotationAnimator QML 类型
The RotationAnimator type animates the rotation of an Item. 更多...
| 导入声明 | import QtQuick | 
| 继承 | 
属性
- direction : 枚举
详细说明
Animator 类型与普通 Animation 类型不同。当使用 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 : 枚举 | 
此属性包含旋转的方向。
可能值包括
| 常量 | 描述 | 
|---|---|
| RotationAnimator.Numerical | (默认) 通过在线性插值之间旋转。从 10 到 350 的旋转将顺时针旋转 340 度。 | 
| RotationAnimator.Clockwise | 在两个值之间顺时针旋转 | 
| RotationAnimator.Counterclockwise | 在两个值之间逆时针旋转 | 
| RotationAnimator.Shortest | 选择产生最短动画路径的方向旋转。从 10 到 350 的旋转将逆时针旋转 20 度。 | 
© 2024 The Qt Company Ltd. 文档贡献者所包含的文档版权属于其各自的所有者。本提供的文档根据自由软件基金会发布的 GNU 自由文档许可版 1.3 的条款获得许可。Qt 和相关标志是 The Qt Company Ltd. 在芬兰和其他全球国家的商标。所有其他商标都是其各自所有者的财产。