JSFiddle - React, Tailwind, and code Playground
HTML
<canvas width=800 height=500></canvas>
JavaScript
var canvas = document.querySelector('canvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle='black';
ctx.fillRect(0,0,canvas.width,canvas.height);
setInterval(function () {
for (var i = 10; i--;) {
ctx.fillStyle='green';
ctx.fillRect(
Math.floor(Math.random() * (canvas.width - 5)),
Math.floor(Math.random() * (canvas.height - 10)),
5, 10
);
}
ctx.fillStyle='rgba(0,0,0,0.2)';
ctx.fillRect(0,0,canvas.width,canvas.height);
}, 50);