Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.12
- import QtQuick.Controls 2.12
- import QtQuick.Shapes 1.15
- ApplicationWindow {
- visible: true
- width: 640
- height: 480
- title: qsTr("Hello World")
- Timer {
- id: worker;
- interval: 2000
- onTriggered: {
- console.log(interval + " finished")
- rotationAnimation.stop();
- }
- }
- Rectangle {
- width: 200
- height: 200
- anchors.centerIn: parent
- Button {
- anchors.fill: parent
- id: button
- icon.source: "https://image.flaticon.com/icons/svg/860/860822.svg"
- icon.width: parent.width*0.9
- icon.height: parent.height*0.9
- background: Rectangle {
- color: "transparent"
- }
- RotationAnimator {
- id: rotationAnimation
- target: button;
- from: 0;
- to: -360;
- duration: 500
- loops: Animation.Infinite
- onStarted: {
- console.log("Rotation started")
- }
- onStopped: {
- console.log("Rotation stopped")
- backAnimator.start()
- }
- }
- RotationAnimator {
- id: backAnimator
- target: button
- from: button.rotation
- to: 0
- duration: (button.rotation/360)*500
- onStarted: {
- console.log("Back started")
- }
- onFinished: {
- console.log("Back finished");
- }
- }
- onClicked: {
- rotationAnimation.start();
- worker.start()
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment