Qt5_NMap_CarouselDemo.qml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import QtQuick 2.0
  2. import QtGraphicalEffects 1.0
  3. import "content"
  4. Item {
  5. id: mainView
  6. width: 1280
  7. height: 720
  8. QtObject {
  9. id: settings
  10. property real spotAnimationPosition: 0.0
  11. SequentialAnimation on spotAnimationPosition {
  12. loops: Animation.Infinite
  13. NumberAnimation { to: 30; duration: 2000; easing.type: Easing.InOutQuad }
  14. NumberAnimation { to: 0; duration: 2000; easing.type: Easing.InOutQuad }
  15. }
  16. }
  17. Image {
  18. anchors.fill: parent
  19. source: "content/images/background_lab.png"
  20. }
  21. ContentModel {
  22. id: listModel
  23. }
  24. NMapLightSource {
  25. id: lightSourceItem
  26. z: 10
  27. lightPosX: mainView.width * 0.5
  28. lightPosY: mainView.height * 0.8 - settings.spotAnimationPosition * 5
  29. lightIntensity: 0.3
  30. }
  31. PathView {
  32. id: pathView
  33. anchors.fill: parent
  34. model: listModel
  35. delegate: ListItem {
  36. onIsSelectedChanged: {
  37. if (isSelected) {
  38. nameTextItem.text = model.name
  39. }
  40. }
  41. }
  42. path: Path {
  43. startX: mainView.width*0.5; startY: mainView.height*0.68
  44. PathAttribute { name: "iconScale"; value: 1.4 }
  45. PathAttribute { name: "iconZ"; value: 100.0 }
  46. PathAttribute { name: "iconFog"; value: 0.0 }
  47. PathQuad { x: mainView.width*0.5; y: mainView.height*0.2; controlX: mainView.width*1.1; controlY: mainView.height*0.2 }
  48. PathAttribute { name: "iconScale"; value: 0.8 }
  49. PathAttribute { name: "iconZ"; value: 1.0 }
  50. PathAttribute { name: "iconFog"; value: 0.5 }
  51. PathQuad { x: mainView.width*0.5; y: mainView.height*0.68; controlX: -mainView.width*0.1; controlY: mainView.height*0.2 }
  52. }
  53. focus: true
  54. Keys.onPressed: {
  55. if (event.key === Qt.Key_Left) {
  56. pathView.decrementCurrentIndex();
  57. event.accepted = true;
  58. }
  59. if (event.key === Qt.Key_Right) {
  60. pathView.incrementCurrentIndex();
  61. event.accepted = true;
  62. }
  63. }
  64. }
  65. Text {
  66. id: nameTextItem
  67. anchors.horizontalCenter: parent.horizontalCenter
  68. anchors.bottom: parent.bottom
  69. anchors.bottomMargin: parent.height * 0.08
  70. font.pixelSize: 68
  71. color: "#d0d0d0"
  72. style: Text.Outline
  73. styleColor: "#404040"
  74. visible: false
  75. }
  76. DropShadow {
  77. anchors.fill: nameTextItem
  78. horizontalOffset: 0
  79. verticalOffset: settings.spotAnimationPosition * 0.5 - 8
  80. radius: 14.0
  81. samples: 16
  82. color: "#000000"
  83. source: nameTextItem
  84. opacity: 0.6
  85. }
  86. Image {
  87. anchors.bottom: parent.bottom
  88. anchors.bottomMargin: parent.height * 0.01
  89. anchors.right: parent.right
  90. anchors.rightMargin: Math.max(8, parent.width * 0.15 - 100)
  91. source: "content/images/arrow-right.png"
  92. MouseArea {
  93. anchors.fill: parent
  94. onClicked: pathView.incrementCurrentIndex()
  95. }
  96. }
  97. Image {
  98. anchors.bottom: parent.bottom
  99. anchors.bottomMargin: parent.height * 0.01
  100. anchors.left: parent.left
  101. anchors.leftMargin: Math.max(8, parent.width * 0.15 - 100)
  102. mirror: true
  103. source: "content/images/arrow-right.png"
  104. MouseArea {
  105. anchors.fill: parent
  106. onClicked: pathView.decrementCurrentIndex()
  107. }
  108. }
  109. Image {
  110. anchors.bottom: parent.bottom
  111. anchors.horizontalCenter: parent.horizontalCenter
  112. anchors.horizontalCenterOffset: 150
  113. source: "content/images/spot.png"
  114. transformOrigin: Item.BottomRight
  115. width: 500
  116. height: 200
  117. rotation: settings.spotAnimationPosition * 0.8
  118. opacity: 0.2
  119. }
  120. Image {
  121. anchors.bottom: parent.bottom
  122. anchors.horizontalCenter: parent.horizontalCenter
  123. anchors.horizontalCenterOffset: -150
  124. source: "content/images/spot.png"
  125. mirror: true
  126. transformOrigin: Item.BottomLeft
  127. width: 500
  128. height: 200
  129. rotation: -settings.spotAnimationPosition * 0.8
  130. opacity: 0.2
  131. }
  132. FpsItem {
  133. id: fpsItem
  134. }
  135. }