7ball cascade
/**
* Copyright masika ( http://wonderfl.net/user/masika )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/dxWg
*/
// forked from masika's 5ball cascade forked from: 3ball cascade
// forked from masika's 3ball cascade
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;
public class OneBall extends Sprite {
public var _timer:Timer;
public function OneBall() {
init();
}
public function init():void{
_timer=new Timer(3000/7,7)
_timer.addEventListener(TimerEvent.TIMER,ontimer);
_timer.start();
}
private function ontimer(e:TimerEvent):void{
throwup(0,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:100}, null , 0.4),
BetweenAS3.serial(
BetweenAS3.tween(ball, {y:440}, null, 0.2, Cubic.easeOut),
BetweenAS3.tween(ball, {y:400}, null, 0.2, Cubic.easeIn)
)
),
BetweenAS3.parallel(
BetweenAS3.tween(ball, {x:300}, 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:200}, null , 0.4),
BetweenAS3.serial(
BetweenAS3.tween(ball, {y:440}, null, 0.2, Cubic.easeOut),
BetweenAS3.tween(ball, {y:400}, null , 0.2, Cubic.easeIn)
)
),
BetweenAS3.parallel(
BetweenAS3.tween(ball, {x:0}, 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)
)
)
)
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();
}
}