I want rectangle animation from y = 0; to y = baza.height - rect1.height. I follow examples, but with no effect. Can you tell me why?
My code is as follow:
Qt Code:
  1. import QtQuick 2.5
  2. import QtQuick.Window 2.2
  3. import QtQuick.Controls 1.4
  4.  
  5. Window {
  6. visible: true
  7. title: qsTr("Hello World")
  8. visibility: Window.Maximized
  9. Rectangle
  10.  
  11. {
  12. id: baza
  13. x: 0
  14. y: 0
  15. width: parent.width
  16. height: parent.height
  17.  
  18. Rectangle
  19. {
  20. id: rect1
  21. x: 0
  22. y: 0
  23. width: 9
  24. height: 100
  25. radius: width / 2
  26. color: "blue"
  27. //color: { if (width > 20) "blue"; else "red" }
  28.  
  29. //SequentialAnimation {
  30. SequentialAnimation{
  31.  
  32. loops: Animation.Infinite
  33. running: true
  34. NumberAnimation { target: rect1; property: "y"; to: { baza.height - rect1.heigh; } duration: 3000 }
  35. }
  36. }
  37.  
  38.  
  39. MouseArea
  40.  
  41. {
  42.  
  43. anchors.fill: baza
  44.  
  45. onClicked:
  46.  
  47. {
  48. Qt.quit();
  49.  
  50. }
  51.  
  52. }
  53.  
  54. }
  55. }
To copy to clipboard, switch view to plain text mode