Circus

Circus lights

by jhalderm

HTML

<script src="http://141.212.120.173/client.js"></script>

JavaScript

// Circus!

// Click Run above to update the simulator. Drag the model to rotate.
// Open your brower's JavaScript console to view error messages.

(new Blinken()).run(function (lights) {
    // My self-contained program goes here.        
    var colors = [ [1, 0, 0], [1, 8 / 15, 0], [1, 1, 0], [0, 1, 0],
        [0, 0, 1], [4 / 15, 14 / 15, 13 / 15], [14 / 15, 0, 14 / 15] ];
    for (i = 0; i < lights.length; i++) {
        lights[i].rgb(colors[i % colors.length][0],
                      colors[i % colors.length][1],
                      colors[i % colors.length][2]);
    }

    // Update lights and return number of ms until
    // this function gets called again.
    return function () {
        lights.unshift(lights.pop());
        return 200;
    };
});