In this sketch we put together a minimal example of drawing with the canvas
API, adding the barest functionality of a simple paint program. You can find a screencast developing the sketch here.
Modify the code so that:
- …each time you click down and then up, the pen color changes
- …when you click a button on screen, a triangle is inserted into the canvas
- …you have a small palette of colored
div
s which you can click on to select the color of the pen.
- Our screencast of the sketch's development.
- MDN's introduction to drawing with
canvas
along with their tutorial. - Dive Into HTML5's treatment of
canvas
- This short video introduction to
canvas