Graphic JavaScript


Back to index
Stale Donuts

Your browser does not support the HTML5 canvas tag.

ASSIGNMENT:

Blue donuts represent stale donuts in this applet. Click several times on the applet area and observe what happens. Note that although the stale donuts accumulate on most of the applet area, if you click on the numbered area at the bottom right of the canvas, the donuts disappear after a couple clicks. Why is this? Being able to answer this question is essential to solving the problem posed in this assignment.

Your job is to alter this applet so that only the most recent donut (blue) and the current donut (yellow) are displayed. All other donuts must disappear. You may not erase the full applet area, but you can erase a small area corresponding to a single donut.