summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml
blob: d351b8c1c4d65136b8c1a2eb40507ae3b2a3531a (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
Rect {
    id: mainrect
    width: 200; height: 200
    state: "first"
    states: [
        State {
            name: "first"
            SetProperty {
                target: mainrect
                property: "color"
                value: "red"
            }
        },
        State {
            name: "second"
            SetProperty {
                target: mainrect
                property: "color"
                value: "blue"
            }
        }
    ]
    transitions: [
        Transition {
            fromState: "first"
            toState: "second"
            reversible: true
            SequentialAnimation {
                ColorAnimation {
                    duration: 2000
                    target: mainrect
                    property: "color"
                }
            }
        }
    ]
    MouseRegion {
        anchors.fill: parent
        onClicked: { mainrect.state = 'second' }
    }
}