Step 1:
float x = 0; float y = 0; float c = 0; float a = 0; float b = 0; void setup() { size(800, 800); background(188, 245, 244); } void draw(){ pattern(400,400,247,236,17); } void pattern(float x , float y, float a , float b , float c ){ stroke(255); strokeWeight(4); fill (a,b,c); triangle(x, y, x+100, y, x+50, y-100); stroke(255); strokeWeight(4); line(x, y, x+20, y+20); stroke(255); strokeWeight(4); line(x+50, y-100, x+70, y-80); stroke(255); strokeWeight(4); fill (a,b,c+100); triangle(x+20, y+20, x+120, y, x+70, y-80); }
Question 1:
In your own words, please explain the difference between having your for loop from Step 2 in setup()
as opposed to in draw()
.
Answer:
When the for loop is in setup()
, it’s contents will repeat a limited amount of times- only as long as certain conditions are met. If it is placed in draw()
, it can go on indefinitely.
Question 2:
What is the benefit of using arrays? How might you use arrays in a potential project?
Answer:
Arrays allow objects in code to be described efficiently. We can use Arrays in Processing to construct shapes, for example
I was only able to complete the first step during recitation. I will attempt the remaining steps on my own time.