Web by the end of this article, you will have learned how to draw rectangles, triangles, lines, arcs and curves, providing familiarity with some of the basic shapes.
How to draw triangle in html canvas. Working with paths is essential when drawing objects onto the canvas and we will see. The beginpath () method starts a new path. It does not draw anything, it just defines a new path.
The moveto () defines the starting point of the line.