In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

BetweenAS3で丸?

...
@author tatzuya
Get Adobe Flash player
by tatzuya 06 Jun 2011
    Embed
package 
{
	import flash.display.SpreadMethod;
	import flash.display.Sprite;
	import flash.events.Event;
	
	import org.libspark.betweenas3.BetweenAS3;
	import org.libspark.betweenas3.easing.*;
	import org.libspark.betweenas3.tweens.ITween;
	import org.libspark.betweenas3.events.TweenEvent;
	
	
	/**
	 * ...
	 * @author tatzuya
	 */
	public class Main extends Sprite 
	{
		private var sp:Sprite = new Sprite();
		private var myTween:ITween;
		private var myStage:Sprite = new Sprite();
		private var myRadius:Number = 200;
		private var myCtrl:Number = myRadius*0.425;
		
		public function Main():void 
		{
			sp.graphics.beginFill(0xff0000);
			sp.graphics.drawCircle(250, 250, 10);
			addChild(sp);			
			myStage.graphics.lineStyle(5, 0x000000);
			myStage.graphics.moveTo(-myRadius,0);
			myStage.y = 250;
			myStage.x=250;
			addChild(myStage);
			setTween();
		}
		
		private function myDrawLine(e:Event = null):void 
		{
			myStage.graphics.lineTo(sp.x, sp.y);
		}

		private function setTween():void {
			myTween = BetweenAS3.serial(
				BetweenAS3.bezier(sp, { x:0, y:myRadius }, { x:-myRadius, y:0 }, { x: [-myRadius, -myCtrl], y: [myCtrl, myRadius] }, 1 ),
				BetweenAS3.bezier(sp, { x:myRadius, y:0 }, null, { x: [myCtrl, myRadius], y: [myRadius, myCtrl ] }, 1),
				BetweenAS3.bezier(sp, { x:0, y:-myRadius }, null, { x: [myRadius, myCtrl], y: [-myCtrl, -myRadius ] }, 1 ),
				BetweenAS3.bezier(sp, { x:-myRadius, y:0 }, null, { x: [-myCtrl,-myRadius], y: [-myRadius,-myCtrl ] }, 1 )
			);
			BetweenAS3.delay(myTween, 1).play();
			myTween.addEventListener(TweenEvent.UPDATE, myDrawLine);
		}
	}
}