summaryrefslogtreecommitdiffstats
path: root/examples/declarative/behaviours/test.qml
blob: 8fffd598c0d6b0abcad2ff074f2ba6e83d6deedf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import Qt 4.6

Rectangle {
    color: "lightsteelblue"
    width: 800
    height: 600
    id: page
    MouseArea {
        anchors.fill: parent
        onClicked: { bluerect.parent = page; console.log(mouseX); bluerect.x = mouseX; }
    }
    MyRect {
        color: "green"
        x: 200
        y: 200
    }
    MyRect {
        color: "red"
        x: 400
        y: 200
    }
    MyRect {
        color: "yellow"
        x: 400
        y: 400
    }
    MyRect {
        color: "orange"
        x: 400
        y: 500
    }
    MyRect {
        color: "pink"
        x: 400
        y: 0
    }
    MyRect {
        color: "lightsteelblue"
        x: 100
        y: 500
    }
    MyRect {
        color: "black"
        x: 0
        y: 200
    }
    MyRect {
        color: "white"
        x: 400
        y: 0
    }
    Rectangle {
        color: "blue"
        x: 0
        y: 0
        width: 100
        height: 100
        id: bluerect
        x: Behavior {
            ParallelAnimation {
                SequentialAnimation {
                    NumberAnimation {
                        target: bluerect
                        property: "y"
                        from: 0
                        to: 10
                        easing.type: "OutBounce"
                        easing.amplitude: 30
                        duration: 250
                    }
                    NumberAnimation {
                        target: bluerect
                        property: "y"
                        from: 10
                        to: 0
                        easing.type: "OutBounce"
                        easing.amplitude: 30
                        duration: 250
                    }
                }
                NumberAnimation { duration: 500 }
            }
        }
        parent: Behavior {
            SequentialAnimation {
                NumberAnimation {
                    target: bluerect
                    property: "opacity"
                    to: 0
                    duration: 150
                }
                PropertyAction {}
                NumberAnimation {
                    target: bluerect
                    property: "opacity"
                    to: 1
                    duration: 150
                }
            }
        }
    }
}