forked from jeromeetienne/virtualjoystick.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dual.html
28 lines (26 loc) · 792 Bytes
/
dual.html
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
<html><body>
<script src="virtualjoystick.js"></script>
<script>
console.log("touchscreen is", VirtualJoystick.touchScreenAvailable() ? "available" : "not available");
//
var joystick = new VirtualJoystick({
container : document.body,
strokeStyle : 'cyan'
});
joystick.addEventListener('touchStartValidation', function(event){
var touch = event.changedTouches[0];
if( touch.pageX < window.innerWidth/2 ) return false;
return true
});
// one on the right of the screen
var joystick = new VirtualJoystick({
container : document.body,
strokeStyle : 'orange'
});
joystick.addEventListener('touchStartValidation', function(event){
var touch = event.changedTouches[0];
if( touch.pageX >= window.innerWidth/2 ) return false;
return true
});
</script></body>
</html>