Created
March 4, 2014 21:43
-
-
Save bwhite/9356423 to your computer and use it in GitHub Desktop.
[wearscript] Example AR Warp
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"> | |
<body style="width:100%; height:100%; overflow:hidden; margin:0"> | |
<canvas id="canvas" width="640" height="360" style="display:block"></canvas> | |
<script> | |
function server() { | |
WS.cameraOn(2, 720, 1280); | |
WS.displayWarpView(); | |
function sample() { | |
setTimeout(function (){ | |
WS.warpDraw(640 / 2, 360 / 2, 10, 255, 0, 0); | |
}, 1500) | |
WS.warpPreviewSampleGlass(''); | |
} | |
WS.dataLog(false, true, .15); | |
WS.gestureCallback('onGesture', function (gesture) { | |
if (gesture === 'TAP') { | |
WS.sound('SUCCESS'); | |
sample(); | |
} | |
}); | |
} | |
function main() { | |
if (WS.scriptVersion(1)) return; | |
ctx = document.getElementById('canvas').getContext("2d"); | |
WS.serverConnect('{{WSUrl}}', 'server'); | |
} | |
window.onload = main; | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment