Flint Particle System Forum - I want know how to make a photo by particles? Sun, 16 Oct 2011 22:39:24 +0100 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher I want know how to make a photo by particles? http://flintparticles.org/forum/comments.php?DiscussionID=515&Focus=1715#Comment_1715 http://flintparticles.org/forum/comments.php?DiscussionID=515&Focus=1715#Comment_1715 Tue, 06 Sep 2011 10:42:38 +0100 William
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 http://flintparticles.org/forum/comments.php?DiscussionID=515&Focus=1738#Comment_1738 Fri, 30 Sep 2011 08:48:08 +0100 Richard
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 ]]>