Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qmlvisual / qdeclarativespringanimation / clock.qml
1 import QtQuick 1.0
2
3 Rectangle {
4     id: clock
5     color: "gray"
6     width: 200; height: 200
7
8     property variant hours: 10
9     property variant minutes: 28
10     property variant seconds: 0
11
12     Timer {
13         interval: 1000; running: true; repeat: true; triggeredOnStart: true
14         onTriggered: seconds++
15     }
16
17     Image { id: background; source: "content/clock.png" }
18
19     Image {
20         x: 92.5; y: 27
21         source: "content/hour.png"
22         transform: Rotation {
23             id: hourRotation
24             origin.x: 7.5; origin.y: 73
25             angle: (clock.hours * 30) + (clock.minutes * 0.5)
26
27             Behavior on angle {
28                 SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
29             }
30         }
31     }
32
33     Image {
34         x: 93.5; y: 17
35         source: "content/minute.png"
36         transform: Rotation {
37             id: minuteRotation
38             origin.x: 6.5; origin.y: 83
39             angle: clock.minutes * 6
40
41             Behavior on angle {
42                 SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
43             }
44         }
45     }
46
47     Image {
48         x: 97.5; y: 20
49         source: "content/second.png"
50         transform: Rotation {
51             id: secondRotation
52             origin.x: 2.5; origin.y: 80
53             angle: clock.seconds * 6
54
55             Behavior on angle {
56                 SpringAnimation { spring: 5; damping: 0.25; modulus: 360 }
57             }
58         }
59     }
60
61     Image {
62         anchors.centerIn: background; source: "content/center.png"
63     }
64 }