fbpx

Html5 canvas element

A new element has introduced in html5 – <canvas>.
It specifies a rectangular area and used to draw graphic shapes, on the fly with the help of scripting.
<canvas> has respective methods for drawing paths, boxes, circles, characters, and also for adding images.

For example: To add a border, use the style attribute:

<canvas id=”myCanvas” width=”200″ height=”100″
style=”border:1px solid #000000;”>
</canvas>

<canvas id=”myCanvas” width=”200″ height=”100″ style=”border:1px solid #d3d3d3;”>
Check your browser whether it support HTML5 or not.</canvas>

<script>

var c=document.getElementById(“myCanvas”);
var ctx=c.getContext(“2d”);
ctx.beginPath();
ctx.arc(95,50,40,0,2*Math.PI);
ctx.stroke();

</script>

 

Related Posts

Leave a comment

Contact Us Now
close slider