There is another way of interacting with the mouse: inside the draw() function you can use if statements to test the values of several built-in variables that contain information about what the mouse is doing. Here is an example:
Source code: Code for using mouse variables
Notice that the behaviour of this sketch is a bit different from the first sketch. Look at the source code of this example and compare it with the previous one. Now try changing the code to make it do other interesting things.
Show off your work by making a new web page linked from your portfolio.
A student asked how to make graaphics move over a web page without hiding the web page itself. this requires a special function to clear the background of the canvas to transparent. Click here to see an example of how to do this.