Как создать анимацию "масштабирование вверх, затем вниз" в QML?

Как создать анимацию, в которой предмет увеличивается в размерах, а затем уменьшается до исходного размера (вспомните "прыгающий мяч" с высоты птичьего полета). Пока я понял, как создать одностороннюю анимацию с помощью "Behavior on x/y", изменяя parent.x и parent.y

Например...

Rectangle {
id: container;
    width: 700
    height: 700
    function goForIt(parent) {
        parent.x = (Math.floor(Math.random()*600));
        parent.y = (Math.floor(Math.random()*600));
        parent.width += 100;
        parent.height += 100;
    }
    Image {
        id: head;
        source: "vlad.png";
        height: 80;
        width: 90;
        MouseArea {
            anchors.fill: parent
            onClicked: goForIt(parent);
        }
        Behavior on x {
            PropertyAnimation {
                target: head;
                properties: "x";
                duration: 1000;
            }
        }
        Behavior on y {
            PropertyAnimation {
                target: head;
                properties: "y";
                duration: 1000;
            }
        }
        Behavior on height {
            PropertyAnimation {
                target: head;
                properties: "height";
                duration: 1000;
            }
        }
        Behavior on width {
            PropertyAnimation {
                target: head;
                properties: "width";
                duration: 1000;
            }
        }
    }
}
6
задан nipponese 5 December 2011 в 20:54
поделиться