int co1 = #00FF00;
int co2 = #FFA54F;
int ccpre = #4169E1;
int ct1 = #FF0066;
int ca = #800080;
int ct2 = #003300;
int co3 = #FF4500;
int co4 = #FFFFFF;
void setup() {
size(500, 500);
}
void draw() {
background(#99CCFF);
float xx = mouseX;
float yy = mouseY;
if (xx < 25) {
xx = 25;
} else if (xx > 300) {
xx = 300;
} else if (yy < 100) {
yy = 100;
} else if (yy > 250) {
yy = 250;
}
potato(xx, yy);
}
void keyPressed() {
if (key == 'p') {
cp = color(random(0, 225), random(0, 225), random(0, 225));
} else if (key == 'o') {
co1 = color(random(0, 225), random(0, 225), random(0, 225));
co2 = color(random(0, 225), random(0, 225), random(0, 225));
co3 = color(random(0, 225), random(0, 225), random(0, 225));
co4 = color(random(0, 225), random(0, 225), random(0, 225));
} else if (key == 't') {
ct1 = color(random(0, 225), random(0, 225), random(0, 225));
ct2 = color(random(0, 225), random(0, 225), random(0, 225));
} else if (key == 'a') {
ca = color(random(0, 225), random(0, 225), random(0, 225));
} else if (key == '0') {
ccpre = color(random(0, 225), random(0, 225), random(0, 225));
}
}
//Potato
void potato(float x, float y) {
fill(cp);
textSize(120);
text("P", x, y);
fill(co1);
ellipse(x+125, y-45, 90, 90); //วงกลมเขียว
fill(co2);
ellipse(x+125, y-45, 60, 60); //วงกลมส้มอ่อน
fill(ccpre);
textSize(18);
text("Cpr.E", x+100, y-40);
fill(ct1);
rect(x+35, y+25, 15, 100); //แกนตัวที1
rect(x+7, y+25, 75, 15); //หัวตัวที1
fill(ca);
textSize(140);
text("A", x+80, y+125);
fill(ct2);
rect(x+35, y+155, 15, 100); //แกนตัวที2
rect(x+7, y+155, 75, 15); //หัวตัวที2
fill(co3);
ellipse(x+135, y+210, 110, 110); //วงกลมส้มเข้ม
fill(co4);
ellipse(x+135, y+210, 10, 60); //วงรีขาว
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น