PauseAnimation
一、描述
在 SequentialAnimation 中使用时,PauseAnimation 指定的持续时间内没有任何反应的停顿。
一个 500 毫秒的动画序列,两个动画之间有 100 毫秒的停顿:
SequentialAnimation
{
NumberAnimation { ... duration: 200 }
PauseAnimation { duration: 100 }
NumberAnimation { ... duration: 200 }
}
二、属性成员
1、duration : int
此属性以毫秒为单位保存暂停的持续时间。默认值为 250。
SequentialAnimation
一、描述
顺序动画,SequentialAnimation 中定义的动画一个接一个运行。
以下示例按顺序运行两个数字动画。矩形动画到 x 位置 50,然后到 y 位置 50。
import QtQuick 2.0
Rectangle
{
id: rect
width: 100; height: 100
color: "red"
SequentialAnimation
{
running: true
NumberAnimation { target: rect; property: "x"; to: 50; duration: 1000 }
NumberAnimation { target: rect; property: "y"; to: 50; duration: 1000 }
}
}
注意:一旦动画被分组为 SequentialAnimation 或 ParallelAnimation,就不能单独启动和停止; SequentialAnimation 或 ParallelAnimation 必须作为一个组启动和停止。
ParallelAnimation
一、描述
并行动画,ParallelAnimation 中定义的动画同时运行。
以下动画并行运行两个数字动画。 通过同时为其 x 和 y 属性设置动画,矩形移动到 (50,50)。
import QtQuick 2.0
Rectangle
{
id: rect
width: 100; height: 100
color: "red"
ParallelAnimation
{
running: true
NumberAnimation { target: rect; property: "x"; to: 50; duration: 1000 }
NumberAnimation { target: rect; property: "y"; to: 50; duration: 1000 }
}
}