Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Resolução (O bolão que deseja emagrecer!)

A solução contendo a mudança de cores, crescimento com SHIFT e decrescimento com o ALT. Encontra-se abaixo:

1 resposta
solução!
<meta charset="UTF-8">

<canvas width="600" height="400"></canvas>

<script> 

    var tela = document.querySelector("canvas");
    var pincel = tela.getContext("2d");

    var raioNormal = 10;

    var coresDisponiveis = ['blue', 'red', 'green'];
    var indiceCor = 0;

    pincel.fillStyle = "gray";
    pincel.fillRect(0,0, 600, 400);

    function mudaCor(){
        indiceCor++
        if (indiceCor >= coresDisponiveis.length) {
            indiceCor = 0;
        }
        return false;        
    }

    tela.oncontextmenu = mudaCor;

    function exibeCirculos(evento) {

        var x = evento.pageX - tela.offsetLeft; //Ajustar as coordenadas;
        var y = evento.pageY - tela.offsetTop; //Ajustar as coordenadas;        

        if (evento.shiftKey){
            raioNormal += 10;
            if (raioNormal > 40) {
                raioNormal = 40;
            }
        }

        if (evento.altKey){
            raioNormal -= 5;
            if (raioNormal < 10) {
                raioNormal = 10;
            }        
        }

        pincel.fillStyle = coresDisponiveis[indiceCor];
        pincel.beginPath();
        pincel.arc(x, y, raioNormal, 0, 3.14*2);
        pincel.fill();
    }

    tela.onclick = exibeCirculos;

</script>