import QtQuick 2.2
Rectangle{
    id: rootItem
    width: 360
    height: 360
    color: "#cfcfcf"
    property int targetWidth: 0
    Rectangle{
        id: rect1
        width:360
        height:rootItem.height
        color:"#808080"
    }
    Rectangle{
        id: rect2
        width:rootItem.width-rect1.width
        height:parent.height
        x:rootItem.width
        color:"#c0c0c0"
    }
    Button{
        text: "Button"
        anchors.centerIn: parent
        onClicked: {
            animation.start()
        }
    }
    NumberAnimation{
        id: animation
        target: rect1
        properties:  "width"
        to: rootItem.targetWidth
        duration: 720
        onStopped: rootItem.targetWidth = rootItem.width - to
    }
}