Last active
February 16, 2018 11:51
-
-
Save benlau/008da10b340cc07133856a2ef49199b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import QtQuick 2.0 | |
| import QuickPromise 1.0 | |
| Item { | |
| id: item; | |
| width: 640 | |
| height: 480 | |
| MouseArea { | |
| anchors.fill: parent | |
| onClicked: { | |
| var promise = Q.promise(function(resolve) { | |
| Q.setTimeout(function() { | |
| resolve(); | |
| }, 1000); | |
| }); | |
| movingText.start(promise); | |
| } | |
| } | |
| Item { | |
| id: movingText | |
| anchors.centerIn: parent | |
| function start(promise) { | |
| promise.then(function() { | |
| animation.start(); | |
| }); | |
| } | |
| Text { | |
| anchors.centerIn: parent | |
| text: "X" | |
| font.pixelSize: 72 | |
| NumberAnimation { | |
| id: animation | |
| target: parent | |
| property: "rotation" | |
| from: 0 | |
| to: 360 | |
| loops: 1 | |
| duration: 1000 | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment