Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qmlvisual / animation / parentAnimation / parentAnimation-visual.qml
1 import QtQuick 1.0
2
3 /*
4 This test shows a green rectangle moving and growing from the upper-left corner
5 of the black rectangle to the same position as the red rectangle (it should end up
6 the same height as the red rect and twice as wide). There should be no odd jumps or clipping seen.
7
8 The test shows one full transition (to the red and back), then several partial transitions, and
9 then a final full transition.
10 */
11
12 Rectangle {
13     width: 400;
14     height: 240;
15     color: "black";
16
17     Rectangle {
18         id: gr
19         color: "green"
20         width: 50; height: 50
21     }
22
23     MouseArea {
24         id: mouser
25         anchors.fill: parent
26     }
27
28     Rectangle {
29         id: np
30         x: 150
31         width: 150; height: 150
32         color: "yellow"
33         clip: true
34         Rectangle {
35             color: "red"
36             x: 50; y: 50; height: 50; width: 50
37         }
38
39     }
40
41     Rectangle {
42         id: vp
43         x: 100; y: 100
44         width: 50; height: 50
45         color: "blue"
46         rotation: 45
47         scale: 2
48     }
49
50     states: State {
51         name: "state1"
52         when: mouser.pressed
53         ParentChange {
54             target: gr
55             parent: np
56             x: 50; y: 50; width: 100;
57         }
58     }
59
60     transitions: Transition {
61         reversible: true
62         to: "state1"
63         ParentAnimation {
64             target: gr; via: vp;
65             NumberAnimation { properties: "x,y,rotation,scale,width" }
66         }
67     }
68 }