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 /examples | |
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 'examples')
-rw-r--r-- | examples/declarative/progressbar/content/ProgressBar.qml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/declarative/progressbar/content/ProgressBar.qml b/examples/declarative/progressbar/content/ProgressBar.qml index 65c80b2..aafb12e 100644 --- a/examples/declarative/progressbar/content/ProgressBar.qml +++ b/examples/declarative/progressbar/content/ProgressBar.qml @@ -21,7 +21,8 @@ Item { id: highlight; radius: 1 anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom anchors.leftMargin: 3; anchors.topMargin: 3; anchors.bottomMargin: 3 - EaseFollow on width { source: highlight.widthDest; velocity: 1200 } + width: highlight.widthDest + Behavior on width { SmoothedAnimation { velocity: 1200 } } gradient: Gradient { GradientStop { id: g1; position: 0.0 } GradientStop { id: g2; position: 1.0 } |