let canvas = document.querySelector( 'canvas' );
let context = canvas.getContext( '2d' );
canvas.width = 200;
canvas.height = 200;
context.fillStyle = 'red';
context.fillRect( 100, 100, 10, 10 );
let canvas = document.querySelector( 'canvas' );
let context = canvas.getContext( '2d' );
canvas.width = 200;
canvas.height = 200;
context.fillStyle = 'red';
let x = 0;
setInterval( () => {
x = ++x % 200;
context.clearRect( 0, 0, 200, 200 );
context.fillRect( x, 100, 10, 10 );
}, 1000 / 60 );