title: How can I add an image inside a circle in canvas?
body: <p>I want to insert this image</p>
  
  <pre><code>var img=new Image();
  img.src="https://dl.dropboxusercontent.com/u/139992952/stackoverflow/desert1.jpg";
  </code></pre>
  
  <p>Into the circle, that I'm drawing with this function</p>
  
  <pre><code>function drawBall() {
      //ctx.globalCompositeOperation='destination-in';
      ctx.beginPath();
      ctx.arc(x, y, ballRadius, 0, Math.PI*2);
      ctx.drawImage(img,10,20);
      ctx.globalCompositeOperation='source-over';
      ctx.fillStyle = "#0095DD";
      ctx.fill();
      ctx.closePath();
  }
  </code></pre>
  
  <p>Here's what the canvas currently looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/7OlQr.png" rel="nofollow"><img src="https://i.stack.imgur.com/7OlQr.png" alt="exemplary rendering"></a></p>