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
millis() (Read 530 times)
millis()
Jul 3rd, 2007, 2:25pm
 


hello,
I've got something like this:

void draw()
{
 if (millis() > 113423)
 {
 curve(0,0, width/2,height/2, width/4,height/4, 0,0)
 }
}

so this starts drawing the curve after a certain time defined by the if function. but how can I do the reverse? say, I want to stop the draw function drawing a certain shape after a certain time elapses.

I'm new in this so sorry if this sounds stupid.

thanks.

emre.

Re: millis()
Reply #1 - Jul 3rd, 2007, 3:31pm
 
You need something like
Code:
int now;

...

//at some point
if(someCondition)
{
now=millis();
}

if(millis()>=now && millis()<now+10000)
{
//dos something.
}
Re: millis()
Reply #2 - Jul 3rd, 2007, 6:13pm
 

thanks!

haven't tried it yet but I'm sure it'll work.

emre.
Page Index Toggle Pages: 1