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.
Page Index Toggle Pages: 1
clock input (Read 560 times)
clock input
May 5th, 2010, 3:50pm
 
i'm wondering if there is a way of modifying the clock input in a sketch so that the actual time can be slowed down by the user. it would have to depend on some sort of motion. and making time go faster, maybe.
thank you
Re: clock input
Reply #1 - May 5th, 2010, 8:08pm
 
Instead of just reading the values of second(), minute(), hour() whenever you need the time, use those functions to set your *own* clock variables initially, and update those clock variable every X milliseconds, with

if( millis() - lastTime > X ){
 lastTime = millis();
 mySlowSecond++;
 // ... rest of your own clock variables updating
}

Then, by varying the value of X below and above 1000, you can speed up or slow down your own clock. Make sense?
Page Index Toggle Pages: 1