final submission

int count=0;//scene controller
float c;
float t;
float k;

int i;//water surface

float offset;//fire wave offset

int xp;//clouds’ x position
int yp;//clouds’ y position

int xa;//x position of air ball
int ya;//y position of air ball
float xw;//x position of water ball
float yw;//y position of water ball
float xf;//x position of fire ball
float yf;//y position of fire ball
int xe;//x position of earth ball
int ye;//y position of earth ball

int armX;//human arm x position
int armY;//human arm y position

void setup(){
  size(1000,600);//set window size
  smooth();
  noStroke();
  frameRate(10);//set frame rate
  //set initial value of some variables
  c=0.0;
  t=0.03;
  k=0.3;
 
  xp=0;
  yp=200;
 
  xa=200;
  ya=200;
  xw=400;
  yw=100;
  xf=600;
  yf=100;
  xe=800;
  ye=200;
 
  armX=550;
  armY=480;
}


void draw(){
  if(count==0){introduction();}//say something about this program
  if(count==1){mainmenu();}//main menu of this program
  if(count==1&&mouseX>120&&mouseX<280&&mouseY>120&&mouseY<280){air();}//show air element
  if(count==1&&mouseX>320&&mouseX<480&&mouseY>20&&mouseY<180){water();}//show water element
  if(count==1&&mouseX>520&&mouseX<680&&mouseY>20&&mouseY<180){fire();}//show fire element
  if(count==1&&mouseX>720&&mouseX<880&&mouseY>120&&mouseY<280){earth();}//show earth elemet
  if(count==2){change();}//elements gathering
  if(count==3){shinning();}//becoming a shinning ball
  if(count==4){human();}//create a human
  if(count==5){end();}//end of the program
  if(count==6){exit();}

     
void introduction(){
  background(0);
  fill(255);
  textSize(30);
  text(“According to the mysterious Greek mythology,”,0,100);
  text(“there are four basic elements which constitute the world and “,0,150);
  text(“human beings.”,0,200);
  text(“Now, let’s see them closer.”,0,250);
  textSize(20);
  text(“please click your left mouse button to continue”,0,550);
}

void mainmenu(){
  //background and initial states
  background(0);
  noStroke();
  textSize(20);
  //”Air” circle
  fill(255);
  ellipse(200,200,80,80);
  fill(59,224,255);
  text(“Air”,187,205);
  //”Water” circle
  fill(109,250,242);
  ellipse(400,100,80,80);
  fill(255);
  text(“Water”,377,105);
  //”Fire” circle
  fill(250,87,33);
  ellipse(600,100,80,80);
  fill(254,255,41);
  text(“Fire”,585,105);
  //”Earth” circle
  fill(247,187,130);
  ellipse(800,200,80,80);
  fill(252,110,0);
  text(“Earth”,779,205);
  //guide infomation
  //different guide texts are showing in different scences
  fill(255);
  if(count==1){
    text(“please move your mouse onto the circles”,0,20);
    text(“after seeing all 4 elements, please click your left mouse button”,0,40);
  }
  if(count==2){
    text(“please click your left mouse button after the balls gathered together”,0,20);
  }
  if(count==3){
    text(“please click your left mouse button”,0,20);
  }
  if(count==4){
    text(“human beings created!”,0,20);
    text(“you can move your mouse around his right hand to make him wave”,0,40);
    text(“after doing waving, please click your left mouse button”,0,580);
  }
 

}

void air(){     
  float a=0.0;
  for(int x=350;x<650;x++){
    float b=0.0;
    for(int y=350;y<550;y++){
      //use noise function to draw points, make it looks like air
      stroke(noise(a,b,c)*255);//use 3 parameters to make the picture change
      point(x,y);
      b+=t;      //change parameter
    }
    a+=t;       //change parameter
  }
  c+=k;        //change parameter

}

void water(){
  frameRate(10);
  background(62,149,219);
  //draw water surface
  stroke(255);
  for(i=0;i<1000;i++){line(i,500+random(10),i+1,500+random(10));}
 
  //create an array,typed “Rain”
  rain[] drops = new rain[100];//set drop number 50
  //create each drop
  for(int i=0;i<drops.length;i++) {
    drops[i] = new rain();
  }
  //draw each drop;
  for(int i=0;i<drops.length;i++){
    drops[i].fall();
  }
}

class rain{
 float x=random(1000);
 float y=random(-100,500);
 //make the drops fall
 void fall() {
  stroke(255);
  if(y<400){line(x,y, x,y+100);}
  if(y>400){line(x,y,x,500);}  //control the drops not to cross the water line
 }
}

void fire(){
  frameRate(40);
  offset=random(8);//make the fire to wave
  //draw outer surface, the red fire
  fill(250,87,33);
  beginShape();
  vertex(500+3*offset,300);
  bezierVertex(520+2*offset,350,550+offset,480,500,500);
  bezierVertex(450+offset,480,480+2*offset,350,500+3*offset,300);
  endShape();
  //draw inner surface, the yellow fire
  fill(254,255,41);
  beginShape();
  vertex(500+1.5*offset,400);
  bezierVertex(520+1.2*offset,440,525+0.6*offset,490,500,500);
  bezierVertex(475+0.6*offset,490,480+1.2*offset,440,500+1.5*offset,400);
  endShape();
  //draw candle
  fill(255);
  rect(425,500,150,200);
}

void earth(){
  frameRate(15);
  background(109,250,242);
  //draw very far mountain
  fill(232,206,140);
  triangle(20,200,-300,500,500,600);
  triangle(700,100,0,600,1500,600);
  //draw far mountain
  fill(240,156,22);
  triangle(50,500,200,300,400,500);
  triangle(500,400,400,500,600,500);
  triangle(600,500,800,300,1200,600);
  //draw near mountain
  fill(227,132,55);
  triangle(0,400,0,600,1500,600);
  //draw sun
  fill(250,87,33);
  ellipse(200,100,80,80);
  //draw cloud
  fill(255);
  ellipse(xp-100,yp,160,70);
  ellipse(xp-200,yp+30,120,50);
  ellipse(xp+150,yp-80,120,50);
  ellipse(xp+180,yp-50,130,30);
  ellipse(xp+400,yp+80,100,60);
  ellipse(xp+450,yp+50,150,80);
  ellipse(xp+700,yp,160,70);
  xp+=3;//move clouds
  if(xp>300){xp=0;}//get clouds back
}


void change(){
  frameRate(20);
  mainmenu();
  //move air ball
  fill(255,80);
  ellipse(xa,ya,60,60);
  if(xa<500){xa++;ya++;}
  //move water ball
  fill(109,250,242,80);
  ellipse(xw,yw,60,60);
  if(xw<500){xw+=0.3;yw+=1.2;}
  //move fire ball
  fill(250,87,33,80);
  ellipse(xf,yf,60,60);
  if(xf>500){xf-=0.3;yf+=1.2;}
  //move earth ball
  fill(247,187,130,80);
  ellipse(xe,ye,60,60);
  if(xe>500){xe—;ye++;}
}
 
void shinning(){
  mainmenu();
  //make a big colorful vibarating ball
  fill(random(255),random(255),random(255));
  ellipse(500,500,80+random(10),80+random(10));
}

void human(){
  mainmenu();
  //draw a cartoon human
  fill(255);
  ellipse(500,400,60,60);
  stroke(255);
  line(500,430,500,510);
  line(500,460,450,480);
  line(500,460,530,472);
  line(500,510,450,570);
  line(500,510,550,570);
  //wave right hand
  line(530,472,armX,armY);
  if(mouseX>550&&mouseX<575&&mouseY<470&&mouseY>430){
    armX=mouseX;
    armY=mouseY;
  }
}


void end(){
  background(0);
  textSize(20);
  text(“Name: Zhu Pengfei”,0,20);//editor’s name
  text(“Student ID: U5068352”,0,40);//editor’s student ID
  text(“Click your left mouse button to exit”,0,60);//guide information
  textSize(60);
  text(“Thank you!”, 350,300);//Thank you!!!
}

//use mouse click to change one scene to another
void mouseClicked(){
  count++;
}

sorry I didn’t finished on the pre-submission day…

change! (elements gathering)

int x=200;
int y=300;

float a=400;
float b=150;
float c=600;
float d=150;
float e=800;
float f=300;
int g;
int h;


void setup(){
  size(1000,800);
  smooth();
 
 
}
void draw(){
  mainmenu();
  if(mousePressed){
    fill(78,250,248,200);
    ellipse(x,y,80,80);
    if(x<500){
      x++;
      y++;
     
    }
    fill(250,47,15,200);
    ellipse(a,b,80,80);
    if(a<500){
      a=a+0.5;
      b=b+2.25;
    }
    fill(255,200);
    ellipse(c,d,80,80);
    if(c>500){
      c=c-0.5;
      d=d+2.25;
    }
    fill(250,137,15,200);
    ellipse(e,f,80,80);
    if(e>500){
      e=e-1;
      f=f+1;
    }
   
  }
}
void mainmenu(){
  background(0);
 
  fill(62,149,219);
  ellipse(200,300,100,100);
  fill(255);
  text(“Water”,190,300);
 
  fill(255,23,50);
  ellipse(400,150,100,100);
  fill(250,255,23);
  text(“Fire”,390,150);
 
  fill(255);
  ellipse(600,150,100,100);
  fill(62,149,219);
  text(“Air”,590,150);
 
  fill(222,96,11);
  ellipse(800,300,100,100);
  fill(250,199,96);
  text(“Earth”,790,300);
}

Just draw a simple picture (earth element)

void earth(){
  frameRate(15);
  background(109,250,242);
  
  fill(232,206,140);
  triangle(20,200,-300,500,500,600);
  triangle(700,100,0,600,1500,600);
  
  fill(240,156,22);
  triangle(50,500,200,300,400,500);
  triangle(500,400,400,500,600,500);
  triangle(600,500,800,300,1200,600);
  
  fill(227,132,55);
  triangle(0,400,0,600,1500,600);
  fill(250,87,33);
  ellipse(200,100,80,80);
  fill(255);
  ellipse(xp-100,yp,160,70);
  ellipse(xp-200,yp+30,120,50);
  ellipse(xp+150,yp-80,120,50);
  ellipse(xp+180,yp-50,130,30);
  ellipse(xp+400,yp+80,100,60);
  ellipse(xp+450,yp+50,150,80);
  ellipse(xp+700,yp,160,70);
  xp+=3;//move clouds
  if(xp>300){xp=0;}
}

clouds can move

“earth” problem

how to describe it?

trees growing?

Do they look like air?

Or cloud or something…

fire element (finished)

 void fire(){
  frameRate(40);
  fill(250,87,33);
  beginShape();
  vertex(500,300);
  bezierVertex(520,350,550,480,500,500);
  bezierVertex(450,480,480,350,500,300);
  endShape();
  fill(254,255,41);
  beginShape();
  vertex(500,400);
  bezierVertex(520,440,525,490,500,500);
  bezierVertex(475,490,480,440,500,400);
  endShape();
  fill(255);
  rect(425,500,150,200);
}

seems more random than “random”

can use it to draw a fire