Time a method?
in
Programming Questions
•
6 months ago
The request is this:
Everytime I call a method, i want to do sth for a specific ammount of time.
Ex1. Everytime i move the mouse, it appears a text saying "hallo", while i am moving it and it desappears 5 seconds after i left the mouse.
Ex2. if i mouse over a specific area, the background changes colour for some seconds and then restores its previous colour.
(I mean the mouse is just a condition and the result lasts for a specific amount of time).
How do i measure the time every time a codition is on, a method is activated and so on...?
I ve tried sth like:
void printHelloFor4second( ) {
while(millis( ) < 4000){
text("Hello", width/2, height/2);
}
}
But while loop causes a lot of problems either doesn' t work, or even processing crashes..
1