JSFiddle - React, Tailwind, and code Playground

by unsign3d

HTML

<canvas id="box" width="200" height="200"></canvas>

JavaScript

var box = document.getElementById('box');
var ctx = getContext('2d');
var color = 0;

setInterval(draw, 500);

function draw()
{
    if (color == 0xFFFFFF) color = 0;
     else
         color += 20;
    
    ctx.fillStyle = '#' + color;
    ctx.fillRect(0, 0, 200, 200);
    
}