HTML Canvas
The <canvas> element is a blank drawing area. You draw on it using JavaScript. It is used for games, data visualisations, animations, and image editing.
How It Works
- Add a
<canvas>element with a width and height - Get the 2D rendering context with JavaScript
- Call drawing methods on the context
Common Drawing Methods
fillRect(x, y, w, h)— Filled rectanglestrokeRect(x, y, w, h)— Rectangle outlinefillText(text, x, y)— TextbeginPath()/arc()/fill()— Circles