TLDR;
Here is the Codepen;
Prerequisites
- Basic understanding of the Canvas API supported on all modern browsers.
- Javascript
- HTML
Let's code
Create a canvas element in your HTML file or panel if using an online editor.
Create or open a javascript panel so we can draw our triangle
Left comments on each line that describes what each line does but for some further reading checkout this MDN documentation
