flash on 2011-5-20
/**
* Copyright kenji_special ( http://wonderfl.net/user/kenji_special )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/juFK
*/
package {
import flash.display.BlendMode;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.easing.Back;
import org.libspark.betweenas3.easing.Circ;
import org.libspark.betweenas3.tweens.ITween;
public class FlashTest extends Sprite {
private var r:int = 100;
public function FlashTest() {
var timer:Timer = new Timer(5, 100);
timer.start();
timer.addEventListener(TimerEvent.TIMER, TimerLoop);
}
private function TimerLoop(event:TimerEvent):void
{
var sp:Sprite = new Sprite();
sp.scaleX = sp.scaleY = 0.01;
sp.graphics.beginFill(0xff0000, 0.3);
sp.graphics.drawCircle(0, 0, 30* (Math.random()*0.9 + 0.1));
sp.x = stage.stageWidth/2;
sp.y = stage.stageHeight/2;
addChild(sp);
var tween1:ITween= BetweenAS3.tween(
sp,
{scaleX: 1, scaleY:1},
{scaleX: sp.scaleX, scaleY: sp.scaleY},
0.3,
Circ.easeOut
);
var tween2:ITween= BetweenAS3.tween(
sp,
{x:(r -sp.width/2)*Math.random() * Math.cos(Math.random()*2*Math.PI) + stage.stageWidth/2, y: (r-sp.width/2) *Math.random()* Math.sin(Math.random() * 2 * Math.PI) + stage.stageWidth/2}, // Parameter object (Destination value)
{x:sp.x, y:sp.y},
0.4,
Back.easeOut
);
var tween3:ITween = BetweenAS3.delay(tween2, 0.1);
tween1.play();
tween3.play();
}
}
}