The <canvas>
element is a drawable region where you can render graphics with JavaScript — shapes, text, images, animations, even games!
fillRect(x, y, width, height)
draws a solid rectangle.
arc(x, y, radius, startAngle, endAngle)
is how you draw circles.
moveTo(x, y)
to set starting point, then lineTo(x, y)
to draw.
getContext('2d')
.beginPath()
before drawing new shapes to reset path.fillStyle
and strokeStyle
change color fills and strokes.requestAnimationFrame()
.