Homework 1.2 part 2 – 2/5/13

//Jad Atoui. Prof: Calli Higgins . Due 2/5/13 . Assignment 1.2 part 2
size(400,400);// sets the size of the window
noStroke();//shape has no outline
fill(255,0,0);//set red color
rect(0,0,200,200);//insert first rectangle
fill(0,255,0);//insert green color
rect(200,0,200,200);//insert second rectangle
fill(0,0,255);//insert blue color
rect(0,200,200,200);//insert third rectangle
fill(144,143,143);//grey color
rect(200,200,200,200);//insert fourth rect
strokeWeight(4);//thickness of the line around the circle
stroke(0);//black line around the circle
fill(255,255,255,210);//transparent circle
ellipse(200,200,100,100);//insert circle

// Assignment 1.2 part 3

float a = 0.0;
float inc = TWO_PI/50;
float prev_x = 0, prev_y = 300, x, y;
size(800, 600);
background(0);

stroke(255);
for(int i=0; i<800; i=i+4) {
x = i;
y = 300 + sin(a) * 80.0 + random(4);
line(prev_x, prev_y, x, y);
prev_x = x;
prev_y = y;
a = a + inc;
}

color red = color(255,0,0);
stroke(red);
prev_x = 0;
prev_y = 300;
for(int i=0; i<800; i=i+4) {
x = i;
y = 300 + cos(a) * 80.0 + random(random(2));
line(prev_x, prev_y, x, y);
prev_x = x;
prev_y = y;
a = a + inc;
}

stroke(150);
fill(255);
ellipse(200,100 , 75, 75);
fill(0);
ellipse(200,100, 25, 25);

stroke(150);
fill(255);
ellipse(600,100 , 75, 75);
fill(0);
ellipse(600,100, 25, 25);

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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