[Qt-qml] Applying common behaviour to a group of elements

Alex alexlordax+qt at gmail.com
Thu Aug 5 02:32:45 CEST 2010


That's much better.  I totally missed ScriptAction.

I think I prefer this to your other suggestion (using
onPlaybackCompleted) since it allows me to keep all the sequencing
information in one place.

My playback function is asynchronous, but I suppose I can add a method
to retrieve the duration beforehand and use that to drive the
PauseAnimation.

Thanks, guys!

Alex



On Wed, Aug 4, 2010 at 5:11 PM,  <michael.brasser at nokia.com> wrote:
> Hi,
>
> On 05/08/2010, at 8:38 AM, ext Alex wrote:
>> Is there a declarative approach for me to express the following?
>>
>> 1.  animate fade-in for element A
>> 2.  play sound(S) and wait for completion
>> 3.  animate fade-in for element B
>
> Typcially ScriptAction is used insert a block of script to execute mid-animation, i.e.
>
> SequentialAnimation {
>    NumberAnimation {}
>    ScriptAction { script: mediaPLayer.play() }
>    NumberAnimation {}
> }
>
> The multimedia elements provided by Qt mobility don't block when play() is called, so you wouldn't get the "wait for completion" behavior you described. Assuming your own elements are the same (a blocking play could cause issues with the animation -- http://bugreports.qt.nokia.com/browse/QTBUG-12662), and similar to Alan's proposal, you could do something like
>
> SequentialAnimation {
>    NumberAnimation {}
>    ParallelAnimation {
>        ScriptAction {}
>        PauseAnimation {}
>    }
>    NumberAnimation {}
> }
>
> Eventually we'd like the multimedia elements to be able to be inserted in an animation directly -- maybe at that point we could give more intuitive control over blocking as well.
>
> Michael




More information about the Qt-qml mailing list