Loading...
Logo
Processing Forum
Hi, I am new to Processing. Does anyone know any good examples animating a moving object or objects with trace? Something like this: http://vimeo.com/21351764

Thank you.

Replies(9)

They are by the dozen in this forum and probably also in the examples shipped with Processing.
Search for trail, instead of trace.
The base trick is to use a semi-transparent rectangle over the scene, fading out the previous drawings progressively.
Thanks a lot for the suggestion. I can now make trails. But I am still wondering how to make the trails dispersing (or diffusing), i.e., when fading out, trails also get larger around the line. I was thinking to redraw the previous lines with larger strokeWeight and semi-transparent color. But it does not sound very correct. Any good ideas?
Nice. Thank you both very much. I will check it out.

I was thinking to redraw the previous lines with larger strokeWeight() and semi-transparent color.
I can't think about another way to do it but redrawing each previous dots/lines.  

For example in that Fireworks simulation, besides the current point(), let's say I make 12 more below it.
Alpha attribute ranges from 0 to 255. Divide 256/13 and round it to get 20.

So each 1 of those 13 dots gonna have an alpha w/ 20 transparent value apart from each other.
The farthest the lesser! And latest one 100% transparent to erase it!

Similar to it, strokeWeight() will get bigger according to distance difference.
Only this time a shorter fraction value.

Well, that's my idea. No easy tricks unfortunately.  
GoToLoop is right (unless you use some kind of blur, perhaps, but not necessarily giving the effect you want).
The solution is to generate and to store the coordinates of the lines in an array list, then to draw them on each frame (with an opaque background(), then), with new width / color.
I see. Thanks guys. I will give it a try and post my result later.
What a fantastic technique! It iterates over an array starting from a certain index (oldest entry) 
and keeps going after extrapolating Array.length until it reaches most recent entry just before initial oldest index!

And they way it changes circularly 1 entry of the Array per draw() call w/ frameCount is über too!
That's what I call fastest performance ever. It doesn't generate orphan trash for Java's GC either!  

By the way, my advise above didn't involve recording any past coordinate positions.
It's assumed that it's a sequence of screen pixels w/ different alpha properties and strokeWeight()!