MyPage.qml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import QtQuick 1.0
  2. Rectangle {
  3. id: pg
  4. property alias colorPage: pg.color
  5. property color colorBorder
  6. property string prevPage: ""
  7. function closePage(_prevPage) {
  8. if( _prevPage !== "" ) {
  9. pg.prevPage = _prevPage
  10. pg.state = "hidden"
  11. } else if( pg.prevPage ) {
  12. pg.state = "hidden"
  13. }
  14. }
  15. height: mytheme.displayHeight
  16. width: mytheme.displayWidth
  17. anchors.fill: parent
  18. border.color: colorBorder
  19. radius: mytheme.radiusMainWin
  20. clip: true
  21. Image {
  22. id: background
  23. anchors.fill: parent
  24. source: "qrc:/qml/images/wp1.png"
  25. opacity: 0.7
  26. }
  27. /*------------*/
  28. transform: [
  29. Rotation {
  30. id: plateRotation
  31. angle: 0
  32. axis { x: 0; y: 1; z: 0 }
  33. origin.x: -100
  34. origin.y: 0 //50
  35. }
  36. ]
  37. property int _tAnimScale: 100
  38. property int _tAnimAngle: 200
  39. state: "hidden"
  40. states: [
  41. State {
  42. name: "hidden"
  43. PropertyChanges { target: plateRotation; angle: -90 }
  44. PropertyChanges { target: pg; scale: 0.96 }
  45. PropertyChanges { target: pg; opacity: 0 }
  46. },
  47. State {
  48. name: "visible"
  49. PropertyChanges { target: plateRotation; angle: 0 }
  50. PropertyChanges { target: pg; scale: 1 }
  51. PropertyChanges { target: pg; opacity: 1 }
  52. }
  53. ]
  54. transitions: [
  55. Transition {
  56. from: "hidden"; to: "visible"
  57. ParallelAnimation {
  58. SequentialAnimation {
  59. PauseAnimation { duration: _tAnimScale*0.4 }
  60. NumberAnimation { property: "opacity"; duration: _tAnimAngle; easing.type: Easing.InOutQuad }
  61. }
  62. SequentialAnimation {
  63. RotationAnimation{ properties: "angle"; from: 90; to: 0; duration: _tAnimAngle; easing.type: Easing.OutCubic }
  64. NumberAnimation { property: "scale"; duration: _tAnimScale; easing.type: Easing.InOutQuad }
  65. }
  66. }
  67. },
  68. Transition {
  69. from: "visible"; to: "hidden"
  70. ParallelAnimation {
  71. SequentialAnimation {
  72. PauseAnimation { duration: _tAnimScale*0.4 }
  73. NumberAnimation { property: "opacity"; duration: _tAnimAngle; easing.type: Easing.InOutQuad }
  74. }
  75. SequentialAnimation {
  76. NumberAnimation { property: "scale"; duration: _tAnimScale; easing.type: Easing.InOutQuad }
  77. RotationAnimation { properties: "angle"; duration: _tAnimAngle; easing.type: Easing.OutCubic }
  78. ScriptAction { script: main.loadPage = prevPage }
  79. }
  80. }
  81. }
  82. ]
  83. }