Graphic JavaScript


Back to index
EMBEDDED CIRCLES:
Your browser does not support the HTML5 canvas tag.
ASSIGNMENT:

There's more than one way to loop in JavaScript and this applet demonstrates how to use a while loop containing an array. Basically the loop just iterates through the contents of the loop, but a counter variable is required for the loop to work. In this example the variable c functions as the counter variable.

Your job will be to make the following changes to this applet:

  1. Create five smaller circles and position one in the center of the canvas and the other four in the center of each quadrant of the canvas area
  2. Do not allow the circles to touch
  3. Each circle should be five layers deep and no two layers of any of the circles should be the same color
  4. In other words, you will need to define twenty-five colors in your color array