Flint Particle System Forum - Animate particles to a bitmap shape Sun, 26 Dec 2010 18:39:48 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Animate particles to a bitmap shape http://flintparticles.org/forum/comments.php?DiscussionID=102&Focus=436#Comment_436 http://flintparticles.org/forum/comments.php?DiscussionID=102&Focus=436#Comment_436 Wed, 15 Oct 2008 14:11:08 +0100 tim
Anyone have any ideas of how I could set particles to be a bitmap shape periodically?

So they start as a shape:
emitter.addInitializer( new Position( new BitmapDataZone(bitmap.bitmapData)));

Then I animate them by using an Action.

On a mouse click I'd like them to resume their initial positions.

One thing I considered was grabbing their positions from the BitmapDataZone and using TargetVelocity action, but this goes against the Flint architecture.

Thanks,
tim ]]>
Animate particles to a bitmap shape http://flintparticles.org/forum/comments.php?DiscussionID=102&Focus=438#Comment_438 http://flintparticles.org/forum/comments.php?DiscussionID=102&Focus=438#Comment_438 Wed, 15 Oct 2008 17:56:47 +0100 Richard
For the same position, you'll need to create a custom initializer based on the Position initializer, that stores the start position in the particle - add

particle.dictionary["startPosition"] = new Point( particle.x, particle.y );

at the end of the initialize method, or something similar.

For a different position in the bitmap, use

var position:Point = zone.getLocation();

where zone is your BitmapDataZone.

To approach the point, you probably want a custom action, which may be similar to TurnTowardsPoint or may be some sort of timed tween. In either case, it will use the point obtained above as the target point for the action.

Add the action to your emitter to make all the points approach their target, and remove it to make it stop. Or have stop/start methods on the action to turn it on and off. ]]>
Animate particles to a bitmap shape http://flintparticles.org/forum/comments.php?DiscussionID=102&Focus=852#Comment_852 http://flintparticles.org/forum/comments.php?DiscussionID=102&Focus=852#Comment_852 Fri, 10 Jul 2009 15:52:03 +0100 ezra