[Qt-qml] use variable during animation

Tibo W tibo_wcc at yahoo.com
Thu May 12 01:55:31 CEST 2011


I think I found a solution:

in the main Animation loop, add a ScripAction that will iterate through all the children.
Then, add a Behavior with an Animation in each children.

cheers


Hi,

I'd to do something like:

SequentialAnimation {
        id: animeA
        running: true
        loops: itemA.nbChildren

        PropertyAction {
            target: itemA;
            property: "varA";
            value: itemA.varA--; // ?
        }

        NumberAnimation {
            target:
 itemA.children[itemA.var];
            property: "y";
            ...
        }
}

That way, during each loop, I can access the property "y" of each children.

If I'm using a ScriptAction only to access itemA.children[var].y, it's working fine, but I can't add duration or effect.

Or, if I add a ScriptAction in a SequantialAnimation like:

SequentialAnimation {
        id: animeA

        running: true

        loops: 8

        ScriptAction {
                script: itemA.varA++;
        }

        PropertyAction {
                target: itemA;
                property: "y";
                value: itemA.varA;
       }
}

The incremented value on varA is not applied in the PropertyAction.

What would be the best way to do that ?

thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110511/568d583b/attachment.html 


More information about the Qt-qml mailing list