| 1 |
import QtQuick 2.0 |
| 2 |
|
| 3 |
Rectangle { |
| 4 |
width: 400; height: 400; color: "blue" |
| 5 |
|
| 6 |
Rectangle { |
| 7 |
id: rect1 |
| 8 |
color: "red" |
| 9 |
width: 60; height: 60; |
| 10 |
x: 100; y: 100; |
| 11 |
SmoothedAnimation on x { to: 200; velocity: 500 } |
| 12 |
SmoothedAnimation on y { to: 200; velocity: 500 } |
| 13 |
} |
| 14 |
|
| 15 |
Rectangle { |
| 16 |
objectName: "theRect" |
| 17 |
color: "green" |
| 18 |
width: 60; height: 60; |
| 19 |
x: rect1.x; y: rect1.y; |
| 20 |
// id are needed for SmoothedAnimation in order to avoid deferred creation |
| 21 |
Behavior on x { SmoothedAnimation { id: anim1; objectName: "easeX"; velocity: 400 } } |
| 22 |
Behavior on y { SmoothedAnimation { id: anim2; objectName: "easeY"; velocity: 400 } } |
| 23 |
} |
| 24 |
} |