function draw(ctx) {
const height = width;
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, width, height);
ctx.lineWidth = 2;
for (let x = size; x < width; x += size) {
for (let y = size; y < height - size; y += size) {
const rdn = Math.floor(Math.random() * colors.length);
const direction = Math.random() >= 0.5 ? 1 : -1;
ctx.save();
ctx.translate(x + direction * y / size * Math.random() / 10, y);
ctx.rotate(direction * y / size * Math.random() * 3 * Math.PI / 180);
ctx.fillStyle = colors[rdn];
ctx.fillRect(-size / 2, -size / 2, size, size);
ctx.strokeRect(-size / 2, -size / 2, size, size);
ctx.restore();
}
}
}