JSFiddle - React, Tailwind, and code Playground

HTML

<div id=cv></div>

JavaScript

let
	cv = document.createElement('canvas')
  rect_max_size_x = 50,
  cv_size_x = 1000,
  cv_size_y = 572;

cv.width = cv_size_x;
cv.height = cv_size_y;
let ctx = cv.getContext('2d');

document.getElementById('cv').appendChild(cv);

let
	rect_count = 5000,
  rect_pos_x = [],
  rect_pos_y = [],
  rect_size_x = [],
  rect_size_y = [],
  rect_speed = [];

for (let i = 0; i < rect_count; i++)
{
  rect_pos_x[i] = Math.random() * cv_size_x;
  rect_pos_y[i] = Math.random() * cv_size_y;
  rect_size_x[i] = 5 + Math.random() * 45;
  rect_size_y[i] = 5 + Math.random() * 45;
  rect_speed[i] = 0.1 + Math.random() * 2.9;
}


function update()
{
	cv.width = cv_size_x;
	ctx.fillStyle = "hsl(0,0%,100%)";
	ctx.strokeStyle = "hsl(0,0%,0%)";
  for (let i = 0; i < rect_count; i++)
  {
  	rect_pos_x[i] += rect_speed[i];
    if (rect_pos_x[i] >= cv_size_x)
    {
    	rect_pos_x[i] -= cv_size_x + rect_max_size_x;
    }
		ctx.fillRect (rect_pos_x[i], rect_pos_y[i], rect_size_x[i], rect_size_y[i]);
		ctx.strokeRect (rect_pos_x[i], rect_pos_y[i], rect_size_x[i], rect_size_y[i]);
  }
	requestAnimationFrame(update);
}

requestAnimationFrame(update);