summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeeasefollow/data
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-02-12 07:19:51 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-03-30 03:54:12 (GMT)
commit7a060ca401b4e260fd08c854213024b050a67ff2 (patch)
tree50745dec7be82136622ae0ccaa0430caa8e0d5a8 /tests/auto/declarative/qdeclarativeeasefollow/data
parent68d3e2da7719ff0fc230e8204946b27018e42c14 (diff)
downloadQt-7a060ca401b4e260fd08c854213024b050a67ff2.zip
Qt-7a060ca401b4e260fd08c854213024b050a67ff2.tar.gz
Qt-7a060ca401b4e260fd08c854213024b050a67ff2.tar.bz2
Change and rename qml EaseFollow to SmoothedAnimation
QDeclarativeSmoothedAnimation inherits from QDeclarativeNumberAnimation, as a consequence SmoothedAnimation can be used inside Behaviors and as PropertySourceValues, like any other animation. The old EaseFollow properties changed to comply with the other declarative animations ('source' changed to 'to'), so now 'to' changes are not automatically 'followed' anymore. You can achieve the following behavior by putting a SmoothedAnimation inside a Behavior of a property that is bound to another, as the following example: If you want to follow an hypothetical rect1, you should do now: Rectangle { color: "green" width: 60; height: 60; x: rect1.x - 5; y: rect1.y - 5; Behavior on x { SmoothedAnimation { velocity: 200 } } Behavior on y { SmoothedAnimation { velocity: 200 } } } SmoothedAnimation also supports animating multiple target(s)/property(ies) in the transition case. When a QDeclarativeSmoothedAnimation is restarted, it will match the QDeclarativeProperty which were being animated and transfer the corresponding track velocity to the new starting animations. QSmoothedAnimation is an uncontrolled animation, duration == -1. The duration is set as -1 to avoid consecutive animation state changes stop()/start(). This is particularly useful when using QSmoothAnimation to 'follow' another property, which is also being animated (change the 'to' property every tick). Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative/qdeclarativeeasefollow/data')
-rw-r--r--tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml4
-rw-r--r--tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml4
-rw-r--r--tests/auto/declarative/qdeclarativeeasefollow/data/easefollowBehavior.qml23
-rw-r--r--tests/auto/declarative/qdeclarativeeasefollow/data/easefollowValueSource.qml13
5 files changed, 41 insertions, 5 deletions
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml
index 0cc19eb..cfece41 100644
--- a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml
+++ b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml
@@ -1,3 +1,3 @@
import Qt 4.6
-EaseFollow {}
+SmoothedAnimation {}
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml
index b65964e..74a110d 100644
--- a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml
+++ b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml
@@ -1,5 +1,5 @@
import Qt 4.6
-EaseFollow {
- source: 10; duration: 300; enabled: true; reversingMode: EaseFollow.Immediate
+SmoothedAnimation {
+ to: 10; duration: 300; reversingMode: SmoothedAnimation.Immediate
}
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml
index f8886e9..3111e82 100644
--- a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml
+++ b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml
@@ -1,6 +1,6 @@
import Qt 4.6
-EaseFollow {
- source: 10; velocity: 250; enabled: false; reversingMode: EaseFollow.Sync
+SmoothedAnimation {
+ to: 10; velocity: 250; reversingMode: SmoothedAnimation.Sync
maximumEasingTime: 150
}
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollowBehavior.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollowBehavior.qml
new file mode 100644
index 0000000..eb06344
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollowBehavior.qml
@@ -0,0 +1,23 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400; height: 400; color: "blue"
+
+ Rectangle {
+ id: rect1
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+ SmoothedAnimation on x { to: 200; velocity: 500 }
+ SmoothedAnimation on y { to: 200; velocity: 500 }
+ }
+
+ Rectangle {
+ objectName: "theRect"
+ color: "green"
+ width: 60; height: 60;
+ x: rect1.x; y: rect1.y;
+ Behavior on x { SmoothedAnimation { objectName: "easeX"; velocity: 400 } }
+ Behavior on y { SmoothedAnimation { objectName: "easeY"; velocity: 400 } }
+ }
+ }
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollowValueSource.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollowValueSource.qml
new file mode 100644
index 0000000..9ae744c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollowValueSource.qml
@@ -0,0 +1,13 @@
+import Qt 4.6
+
+Rectangle {
+ width: 300; height: 300;
+ Rectangle {
+ objectName: "theRect"
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+ SmoothedAnimation on x { objectName: "easeX"; to: 200; velocity: 500 }
+ SmoothedAnimation on y { objectName: "easeY"; to: 200; duration: 250; velocity: 500 }
+ }
+}