function draw() { c.clear(); var t = new Date(); var sin = function(i, l) { return Math.floor(Math.sin(i*2*Math.PI)*l+80); }, cos = function(i, l) { return Math.floor(Math.cos(i*2*Math.PI)*l+80); }; line(80, 80, sin(t.getHours()/24, 30), 160-cos(t.getHours()/24, 30), c.set.bind(c)); line(80, 80, sin(t.getMinutes()/60, 50), 160-cos(t.getMinutes()/60, 50), c.set.bind(c)); line(80, 80, sin(t.getSeconds()/60+(+t%1000)/60000, 75), 160-cos(t.getSeconds()/60+(+t%1000)/60000, 75), c.set.bind(c)); process.stdout.write(c.frame()); }
function br(p1, p2) { return bresenham( Math.floor(p1[0]), Math.floor(p1[1]), Math.floor(p2[0]), Math.floor(p2[1]) ); }
Context.prototype.stroke = function stroke() { if (this.lineWidth==0) return; var set = this._canvas.set.bind(this._canvas); for(var i = 0; i < this._currentPath.length - 1; i++) { var cur = this._currentPath[i]; var nex = this._currentPath[i+1]; if(nex.stroke) { bresenham(cur.point[0], cur.point[1], nex.point[0], nex.point[1], set); } } };