Skip to content

Instantly share code, notes, and snippets.

@bwhite
Created March 8, 2014 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwhite/9423246 to your computer and use it in GitHub Desktop.
Save bwhite/9423246 to your computer and use it in GitHub Desktop.
[wearscript]
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<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">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function cb(data) {
// Changes canvas color with head rotation
if (data['type'] == WS.sensor('orientation')) {
ctx.fillStyle = 'hsl(' + data['values'][0] + ', 90%, 50%)'
ctx.fillRect(0, 0, 640, 360);
}
}
function onEyeGesture(name) {
WS.log('onEyeGesture: ' + name);
}
function onGesture(name) {
WS.log('onGesture: ' + name);
}
function onFingerCountChanged(i, i2) {
WS.log('onFingerCountChanged: ' + i + ', ' + i2);
}
function onScroll(v, v2, v3) {
WS.log('onScroll: ' + v + ', ' + v2 + ', ' + v3);
}
function onTwoFingerScroll(v, v2, v3) {
WS.log('onTwoFingerScroll: ' + v + ', ' + v2 + ', ' + v3);
}
function speech(data) {
WS.log('speech: ' + data);
WS.say('you said ' + data);
}
function server() {
WS.speechRecognize('Say Something', 'speech');
//WS.cameraPhoto();
//WS.cameraVideo();
//WS.cameraOff();
//WS.shutdown();
}
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