summaryrefslogtreecommitdiff
path: root/public/assets/test/wheel.html
blob: 054945e028f98361ea39caee2f9608a3ace04592 (plain)
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
<style>
#cursor {
	position:absolute;margin-top:-5px;margin-left:-5px;
	width:10px;height:10px;border-radius:50%;
	background:red;
}
</style>
<div id="cursor"></div>
<script src="/assets/javascripts/util.js"></script>
<script src="/assets/javascripts/rectangles/util/wheel.js"></script>

<script>
x = window.innerWidth/2
y = window.innerHeight/2
function draw(){
	cursor.style.top = y + 'px'
	cursor.style.left = x + 'px'
}
new wheel({
	el: document,
	propagate: false,
	update: function(e,dy,dx){
		y = mod(y + dy, window.innerHeight)
		x = mod(x + dx, window.innerWidth)
		draw()
	},
})
draw()
</script>