...

/

Drawing Triangles on the Canvas

Drawing Triangles on the Canvas

When you are working with the canvas element in HTML, you have some built-in functions that help you easily draw common shapes like circles, squares, and lines. Guess what shape you don’t have a built-in function to help you easily draw?

If you guessed any shape other than a triangle, I weep for you. Because there is no built-in triangle function, drawing triangles on the canvas is a bit more involved and error prone than the other shapes:

Access this course and 1400+ top-rated courses and projects.