void setup(){
size(600,600);
}
int mouthY;
// make variable for limit value mouth
int limitMouthY=0;
int slidevalue=0;//for make animation of text
void draw(){
// call function for make background
backGround(196,255,23,0);
backGround(196,200,23,60);
backGround(196,150,23,120);
backGround(196,100,23,180);
backGround(196,50,23,240);
backGround(196,0,23,300);
backGround(196,0,80,360);
backGround(196,0,160,420);
backGround(196,0,240,480);
backGround(140,0,240,540);
// make function for control mouth
if(keyPressed){
if(key=='+'&&limitMouthY<=40){
mouthY++;
limitMouthY++;
}
if(key=='-'&&limitMouthY>=-100){
mouthY--;
limitMouthY--;
}
}
// call function for make face
face(0,0,mouthY);
//call text
assination(slidevalue);
// rule slide
slidevalue--;
if(slidevalue==-600){
slidevalue=600;
}
}
//make function background
void backGround(int R,int G,int B,int X)//R G B is Red Green Blue and X Y is reference point
{
stroke(R,G,B);
fill(R,G,B);
rect(X,0,60,600);
}
//make function for make face and eye
void face(int eyeX,int eyeY,int mouthY)//eye X,Y for move eye in x and y line
{
stroke(0);
strokeWeight(10);
fill(255,231,41);
ellipse(300,300,400,400);//face
strokeWeight(15);
stroke(255,0,0);
point(250+eyeX,200+eyeY);
point(350+eyeX,200+eyeY);
strokeWeight(4);
stroke(0);
fill(250,0,0);
arc(300,300,300,240+mouthY/4,0,PI); //top mouth
fill(255,231,41);
arc(300,300,300,180+mouthY,0,PI); // bottom mouth
tooth(mouthY);
}
//make function tooth
void tooth(int mouthY){
line(180,340+mouthY/3,180,380);
line(210,360+mouthY/2,210,400);
line(240,375+mouthY/2,240,420);
line(270,380+mouthY/2,270,425);
line(300,380+mouthY/2,300,430);
line(330,380+mouthY/2,330,425);
line(360,375+mouthY/2,360,420);
line(390,360+mouthY/2,390,400);
line(420,340+mouthY/3,420,380);
}
//make function for make text
void assination(int X)//x in value of refence
{
textSize(50);
fill(255,235,15);
text(" Assassination Classroom ",X,50);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น