Moving Face

Here is the code I used to create this:

int mouth = 50;
int interval = 100;
float leye = 85;
float reye = 200;
int counter;
color random;

void setup() {
size(300, 400);
smooth();
}
void draw() {
counter++;
fill(81, 197, 152);
ellipse(width/2, height/2, 200, 300); // head

fill (255);
ellipse(100, 180, 40, 40); // left eye
ellipse(186, 180, 40, 40); // right eye
fill(1, 255, 0);

if (counter >= interval && counter <= interval +50) {
leye = leye +.5;
reye = reye -.5;
mouth = mouth +1;
}
if (counter >= interval+50 && counter <= interval +100) {
reye = reye +.5;
leye = leye -.5;
mouth = mouth -1;
}

fill (random (255), random (255), random (255));
ellipse(leye, 180, 10, 10); // left pupil
ellipse(reye, 180, 10, 10); // right pupil

if (counter >= interval+100) {
counter = 0;
}

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

Advertisements

About nadiaparfait1

I am currently attending Alfred State college. My major is Digital Media and Animation. I create art that expresses my emotions and experiences, incorporated with the knowledge that I obtain from school.
This entry was posted in Time Based 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