Guest User

Untitled

a guest
Jun 30th, 2020
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. import QtQuick 2.12
  2. import QtQuick.Controls 2.12
  3. import QtQuick.Shapes 1.15
  4.  
  5. ApplicationWindow {
  6. visible: true
  7. width: 640
  8. height: 480
  9. title: qsTr("Hello World")
  10. Timer {
  11. id: worker;
  12. interval: 2000
  13. onTriggered: {
  14. console.log(interval + " finished")
  15. rotationAnimation.stop();
  16. }
  17. }
  18.  
  19. Rectangle {
  20. width: 200
  21. height: 200
  22. anchors.centerIn: parent
  23. Button {
  24. anchors.fill: parent
  25. id: button
  26. icon.source: "https://image.flaticon.com/icons/svg/860/860822.svg"
  27. icon.width: parent.width*0.9
  28. icon.height: parent.height*0.9
  29. background: Rectangle {
  30. color: "transparent"
  31. }
  32. RotationAnimator {
  33. id: rotationAnimation
  34. target: button;
  35. from: 0;
  36. to: -360;
  37. duration: 500
  38. loops: Animation.Infinite
  39. onStarted: {
  40. console.log("Rotation started")
  41. }
  42. onStopped: {
  43. console.log("Rotation stopped")
  44. backAnimator.start()
  45. }
  46. }
  47. RotationAnimator {
  48. id: backAnimator
  49. target: button
  50. from: button.rotation
  51. to: 0
  52. duration: (button.rotation/360)*500
  53. onStarted: {
  54. console.log("Back started")
  55. }
  56. onFinished: {
  57. console.log("Back finished");
  58. }
  59. }
  60.  
  61. onClicked: {
  62. rotationAnimation.start();
  63. worker.start()
  64. }
  65. }
  66. }
  67. }
Add Comment
Please, Sign In to add comment