Battery follow the Cursor!!
void setup() {
size(500, 500);
}
void draw() {
background(255);//white
battery(mouseX, mouseY);
}
void battery(int countX, int countY) {
int space=40;
int w=180;//width
int h=90;//height
stroke(#0041E0);//dark blue
strokeWeight(8);
fill(#0393FF);//blue
//big square
rect(countX, countY, w, h);
fill(255);//white
//batt head
rect(countX+180, countY+35, w/9, h-70);
//battery quntity
fill(#FF0011);//red
rect(countX, countY, space, h);//#1 batt
rect(countX+space, countY, space, h);//#2 batt
rect(countX+space*2, countY, space, h);//#3 batt
rect(countX+space*3, countY, space, h);//#4 batt
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น