FLiNT Examples -> Logo firework を参考にした。
org.flintparticles.common.actions.Fade
を使うと出現回数をコントロールできるみたい。
Fade () constructor public function Fade(startAlpha:Number = 1, endAlpha:Number = 0) |
org.flintparticles.common.actions.Age
に easing 関数をセット。
easing 関数は fl.motion.easing.*
と同じ名前だけど引数の数が違うので使えない。
org.flintparticles.common.energyEasing.*
を使う。
default は org.flintparticles.common.energyEasing.Linear.easeNone
import org.flintparticles.common.actions.*; import org.flintparticles.common.counters.*; import org.flintparticles.common.initializers.*; import org.flintparticles.common.events.EmitterEvent; import org.flintparticles.common.energyEasing.*; import org.flintparticles.twoD.actions.*; import org.flintparticles.twoD.emitters.Emitter2D; import org.flintparticles.twoD.initializers.*; import org.flintparticles.twoD.renderers.*; import org.flintparticles.twoD.zones.*; // Look up the dimensions of your logo (Right-click in the library->Properties) var lw:uint = 330; var lh:uint = 70; var sw:uint = stage.stageWidth; var sh:uint = stage.stageHeight; var emitter:Emitter2D = new Emitter2D(); emitter.counter = new Blast( 4000 ); emitter.addInitializer( new ColorInit( 0xFF24ff00, 0xFF0096ff ) ); emitter.addInitializer( new Lifetime( 6.5 ) ); emitter.addInitializer( new Position( new DiscZone( new Point( 0, 0 ), 10 ) ) ); var bitmapData:BitmapData = new Logo( lw, lh); emitter.addInitializer( new Velocity( new BitmapDataZone( bitmapData, -lw/2, -sh - 10 ) ) ); emitter.addAction( new Age( Quadratic.easeIn ) ); emitter.addAction( new Fade( 1.2, 0 ) ); emitter.addAction( new Move() ); emitter.addAction( new LinearDrag( 0.5 ) ); emitter.addAction( new Accelerate( 0, 70 ) ); emitter.addEventListener( EmitterEvent.EMITTER_EMPTY, restart ); var renderer:PixelRenderer = new PixelRenderer( new Rectangle( 0, 0, sw, sh ) ); renderer.addFilter( new BlurFilter( 2, 2, 1 ) ); renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0 ,0,1,0,0,0 ,0,0,1,0,0 ,0,0,0,.97,0 ] ) ); renderer.addEmitter( emitter ); addChild( renderer ); emitter.x = (sw/2); emitter.y = sh + 30; emitter.start( ); function restart( ev:EmitterEvent ):void { Emitter2D( ev.target ).start(); } |