Skip to content

Instantly share code, notes, and snippets.

@benlau
Last active February 16, 2018 11:51
Show Gist options
  • Select an option

  • Save benlau/008da10b340cc07133856a2ef49199b1 to your computer and use it in GitHub Desktop.

Select an option

Save benlau/008da10b340cc07133856a2ef49199b1 to your computer and use it in GitHub Desktop.
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