<canvas width="400" height="200"></canvas>
<script>
var tela = document.querySelector('canvas');
var pincel = tela.getContext('2d');
pincel.fillStyle = 'lightgray';
pincel.fillRect(0, 0, 400,200);
var cor = ["blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange","blue","red","yellow","orange"]
var indice = 0
function desenhaCirculo(x, y, raio) {
pincel.fillStyle = cor[indice];
pincel.beginPath();
pincel.arc(x, y, raio, 0, 2 * Math.PI);
pincel.fill();
}
function limpaTela() {
pincel.clearRect(0, 0, 400, 200);
}
var y = 0
var x = 0;
function atualizaTela() {
desenhaCirculo(x, y, 10);
y++;
if(y == 200 ){
y = 0 ;
x = x + 10;
indice++
}
if(x == 400 ){
x = 20
}
}
setInterval(atualizaTela, 0,1);
</script>