Skip to content

Instantly share code, notes, and snippets.

@bwhite
bwhite / glass.html
Created March 1, 2014 22:02
[wearscript] Get one of every preview image size and photo
<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 next_image() {
if (SIZES.length) {
var size = SIZES.pop();
WS.cameraOn(.5, size[0], size[1]);
WS.sound('TAP');
} else {
@bwhite
bwhite / glass.html
Created March 2, 2014 00:05
[wearscript] Eye tracker preview frame stream
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0;" bgcolor='#000000'>
<script>
function server() {
WS.sound('SUCCESS');
WS.cameraOn(.5, 360, 640);
WS.dataLog(false, true, .15);
}
function main() {
if (WS.scriptVersion(1)) return;
@bwhite
bwhite / glass.html
Created March 2, 2014 02:05 — forked from amiller/glass.html
[wearscript] Big to Glass Calibration
<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
@bwhite
bwhite / glass.html
Last active August 29, 2015 13:56
[wearscript] Warp view
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
WS.displayWarpView([3.0439236881258753, -0.09811170052611454, -1351.6367347302782, 0.03321587552236447, 3.053154626691264, -40.341560801335376, -0.00010172584427831437, -5.8759263127489935e-05, 1.0]);
WS.cameraOn(.1, 360, 640);
}
window.onload = main;
</script>
@bwhite
bwhite / glass.html
Created March 3, 2014 23:23
[wearscript] Python image/sensor stream example
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
WS.serverConnect('{{WSUrl}}', function () {
WS.sensorOn('accelerometer', .25);
WS.cameraOn(1);
WS.dataLog(false, true, .15);
});
@bwhite
bwhite / glass.html
Created March 4, 2014 21:43
[wearscript] Example AR Warp
<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);
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WSRAW.scriptVersion(1)) return;
WS.gestureCallback('onPebbleClick', function (name) {
switch (name) {
case 'UP':
WS.say('up');
break;
@bwhite
bwhite / glass.html
Created March 6, 2014 14:01
[wearscript] Neopixel + bluetooth
<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 NeoPixel(bluetooth) {
this.bluetooth = bluetooth;
this.buffer = ['arduinoneopixel'];
this.concat = function (x) {
this.buffer = this.buffer.concat(x);
}
@bwhite
bwhite / glass.html
Created March 8, 2014 00:35
[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
@bwhite
bwhite / glass.html
Created March 11, 2014 00:55
[wearscript]
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script type="text/html" id="tpl_card0">
<article>
<section>
<ul class="text-x-small">
<li>Gingerbread</li>
<li>Chocolate Chip Cookies</li>
<li>Tiramisu</li>
<li>Donuts</li>