QML-旋转、反折、变色字的实现!

来源:互联网 发布:淘宝退货运费险规则 编辑:程序博客网 时间:2024/05/14 05:39
import QtQuick 1.0Rectangle{    id:page    width:500;height:200    color:"green"    Text{        id:mytext        text:"Welcome to China"        y:30        anchors.horizontalCenter: page.horizontalCenter        font.pointSize: 24;font.bold: true;color:"yellow"        MouseArea{id:mouseArea;anchors.fill: parent}        states:State{            name:"down";when:mouseArea.pressed==true            PropertyChanges {                target: mytext;y:150;rotation:180;color:"red"            }        }        transitions:Transition {                from: ""                to: "down"                reversible: true                ParallelAnimation{                    NumberAnimation{properties: "y,rotation";duration:500;easing.type:Easing.InOutQuad}                    ColorAnimation { duration:500 }                }        }    }}


呵呵,没想到QML制作动画如何easy,挺有意思的!