Draw an oval in html5 canvas - Javascript Canvas

Javascript examples for Canvas:Oval

Description

Draw an oval in html5 canvas

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   ww  w  . j av a2s.c o m
var canvas = document.getElementById("canvas"),
    ctx = canvas.getContext("2d");
ctx.ellipse(100, 100, 10, 15, 0, 0, Math.PI*2);
ctx.fill();
    }

      </script> 
   </head> 
   <body> 
      <canvas id="canvas"></canvas>  
   </body>
</html>

Related Tutorials