QML动画之PropertyAnimation(属性动画)

来源:互联网 发布:淘宝 真皮皮带 编辑:程序博客网 时间:2024/05/18 00:33

QML中的动画有很多种,属性动画顾名思义就是对对象的属性操作来实现动画。

多说无益,简单的幕布效果动画例子:


import QtQuick 2.3import QtQuick.Window 2.2Window {    id:win    visible: true    width: 500    height: 500    Rectangle{        anchors.fill: parent        color: "red"        id:root        PropertyAnimation{            id:donghua            target: win            property: "height"            from:0            to:500            duration: 5000        }        MouseArea{            anchors.fill: parent            onClicked: donghua.running=true        }                    }}

效果图:

这个图是效果到一半的时候截取的。单击鼠标以后,窗口会一点点向下展开,看起来非常酷炫哦。

0 0