As well as the three techniques we saw in Drawing rectangles, which draw rectangular forms straight to the canvas, there is also the rect() technique, which adds a rectangular road to a path that is currently open.
rect(x, y, width, height) attracts a rectangle whose corner that is top-left specified by ( x , y ) using the specified width and height .
Before this process is performed, the moveTo() technique is immediately called with all the parameters (x,y). The current pen position is automatically reset to the default coordinates in other words.
Up to now, each instance with this web page has utilized just one form of path function per form. Nevertheless, there isn’t any limitation towards the true quantity or forms of paths you should use to produce a form. Read more