Thursday, January 31, 2008

Assignment #2










void setup() {

size (800,400);

}

void draw (){
strokeWeight(.5);


fill(.5* mouseX, .5* mouseY, mouseX,25);

ellipse (mouseX, mouseY, .5* mouseX +10, .5* mouseY + 10);



if (mousePressed == true){

background(mouseX, mouseY,.5*mouseX); }

}


void keyPressed (){

if(key=='s'){ saveFrame("testimage-####.jpg");
}

}

Friday, January 25, 2008

assignment #1





size(600,600); //size of the canvas
background(200); //light gray background color

strokeWeight(3); //weight of the stroke
smooth(); //creates smoother lines

stroke(135,0,100); //color of the stroke
fill(135,0,100,20); //fill color and transparency


ellipse (400,100,200,200);
ellipse (500,200,200,200);
ellipse (400,300,200,200);
ellipse (500,400,200,200);
ellipse (200,100,200,200);
ellipse (100,0,200,200);
ellipse (500,0,200,200);
ellipse (300,0,200,200);
ellipse (600,300,200,200);
ellipse (300,200,200,200);
ellipse (600,100,200,200);
ellipse (600,500,200,200);

/* the previous ellipse commands form a pattern of overlapping circles that gain opacity when overlapped. the ellipse command forms a circle when the height and width are the same. */


stroke(0,135,100); //color of the stroke
fill(0,135,100,50); //fill color and transparency

int xvalue = 45; // setting up variables to easily change
int yvalue = 60; // the x and y translations

int a = -250; // sets triangle point x1
int b = -150; // sets triangle point y1
int c = -300; // sets triangle point x2
int d = -50; // sets triangle point y2
int e = 200; // sets triangle point x3
int f = 50; // sets triangle point y3

triangle(a,b,c,d,e,f);

translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);
translate (xvalue, yvalue);triangle(a,b,c,d,e,f);


/* the previous code repeats the same triangle and translates the x and y values by a given amount
*/