문제

How to get it to work anchors animation, like described here:

import QtQuick 2.0

Item {
    id: container
    width: 200; height: 200

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

    Behavior on anchors.right {
        AnchorAnimation { duration: 2000 }
    }

    Component.onCompleted: {
        myRect.anchors.right = container.right
    }
}

What am I doing wrong? There is no proper animation on changing anchors.

Also, if you can, provide some examples on this theme.

UPD: Provided simpler example.

도움이 되었습니까?

해결책

AnchorAnimation can only be used in a Transition and in conjunction with an AnchorChange. It cannot be used in behaviors and other types of animations.

from AnchorAnimation documentation. There you can also find an example how to use states to do AnchorAnimations.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top