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 的项目指定一个 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 一起使用,因为指定 endRotation 而不指定orientationExitDuration 可能会导致最终旋转的跳转,而不是平滑过渡。
orientation : enumeration
该属性控制着项目在沿路径移动时的旋转方向。
如果指定的值不是Fixed ,则PathAnimation 将在项目沿路径移动时旋转项目以达到指定的方向。
- PathAnimation.Fixed(固定)(默认)-PathAnimation 不会控制项目的旋转。
- PathAnimation.RightFirst - 项目的右侧将沿着路径前进。
- PathAnimation.LeftFirst - 项目的左侧将沿路径前进。
- PathAnimation.BottomFirst - 项目的底部将沿着路径前进。
- PathAnimation.TopFirst - 项目的顶部将沿着路径前进。
orientationEntryDuration : real
该属性用于保存过渡到方向的持续时间(以毫秒为单位)。
如果已为PathAnimation 指定了方向,而项目的起始旋转与方向所给定的旋转不一致,则可以使用 orientationEntryDuration 从项目的起始旋转平滑过渡到路径方向所给定的旋转。
orientationExitDuration : real
该属性用于保存脱离方向的持续时间(以毫秒为单位)。
如果已为PathAnimation 指定了方向和endRotation ,则方向退出持续时间可用于从路径方向给出的旋转平滑过渡到指定的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.