Recitation 5: Processing Basics

Initially, I want to draw a face of a man. But on the piece of paper given, I realized that no matter how I draw, it would be too hard to find the exact coordinates corresponding to each dot that I used. Thus, I decided to make something that went more randomly, to say, grass. 

This was the graph that I wanna draw, but then I realized that it was kind of hard to draw because of all those lines and shapes of grass. So I wanted it automatically done. Thus, I made the following. 

The code is here. 

void setup() {
size(800,800);
strokeWeight(10);
background(255);
}
void draw() {

fill(0,200,100);
beginShape();
vertex(0,700);
vertex(100,80);
vertex(200,400);
vertex(300,80);
vertex(400,500);
vertex(500,80);
vertex(600,400);
vertex(700,80);
vertex(800,700);
endShape();
color(100,100,100,100);
fill(0,200,150);
for (int i = 0; i < 40; i+=10) {
bezier(
width/2, height,
width/2, random(height),
random(width), random(height),
random(width), random(height)
);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *