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
Animations (Read 839 times)
Animations
Dec 25th, 2009, 12:14am
 
Hi, Im starting with processing, I've draw some fractals and now I want to make some animations.

I,ve read this page:

jtnimoy.net

and I've tried this code that I´ve found there:
Code:
int x = 0;

void setup( ){
   noStroke( );
}

void loop( ){
   background(190);
   rect(x, 0, 5, 100);
   x=x+1;
}

It´s supossed to draw a rectangle moving to the right, but it doesnt draw anything at all, it only open a little window with nothing in it.

In fact, I´ve made some tries and I can´t draw nothing at all inside the loop function.
Re: Animations
Reply #1 - Dec 25th, 2009, 12:29am
 
Dont know if you learned that from his page, or if his applets are just a bit too old. but for a while now. Since the beta release (0085) loop is called draw. so if you cange void loop() to void draw. it will work.
Re: Animations
Reply #2 - Dec 25th, 2009, 11:02am
 
Thank you, I've made this and it works.

There is something that it seems odd to me. The only question is a change of name between loop and draw? It seems odd to me bacause maybe  I want to make a loop without any drawing, for example to control some lamps with arduino, it seems odd to me to use the draw function without any drawings.
Re: Animations
Reply #3 - Dec 25th, 2009, 12:45pm
 
it's just semantics: draw() == loop()...  Someone probably decided that in the context of Processing 'draw' makes the most sense as more often than not you'll use it to draw to the screen; but that doesn't mean you have to...
Page Index Toggle Pages: 1