Question: Begin with the solution to the Gold exercise from Lab 4. Use your own solution f you did that exercise. If not, you can use

 Begin with the solution to the Gold exercise from Lab 4.

Begin with the solution to the Gold exercise from Lab 4. Use your own solution f you did that exercise. If not, you can use the posted solution from the website (available in the Lab Instructions folder Saturday at 12:01 am). That program drew a "rose" such as the one shown on the right, but it used a white line. In this exercise, modify that program so that will draw each "petal" of the rose using a different random colour. . In each frame, determine whether the newly calculated (x,y) point is farther from the centre than the previous one. Use a boolean variable to store this information. That tells you whether the line is moving away from the middle, or toward it. . When should you change the colour? When the line is now moving away from the centre, but it wasn't last time. Use a boolean expression to figure this out. . Now you need a few more state variables to keep more information from the last frame. You will need to know how far away the last point was, and whether it was moving toward the centre, or away from it. One of these new state variables must be a boolean variable. . To pick a random colour you can use stroke (random(255), random(255), random(255) ); The number of lines of code that you will have to add to the old solution will be quite small. But you will have to read, understand, and modify, some existing code, which is always a big part of computer programming

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!