QML动画 之 PropertyAnimation

import QtQuick 2.2
import QtQuick.Window 2.0
Window{
    visible:true;
    width:400
    height:400
    Rectangle{
        width:400
        height:400
        color:"#EEEEEE"
        id:rootItem
        Rectangle{
            id:rect
            width:50
            height:150
            anchors.centerIn: parent
            color:"blue"
            PropertyAnimation{
                id:animation
                target: rect  //目标对象
                property:"width" //改变width属性
                to:150  //改变为 150宽度
                duration:1000
            }
            MouseArea{
                anchors.fill: parent;  //锚点为填充  填充的目标对象是 parent
                onClicked: animation.running=true
            }
        }
    }

}
QML动画 之 PropertyAnimation_第1张图片

你可能感兴趣的:(C++Qt框架,C++,Qt框架)