翻转180

import QtQuick 2.0

Flipable {
    id: flipable
  width: 360; height: 630

    property int angle: 0
    property bool flipped: false

    front: Image { source: "1.png" }
    back: Image { source: "2.png" }

    transform: Rotation {
        origin.x: flipable.width/2; origin.y: flipable.height/2
        axis.x: 0; axis.y: 1; axis.z: 0     // rotate around y-axis
        angle: flipable.angle
    }

    states: State {
        name: "back"
        PropertyChanges { target: flipable; angle:180 }
        when: flipable.flipped



 }
    transitions: Transition {
        NumberAnimation { easing.type: Easing.InOutElastic;properties: "angle"; duration: 1000 }
    }

    MouseArea {
        anchors.fill: parent
        onClicked: flipable.flipped = !flipable.flipped
    }
}

 

posted on 2013-02-23 12:17  小风儿_xf  阅读(139)  评论(0编辑  收藏  举报

导航