Created
June 28, 2014 02:16
-
-
Save scottgwald/f3c37650b9687396a487 to your computer and use it in GitHub Desktop.
[wearscript] take two v1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html style="width:100%; height:100%; overflow:hidden"> | |
<head> | |
<!-- You can include external scripts here like so... --> | |
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>--> | |
</head> | |
<body style="width:100%; height:100%; overflow:hidden; margin:0" bgcolor="#000"> | |
<canvas id="canvas" width="640" height="360" style="display:block"></canvas> | |
<script> | |
var mp; | |
function action (x) { | |
if (x == 'TAP') { | |
mp.play(); | |
} | |
if (x == 'TWO_TAP') { | |
mp.pause(); | |
} | |
if (x =='SWIPE_LEFT') { | |
mp.jump(-5000); | |
} | |
else if (x =='TWO_SWIPE_LEFT') { | |
mp.jump(-10000); | |
} | |
if (x =='SWIPE_RIGHT') { | |
mp.jump(5000); | |
} | |
else if (x =='TWO_SWIPE_RIGHT') { | |
mp.jump(10000); | |
} | |
} | |
function server() | |
{ | |
WS.say('welcome to wearscript'); | |
mp = new WS.Media(); | |
mp.onGesture('onGesture', action); | |
setTimeout(function() { | |
mp.startRecording(); | |
}, 1000); | |
} | |
function main() | |
{ | |
if (WS.scriptVersion(1)) return; | |
ctx = document.getElementById('canvas').getContext("2d"); | |
WS.serverConnect('{{WSUrl}}', server); | |
} | |
window.onload = main; | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"name":"Example"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment