HTML and CSS Reference
In-Depth Information
Figure I.9. We have a Wilson following our mouse pointer! Debugging information displays in the background
showing the values of important variables.
The process for creating this test bed is as follows:
• Step 1: Create a basic page with a <canvas> element.
• Step 2: Create a function that draws an image at a particular position on the canvas.
• Step 3: Detect and record mouse movement.
• Step 4: Update the position of the image each time the animation is updated.
Step 1: Create a basic page with a canvas element
To start, you need a simple HTML5 document like the one shown in figure I.10 .
Search WWH ::

Custom Search