JSFiddle - React, Tailwind, and code Playground

by asemahle

HTML

<canvas id="c" width="2000px" height="2000px"></canvas>

JavaScript

let canvas = document.getElementById('c');
let ctx = canvas.getContext('2d');

function getRandomColor() {
  var letters = '0123456789ABCDEF';
  var color = '#';
  for (var i = 0; i < 6; i++) {
    color += letters[Math.floor(Math.random() * 16)];
  }
  return color;
}

l = () => {
	ctx.fillStyle = getRandomColor();
  ctx.fillRect(0,0,canvas.width,canvas.height);
  window.requestAnimationFrame(l);
}
window.requestAnimationFrame(l);