Next page | Contents page |

Exercise 3 - draw away!

You should now be able to write a run() function which gets hold of the canvas and its 2d context, enlarges it to fill the screen, fills the whole of it with a background colour and then draws shapes all over it in various colours. Have some fun!

Note that when the end of the run() function is reached the program displays the completed drawing and simply stops. That's the end unless you refresh the page. We will say more about this, and how make things continue, in the next section: event-driven Javascript.
Next page | Contents page |