Interactive Authoring : HW3

int counter;
int interval = 1;
int step = 0;

float eyeH = 40;
float eyeW = 1;
float pupilX = 100;
float pupilY = 180;
float pupilW = 1;
float mouthW = 1;

void setup() {
size(300, 400);
smooth();
frameRate(20);}

void draw() {
background(100);
counter++;
if (counter>=0&&counter<=29){
step = 0;}
if (counter>=30&&counter<=69) {
step = 1;}
if (counter>=70&&counter<=99) {
step = 2;}
if (counter>=100&&counter<=129) {
step = 3;}
if (counter>=150&&counter<=199) {
step = 4;}
if (counter>=200&&counter<=259) {
step = 5;}
if (counter>=260&&counter<=299) {
step = 6;}
if (counter>=300&&counter<=339) {
step = 7;}
if (counter>=340&&counter<=359) {
step = 8;}
if (counter>=360&&counter<=379) {
step = 9;}
if (counter>=380&&counter<=409) {
step = 10;}
if (counter>=410&&counter<=450) {
step = 11;}

if(step == 0){
mouthW = mouthW + 2;
if(mouthW >= 40){
mouthW = 40;
step = 1;}}

else if(step == 1){
mouthW = mouthW – 2;
if(mouthW <= 1){
mouthW = 1;
step = 2;}}

else if(step == 2){
mouthW = mouthW + 2;
if(mouthW >= 30){
mouthW = 30;
step = 3;}}

else if(step == 3){
mouthW = mouthW – 2;
if(mouthW <= 1){
mouthW = 1;
step = 4;}}

else if(step == 4){
eyeW = eyeW + 1;
pupilW = pupilW + 1;
if(eyeW >= 10){
eyeW = 10;
if(pupilW >= 10){
pupilW = 10;
step = 5;}}}

else if(step == 5){
eyeW = eyeW -1;
pupilW = pupilW – 1;
if(eyeW <= 1){
eyeW = 1;
if(pupilW <= 1){
pupilW = 1;
step = 6;}}}

else if(step == 6){
eyeW = eyeW + 1;
pupilW = pupilW + 1;
if(eyeW >= 10){
eyeW = 10;
if(pupilW >= 10){
pupilW = 10;
step = 7;}}}

else if(step == 7){
eyeW = eyeW + 3;
if(eyeW >= 40){
eyeW = 40;
background(255,65,65);
step = 8;}}

else if(step == 8){
pupilX = pupilX + 5;
if(pupilX >= 110){
pupilX = 110;
background(245,255,50);
step = 9;}}

else if(step == 9){
pupilX = pupilX – 5;
if(pupilX <= 90){
pupilX = 90;
background(240,0,0);
step = 10;}}

else if(step == 10){
pupilX = pupilX + 5;
if(pupilX >= 100){
pupilX = 100;
step = 11;}}

else if(step == 11){
pupilX = pupilX – 40;
mouthW = mouthW + 20;
background (0,0,240);
if(mouthW >= 120){
mouthW = 120;}}

fill(255);
ellipse(width/2, height/2, 200, 300); // head
ellipse(100, 180, eyeH, eyeW); // left eye
ellipse(186, 180, eyeH,eyeW); // right eye
fill(1);
ellipse(pupilX, pupilY, 10, pupilW); // left pupil
ellipse(pupilX+86, pupilY, 10, pupilW); // right pupil
fill(255);
ellipse(143, 280, 50, mouthW); // mouth}

Advertisements

About Yoko

I'm Yoko. I'm an international student from Japan. I love Japanese animation♡
This entry was posted in Interactive Authoring, Non-Timebased 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