<canvas width="600" height="400"> </canvas>
<script>
var colores = ["blue", "red", "green"];
var colorRef = 0;
var pantalla = document.querySelector("canvas");
var pincel = pantalla.getContext("2d");
pincel.fillStyle = "grey";
pincel.fillRect(0,0,600,400);
function dibujarCirculo(x,y,radio) {
pincel.fillStyle = "blue";
pincel.beginPath();
pincel.arc(x,y,radio,0,2*(Math.PI));
pincel.fill();
}
dibujarCirculo(20,20,10);
dibujarCirculo(40,40,20);
/*pantalla.onclick = dibujarCirculo;
function alterarColor() {
colorRef++;
if(colorRef >= colores.length) {
colorRef = 0;
}
return false;
}
pantalla.oncontextmenu = alterarColor;*/
</script>