SequentialAnimation Element Reference

The SequentialAnimation element allows animations to be run sequentially.

[Inherits Animation]

This element was introduced in Qt 4.7.

Detailed Description

The SequentialAnimation element allows animations to be run sequentially.

The SequentialAnimation and ParallelAnimation elements 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 example runs two number animations in a sequence. The Rectangle animates to a x position of 50, then to a y position of 50.

  1. import QtQuick 1.0
  2.  
  3. Rectangle  {
  4.     id: rect
  5.     width: 100; height: 100
  6.     color: "red"
  7.  
  8.     SequentialAnimation  {
  9.         running: true
  10.         NumberAnimation  { target: rect; property: "x"; to: 50; duration: 1000 }
  11.         NumberAnimation  { target: rect; property: "y"; to: 50; duration: 1000 }
  12.     }
  13. }

Animations defined within a Transition are automatically run in parallel, so SequentialAnimation can be used to enclose the animations in a Transition if this is the preferred behavior.

Like any other animation element, a SequentialAnimation can be applied in a number of ways, including transitions, behaviors and property value sources. The QML Animation and Transitions documentation shows a variety of methods for creating animations.

Note: 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.

Notes provided by the Qt Community

No notes