We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › how to move out navigation bar after 3 seconds
Page Index Toggle Pages: 1
how to move out navigation bar after 3 seconds? (Read 276 times)
how to move out navigation bar after 3 seconds?
Jun 14th, 2009, 12:28pm
 
I have a simple navigation bar with three buttons (icons and text) located at the very right of the screen. If the user does not move the mouse within 3 seconds the navigation should move out of the screen so that only the icons are still visible.
If the user clicks on on the navigation bar it should move back in again completely.

I hope this explains it better:
...

Can anyone please help I am a beginner and need some help.
Re: how to move out navigation bar after 3 seconds?
Reply #1 - Jun 14th, 2009, 2:11pm
 
In mouseMoved(), set a start time. In draw(), check if time difference between current time and last mouse move time is above 3s. If so, move your bar.
Re: how to move out navigation bar after 3 seconds?
Reply #2 - Jun 14th, 2009, 2:25pm
 
Thanks Philho for your reply.

I'm sorry but I am not much familiar with Processing.
Would you help me with a little bit of code?
That would be helpful.
Re: how to move out navigation bar after 3 seconds?
Reply #3 - Jun 14th, 2009, 3:48pm
 
Well there's always the Reference...

Here's one crude approach, working on the assumption that most of the time the mouse will be in motion and that counter>90 is more or less equivalent to 3 seconds at FrameRate(30):

Code:
int counter = 0;

void setup() {
frameRate(30);

}

void draw() {
counter ++;
if (counter> 90) {
// hide stuff;
println("hide me!" + counter);
}
}

void mouseMoved() {
counter = 0;
}


Mind you it's worth mentioning that your interface concept is a little odd...  It's not entirely intuitive to click on something that isn't there in order to make it appear.  Perhaps better to fade it in as the mouse position approaches it; and in fact fade it out as the mouse position leaves it.  That would strike me as more consistent at least...
Page Index Toggle Pages: 1