Displaying Our Triangle
Let’s start easy by first drawing our triangle. The way we are going to do that is by defining a function called drawTriangle
that draws a triangle at a fixed position in our canvas
.
Using our usual example where we have a canvas
element defined with an id
value of myCanvas, ensure the contents of your script
tag look as follows:
Get hands-on with 1400+ tech skills courses.