class RobotFace{ int r; int g; int b; int mouthwidth; int mouthheight; int speed = 2; RobotFace(int tempr, int tempg, int tempb, int tempwidth, int tempheight){ r=tempr; g=tempg; b=tempb; mouthwidth=tempwidth; mouthheight=tempheight; } void display(){ //face fill(220,20,120); rectMode(CENTER); rect(mouseX,mouseY,200,200); //eyes fill(r+speed,g+mouthheight*2,b-mouthwidth); rect(mouseX-40,mouseY-50,30,30); rect(mouseX+40,mouseY-50,30,30); //nose fill(255); rect(mouseX,mouseY,20,20); //mouth fill(r,g,b); rect(mouseX,mouseY+40,mouthwidth,mouthheight); //ear left fill(mouthwidth+50); stroke(0); smooth(); line(mouseX-20,mouseY-100,mouseX-100,mouseY-200); ellipse(mouseX-100,mouseY-200,20,20); //right ear line(mouseX+20,mouseY-100,mouseX+100,mouseY-200); ellipse(mouseX+100,mouseY-200,20,20); } void move(){ mouthwidth = mouthwidth + speed; if(mouthwidth>=200 || mouthwidth<=50){ speed=speed*-1; } r=mouseX; g=mouseY; } }