BetweenAS3_test
Tweenerから乗り換え予定なので
ちょっとさわってみた。
//Tweenerから乗り換え予定なので
//ちょっとさわってみた。
package
{
import __AS3__.vec.Vector;
import flash.display.Sprite;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.easing.*;
import org.libspark.betweenas3.events.TweenEvent;
import org.libspark.betweenas3.tweens.IObjectTween;
[SWF(width = "465",height ="465",backgroundColor="0xFFFFFF")]
public class study1 extends Sprite
{
private var tweenObj:IObjectTween;
private var funcAry:Array = [Back.easeIn,Bounce.easeIn,Quart.easeIn,Exponential.easeIn];
public function study1()
{
for(var i:int =0; i < 500; i++)
{
var sp:particle = new particle();
sp.x = Math.random() * 100;
sp.y = Math.random() * 100;
addChild(sp);
tweenObj = BetweenAS3.tween(sp,{x:465/2,y:465/2},null,1.0,Back.easeIn);
tweenObj.addEventListener(TweenEvent.COMPLETE,onComplete);
tweenObj.play();
}
}
private function onComplete(e:TweenEvent):void
{
var tweenObj:IObjectTween = e.target as IObjectTween;
tweenObj.removeEventListener(TweenEvent.COMPLETE,onComplete);
var scale:Number = Math.random() * 4;
var i:int = Math.floor(Math.random() * funcAry.length);
tweenObj = BetweenAS3.tween(e.target.target,{x:Math.random() * stage.stageWidth,y:Math.random() * stage.stageHeight,scaleX:scale,scaleY:scale},null,1.0,funcAry[i]);
tweenObj.addEventListener(TweenEvent.COMPLETE,onComplete);
tweenObj.play();
}
}
}
import flash.display.Sprite;
class particle extends Sprite
{
public function particle()
{
graphics.beginFill(0xE50606);
graphics.drawRect( -1, 0, 3, 1 );
graphics.drawRect( 0, -1, 1, 3 );
graphics.drawRect( 0, 0, 1, 1 );
graphics.endFill();
}
}