Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qmlvisual / animation / scriptAction / scriptAction-visual.qml
1 import QtQuick 1.0
2
3 /*
4 This test starts with a red rectangle at 0,0. It should animate moving 50 pixels right,
5 then immediately change blue, and then animate moving 50 pixels down.
6 */
7
8 Rectangle {
9     width: 100; height: 100
10     Rectangle {
11         id: myRect
12         width: 50; height: 50
13         color: "red"
14     }
15     MouseArea {
16         id: clickable
17         anchors.fill: parent
18     }
19
20     states: State {
21         name: "state1"
22         when: clickable.pressed
23         PropertyChanges {
24             target: myRect
25             x: 50; y: 50
26         }
27         StateChangeScript {
28             name: "setColor"
29             script: myRect.color = "blue"
30         }
31     }
32
33     transitions: Transition {
34         SequentialAnimation {
35             NumberAnimation { properties: "x"; easing.type: "InOutQuad" }
36             ScriptAction { scriptName: "setColor" }
37             NumberAnimation { properties: "y"; easing.type: "InOutQuad" }
38         }
39     }
40 }