Question: I need the answer to Exercise 6-5. Example 6-8. Lines one at a time int y void setup) No for loop here. Instead, a global
I need the answer to Exercise 6-5.
Example 6-8. Lines one at a time int y void setup) No for loop here. Instead, a global variable size (200, 200); background (255); frameRate (5); Slowing down the frame rate to easily see the effect. void draw) // Draw a line stroke (0); Line (0, y, width, y); // Increment y y+10 Only one line is drawn each time through draw). The logic of this sketch is identical to Example 4-3, this book's first motion sketch with variables. Instead of moving a circle across the window horizontally, I am moving a line vertically (but not clearing the background for each frame) Exercise 6-5. It's possible to achieve the effect ofrendering one line at a time usinga for loop. See ifyou canfgure out how this is done. Part of the code is below. int endY void setup) size (200, 200); frameRate (5) void draw) background (0); for (inty stroke (255) Line (0, y, width, y)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
