JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="okno">
</canvas>
JavaScript
var okno = document.getElementById("okno")
var ctx = okno.getContext('2d');
ctx.font = "20px Arial";
var cel = {};
cel.x = 10;
cel.y = 10;
cel.dlug = 25;
cel.szer = 25;
cel.xspeed = 55;
cel.yspeed = 2;
function clear (){
ctx.clearRect(0,0,900,600);
}
function draw (){
clear ();
ctx.fillRect(cel.x,cel.y,cel.dlug,cel.szer);
cel.x += cel.xspeed;
}
setInterval(draw, 300);