PropertyAnimation 结合使用的小例子

来源:互联网 发布:java storm整合kafka 编辑:程序博客网 时间:2024/05/17 02:39
import QtQuick 2.2import QtQuick.Window 2.0/************邱于涵*Time:2017年1月4日21:41:13*******/Window{    visible:true;    width:400    height:400    title:"四个属性动画-涵涵"    Rectangle{        width:400        height:400        color:"#EEEEEE"        id:rootItem        Rectangle{            id:rect            width:150            height:150            color:"blue"            PropertyAnimation{                id:animation                target: rect  //目标对象                property:"radius" //改变width属性                to:150  //改变为 150宽度                duration:5000            }            PropertyAnimation{                id:rotationAni                target:rect                property:"rotation"                to:800                duration:5000            }            PropertyAnimation{                id:posAni                target:rect                property:"x"                to:200                duration:5000            }            PropertyAnimation{                id:colorAni                target:rect                property:"color"                to:"red"                duration:5000            }            MouseArea{                anchors.fill: parent;  //锚点为填充  填充的目标对象是 parent                onClicked:                {                    animation.running=true                    rotationAni.running=true                    posAni.running=true                    colorAni.running=true;                }            }        }    }}


0 0
原创粉丝点击