HTML and CSS Reference
Step 3: Detect and record mouse movement
Next, record the mouse movement. The function in the following listing will add an event
listener to the <canvas> element, which updates the wilson object when mouse move-
ment is detected. Add this code directly after the wilson object you added in listing I.18 .