BetweenAS3を試してみた
package {
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.tweens.ITween;
[SWF(backgroundColor=0x000000, width=512, height=512)]
public class Particle_BetweenAS3 extends Sprite
{
private const num_of_particle:int = 200;
private var w:Number;
private var h:Number;
private const depth:Number = 300;
public function Particle_BetweenAS3()
{
if(stage)
init();
else
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(event:Event=null):void{
removeEventListener(Event.ADDED_TO_STAGE, init);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
w = stage.stageWidth;
h = stage.stageHeight;
var p:Shape;
for(var i:int = 0; i < num_of_particle; i++){
p = new Shape();
p.graphics.beginFill(0xFFFFFF*Math.random());
p.graphics.drawCircle(0, 0, Math.random()*5+1);
p.graphics.endFill();
p.x = Math.random() * w;
p.y = Math.random() * h;
p.z = Math.random() * depth*2-depth;
addChild(p);
var t:ITween = BetweenAS3.serial(
BetweenAS3.addChild(p, this),
BetweenAS3.tween(p, {z:-depth,
alpha:0.8,
_blurFilter: {blurX: 0, blurY: 0}},
{_blurFilter: {blurX: 16, blurY: 16},
alpha:0},
3, null, Math.random()*5),
BetweenAS3.tween(p, {z:-depth*2, alpha:1}, {z:-depth, alpha:0.8}, 2),
BetweenAS3.removeFromParent(p)
);
t.stopOnComplete = false;
t.play();
}
}
}
}