[Qt-interest] QTimeLine from 0 to 100, to -100 and back to 0 ?

Sean Harmer sean.harmer at maps-technology.com
Fri Aug 21 10:26:21 CEST 2009


Hi Oliver,

On Friday 21 Aug 2009 09:02:23 Oliver Demetz wrote:
> Hi!
>
> QTimeLine seems to perfectly suited for the animation I want to realize,
> but I just see a way to go elegantly "in one direction".
>
> I want to drive my animation first from state 0 to 100 - this should be
> no problem. Then I would like to automatically drive the way down to
> -100, and then back to the original state 0.
>
> So something like a complete sine period (2 PI) would be what I like.
> Note that it would alos be fine to have linear trajectories, the sine
> shape is not a must.
>
> Hope you can help me,
>From the QTimeLine docs:

"For a custom timeline, you can reimplement valueForTime(), in which case 
QTimeLine's curveShape property is ignored."

so I think that you need to reimplement the valueForTime() function and 
interpret the value (in the range 0-1) slightly differently. i.e. Assume that 
your start position is 0.5 which then increases up to 1 then down to 0 then 
back to 0.5 again. i.e. It is a simple transformation from these values to 
your desired animation sequence.

HTH,

Sean




More information about the Qt-interest-old mailing list