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