I need help to make a loading bar…When i click the mouse over the button the message come with 100% and filled bar…How can I make it charge a percent after X seconds?
And how I can go back to the buttons screens after the loading message and bar?
Thanks in advance guys!
void mouseClicked(){
if mouseX>340 && mouseX <390 && mouseY > 45 && mouseY < 95){
for (int i=0; i < 101; i = i+1){
background(0);
textSize(30);
text("washing" + i + "%", 480/4,320/2.5);
rect(480/4,320/2,i*2,20,7);
}
}
Thanks for your reply! When I tried to use in draw, I used mousePressed, because I need to show the loading after a buton is pressed… but the animation only works when holding…
When I try to put that part inside draw:
background(0);
textSize(30);
text("washing" + i + "%", 480/4,320/2.5);
rect(480/4,320/2,i*2,20,7);
It shows up the loading animation more than 100% (1 by 1) because I set no limit, but when I try to put a while, to limit by 100% or a if to detect the button press, the full bar and 100% message show on the screen not loading 1 by 1…
I did it by putting a if inside draw, and a mouseclicked that set a value to enter the if inside the draw! when i reach 100% the value come back to 0 and the if stop working! Thanks!