Particle Class
Panda a,b,c,d,e,f,g;
int di = 1;
float speed= 1;
float i=0;
float y = 0;
void setup(){
frameRate(35);
size(400,400);
background(255);
a = new Panda();
b = new Panda();
c = new Panda ();
d= new Panda();
e = new Panda();
f = new Panda();
g = new Panda();
}
void draw(){
background(255);
stroke(0);
scale(0.25);
translate(0,y);
if (mousePressed){
y +=5;
} if( y >= height+3800){
y = 0;
}
a.update();
a.display();
b.update();
b.display();
c.update();
c.display();
d.update();
d.display();
e.update();
e.display();
f.update();
f.display();
g.update();
g.display();
}
///Panda Class
class Panda{
int di = 1;
Panda(){
}
void update(){
if(mousePressed){
i +=2*di;
if(i >=20){
di = -1;
}if(i<=-10){
di = 1;
}}else{
i=0;
}
}
void display(){
translate(150,-400);
pushMatrix();
strokeWeight(25);
translate(100,165);
rotate(radians(i));
arc(0,0,100,100,radians(190),radians(250));
arc(0,0,100,100,radians(290),radians(350));
popMatrix();
////legs////
strokeWeight(23);
arc(110,175,70,70,radians(130),radians(170));
arc(95,175,70,70,radians(10),radians(50));
////////body////////
strokeWeight(3);
ellipse(100,150,85,95);
strokeWeight(20);
arc(100,108,70,60,radians(40),radians(140));
//left ears
stroke(0);
strokeWeight(3);
fill(0);
ellipse(80,75,25,25);
//right ears
ellipse(125,75,25,25);
//head
stroke(0);
fill(255);
strokeWeight(3);
ellipse (100, 100, 70,60);
//eyes
strokeWeight(12);
arc(85,100,10,10,radians(200),radians(250));
arc(115,100,10,10,radians(290),radians(340));
//lips or nose
strokeWeight(2);
ellipse(100,102,6,4);
}
}
Comments
Post a Comment