In the last article on HTML5 Canvas, we have discussed about the basics and created a simple rectangular shape. In this tutorial, we will create more shapes – rectangles and squares with various styles, lines, triangles and combined shapes. You will recall that creating a rectangle in canvas is pretty simple. We need to provide the origin point of rectangle with X and Y coordinate with respect to the canvas origin and then define the width and height. We can write the arguments of the fillRect method like this: ctx.fillRect(Xstart,Ystart,Width,Height); With fillRect method, we have already drawn a pretty looking…
↧