blob: 1f4be6dd43ff4e5e1c7518f0fc5651319dc2f981 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import QtQuick 2.0
import GoExtensions 1.0
Rectangle {
width: 640; height: 400
color: "black"
Gopher {
id: gopher
width: 300; height: 300
anchors.centerIn: parent
NumberAnimation on rotation {
id: anim
from: 360; to: 0
duration: 5000
loops: Animation.Infinite
}
MouseArea {
anchors.fill: parent
property real startX
property real startR
onPressed: {
startX = mouse.x
startR = gopher.rotation
anim.running = false
}
onReleased: {
anim.from = gopher.rotation + 360
anim.to = gopher.rotation
anim.running = true
}
onPositionChanged: {
gopher.rotation = (36000 + (startR - (mouse.x - startX))) % 360
}
}
}
}
|