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

michael.brasser at nokia.com michael.brasser at nokia.com
Fri Aug 27 06:11:16 CEST 2010


On 27/08/2010, at 8:21 AM, ext Alex wrote:
> I am looking for a way to pause a SequentialAnimation until a certain
> condition is met.  I.e., something similar to PauseAnimation but with
> a conditional statement instead of a duration.
> 
> For example:
> 
> SequentialAnimation {
>  NumberAnimation {}
>  ConditionalPauseAnimation { condition: myComponent.isReady }
>  NumberAnimation {}
> }

I can't think of anything currently available that's as elegant as the above -- could you add a suggestion for this in JIRA?

> I know I can split up the animation into multiple shorter ones and
> then use state transitions to start them, but it's not very elegant...
> 
> Any ideas?


You could try something like this to pause the animation:

SequentialAnimation {
    id: group
    NumberAnimation { to: 200 }
    ScriptAction { script: if (!myComponent.isReady) group.pause() }
    NumberAnimation { to: 400 }
}

and then elsewhere call group.resume() whenever the condition is met.

Regards,
Michael



More information about the Qt-qml mailing list