HTML and CSS Reference
MAKING YOUR SHAPES
The canvas is a non-retained painting surface. That
means that the canvas doesn't keep track of what draw-
ing operations you've performed. Instead, it just keeps
the final result—the grid of colored pixels that makes up
For example, if you draw a red square in the middle of
your canvas, the moment you call stroke() or fill(), that
square becomes nothing more than a block of red pixels.
It may look like a square, but the canvas has no memory
of its squareness.
This model makes drawing fast. However, it also makes
life difficult if you want to add interactivity to your draw-