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
delay a problem (Read 415 times)
delay a problem
Jan 17th, 2007, 7:22am
 
I'm trying to do event-driven programming, typically playing a musical sound, then doing some graphics. I always have probs with delay.
For example:
int i=10;
void setup(){
size(300,300);
}
void draw(){
 background(255);
 fill(0);
rect(50+i,50,40,20);
 delay(400);
 
  rect(50+i,250,40,20);
 i=i+10;
 delay(400);
// background(255);  // if you  call it here, its a blank screen
}

won't run as it should; and does odd things at times.
Cheers.
Re: delay a problem
Reply #1 - Jan 17th, 2007, 2:09pm
 
putting delay in the middle of draw does not do what you think it does.

Nothing is drawn to the screen until draw() is finished, so any delay insdie draw will not be seen, as all it does is delay the drawing to an off-screen buffer.
Page Index Toggle Pages: 1