# <canvas width="600" height="400">
</canvas>
<script>
var pantalla = document.querySelector("canvas");
var pincel = pantalla.getContext("2d");
var i = 0;
var colores = ["blue", "red", "green"]
pincel.fillStyle = "grey";
pincel.fillRect(0,0,600,400);
function dibujarCirculo(evento){
var x = evento.pageX - pantalla.offsetLeft;
var y = evento.pageY - pantalla.offsetTop;
pincel.fillStyle = color[i];
pincel.beginPath();
pincel.arc(x,y,10,0,2*3.14);
pincel.fill();
console.log(x + "," + y);
}
pantalla.onclick = dibujarCirculo;
function alterarColor() {
if(i==0){
i==1;
return i;
} if(i==1){
i==2;
return i;
} if(i==2){
i==0;
return i;
}
return false;
}
pantalla.oncontextmenu = alterarColor;
</script>