in class animate

int counter;
int interval = 100;

float a;
float b;
float x;
void setup() {
size(300, 400);
smooth();
a = 100;
b = 186;
x = 1;
}
void draw() {
counter ++;

fill(255);
fill (255,14,50);
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);
ellipse(a, 180, 10, 10); // left pupil
ellipse(b, 180, 10, 10); // right pupil
if (counter > 0 && counter < 20) {
a = a + 1;
}
if (counter > 20 && counter < 40) {
a = a – 1;
}
if (counter > 0 && counter < 20) {
b = b + 1;
}
if (counter > 20 && counter < 40) {
b = b – 1;
}
fill(255);
ellipse(143, 280, 50, x); // mouth
if (counter > 30 && counter < 100) {
x = x + 1;
}

}

Advertisements
This entry was posted in Interactive, 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