Slide 41
Slide 41 text
hello -API
var ws281x = require('rpi-ws281x'),
canvas = ws281x.createCanvas(10,10),
ctx = canvas.ctx;
var c1 = new ws281x.Color('red'),
c2 = new ws281x.Color('blue');
function rnd(max) { return (max || 1) * Math.random(); }
function rndi(max) { return Math.round(rnd(max)); }
setInterval(function() {
var c = ws281x.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);