Partigenを使ってみる。
Partigenのテスト
どうやって使うんだこれ。
@author paq89
/**
* Copyright paq ( http://wonderfl.net/user/paq )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/ng4O
*/
package
{
import com.desuade.partigen.emitters.Emitter;
import com.desuade.partigen.renderers.StandardRenderer;
import flash.display.Sprite;
import flash.events.Event;
/**
* Partigenのテスト
* どうやって使うんだこれ。
* @author paq89
*/
[SWF(backgroundColor="0xFFFFFF", width=465, height=465, frameRate=60)]
public class Main extends Sprite
{
private var _renderer:StandardRenderer;
private var _emitter:Emitter;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
_renderer = new StandardRenderer(this);
_emitter = new Emitter();
_emitter.particle = CircleParticle;
_emitter.renderer = _renderer;
_emitter.eps = 10;
_emitter.life = 2;
_emitter.lifeSpread = 4;
_emitter.controllers.particle.addTween('alpha').setSingleTween(1, '0', 0, '0');
_emitter.controllers.particle.addTween('scale').setSingleTween(.2, '0', 1, '0');
_emitter.controllers.particle.addTween('x').setSingleTween('0', '0', 300, '50', 'easeOutBounce');
_emitter.controllers.particle.addTween('y').setSingleTween('0', '0', '465', '0');
_emitter.start();
}
}
}
import flash.display.Sprite;
class CircleParticle extends Sprite
{
public function CircleParticle()
{
super();
graphics.beginFill(0x000000);
graphics.drawCircle(0, 0, 20);
}
}