Friday, February 22, 2008

Week 6


































































float x = 300;
float y = 400;
float angle1 = 0.0;
float angle2 = 0.0;
float segLength = 8;
void setup()
{
size(1000, 800);
smooth();
strokeWeight(10.0);
}
void draw()
{
background(215);
angle1 = (mouseX/float(width) - 0.7) *PI;
angle2 = (mouseY/float(height) - 0.4) *-.25*PI;

pushMatrix();
segment(x, y, angle1);
stroke(0, 200);
segment(segLength, 12, angle2);
stroke(0, 180);
segment(segLength+5, 12, angle1);
stroke(0, 160);
segment(segLength+10, 16, angle1);
stroke(0, 140);
segment(segLength+13, 20, angle1);
stroke(0, 120);
segment(segLength+20, 24, angle1);
stroke(0, 100);
segment(segLength+25, 28, angle1);
stroke(0, 80);
segment(segLength+30, 32, angle1);
stroke(0, 60);
segment(segLength+30, 36, angle1);
stroke(0, 40);
segment(segLength+30, 36, angle1);
stroke(0, 20);
segment(segLength+30, 36, angle1);
stroke(0, 40);
segment(segLength+30, 36, angle1);
stroke(0, 60);
segment(segLength+30, 36, angle1);
stroke(0, 80);
segment(segLength+30, 36, angle1);
stroke(0, 100);
segment(segLength+30, 36, angle1);
stroke(0, 120);
segment(segLength+30, 36, angle2);
stroke(0, 140);
segment(segLength+30, 36, angle2);
stroke(0, 160);
segment(segLength+30, 36, angle2);
stroke(0, 180);
segment(segLength+30, 40, angle2);
stroke(0, 200);
segment(segLength+30, 40, angle2);
stroke(0, 220);
popMatrix();
}
void segment(float x, float y, float a) {
translate(x, y);
rotate(a);
line(0, 0, segLength, 0);
}

Friday, February 15, 2008

Colors changes randomly in the triangular bottom



















int r,g,b;
float x, y;
int i=0;
void setup()
{
size(600,600);
background(0,0,0);
//center
x = width/2;
y = height/2;
i=0;
r=0;
g=0;
b=0;
frameRate(60);
smooth();
}
void draw(){
//loop through and draw a triangles
background(0,0,0);
translate(x, y);
//i++;
r=(int)random(255);
g=(int)random(255);
b=(int)random(255);
color c = color(r, g, b);
fill(c);
//rotate(i);
beginShape(POLYGON);
vertex(0, -100);
vertex(-100, 100);
vertex(100, 100);
endShape();
}