Documentation mentions only usage with states, transitions and
ParentChange. Is it possible to use ParentAnimation inside Behavior or even
as a standalone animation that is launched manually?

Here's modified example from ParentAnimation's web page:

import QtQuick 2.0

Item {
    objectName: "root"
    width: 200; height: 100

    Rectangle {
        id: redRect
        objectName: "redRect"
        width: 100; height: 100
        color: "red"
    }


    Rectangle {
        id: blueRect
        objectName: "blueRect"
        x: parent === redRect ? 10 : redRect.width
        y: parent === redRect ? 10 : 0
        width: 50; height: 50
        color: "blue"

        Behavior on parent {
            ParentAnimation {
                NumberAnimation { properties: "x,y"; duration: 1000 }
            }
        }

        onParentChanged: console.log("parent:", parent.objectName)

        MouseArea { anchors.fill: parent; onClicked: blueRect.parent =
redRect }
    }
}

Blue rectangle instantly jumps inside the red one instead of moving
smoothly.
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to