[Qt-qml] Pause animation until a condition is met

Alex alexlordax+qt at gmail.com
Tue Sep 14 21:01:43 CEST 2010


On Mon, Sep 13, 2010 at 9:10 AM, Adriano Rezende
<adriano.rezende at openbossa.org> wrote:
> On Fri, Sep 10, 2010 at 3:32 PM, Alex <alexlordax+qt at gmail.com> wrote:

> The first issue can be easily fixed adjusting onConditionChanged to
> check if target is running and if the action has already being
> consumed or not. But I wouldn't suggest this component anymore, since
> a workaround is needed to compensate the time interval, like adding a
> PauseAnimation, and this could also result in race conditions.

Yes, you're right.  I was in the process of adding predicates when I
discovered the asynchronous behavior.

>
>> Here is the same test using my polling approach:
>>
>
> Changing the loop count while the animation is running will mess up
> with the AnimationGroup logic and result in bizarre behaviors like
> rewinds. Also, a child animation should not be stopped
> programmatically, this is the AnimationGroup's job.

> This happens due the fact that an AnimationGroup is constantly looking
> for the current animation based on the current time. It search all
> child animations in sequence, incrementing the duration to see where
> it will fit. But when it finds an animation that have an infinite
> duration it returns this animation as the current one, even if it's
> already being processed.

Ah!  I've run into the rewind issue under different circumstances, and
it makes more sense now.

>
> Maybe the best approach for you, even if it's not so cool, is to
> handle these conditions externally, triggering different animations.
> You can create a component like a ChainAnimation that have a condition
> and a next animation target.

Okay.  Do you have any suggestions for doing this cleanly?


>> PS: As an aside, just like I noted above about stop/pause/resume, it
>> seems that a property value changes are not synchronous.
>
> Do you have a QML code to simulate this problem?
>
> AFAIK properties are set synchronously. Maybe what you are facing is
> something related to this specific component.

I am not sure what I was doing before, but after some testing it looks
like the property 'write' function runs to completion before the
animation continues.

Thanks,
Alex



More information about the Qt-qml mailing list