Confused face- a coding animation

float circleX = 100;
float circleX2 = 186;
float circleY=180;
float circleY2=180;
float eyeX= 40;
float eyeY=40;
float eyeX2= 40;
float eyeY2=40;
float speed = .70;
float speed2= .5;
long timer;
float fMouth= 1;
float fSpeed= 2;

void setup() {
size(300, 400);
smooth();

}
void draw() {
fill(253,214,188);
ellipse(width/2, height/2, 200, 300); // head
fill(255,190,209);
ellipse(100, 180, eyeX, eyeY); // left eye
ellipse(186, 180, eyeX2, eyeY2); // right eye
fill(1);
ellipse(circleX, circleY, 10, 10); // left pupil
ellipse(circleX2, circleY2, 10, 10); // right pupil

fill(255);
ellipse(143, 280, 50, fMouth); // mouth

circleX= circleX+speed;//left pupil movement
circleX2= circleX2 + speed;//right pupil movement
eyeX = eyeX + speed2;//left eye growth
eyeX2 = eyeX2 + speed2;//right eye growth
eyeY = eyeY + speed2;//left eye growth
eyeY2 = eyeY2 + speed2;//right eye growth
fMouth = fMouth + fSpeed;// mouth growth

timer= millis();

if (circleX >= 110) {
speed = -.7;
}
if (circleX <= 90) {
speed = .7;
}
if (circleX2 >= 196) {
speed = -.7;
}
if (circleX2 <= 176) {
speed = .7;

if (millis() >= 5000) {
ellipse(100, 180, eyeX+2, eyeY+2);
ellipse(186, 180, eyeX2+2, eyeY2+2);
eyeX = eyeX + speed2;
eyeX2 = eyeX2 + speed2;
eyeY = eyeY + speed2;
eyeY2 = eyeY2 + speed2;
}
if (eyeX >= 48) {
speed2 = -.5;
}
if (eyeX <= 38) {
speed2 = .5;
}

if (fMouth >= 50) {
fSpeed = -2;
}
if (fMouth <= 1) {
fSpeed= 2;

}
}
}

Advertisements
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s