Draw arc on HTML5 Canvas and fill rectangle - Javascript Canvas

Javascript examples for Canvas:Arc

Description

Draw arc on HTML5 Canvas and fill rectangle

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from  w  w w.  j  av  a  2 s .co m*/
var ctx = canvas.getContext('2d');
ctx.arc(250, 250, 220, 0, 2*Math.PI);
ctx.clip();
ctx.fillRect(0,0,500,500);
    }

      </script> 
   </head> 
   <body> 
      <canvas id="canvas" width="500" height="500"></canvas>  
   </body>
</html>

Related Tutorials