JSFiddle - React, Tailwind, and code Playground
by Giorgio Malvone
HTML
<canvas id="c"></canvas>
CSS
body { background: -webkit-canvas(squares); }
JavaScript
var canvas = document.getElementById("c");
var width = 400;
var height = 400;
canvas.width = width;
canvas.height = height;
var ctx = document.getCSSCanvasContext("2d", "squares", 400, 400);
function draw(){
for(j = 0; j < 10; j++){
for(i = 0; i < 10; i++){
ctx.fillStyle = "rgb(" + Math.floor(Math.random() * 255) + "," + Math.floor(Math.random() * 255) + "," + Math.floor(Math.random() * 255) + ")";
ctx.fillRect(40*i,40*j,40,40);
}
}
requestAnimationFrame(draw);
}
draw();