Monday, September 21, 2009

HW2-Repetition

HW02-1

(a)






(b)






HW02-2




HW02-3


In the fist exercise, I've learned how to use loop function to generate 100 rectangles with random colors, positions, and sizes. In the beginning, I thought that it must be a tough task to command each rectangle with random conditions. Afterward I finally figured out how to collocate random() function with rect() and fill() functions which we have known from last week lecture. I found that random() function is really useful while creating any graphs in random way.


The second one, I think the chanllage is to generate random rectangles in evey second which means the pitcure will rechange constantly. I think it's interesting and it seems like a flash. Even though I have no idea about how to make it change in every second. Then, I found the frameRate() syntax which can order this mission. Another one that really drew my attention is setup() and draw() function. In order to declare frameRate() syntax, I need a setup() function to define this condition. In the end, I also can use draw() to define the generation of rectangles which have been completed in the previous exercise.


About the third one, what I have learned is to use two for loops creating diverse pictures. Nesting for loops can be appllied in color, size, and position. It's really a practical syntax that can make program more concise.


The last one, all I have to do is to find out the coordinate of the center of the circle. So that I can define two values x and y which represent x axis and y axis. Then, I can declare the values of x and y condition in the for loops functions. In addition, I used setup() to define background color and the size of picture. I also used draw() to declare for loops functions, fill(), and ellipse(). Finally, I used paint tool to find the specific vaules of RGB for the colors of background and three circles. In that way, I can simulate the picture completely. All I have learned is using for loops function. It really helps a lot in simulating pictures.

























No comments:

Post a Comment