skip to main |
skip to sidebar

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
}
}

Spot [] sp= new Spot [100];
void setup(){
size (500,500);
smooth();
noStroke();
for(int i=0; i<50;>
sp[i] = new Spot(random(width),random(height),random(5,75), color(int(random(170)),150,110) ); //construct the object
}
}
void draw(){
//background(0);
fill(70,20);
rect (0,0,width, height); //leaves a "residue" when the lines moves
for(int i=0; i<50;>
sp[i].display();
sp[i].update();
for(int j=0; j<50;>
sp[i].drawLines(sp[i].x, sp[i].y, sp[j].x, sp[j].y);
}
}
}
class Spot{ //declaring a new class named spot
float x, y; //the x- and y-coordinate
float diameter; //diameter of the circle
color fColor;
boolean goingRight=true; //setting up local variables for class
//constructor so that the beginning spot at top doesn't need
//the excessive variables listed - it gets information from here.
Spot(float xpos, float ypos, float dia, color fillColor){
x=xpos;
y=ypos;
diameter=dia;
fColor=fillColor;
}
//sets up the connector lines to attract to the circles
void drawLines(float x1, float y1, float x2, float y2){
float distance=dist(x1,y1,x2,y2);
if(distance<120){
strokeWeight(.10);
stroke(255);
line(x1,y1,x2,y2);
}
}
void update(){ //causing bubbles to bounce back and forth at edges
if(x<0){
goingRight=true;
}
if(goingRight==true){
x=x+.5;
}
if(x>width){
goingRight=false;
}
if(goingRight==false){
x=x-.8;
}
}
void display(){ //causing bubbles to move across the screen
fill(fColor); //changes colors of dots
ellipse (x,y,diameter,diameter);
}
}
void keyPressed(){
if (key=='s'){
saveFrame("week3-####.jpg"); //saves the image in documents
}
}

Spot [] sp= new Spot [100];
void setup(){
size (500,500);
smooth();
noStroke();
for(int i=0; i<50; i="0;" goingright="true;" x="xpos;" y="ypos;" diameter="dia;" fcolor="fillColor;" goingright="true;" goingright="="true){" x="x+.5;">width){
goingRight=false;
}
if(goingRight==false){
x=x-.8;
}
}
void display(){ //causing bubbles to move across the screen
fill(fColor); //changes colors of dots
ellipse (x,y,diameter,diameter);
}
}
void keyPressed(){
if (key=='s'){
saveFrame("week3-####.jpg"); //saves the image in documents
}
}


Spot [] sp= new Spot [100];
void setup(){
size (500,900);
smooth();
noStroke();
for(int i=0; i<50; i++){
sp[i] = new Spot(random(width),random(height),random(10,50), color(int(random(255)),0,0) ); //construct the object
}
}
void draw(){
background(0);
for(int i=0; i<50; i++){
sp[i].display();
}
}
class Spot{ //declaring a new class named spot
float x, y; //the x- and y-coordinate
float diameter; //diameter of the circle
color fColor;
//constructor so that the beginning spot at top doesn't need
//the excessive variables listed - it gets information from here.
Spot(float xpos, float ypos, float dia, color fillColor){
x=xpos;
y=ypos;
diameter=dia;
fColor=fillColor;
}
void display(){
fill(fColor); //changes colors of dots
ellipse (x,y,random(diameter),random(diameter));
}
}
void keyPressed(){
if (key=='s'){
saveFrame("week3-####.jpg"); //saves the image in documents
}
}