[Qt-qml] "RotationAnimation: setRunning() cannot be used on non-root animation nodes"

Stephen Collyer scollyer at netspinner.co.uk
Wed Jul 21 17:27:49 CEST 2010


On 19 July 2010 20:06, Eduardo Fleury <eduardo.fleury at openbossa.org> wrote:

> On Mon, Jul 19, 2010 at 3:45 PM, Stephen Collyer <
> scollyer at netspinner.co.uk> wrote:
>
>>
>> 1. Is this documented anywhere ? I can't see anything in Assistant that
>> mentions
>> a restriction like this.
>>
>
> The concept here is that once an animation is part of a larger group, it is
> the group that decides when it's the right moment for each of its children
> to start or stop. That restriction is tied to the concept of AnimationGroup.
>

Right. The current documentation for QML ParallelAnimation doesn't mention
this restriction, neither does it mention the concept of an AnimationGroup.
That concept doesn't seem to be exposed very explicity in the QML docs.
The impression I get from the docs. as they currently stand is that a
SequentionAnimation and a ParallelAnimation are fundamentally the same
type of Item as, say, a PropertyAnimation. But that seems not to be the
case.


>
>
>
>> 2. It's not clear to me what in my code is trying to start or stop the
>> animations. Is it
>> the presence of the loops property ?
>>
>
> I couldn't find where you are starting the animation but since the
> ParallelAnimation does not have an id, and the Rotation animation has, I'm
> assuming you might be calling "rot.start()" somewhere... or "rot.enabled =
> true".
>

It's not clear to me why that code isn't working: I wasn't trying to call
rot.start()
or anything like that. The following example works as expected however:

 import Qt 4.7

Item
{
    id: page
    height: 200
    width: 200

    Text
    {
        id: t1
        text: "Colours"
        font.pointSize: 18
        font.bold: true
        anchors.horizontalCenter: page.horizontalCenter
        anchors.verticalCenter: page.verticalCenter
        color: "grey"

    }

    ParallelAnimation
    {
        running: true
        ColorAnimation
        {
            id: ca
            property: "color"
            target: t1
            loops: Animation.Infinite
            from: "red"
            to:   "blue"
            duration: 4000
        }
        RotationAnimation
        {
            id: ra
            property: "rotation"
            target: t1
            loops: Animation.Infinite
            from: 0.0
            to: 360.0
            duration: 4000
        }
    }

}


-- 
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100721/4e01876e/attachment.html 


More information about the Qt-qml mailing list