forked from: flash on 2009-5-12
// forked from qurumi's forked from: flash on 2009-5-12
// write as3 code here..
package
{
import flash.display.Sprite;
import flash.events.*;
import flash.geom.ColorTransform;
import flash.filters.BlurFilter;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.easing.*;
import org.libspark.betweenas3.tweens.ITween;
[SWF(frameRate="24", backgroundColor="#000000")]
public class lesson3 extends Sprite
{
private var ball:Sprite;
private var ball2:Sprite;
private var _t:ITween;
public function lesson3()
{
init();
addEventListener(Event.ENTER_FRAME, test);
}
private function init():void
{
ball = new Sprite();
addChild(ball);
ball.graphics.beginFill(0x0066cc);
ball.graphics.drawCircle(0,0,40);
ball.graphics.endFill();
ball.x = stage.stageWidth/2;
ball.y = stage.stageHeight/2;
ball2 = new Sprite();
addChild(ball2);
ball2.graphics.beginFill(0x0066cc);
ball2.graphics.drawCircle(0,0,40);
ball2.graphics.endFill();
ball2.x = stage.stageWidth/2;
ball2.y = stage.stageHeight/2;
}
private function test(e:Event=null):void
{
var blur:BlurFilter=new BlurFilter(10,10);
var filters:Array =new Array();
filters.push(blur);
ball.filters = filters;
ball2.filters = filters;
_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.tween(ball, {x: 420}, {x: 50}, 0.5, Cubic.easeInOut),
BetweenAS3.tween(ball, {x: 50}, {x: 420}, 0.5, Cubic.easeInOut)
),
BetweenAS3.serial(
BetweenAS3.tween(ball2, {x:50, y: 50}, {x:420, y: 420}, 0.6, Cubic.easeInOut),
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();
}
}
}