void setup(){
size(500,500);
int x=100;
int y=100;
int sizeX=100;
int sizeY=100;
noStroke();
rect(x+50,y,sizeX+50,sizeY+160,20);//ตัวแบต
rect(x+115,y-20,sizeX-80,sizeY-60,20);//หัวแบต
//ไฟแบตเตอร์รี่
fill(#33CC00);
rect(x+70,y+10,sizeX+10,sizeY-60,20);//100%-81%
fill(#33FF00);
rect(x+70,y+60,sizeX+10,sizeY-60,20);//80%-61%
fill(#66FF00);
rect(x+70,y+110,sizeX+10,sizeY-60,20);//60%-41%
fill(#FF6600);
rect(x+70,y+160,sizeX+10,sizeY-60,20);//40%-21%
fill(#FF3300);
rect(x+70,y+210,sizeX+10,sizeY-60,20);//20%-0%
//ตัวเลขแสดงค่าแบตเตอร์รี่
fill(0);
textSize(30);
text("100%",x+90,y+40);
text("80%",x+100,y+90);
text("60%",x+100,y+140);
text("40%",x+100,y+190);
text("20%",x+100,y+240);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น