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
looping (Read 635 times)
looping
Jun 7th, 2006, 6:42am
 

float t = 0.0;
float a=0.0;
void setup()
{
 size(350, 350);
 stroke(51);
 background (255);
 framerate(35);
}

void draw()
{
   t = t - 2.5;
    if (t<0){
     t=height;
     if (a>350){
   a=0;
 }
 }
 line(0, t, width, t);  
 line (t,0,0,width);
 line (125,0,t,width);
 line (-350,width,t,0);
 line (250,width,0,t);
 line (width,300,t,0);
 
}

Hi, I tried the basic looping but it doesnt seem to be looping...

i was wondering if you can tell me the problem here so i can have this animation continuously on the move (looping)...

thanks
Re: looping
Reply #1 - Jun 7th, 2006, 8:32am
 
It's looping. But you can't see this, cause you draw the lines over the old lines. So at the end of the loop you have to clear the screen (background(255)).
Re: looping
Reply #2 - Jun 8th, 2006, 2:10am
 
so how can i clear it so i can the loop occuring??

sorry im a begginer, u see.
Re: looping
Reply #3 - Jun 8th, 2006, 2:36am
 
You just need to add background()at the start or end of your draw()block, as shown below. This means your display will be rereshed every time the code runs, and you can therefore see it looping...

float t = 0.0;
float a=0.0;
void setup()  
{
 size(350, 350);
 stroke(51);
 background (255);
 framerate(35);
}

void draw()

{
background(255);
   t = t - 2.5;
    if (t<0){
t=height;  
if (a>350){
   a=0;
 }
 }
 line(0, t, width, t);  
 line (t,0,0,width);
 line (125,0,t,width);
 line (-350,width,t,0);
 line (250,width,0,t);
 line (width,300,t,0);
 
}
Re: looping
Reply #4 - Jun 8th, 2006, 5:43am
 
thanks again eskimoblood and self, it is much apreciated.

Page Index Toggle Pages: 1