Flint Particle System Forum - I want know how to make a photo by particles? 2011-10-16T22:33:46+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher I want know how to make a photo by particles? http://flintparticles.org/forum/comments.php?DiscussionID=515&Focus=1715#Comment_1715 2011-09-06T10:42:38+01:00 2011-10-16T22:33:46+01:00 William http://flintparticles.org/forum/account.php?u=539 I want to use a bitmapdata photo as particles. At the beginning, it's scattered and can be any shape like linezone or pointzone,etc. And at the end the photo can be consisted of these moving ...
photo=new Bitmap();
photo.bitmapData=new myPhoto();
emitter=new Emitter2D();
var particles:Array = Particle2DUtils.createRectangleParticlesFromBitmapData(photo.bitmapData,2,emitter.particleFactory,0,0);
emitter.addExistingParticles(particles,true);
renderer=new DisplayObjectRenderer();
renderer.addEmitter(emitter);
addChild(renderer);
emitter.addInitializer(new Position(new LineZone(new Point(0,0),new Point(1003,0))));
emitter.start();

By use these codes I can't scatter the photo and change the shape at the beginning, it's a whole picture. Do anyone know how to make this effect?
myPhoto is a png picture import in the .fla document]]>
I want know how to make a photo by particles? http://flintparticles.org/forum/comments.php?DiscussionID=515&Focus=1738#Comment_1738 2011-09-30T08:48:08+01:00 2011-10-16T22:18:05+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Flint doesn't contain an Action to tween the particle from a random position to its current position, so you'll need to create your own. Something like this should do it (this code is ...
package
{
import org.flintparticles.common.actions.ActionBase;
import org.flintparticles.common.emitters.Emitter;
import org.flintparticles.common.particles.Particle;
import org.flintparticles.twoD.particles.Particle2D;
import org.flintparticles.twoD.zones.Zone2D;

import flash.geom.Point;

public class TweenToCurrentPosition extends ActionBase
{
private var startZone : Zone2D;

public function TweenToCurrentPosition( startZone : Zone2D )
{
this.startZone = startZone;
}

override public function update( emitter : Emitter, particle : Particle, time : Number ) : void
{
var p : Particle2D = Particle2D( particle );
if ( !p.dictionary[this] )
{
var start : Point = startZone.getLocation();
p.dictionary[this] = { moveX:start.x - p.x, moveY:start.y - p.y, endX:p.x, endY:p.y };
}
var data : Object = p.dictionary[ this ];
p.x = data.endX + data.moveX * p.energy;
p.y = data.endY + data.moveY * p.energy;
}
}
}


With this code, you'll also need to add a Lifetime initializer (this is how long it takes for the particles to reach their destination) and an Age action.

Richard]]>