function drawBall() {
      g.setColor(0.7, 0.7, 0.8).fillCircle(x, y, r-1);
      const gx = -x/sW, gy = -y/sH;
      g.setColor(0.8, 0.8, 0.9).fillCircle(x+gx*r/5, y+gy*r/5, r/2)
        .setColor(0.85, 0.85, 0.95).fillCircle(x+gx*r/4, y+gy*r/4.5, r/2.5)
        .setColor(0.9, 0.9, 1).fillCircle(x+gx*r/3, y+gy*r/3, r/3.5)
        .setColor(1, 1, 1).fillCircle(x+gx*r/3, y+gy*r/3, r/6);
    }
/**
     * Draw the ball, with glare offset depending on ball position
     */
Draw the ball, with glare offset depending on ball position
Draw the ball with glare offset depending on ball position
function drawBall() {
      g.setColor(0.7, 0.7, 0.8).fillCircle(x, y, r-1);
      const gx = -x/sW, gy = -y/sH;
      g.setColor(0.8, 0.8, 0.9).fillCircle(x+gx*r/5, y+gy*r/5, r/2)
        .setColor(0.85, 0.85, 0.95).fillCircle(x+gx*r/4, y+gy*r/4.5, r/2.5)
        .setColor(0.9, 0.9, 1).fillCircle(x+gx*r/3, y+gy*r/3, r/3.5)
        .setColor(1, 1, 1).fillCircle(x+gx*r/3, y+gy*r/3, r/6);
    }
function drawBall ( ) { g . setColor ( 0.7 , 0.7 , 0.8 ) . fillCircle ( x , y , r - 1 ) ; const gx = - x / sW , gy = - y / sH ; g . setColor ( 0.8 , 0.8 , 0.9 ) . fillCircle ( x + gx * r / 5 , y + gy * r / 5 , r / 2 ) . setColor ( 0.85 , 0.85 , 0.95 ) . fillCircle ( x + gx * r / 4 , y + gy * r / 4.5 , r / 2.5 ) . setColor ( 0.9 , 0.9 , 1 ) . fillCircle ( x + gx * r / 3 , y + gy * r / 3 , r / 3.5 ) . setColor ( 1 , 1 , 1 ) . fillCircle ( x + gx * r / 3 , y + gy * r / 3 , r / 6 ) ; }
Draw the ball, with glare offset depending on ball position
Draw the ball with glare offset depending on ball position