/**
* Copyright drpt ( http://wonderfl.net/user/drpt )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/g5H4
*/
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.BlurFilter;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.easing.*;
import org.libspark.betweenas3.tweens.ITween;
[SWF(width="400", height="400", frameRate="24", backgroundColor="#000000")]
import flash.events.MouseEvent;
public class FlashTest extends Sprite {
private var ball:Sprite = new Sprite();
private var ball2:Sprite = new Sprite();
private var blur:BlurFilter = new BlurFilter(10,10);
private var _t:ITween;
public function FlashTest() {
// write as3 code here..
init();
this.addEventListener(Event.ENTER_FRAME, move);
}
public function init():void{
ball.graphics.beginFill(Math.random()*0xFF00FF);
ball.graphics.drawCircle(Math.random()*80,Math.random()*70,Math.random()*100);
filters = [blur];
addChild(ball);
ball2.graphics.beginFill(Math.random()*0xFF00FF);
ball2.graphics.drawCircle(Math.random()*80,Math.random()*70,Math.random()*100);
addChild(ball2);
}
public function move(event:Event):void {
_t = BetweenAS3.parallel(
BetweenAS3.serial(
BetweenAS3.tween(ball, {x: 420}, {x: 50}, 0.6, Cubic.easeInOut),
BetweenAS3.tween(ball, {x: 50}, {x: 420}, 0.6, Cubic.easeInOut),
BetweenAS3.bezier(ball, {x: 385, y: 207}, null, {x: [58, 246, 245, 345], y: [60, 80, 167, 209]}),
BetweenAS3.bezier(ball, {x: 58.05, y: 207}, null, {x: [345, 145, 246, 58], y: [209, 167, 80, 60]}),
BetweenAS3.bezier(ball, {x: 385, y: 207}, null, {x: [58, 246, 145, 345], y: [60, 80, 167, 209]})
),
BetweenAS3.serial(
BetweenAS3.bezier(ball2, {x: 385, y: 207}, null, {x: [58.05, 145.9, 246.7, 345.55], y: [61.4, 80.65, 167.05, 209.3]}),
BetweenAS3.tween(ball2, {x:420, y: 420}, {x:50, y: 50}, 0.6, Cubic.easeInOut),
BetweenAS3.tween(ball2, {x:50, y: 50}, {x:420, y: 420}, 0.5, Cubic.easeInOut),
BetweenAS3.tween(ball2, {x:420, y: 420}, {x:50, y: 50}, 0.5, Cubic.easeInOut)
)
);
_t.play();
}
}
}