Furkanzmc / QML-Loaders

Loading animation implementations in QML
264 stars 65 forks source link

Add ClockSpinner.qml #1

Closed majidkamali1370 closed 7 years ago

majidkamali1370 commented 7 years ago

A clock spinner with minute and hour hands.

Furkanzmc commented 7 years ago

Thank you for the contribution. I love it. But can you make the following changes to enable manipulation of the animation's paused state? I'm also adding the same thing to the other loaders.

     property int lineThickness: 2
     property color color: "white"
-
-    id: root
-    Component.onCompleted: {
-        rotationAnimation.start()
-        hourAnimation.start()
-    }
+    property alias running: rotationAnimation.paused
+
+    id: root

     Rectangle {
         id: line
@@ -41,6 +38,7 @@
         id: rotationAnimation
         target: line
         property: "rotation"
+        running: true
         duration: 500
         from: 180
         to: 540
@@ -51,6 +49,8 @@
     NumberAnimation {
         id: hourAnimation
         target: hourLine
+        running: rotationAnimation.running
+        paused: rotationAnimation.paused
         property: "rotation"
         duration: 6000
         from: 180
@@ -59,4 +59,3 @@
         loops: Animation.Infinite
     }
-}
-
+}