HTML5 BASICS: HTML5 Canvas

What Is HMTL Canvas?

HTML <canvas> and <svg> are graphics elements.They use different methods for dwawing.I is a rectangular area which gives an easy drawing method with the help of the element <canvas>.Canvas provides two attributes 'width' and 'height'.

Features Of Canvas


1. Canvas doesn't support event handlers.
2. It is fully interactive.
3. Suited for graphic games and animations.
4. Text resolution capability is very poor.
5. Canvas popularity is grows steadly and rapidly.

How To Draw Lines

Canvas API methods are suitable for drawing lines.Following are the methods for drawing a line.
1.BeginPath(): We start using this method.It instruct the browser,to prepare for draw a new line.
2.moveTo(x,y): It sets the starting point of the line.
3.lineTo(x,y): Set the ending point of the line.
4.Stroke(): This method helps to display the line.

In the same way we can draw text,rectange etc, using different methods.


Related Articles


Jesna N Scaria

Articles : 32

I am a Software Developer at Leedhar Technologies
India India