[Interest] Infinte animation

Jérôme Godbout jerome at bodycad.com
Tue Oct 20 17:42:48 CEST 2015


Just an idea for a Timer based "solution" (more a workaround):

you may want to use a Timer to trigger update event, where you could read
the actual time and perform a delta by using javascript new Date() object
and
http://javascript.info/tutorial/datetime-functions#numeric-conversion-date-diff

Make any F(t) you want, set your animation to have the higher delay as your
timer or better the last real time delta you got from the timer update
event.  With that new delta you can set the animation for the next Timer
update event and a little more. Re update the behaviors parameters at each
event with the real delta. Make sure your animation alwaysRunToEnd is set
to false.

This way if you process the update event ahead or behind lightly, the
animation should be relatively smooth. This is not perfect and may require
some tweaking to avoid glitching and not overcharge the Timer events. At
least you could use the stop event current time to have the actual value
without too much errors.


On Tue, Oct 20, 2015 at 10:29 AM, Dmitry Volosnykh <
dmitry.volosnykh at gmail.com> wrote:

> I need to continuously increment some value with constant velocity over
> time until the animation is requested to stop. I.e. I don't know the end
> value in advance.
>
> SmoothedAnimation does not provide constant motion since it
> accelerates/decelerates.
>
> NumberAnimation with loops: Animation.Infinite does not fit my needs
> because it will reset value each time next loop is started.
>
> Behavior leads to a tricky solution requiring adding some delta to the
> value over time. The delta needs to be defined empirically so that motion
> looks smooth.
>
> Is there a way to achieve that with QML-only solution?
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151020/4b590272/attachment.html>


More information about the Interest mailing list