PathAnimation QML Type

沿路径动画一个项目。更多

Import Statement: import QtQuick
Inherits:

Animation

属性

详细说明

例如,在转换中使用路径时,可以不指定起点或终点:

PathAnimation {
    path: Path {
        //no startX, startY
        PathCurve { x: 100; y: 100}
        PathCurve {}    //last element is empty with no end point specified
    }
}

在上述情况中,路径起点将是项目的当前位置,路径终点将是项目在目标状态下的目标位置。

另请参阅 Qt QuickPathInterpolator中的动画和转换

属性文档

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 将在项目沿路径移动时旋转项目以实现指定的方向。


orientationEntryDuration : real

该属性保存了向方向过渡的持续时间(以毫秒为单位)。

如果已为PathAnimation 指定了方向,而项目的起始旋转与方向所给定的旋转不一致,则可以使用 orientationEntryDuration 从项目的起始旋转平滑过渡到路径方向所给定的旋转。


orientationExitDuration : real

该属性保存了从方向过渡的持续时间(以毫秒为单位)。

如果已为PathAnimation 指定了方向和endRotation ,则方向退出持续时间可用于从路径方向给出的旋转平滑过渡到指定的endRotation


path : Path

该属性包含动画路径。

有关定义路径的更多信息,请参阅Path 文档。


target : Item

此属性包含要制作动画的项目。


© 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.