MenuBackButton.qml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import QtQuick 2.0
  2. Item {
  3. id: root
  4. signal clicked()
  5. signal back()
  6. MouseArea {
  7. id: ma
  8. anchors.fill: parent
  9. anchors.margins: -8
  10. }
  11. Rectangle {
  12. id: bar1
  13. x: 0
  14. y: root.height / 6
  15. width: root.height
  16. height: root.height / 9
  17. antialiasing: true
  18. }
  19. Rectangle {
  20. id: bar2
  21. x: 0
  22. y: root.height / 2 - height / 2
  23. width: root.height
  24. height: root.height / 9
  25. antialiasing: true
  26. }
  27. Rectangle {
  28. id: bar3
  29. x: 0
  30. y: root.height / 2 + height * 2
  31. width: root.height
  32. height: root.height / 9
  33. antialiasing: true
  34. }
  35. property int animationDuration: 450
  36. state: "menu"
  37. states: [
  38. State {
  39. name: "menu"
  40. PropertyChanges { target: ma; onClicked: root.clicked() }
  41. },
  42. State {
  43. name: "back"
  44. PropertyChanges { target: root; rotation: 180 }
  45. PropertyChanges { target: bar1; rotation: 45; width: root.height / 3 * 2; x: root.height / 2; y: root.height / 4 }
  46. PropertyChanges { target: bar2; width: root.height / 6 * 5 + 1; x: root.height / 9 }
  47. PropertyChanges { target: bar3; rotation: -45; width: root.height / 3 * 2; x: root.height / 2; y: root.height / 3 * 2 }
  48. PropertyChanges { target: ma; onClicked: root.back() }
  49. }
  50. ]
  51. transitions: [
  52. Transition {
  53. RotationAnimation { target: root; direction: RotationAnimation.Clockwise; duration: animationDuration; easing.type: Easing.InOutQuad }
  54. PropertyAnimation { target: bar1; properties: "rotation, width, x, y"; duration: animationDuration; easing.type: Easing.InOutQuad }
  55. PropertyAnimation { target: bar2; properties: "rotation, width, x, y"; duration: animationDuration; easing.type: Easing.InOutQuad }
  56. PropertyAnimation { target: bar3; properties: "rotation, width, x, y"; duration: animationDuration; easing.type: Easing.InOutQuad }
  57. }
  58. ]
  59. }