QML:命运齿轮开始转动!

当鼠标点击齿轮时,齿轮开始转动,3秒转完360度。 

QML:命运齿轮开始转动!_第1张图片

import QtQuick

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("命运齿轮")

    Image {
        id: zyz
        source: "../01/images/u97_mouseOver.png"
        anchors.centerIn: parent

        Behavior on rotation {  // 为特定属性的修改行为提供动画
            NumberAnimation {
                duration: 3000 // 3秒的时间旋转360度
            }
        }

        MouseArea {
            anchors.fill: parent
            onClicked: zyz.rotation += 360 // 鼠标点击后,将zyz旋转360度
        }
    }
}

你可能感兴趣的:(QML,qt,quick,qml)