-
Notifications
You must be signed in to change notification settings - Fork 124
/
dual.html
35 lines (33 loc) · 970 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
29
30
31
32
33
34
35
<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',
limitStickTravel: true,
stickRadius : 120
});
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',
limitStickTravel: true,
stickRadius : 0
});
joystick.addEventListener('touchStartValidation', function(event){
var touch = event.changedTouches[0];
if( touch.pageX >= window.innerWidth/2 ) return false;
return true
});
joystick.addEventListener('touchStart', function(){
console.log('fire')
})
</script></body>
</html>