Tweenerによるベジェ曲線のトゥイーン
Tweener 1.31.74
package
{
import flash.display.Sprite;
//Tweener 1.31.74
import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;
[SWF(width = 400, height = 400, frameRate = 30, backgroundColor = 0xFFFFFF)]
public class Main extends Sprite
{
private var ball:Sprite;
public function Main():void
{
CurveModifiers.init();
graphics.lineStyle(1, 0x336699);
graphics.moveTo(0, 0);
graphics.curveTo(400, 0, 200, 200);
graphics.curveTo(0, 400, 400, 400);
graphics.lineStyle();
ball = new Sprite();
ball.graphics.beginFill(0x000000);
ball.graphics.drawCircle(0, 0, 5);
ball.graphics.endFill();
addChild(ball);
loopTween();
}
private function loopTween():void
{
if (ball.x == 0)
{
Tweener.addTween(ball, { x:400, y:400, _bezier:[ { x:400, y:0 }, { x:0, y:400 } ], time:5, onComplete:loopTween } );
}
if (ball.x == 400)
{
Tweener.addTween(ball, { x:0, y:0, _bezier:[ { x:0, y:400 }, { x:400, y:0 } ], time:5, onComplete:loopTween } );
}
}
}
}