summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlvisual
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-04-08 03:42:58 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-04-08 05:06:12 (GMT)
commit62fb142331fe8780a38a3ec84cf0e9d5eada316e (patch)
treef3d3c4cfbf344e85ad8b4c6aaa758d25fc66e4dd /tests/auto/declarative/qmlvisual
parent74595d1d6156603fc29090a96e0f0d066756bbe6 (diff)
downloadQt-62fb142331fe8780a38a3ec84cf0e9d5eada316e.zip
Qt-62fb142331fe8780a38a3ec84cf0e9d5eada316e.tar.gz
Qt-62fb142331fe8780a38a3ec84cf0e9d5eada316e.tar.bz2
Add SmoothedFollow element to qml
The SmoothedFollow is the same as the old EaseFollow, so it's not an animation, but its main use case is to be used as a property value source to automatically follow the 'to' property, as in the example below. Rectangle { color: "green" width: 60; height: 60; SmoothedFollow on x { to: rect1.x - 5; velocity: 200 } SmoothedFollow on y { to: rect1.y - 5; velocity: 200 } } This element shares the internal implementation with SmoothedAnimation, both providing the same easing function, but with SmoothedFollow it's easier to set a start value to animate intially and then start to follow, while SmoothedAnimation is still convenient for using inside Behaviors and Transitions. Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative/qmlvisual')
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml
new file mode 100644
index 0000000..5dee0c6
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml
@@ -0,0 +1,40 @@
+import Qt 4.6
+
+Rectangle {
+ width: 800; height: 240; color: "gray"
+
+ Rectangle {
+ id: rect
+ width: 50; height: 20; y: 30; color: "black"
+ SequentialAnimation on x {
+ loops: Animation.Infinite
+ NumberAnimation { from: 50; to: 700; duration: 2000 }
+ NumberAnimation { from: 700; to: 50; duration: 2000 }
+ }
+ }
+
+ Rectangle {
+ width: 50; height: 20; y: 60; color: "red"
+ SmoothedFollow on x { to: rect.x; velocity: 400; enabled: true }
+ }
+
+ Rectangle {
+ width: 50; height: 20; y: 90; color: "yellow"
+ SmoothedFollow on x { to: rect.x; velocity: 300; reversingMode: SmoothedAnimation.Immediate; enabled: true }
+ }
+
+ Rectangle {
+ width: 50; height: 20; y: 120; color: "green"
+ SmoothedFollow on x { to: rect.x; reversingMode: SmoothedAnimation.Sync; enabled: true }
+ }
+
+ Rectangle {
+ width: 50; height: 20; y: 150; color: "purple"
+ SmoothedFollow on x { to: rect.x; maximumEasingTime: 200; enabled: true }
+ }
+
+ Rectangle {
+ width: 50; height: 20; y: 180; color: "blue"
+ SmoothedFollow on x { to: rect.x; duration: 300; enabled: true }
+ }
+}