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.
IndexProgramming Questions & HelpSyntax Questions › Trails behind boids
Page Index Toggle Pages: 1
Trails behind boids? (Read 1754 times)
Trails behind boids?
Nov 27th, 2009, 2:00pm
 
Hi

I've been looking at the Daniel Shiffman flocking code, and wondering if there is a way to put trails behind each object to map their movements?

I'm sure this has been done before, and have to confess my ignorance- as an architecture student I am completely new to all of this!

Any help is much appreciated.
Re: Trails behind boids?
Reply #1 - Nov 27th, 2009, 2:42pm
 
the easiest way if you dont want to add anything else is to call

fill(0,40);
rect(0,0,width,height);

instead of background(0);

this always fills the screen with a semitransparent rect. if that doesnt help you you need to create an array store the previous positions and draw some trails behind your boids.
Re: Trails behind boids?
Reply #2 - Nov 28th, 2009, 2:31am
 
background() accepts an alpha value. It doesn't work?
Re: Trails behind boids?
Reply #3 - Nov 28th, 2009, 2:41am
 
PhiLho  wrote on Nov 28th, 2009, 2:31am:
background() accepts an alpha value. It doesn't work


No.  The sketch runs but the alpha is ignored.  I think that's worth some investigation and getting the reference updated as it seems to be a recurring problem people run into...
Re: Trails behind boids?
Reply #4 - Nov 28th, 2009, 8:27am
 
Ah, right! Actually, it is documented, I scanned the page too fast: "It is not possible to use transparency (alpha) in background colors with the main drawing surface, however they will work properly with createGraphics."
Which makes sense: actually background() isn't strictly equals to a call to rect() but it just fills the area with the given color. And a background transparency on the main sketch area makes thus little sense (what to show thru?).
Page Index Toggle Pages: 1