

Students [] stu = new Students [16];
void setup(){
size(screen.width,screen.height); //full screen
//for(int i=0;i<15;i++){
//stu[i]=new Students();
//}
stu[0]=new Students(60,57,1,100,0,0);
stu[1]=new Students(58,45,2,150,0,1); //me!
stu[2]=new Students(60,42,3,100,0,1);
stu[3]=new Students(57,40,4,200,0,1);
stu[4]=new Students(58,70,1,100,0,0);
stu[5]=new Students(61,92,3,800,0,0);
stu[6]=new Students(62,91,PI,400,0,0);
stu[7]=new Students(55,40,5,200,0,0);
stu[8]=new Students(59,100,random(1,10),100,0,0);
stu[9]=new Students(54,20,1,1,0,1);
stu[10]=new Students(59,50,2.5,500,0,0);
stu[11]=new Students(54,20,PI,200,0,1);
stu[12]=new Students(58,60,3,250,0,0);
stu[13]=new Students(54,48,3,300,0,1);
stu[14]=new Students(10,101,PI/2,200,0,0);
stu[15]=new Students(59,40,PI,100,0,0);
for(int i=0;i<16;i++){
stu[i].x=map(i,0,16,0,width);
//stu[i].x=i*30;
}
}
void draw(){
fill(255,20);
rect(0,0,width,height);
for(int i=0;i<16;i++){
stu[i].appearance();
stu[i].performance(mouseY);
}
}
class Students{
float sHeight;
float sWeight;
float sIntel;
float sSexiness;
float x;
float sex;
float jiggle;
//constructor, takes values you send to class
//when you are constructing them.. feeds variables
Students (float h, float w, float i, float ss, float x, float s){
sHeight=h;
sWeight=w;
sIntel=i;
sSexiness=ss;
x=x;
sex=s;
}
void appearance(){
pushMatrix();
translate(x,height/2-sIntel);
rotate(sSexiness*sIntel+jiggle);
fill(sSexiness,50);
rect(0,0,sWeight,sHeight);
popMatrix();
}
void performance(float jig){
//rotate rectangle
jiggle=random(radians(1),radians(jig));
//change transparency
}
}
void keyPressed(){
if (key=='s'){
saveFrame("week3-####.jpg"); //saves the image in documents
}
}
No comments:
Post a Comment