diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-02-12 07:19:51 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-03-30 03:54:12 (GMT) |
commit | 7a060ca401b4e260fd08c854213024b050a67ff2 (patch) | |
tree | 50745dec7be82136622ae0ccaa0430caa8e0d5a8 /tests/auto/declarative/qmlvisual | |
parent | 68d3e2da7719ff0fc230e8204946b27018e42c14 (diff) | |
download | Qt-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/qmlvisual')
-rw-r--r-- | tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/easefollow.qml | 15 | ||||
-rw-r--r-- | tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml | 9 |
2 files changed, 16 insertions, 8 deletions
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/easefollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/easefollow.qml index 121328b..ee94857 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/easefollow.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/easefollow.qml @@ -15,26 +15,31 @@ Rectangle { Rectangle { width: 50; height: 20; y: 60; color: "red" - EaseFollow on x { source: rect.x; velocity: 400 } + x: rect.x + Behavior on x { SmoothedAnimation { velocity: 400 } } } Rectangle { width: 50; height: 20; y: 90; color: "yellow" - EaseFollow on x { source: rect.x; velocity: 300; reversingMode: EaseFollow.Immediate } + x: rect.x + Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } } } Rectangle { width: 50; height: 20; y: 120; color: "green" - EaseFollow on x { source: rect.x; reversingMode: EaseFollow.Sync } + x: rect.x + Behavior on x { SmoothedAnimation { reversingMode: SmoothedAnimation.Sync } } } Rectangle { width: 50; height: 20; y: 150; color: "purple" - EaseFollow on x { source: rect.x; maximumEasingTime: 200 } + x: rect.x + Behavior on x { SmoothedAnimation { maximumEasingTime: 200 } } } Rectangle { width: 50; height: 20; y: 180; color: "blue" - EaseFollow on x { source: rect.x; duration: 300 } + x: rect.x + Behavior on x { SmoothedAnimation { duration: 300 } } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml b/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml index f4fb863..d8512eb 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml @@ -48,9 +48,12 @@ Rectangle { flickableData: [ Rectangle { color: "transparent"; border.color: "white"; border.width: 8; z: 3000 - height: 100; width: 100; x: 4; y: 4 - EaseFollow on x { source: gridView.currentItem.x; velocity: 500 } - EaseFollow on y { source: gridView.currentItem.y; velocity: 500 } + height: 100; width: 100 + x: gridView.currentItem.x + y: gridView.currentItem.y + + Behavior on x { SmoothedAnimation { velocity: 500 } } + Behavior on y { SmoothedAnimation { velocity: 500 } } } ] } |