JSFiddle - React, Tailwind, and code Playground

by hugoruscitti

HTML

<canvas id='canvas' width=300 height=300>

JavaScript

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

var x = 0;
var y = 0;

function dibujar() {
    c.fillStyle='rgba(255, 255, 255, 0.2)';
    c.fillRect(0, 0, 300, 300);
    
    c.fillStyle = 'blue'
    x +=4;
    y += 4;
    c.fillRect(x, y, 50, 50);
}

setInterval(dibujar, 30);