import QtQuick 2.1 import QtQuick.Window 2.1 Window { id: window visibility: Window.Windowed ListView { id: view orientation: ListView.Horizontal highlightRangeMode: ListView.StrictlyEnforceRange preferredHighlightBegin: 0 preferredHighlightEnd: 0 snapMode: ListView.SnapOneItem anchors.fill: parent focus: true model: 2 delegate: Item { id: slide width: view.width height: view.height Flipable { id: tile anchors { fill: parent; margins: parent.width/10 } transform: Rotation { id: rotation origin.x: tile.width/2 origin.y: tile.height/2 axis.x: 1; axis.y: 0; axis.z: 0 Behavior on angle { RotationAnimation { easing.type: Easing.OutBack; duration: 1000 } } Behavior on axis { Vector3dAnimation { easing.type: Easing.OutBack; duration: 1000 } } } Behavior on scale { NumberAnimation { easing.type: Easing.OutBack; duration: 1000 } } front: Rectangle { anchors.fill: parent color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1) } MouseArea { id: mouseArea function releasePress() { console.log(rotation.axis) rotation.axis = Qt.vector3d(1, 0, 0); rotation.angle = 0; tile.scale = 1; } anchors.fill: parent onPressed: { console.log(rotation.axis) if (mouse.x < width/5 || mouse.x > (width - width/5)) { rotation.axis = Qt.vector3d(0, 1, 0); rotation.angle = mouse.x < width/2 ? -10 : 10; } else if (mouse.y < height/5 || mouse.y > (height - height/5)) { rotation.axis = Qt.vector3d(1, 0, 0); rotation.angle = mouse.y > height/2 ? -10 : 10;; } else { rotation.axis = Qt.vector3d(0, 0, 0); tile.scale = 0.9; } } onReleased: releasePress(); onCanceled: releasePress(); } } } } }