Enables animations to be run in parallel. 更多...
import 语句: | import QtQuick 2.12 |
继承: | Animation |
The SequentialAnimation and ParallelAnimation types allow multiple animations to be run together. Animations defined in a SequentialAnimation are run one after the other, while animations defined in a ParallelAnimation are run at the same time.
The following animation runs two number animations in parallel. The
Rectangle
moves to (50,50) by animating its
x
and
y
properties at the same time.
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 } } }
Like any other animation type, a ParallelAnimation can be applied in a number of ways, including transitions, behaviors and property value sources. The Qt Quick 中的动画和过渡 documentation shows a variety of methods for creating animations.
注意: Once an animation has been grouped into a SequentialAnimation or ParallelAnimation , it cannot be individually started and stopped; the SequentialAnimation or ParallelAnimation must be started and stopped as a group.
另请参阅 SequentialAnimation , Qt Quick 中的动画和过渡 ,和 Qt Quick Examples - Animation .