PathAnimation QML Type
使项目沿路径进行动画效果。更多...
| Import Statement: | import QtQuick |
| Inherits: |
属性
- anchorPoint : point
- duration : int
- easing
- easing.amplitude : real
- easing.bezierCurve : list<real>
- easing.overshoot : real
- easing.period : real
- easing.type : enumeration
- endRotation : real
- orientation : enumeration
- orientationEntryDuration : real
- orientationExitDuration : real
- path : Path
- target : Item
详细说明
在过渡中使用时,路径可以不指定起始点或终点,例如:
PathAnimation {
path: Path {
//no startX, startY
PathCurve { x: 100; y: 100}
PathCurve {} //last element is empty with no end point specified
}
}在上述情况下,路径起点将设为元素的当前位置,路径终点将设为元素在目标状态下的目标位置。
另请参阅 Qt Quick和PathInterpolator中的“动画与过渡”部分。
属性文档
anchorPoint : point
该属性用于存储正在进行动画效果的项的锚点。
默认情况下,目标的左上角(其 (0,0) 点)将锚定于(或跟随)路径。 可以使用 anchorPoint 属性指定另一个锚点。例如,对于一个 10x10 的项目,若将 anchorPoint 指定为 5,5,则表示该项目的中心点将沿路径移动。
duration : int
该属性存储动画的持续时间,单位为毫秒。
默认值为 250。
easing group
easing.amplitude : real
easing.bezierCurve : list<real>
easing.overshoot : real
easing.period : real
easing.type : enumeration
动画中使用的缓动曲线。
要指定缓动曲线,至少需要指定其类型。对于某些曲线,还可以指定振幅、周期、过冲或自定义的贝塞尔曲线数据。默认的缓动曲线是Easing.Linear 。
有关不同类型缓动曲线的详细信息,请参阅PropertyAnimation::easing.type 文档。
endRotation : real
该属性存储目标的最终旋转角度。
如果已为PathAnimation 指定了方向,且路径结束时项目未处于期望的旋转角度,则可使用endRotation属性手动指定结束时的旋转角度。
该属性通常与orientationExitDuration 配合使用,因为在未指定orientationExitDuration 的情况下指定endRotation可能会导致直接跳转到最终旋转角度,而非平滑过渡。
orientation : enumeration
此属性控制项目沿路径动画时旋转的角度。
如果指定的值不是Fixed ,则PathAnimation 会使项目在沿路径移动时旋转,以达到指定的朝向。
- PathAnimation.Fixed(默认)——PathAnimation 不会控制项目的旋转。
- PathAnimation.RightFirst - 对象的右侧将领先沿路径移动。
- PathAnimation.LeftFirst - 对象的左侧将率先沿路径移动。
- PathAnimation.BottomFirst - 对象的底部将率先沿路径移动。
- PathAnimation.TopFirst - 对象的顶部将率先沿路径移动。
orientationEntryDuration : real
该属性保存过渡到该方向所需的持续时间(以毫秒为单位)。
如果已为路径方向(PathAnimation )指定了方向,且项目的初始旋转角度与该方向指定的旋转角度不一致,则可使用 orientationEntryDuration 属性,使项目从初始旋转角度平滑过渡到路径方向指定的旋转角度。
orientationExitDuration : real
该属性存储退出该方向时的过渡时长(以毫秒为单位)。
如果已为PathAnimation 指定了orientation和endRotation ,则可以使用orientationExitDuration从路径orientation指定的旋转平滑过渡到指定的endRotation 。
path : Path
该属性保存了动画的运动路径。
有关定义路径的更多信息,请参阅Path 文档。
target : Item
该属性保存要进行动画处理的对象。
© 2026 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.