Flint Particle System Forum - Speed particles up 2011-06-23T16:32:42+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Speed particles up http://flintparticles.org/forum/comments.php?DiscussionID=70&Focus=328#Comment_328 2008-08-23T19:43:59+01:00 2008-08-24T15:08:27+01:00 Flashingback http://flintparticles.org/forum/account.php?u=38 Hello, I have litle question is it posible to speed up the particles. I am making some fireworks for een application and they ar just to slow and id dontt know how I can make it faster. This is ...
I have litle question is it posible to speed up the particles. I am making some fireworks for een application and they ar just to slow and id dontt know how I can make it faster. This is an example of a firework

package be.zenacity.effects {

import flash.display.BitmapData;
import flash.display.LineScaleMode;
import flash.display.Sprite;
import flash.filters.*;
import flash.filters.ColorMatrixFilter;
import flash.geom.Point;
import flash.geom.Rectangle;

import org.flintparticles.actions.*;
import org.flintparticles.counters.*;
import org.flintparticles.emitters.Emitter;
import org.flintparticles.energyEasing.*;
import org.flintparticles.events.FlintEvent;
import org.flintparticles.initializers.*;
import org.flintparticles.renderers.*;
import org.flintparticles.zones.*;
import org.flintparticles.displayObjects.*;
import flash.events.Event;

import caurina.transitions.Tweener;

public class Salute extends Firework{
private var emitter:Emitter
private var emitter_ex:Emitter
private var count:Number;
private var renderer:BitmapRenderer

public var explodePosition:Object;
public var lifeTime_nr:Number

private var _color:uint
private var _size:Number
private var _duration:Number
private var _currentAnim:Object;
private var _wind:Number;
public function Salute(duration:Number,size:Number,color:uint,track:Number) {
_currentAnim==null;
trace("Crossete::constructor");
super();
lifeTime_nr = 1;
var pos:Number = Number(track)+1
trace("////////////////////"+pos);
explodePosition = {x:(800/4)*pos,y:200-(size/2)};
trace(explodePosition.x)

_duration = duration;
_size=size;
_color=color
_wind = -50 + (Math.random()*100)
renderer = new BitmapRenderer ( new Rectangle( 0, 0, 1280, 800 ) );
//renderer.addFilter( new BlurFilter(2,2,2) );
addChild( renderer );
}
public function pause(){
trace("Crosette::pause");
_currentAnim.pause();
}
public function restart(){
_currentAnim.resume();
}

public function fire(){
trace("Crossette::fire")
emitter = new Emitter();


emitter.renderer = renderer;


emitter.counter = new Blast( 20);

emitter.addInitializer( new ImageClass( Dot, 0.5) )
emitter.addInitializer( new Position( new PointZone( new Point( explodePosition.x, 600 ) ) ) );
emitter.addInitializer( new Lifetime(0.5,0.7) );
emitter.addAction( new Age());
emitter.addAction( new Fade(0.5,1) );
emitter.addAction( new ColorChange(_color,_color) );
emitter.addAction( new Move());



emitter.addAction(new TweenPosition(explodePosition.x,600,explodePosition.x+_wind,explodePosition.y));

emitter.addEventListener( FlintEvent.EMITTER_EMPTY, doneStart);
emitter.start();
_currentAnim=emitter;
}
private function doneStart(ev:FlintEvent){
emitter.dispose();
explode()
}
private function explode():void{

trace("Crossette::fire");

emitter_ex = new Emitter();
emitter_ex.renderer = renderer
emitter_ex.counter = new Blast(400);

emitter_ex.addInitializer( new ImageClass(SoftParticle) )
emitter_ex.addInitializer( new Position( new DiscZone( new Point(explodePosition.x+_wind,explodePosition.y ),_size/4)) ) ;
emitter_ex.addInitializer( new Velocity( new DiscZone( new Point(0,0),_size/2) ) );
emitter_ex.addInitializer( new Lifetime(2,_duration/20) );

emitter_ex.addAction(new Age());
emitter_ex.addAction( new Explosion(100,0,0));
emitter_ex.addAction( new Fade(1,0.5) );
//emitter_ex.addAction( new ColorChange(_color,_color) );
emitter_ex.addAction( new LinearDrag(1) );
//emitter_ex.addAction( new RotateToDirection() );
emitter_ex.addAction( new RandomDrift(20,20) );
//emitter.addAction( new Scale(1,0) );
emitter_ex.addAction(new Move());

emitter_ex.addEventListener( FlintEvent.EMITTER_EMPTY, done );
emitter_ex.start();
_currentAnim=emitter_ex;
emitter_ex.addEventListener( FlintEvent.PARTICLE_DEAD, deadParticle );

}
private function deadParticle (e:FlintEvent){
emitter_ex.removeEventListener( FlintEvent.PARTICLE_DEAD, deadParticle );

//renderer.addFilter( new BlurFilter(10,10,1) );
}

private function done(e:FlintEvent){
emitter_ex.dispose();
Tweener.addTween(renderer,{alpha:0,time:1});
}


}

}
]]>
Speed particles up http://flintparticles.org/forum/comments.php?DiscussionID=70&Focus=329#Comment_329 2008-08-24T15:12:59+01:00 2011-06-23T16:32:42+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi The Tween action occurs over the lifetime of the particle. So you can speed it up by reducing the lifetime or increasing the distance of the Tween. Or have I misunderstood your question?
The Tween action occurs over the lifetime of the particle. So you can speed it up by reducing the lifetime or increasing the distance of the Tween.

Or have I misunderstood your question?]]>