{
const height = 500;
const cell = 50;
const rad = Math.PI / 180;
const ctx = DOM.context2d(width, height);
ctx.clearRect(0, 0, width, height);
ctx.strokeStyle="#5a5a5a";
ctx.lineWidth = 50;
ctx.lineCap = 'round';
ctx.globalCompositeOperation = 'xor';
let step = 0;
let points = [];
for (let y=0; y<height; y+=cell) {
for (let x=0; x<width; x+=cell) {
let r = Math.round(Math.random()) * 90;
points.push({ x, y, r });
}
}
do {
ctx.clearRect(0, 0, width, height);
for (let p of points) {
ctx.save();
ctx.beginPath();
ctx.translate(p.x, p.y);
ctx.moveTo(0, 0);
ctx.rotate((p.r+step) * rad);
ctx.lineTo(cell, cell);
ctx.stroke();
ctx.closePath();
ctx.restore();
}
step += 1;
yield ctx.canvas;
} while( true );
}