대량생산기술의레져활동과비슷한유형의성공적인경청력과감성적바느질의생명공학커뮤니케이션

Interactive Video | Week 5, Homework 1 : Interactive Animation 30

I originally imagined a situation where a person tried to walk and open the door of a room and leave, but couldn't escape in 500X500 sized space. But I've hit a serious snag in making a person walking. By using trigonometric functions, I succeeded. But it was more difficult to make the other situation, so another parts were not completed. If I have a next chance, I would like to make a more complete animation....

// Processing Code

float bR;  // body-Rotation
float lM;  // limbs-Movement
boolean Moving = false;
boolean lM_Minus = true;
boolean lM_Plus = false;
float X = 250;
float Y = 250;
float x;
float y;

void setup(){
size(500,500);
}

void draw(){
background(255);

// Player Movement
if (keyPressed && key == CODED){
Moving = true;
if (keyCode == UP){
x = sin(bR);
y = -cos(bR);
} else if (keyCode == DOWN){
x = -sin(bR);
y = cos(bR);
} else if (keyCode == RIGHT){
bR += 0.05;
} else if (keyCode == LEFT){
bR -= 0.05;
}
} else{
Moving = false;
}

// Player Limbs Movement
if (Moving == true){
if (lM_Minus == true && lM_Plus == false){
if (lM <= -25){
lM = -25;
lM_Minus = false;
lM_Plus = true;
} else{
lM -= 1;
}
}
if (lM_Plus == true && lM_Minus == false){
if (lM >= 0){
lM = 0;
lM_Plus = false;
lM_Minus = true;
} else{
lM += 1;
}
}
}

X += x;
Y += y;
if (X-50 <= 0){
X = 50;
}
if (X+50 >= 500){
X = 450;
}
if (Y-50 <= 0){
Y = 50;
}
if (Y+50 >= 500){
Y = 450;
}

pushMatrix();
translate(X,Y);
rotate(bR);
drawPlayer();
popMatrix();

x = 0;
y = 0;
}

void drawPlayer(){
strokeWeight(1.5);  // Foot Drawing
fill(0);
ellipse(12.5,12.5+lM,15,30);  // Right Foot
ellipse(-12.5,-12.5-lM,15,30);  // Left Foot
fill(255);  // Hand Drawing
circle(32.5,-25-2*lM,15);  // Right Hand
circle(-32.5,25+2*lM,15);  // Left Hand
fill(155);  // Arm Drawing
ellipse(32.5,-12.5-lM,17.5,30);  // Right Arm
ellipse(-32.5,12.5+lM,17.5,30);  // Left Arm
ellipse(0,0,80,25);  // Body drawing
beginShape();
vertex(0,-22.5);
vertex(10,-5);
vertex(-10,-5);
endShape(CLOSE);
strokeWeight(2.5);
fill(255);
circle(0,0,30);
}