aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation-visual.qml
blob: 235ad9d94bbf2296d4995f638da32b334071c1e5 (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
import QtQuick 1.0

Rectangle {
    id: mainrect
    width: 200; height: 200
    state: "first"
    states: [
        State {
            name: "first"
            PropertyChanges {
                target: mainrect
                color: "red"
            }
        },
        State {
            name: "second"
            PropertyChanges {
                target: mainrect
                color: "blue"
            }
        }
    ]
    transitions: [
        Transition {
            from: "first"
            to: "second"
            reversible: true
            SequentialAnimation {
                ColorAnimation {
                    duration: 2000
                    target: mainrect
                    property: "color"
                }
            }
        }
    ]
    MouseArea {
        anchors.fill: parent
        onClicked: { mainrect.state = 'second' }
    }
}