Graphic JavaScript


Back to index
Moving an Object

Your browser does not support the HTML5 canvas tag.

ASSIGNMENT:

Click on the canvas area several times to discover what behavior is produced by clicking. Inspect the code carefully. Be able to answer these questions:

  1. What are the maximum and minimum values of loc?
  2. What are the possible values of d?
  3. Why doesn't the circle move vertically?
  4. What would it take to make the circle move vertically?
Change the behavior of this applet so that two small squares move diagonally from corner to corner. One will move from upper-left to lower-right and he other from lower-left to upper-right. Make each small square a different color.