summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@qt.io>2020-10-15 15:45:36 +0300
committerSamuli Piippo <samuli.piippo@qt.io>2020-10-20 05:08:49 +0000
commit84726988dad28ad4b7e77dcda7baddda094b90dd (patch)
treee2924f07199a72d85a9c90b4d5a7d0d1d9b17dfa
parent499870a9ccf17728c824f76967a556c5b45bbe69 (diff)
startupscreen: fix up movement for clock hands
Avoid hardcoded sizes and positions to make clock hands centered and rotate on correct axes. Change-Id: I9d5e80fbf785a34dc1fc81f57d57886efff31b23 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
-rw-r--r--startupscreen/AnalogClock.qml18
1 files changed, 9 insertions, 9 deletions
diff --git a/startupscreen/AnalogClock.qml b/startupscreen/AnalogClock.qml
index a430227..c7d5643 100644
--- a/startupscreen/AnalogClock.qml
+++ b/startupscreen/AnalogClock.qml
@@ -105,7 +105,7 @@ Item {
transform: Rotation {
id: hourRotation
- origin.x: 2
+ origin.x: wideDial / 2
origin.y: clockRadius/2
angle: (clock.hours * 30) + (clock.minutes * 0.5)
Behavior on angle {
@@ -120,16 +120,16 @@ Item {
Rectangle {
id: minuteDial
x: clockRadius - (wideDial/2)
- y: 32
+ y: clockRadius * 0.3
width: wideDial
- height: clockRadius - 32
+ height: clockRadius * 0.7
color: "#53586b"
radius: width/2
transform: Rotation {
id: minuteRotation
- origin.x: 2
- origin.y: clockRadius - 32
+ origin.x: wideDial / 2
+ origin.y: clockRadius * 0.7
angle: clock.minutes * 6
Behavior on angle {
SpringAnimation {
@@ -144,16 +144,16 @@ Item {
Rectangle {
id: secondHand
x: clockRadius - (narrowDial/2)
- y: 24
+ y: clockRadius * 0.1
width: narrowDial
- height: clockRadius - 24
+ height: clockRadius * 0.9
color: "red"
radius: width/2
transform: Rotation {
id: secondRotation
- origin.x: 1
- origin.y: clockRadius - 24
+ origin.x: narrowDial / 2
+ origin.y: clockRadius * 0.9
angle: clock.seconds * 6
Behavior on angle {
SpringAnimation {