Drawing forms with canvas. Jump to area
Lines
For drawing lines that are straight make use of the lineTo() technique.
lineTo(x, y) Draws a line through the present drawing place towards the place specified by x and y .
This process takes two arguments, y and , that are the coordinates regarding the line’s end point. The point that is starting influenced by formerly drawn paths, where in fact the end point of this past course could be the kick off point for the after, etc. The point that is starting additionally be changed using the moveTo() technique.
The instance below attracts two triangles, one filled plus one outlined.
This starts by calling beginPath() to begin a brand new form course. We then utilize the moveTo() solution to move the point that is starting the required place. Below this, two lines are drawn which will make up two edges regarding the triangle. […]