Skip to content


Subversion checkout URL

You can clone with
Download ZIP
JavaScript with Batteries Included for Google Glass
Java JavaScript Other

1. Refactored media player, 2. Added advanced bluetooth commands to i…

…nit.js, 3. Added more sophisticated per-device script support

Signed-off-by: Brandyn A. White <>
latest commit 618502dd6a
@bwhite bwhite authored


WearScript combines the power of Android development on Glass with the learning curve of a website. Go from concept to demo in a fraction of the time. For an overview check out the intro video and sample script below. Visit for documentation and more information.

intro video

// Sample WearScript
<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>
function cb(data) {  // Changes canvas color depending on head rotation
    if (data['type'] == WS.sensor('orientation')) {
        ctx.fillStyle = 'hsl(' + data['values'][0] + ', 90%, 50%)'
        ctx.fillRect(0, 0, 640, 360);
function server() {
    WS.log('Welcome to WearScript');  // Write to Android Log and Playground console
    WS.say('Welcome to WearScript');  // Text-to-speech
    // Stream camera images and all sensors to the WearScript Playground Webapp
    var sensors = ['gps', 'accelerometer', 'magneticField', 'orientation', 'gyroscope',
                   'light', 'gravity', 'linearAcceleration', 'rotationVector'];
    for (var i = 0; i < sensors.length; i++)
        WS.sensorOn(WS.sensor(sensors[i]), .15, 'cb');
    WS.dataLog(false, true, .15);
function main() {
    if (WS.scriptVersion(0)) return;
    ctx = document.getElementById('canvas').getContext("2d");
    WS.serverConnect('{{WSUrl}}', 'server');
window.onload = main;


  • Full documentation at
  • OpenShades (the new OpenGlass) is our community
  • IRC freenode #openshades (if you want to collaborate or chat that's the place to be)
  • Project Lead: Brandyn White (bwhite dappervision com)
  • G+ Community (we post work in progress here)
  • Youtube (all OpenShades videos)
  • Dapper Vision, Inc. (by Brandyn and Andrew) is the sponsor of this project
  • Code is licensed under Apache 2.0 unless otherwise specified


See contributors for details. Name (irc nick)

  • Brandyn White (brandyn)
  • Andrew Miller (amiller)
  • Scott Greenwald (swgreen_mit)
  • Kurtis Nelson (kurtisnelson)
  • Conner Brooks (connerb)
  • Justin Chase (jujuman)
  • Alexander Conroy (geilt)
Something went wrong with that request. Please try again.