Created
March 27, 2014 07:44
-
-
Save timothyclemans/9802362 to your computer and use it in GitHub Desktop.
[wearscript]
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> | |
</head> | |
<body style="width:100%; height:100%; background:yellow; overflow:hidden; margin:0"> | |
<canvas id="image" width="640" height="360" style="position: absolute; left: 0; top: 0; z-index: 0;"></canvas> | |
<script> | |
function showImage(imageDataArray) { | |
image = "data:image/jpeg;base64,"+imageDataArray ; | |
var img = new Image(); | |
img.onload = function () { | |
ctximg.drawImage(img, 0, 0, 640, 360); | |
} | |
img.src = image; | |
} | |
function onGesture(name) { | |
if (name == 'TAP') { | |
WS.cameraPhoto(); | |
} | |
} | |
function server() { | |
WS.cameraOn(.001, 320, 180, function(x) {showImage(x)}); | |
var gestures = ['onGesture']; | |
for (var i = 0; i < gestures.length; i++) | |
WS.gestureCallback(gestures[i], gestures[i]); | |
} | |
function main() { | |
ctximg = document.getElementById('image').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