JSFiddle - React, Tailwind, and code Playground

by totoromaum

HTML

<!DOCTYPE html>
<html>

  <head>
    <title>Canvas</title>
  </head>

  <body>
    <canvas id="canvas" width="200" height="200"></canvas>
    <script>
      var canvas = document.getElementById("canvas");
      var ctx = canvas.getContext("2d");
      var size = 0;
      setInterval(function() {
        ctx.clearRect(0, 0, 200, 200);
        ctx.fillRect(0, 0, size, size);
        size++;
        if (size > 200) {
          size = 0;
        }
      }, 30);

    </script>

  </body>

</html>