Slide 45
Slide 45 text
canvas-API
var ws281x = require('../lib/ws281x'),
canvas = ws281x.createCanvas(10,10),
ctx = canvas.ctx,
Color = ws281x.Color;
var c1 = new Color('red'), c2 = new Color('blue');
function rnd(max) { return (max || 1) * Math.random(); }
function rndi(max) { return Math.round(rnd(max)); }
setInterval(function() {
var c = Color.mix(c1,c2, rnd());
ctx.clearRect(0,0,10,10);
ctx.fillStyle = 'rgb(' + c.rgb.join(',') + ')';
ctx.fillRect(rndi(10)-2, rndi(10)-2, rndi(10), rndi(10));
canvas.render();
}, 1000/5);
the javascript-side