canvas
is an HTML element which can be used to draw graphics. It is an alternative to svg
canvas
element in the html. Give it an id. It creates a fixed-size drawing surface that exposes one or more rendering contexts
fillRect
: to create a filled rectangle. 4 arguments: x
, y
, width
and height
.strokeRect
: to draw just the outlineclearRect
: to clear all the pixel under this rectangle
beginPath()
.moveTo()
.lineTo()
to build as many segments as you need.fill()
, and/or draw the stroke with stroke
arc()
function.x
, y
, radius
, startAngle
and endAngle
.