<canvas width="400" height="200"></canvas>
<br>
<input type = "color">
<script>
var color = document.querySelector("input");
var tela = document.querySelector('canvas');
var pincel = tela.getContext('2d');
pincel.fillStyle = 'lightgray';
pincel.fillRect(0, 0, 400,200);
var indice = 0
function desenhaCirculo(x, y, raio) {
pincel.fillStyle = color.value;
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>