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 yy = 0;
if (mouseX <= width/2) {
while (yy < mouseY) {
potato(mouseX, yy);
yy += 125;
}
} else {
potato(mouseX, mouseY);
}
}
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) {
int n = 0;
int m = 0;
while (n < 2) {
fill(cp);
textSize(120);
text("P", x+m, y);
fill(co1);
ellipse(x+125+m, y-45, 90, 90); //วงกลมเขียว
fill(co2);
ellipse(x+125+m, y-45, 60, 60); //วงกลมส้มอ่อน
fill(ccpre);
textSize(18);
text("Cpr.E", x+100+m, y-40);
fill(ct1);
rect(x+35+m, y+25, 15, 100); //แกนตัวที1
rect(x+7+m, y+25, 75, 15); //หัวตัวที1
fill(ca);
textSize(140);
text("A", x+80+m, y+125);
fill(ct2);
rect(x+35+m, y+155, 15, 100); //แกนตัวที2
rect(x+7+m, y+155, 75, 15); //หัวตัวที2
fill(co3);
ellipse(x+135+m, y+210, 110, 110); //วงกลมส้มเข้ม
fill(co4);
ellipse(x+135+m, y+210, 10, 60); //วงรีขาว
n++;
m += 200;
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น