[Qt-qml] SmoothedFollow and SmoothedAnimation

Leonardo Sobral Cunha leo.cunha at nokia.com
Fri Apr 9 02:53:38 CEST 2010


hi,

While porting some of our examples and demos, we noticed that there is one use 
case that is not easily achievable with SmoothedAnimation, which is animating 
from an specific initial value and after that start following an item 
(examples/declarative/clocks). This is because behavior doesnt have a syntax 
to specify an initial value.

So for this purpose we added SmoothedFollow (renamed from EaseFollow), its in 
the qt-qml staging branch. Now you can still use the old automatic syntax for 
tracking 'to' changes:

      Rectangle {
          color: "green"
          width: 60; height: 60;
	  x: 45; y: 45
          SmoothedFollow on x { to: rect1.x; velocity: 200 }
          SmoothedFollow on y { to: rect1.y; velocity: 200 }
     }

In the example above, x will first animate from 45 and then start following 
rect1.x

SmoothedFollow and SmoothedAnimation share the internals, so its not duplicate 
code. We preferred having two different simple elements that have well 
defined behaviors, than adding special properties to SmoothedAnimation to 
handle those cases.

Resuming: - SmoothedAnimation is still useful for using inside Behavior and 
Transitions or as a common Animation;
                  - SmoothedFollow, as the old EaseFollow, is not an Animation 
and should be used as PropertyValueSource. The 'source' property was renamed 
to 'to';
                  - SpringFollow will remain and its 'source' property was 
also renamed to 'to'.

That should be the last change on these items for 4.7.

br,
leo



More information about the Qt-qml mailing list