int eyeSize = 100;
int R = 255;
int G = 255;
int B = 255;
void setup() {
size(500, 600);
background(100);
strokeWeight(5);
}
void draw() {
fill(R, G, B);
rect(50, 50, 400, 500);
if (mousePressed && (mouseButton == LEFT)) {
closeEye(100, 200, eyeSize);
openEye(350, 200, eyeSize);
} else if (mousePressed && (mouseButton == RIGHT)) {
openEye(150, 200, eyeSize);
closeEye(300, 200, eyeSize);
} else if (mousePressed && (mouseButton == CENTER)) {
closeEye(100, 200, eyeSize);
closeEye(300, 200, eyeSize);
} else {
openEye(150, 200, eyeSize);
openEye(350, 200, eyeSize);
}
mouth(250, 320);
elizabeth_text(250, 80);
gintama_text(250, 500);
}
void openEye(int eyeposX, int eyeposY, int eyeSize) {
fill(255);
ellipse(eyeposX, eyeposY, eyeSize, eyeSize);
fill(0);
ellipse(eyeposX, eyeposY, eyeSize/2, eyeSize/2);
/////Eyelashes/////
line(eyeposX-40, eyeposY-60, eyeposX-30, eyeposY-40);
line(eyeposX, eyeposY-70, eyeposX, eyeposY-50);
line(eyeposX+40, eyeposY-60, eyeposX+30, eyeposY-40);
}
void closeEye(int x, int y, int eyeSize) {
line(x, y, x+eyeSize, y);
/////Eyelashes/////
line(x+eyeSize/6, y, x+eyeSize/8, y-eyeSize/4);
line(x+eyeSize/2, y, x+eyeSize/2, y-eyeSize/4);
line(x+(eyeSize-(eyeSize/6)), y, x+(eyeSize-(eyeSize/8)), y-eyeSize/4);
}
void mouth(int mouthposX, int mouthposY) {
fill(#FFFF00);
ellipse(mouthposX, mouthposY, 250, 80);
line(mouthposX-110, mouthposY, mouthposX+110, mouthposY);
}
void elizabeth_text(int x, int y) {
fill(0);
textAlign(CENTER);
textSize(20);
text("ELIZABETH", x, y);
}
void gintama_text(int x, int y) {
fill(50);
textAlign(CENTER);
textSize(70);
text("GINTAMA", x, y);
}
void keyPressed() {
if (key == ' ') {
R = R - 5;
G = G - 15;
B = B - 51;
if (R == 0) {
R = 255;
}
if (G == 0) {
G = 255;
}
if (B == 0) {
B = 255;
}
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น