$29
You will create an interactive program that will draw a specific pattern of circles inside of circles. You will draw one large circle that exactly touches the four sides of a square drawing window. Inside this circle will be three smaller circles. Each of these three smaller circles will exactly touch the edge of the larger circle. Each of the three smaller circles will be spaced evenly along the edge of the larger circle, so that the three circles are each 1/3 of the way around the edge of the large circle from each of the others. That is, the centers of the three smaller circles form an equilateral triangle.
The positions of the smaller circles will be controlled by the horizontal mouse (cursor) position. When the mouse is at the left edge of the window, one of the three smaller circles should be positioned at the top of the larger circle. As your mouse moves to the right, all three circles should rotate clockwise. When the mouse has moved all the way across the screen, each smaller circle should have travelled around the edge of the larger circle exactly one time.
The sizes of the smaller circles will be controlled by the vertical mouse position. When the mouse is at the bottom of the screen, the smaller circles should have radius zero. When the mouse is at the top of the screen, the radius of the smaller circles should be 0.7 times the radius of the large circle. The smaller circle’s radius will vary smoothly from zero to 0.7 of the larger circle as you move the cursor from bottom to top.
Inside of the three circles will be three smaller circles, and three more circles will be inside each of these, and so on. Each of these sets of nested circles should have their positions and their relative sizes be guided by the mouse position, just like the largest set of circles.
Your pattern should have at least six different sizes of circles, from the largest to the smallest. Even though you will be drawing many, many circles, your code should include very few calls to the ellipse() function to draw those circles. If you find yourself using many calls to the ellipse function, you are not approaching the problem correctly.
To add more variety to the images that you draw, add some kind of color variation to your circles. You may choose colors based on the positions of the circles, based on how “deep” they are in the pattern, based on their angle, or anything other scheme of your own choosing.