Canvas
Basics
To start, we need to set the context of the canvas.
Usually we will select the element in JS and then:
const ctx = myCanvas.getContext('2d')
Now, everything we do will be methods applied on ctx
. For example ctx.fillStyle
, ctx.fillRect()
.