2in1hand
/**
* Copyright masika ( http://wonderfl.net/user/masika )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/smiC
*/
package {
import flash.display.Sprite;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.tweens.ITween;
import org.libspark.betweenas3.easing.*;
import flash.events.TimerEvent;
import flash.utils.Timer;
[SWF(backgroundColor="#FFFFFF", frameRate=60)]
public class OneBall extends Sprite {
public var _timer:Timer;
public function OneBall() {
init();
}
public function init():void{
_timer=new Timer(1400/2,2)
_timer.addEventListener(TimerEvent.TIMER,ontimer);
_timer.start();
}
private function ontimer(e:TimerEvent):void{
throwup(230,400,0)
}
private function throwup(_x:Number,_y:Number,delay:Number):void{
var ball:Ball=addNewBall(_x,_y);
var t1:ITween;
t1=BetweenAS3.serial(
BetweenAS3.parallel(
BetweenAS3.tween(ball, {x:160}, null , 1.2),
BetweenAS3.serial(
BetweenAS3.tween(ball, {y:40}, null, 0.6,Cubic.easeOut),
BetweenAS3.tween(ball, {y:400}, null , 0.6, Cubic.easeIn)
)
),
BetweenAS3.parallel(
BetweenAS3.tween(ball, {x:230}, null , 0.2),
BetweenAS3.serial(
BetweenAS3.tween(ball, {y:440}, null, 0.1,Cubic.easeOut),
BetweenAS3.tween(ball, {y:400}, null , 0.1, Cubic.easeIn)
)
)
)
t1.stopOnComplete = false;
t1.play();
}
private function addNewBall(x:Number,y:Number):Ball
{
var ball:Ball = new Ball();
ball.x = x;
ball.y = y;
addChild(ball);
return ball;
}
}
}
import flash.display.Sprite;
internal class Ball extends Sprite
{
public function Ball()
{
graphics.beginFill(0);
graphics.drawCircle(0, 0, 10);
graphics.endFill();
}
}