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 › Randomly Moving 900-1000 Objects
Page Index Toggle Pages: 1
Randomly Moving 900-1000 Objects (Read 378 times)
Randomly Moving 900-1000 Objects
Apr 11th, 2008, 4:04am
 
Hello,

Can someone help me accomplish this? ->

I have created a comp in illustrator that contains 990 squares of different color/size/position. I have exported this illustrator file to svg in order to database the color/size/position of all of these squares (syntax different than processing).

Now, I would like to move all of these squares randomly, but also be able to have them reposition themselves in their original position (the positions in the comp) at a given time (mouseclick, etc).

take a look at this screenshot, http://www.degraafdesign.com/superman.png

if you think you might have a logical solution for providing the random motion of these squares (in addition to relocating them into the image) Please let me know!

-Dan
degraafdesign@gmail.com
Re: Randomly Moving 900-1000 Objects
Reply #1 - Apr 12th, 2008, 8:41am
 
First, you could create your custom 'moving square' class. Color, size, initial position and motion vector would be properties of this class. Then, it is easy to instanciate 990 different objects : one per square.

To do so, you'll have to parse the SVG file to retrieve the attributes of each square (color, size, initial position). Since SVG is XML, you can easily parse it with the XML Import library.
Page Index Toggle Pages: 1