JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="ctxt" width="500" height="500"></canvas>

JavaScript

var cvas = document.getElementById("ctxt");
var cx = cvas.getContext("2d");

function randomColor(num) {
    return Math.floor(Math.random() * num);
}

setInterval(function() {
    cx.fillStyle = "rgba(255,255,255,0.02)"
    cx.fillRect(0, 0, 500, 500);
}, 1000/60);
       
setInterval(function() {
    var r = randomColor(255);
    var g = randomColor(255);
    var b = randomColor(255);
    cx.fillStyle = "rgba(" + r + "," + g + "," + b + ",1.0)";
    cx.fillRect(200*Math.random(), 200*Math.random(), 300*Math.random(), 300*Math.random());
}, 1000/5);