Interactive Authoring: Animating Exercise

 

The code used to create this project is as follows.

float r = 0;
float g = 0;
float b = 0;
float h = 0;
float w = 0;
int circleX = 0;
int circleY = 0;
void setup() {
size(300, 400);
smooth();
}

void draw() {
background(r,0,0);
fill(56,255,62);
ellipse(width/2, height/2, 200, 300); // head
fill(255);
ellipse(100, 180, 70, 70); // left eye
ellipse(186, 180, 70, 70); // right eye
fill(255,g,b);
ellipse(186, 180, h, h);
ellipse(100, 180, h, h);
fill(1);
ellipse(100, 180, 20, 20); // left pupil
ellipse(186, 180, 20, 20); // right pupil

h = h +1;
if (h > 75){
h = 0;
}

r = r + 3.4;
if (r > 255){
r = 0;
}
fill(g,0,0);
ellipse(143, 280, mouseX/3, h*2); // mouth

g = random(255);
b = random(255);

fill(g,0,b);
ellipse(circleX,circleY,100,100);

circleX = circleX + 10;
if (circleX > 650){
circleX = -50;
}
circleY = circleY + 5;
if (circleY > 450){
circleY = -50;
}

}

Advertisements
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