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: Math.random() * 2000
- onTriggered: {
- 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
- // infinite run - alwaysRunToEnd: true
- loops: Animation.Infinite
- }
- onClicked: {
- rotationAnimation.start();
- worker.start()
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment