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

ルーローの三角形を正方形内で転がしたときの中心→頂点の軌跡

Get Adobe Flash player
by keno42 05 Apr 2010
    Embed
/**
 * Copyright keno42 ( http://wonderfl.net/user/keno42 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/74hS
 */

package  
{
	import flash.display.Sprite;
	public class Test extends Sprite
	{
		
		public function Test() 
		{
			this.x = 80;
			this.y = 80;
			for ( var i:Number = 0; i < 90; i+= 1 ) {
				var angle:Number = Math.PI * i / 180;
				var r:Number = 400;
				this.graphics.lineStyle(0, 0x00FF00);
				this.graphics.moveTo(0, 0);
				var toX:Number = 0;
				var toY:Number = 0;
				if ( i < 30 ) {
					toX = 0.5 * r * Math.sqrt(3) - r * Math.cos( angle );
					toY = - 0.5 * r * Math.sqrt(3) + r * Math.cos( angle - (30 * Math.PI / 180) );
				} else if ( i > 60 ) {
					toX = - 0.5 * r * Math.sqrt(3) + r * Math.cos( angle - (60 * Math.PI / 180) );
					toY = 0.5 * r * Math.sqrt(3) - r * Math.cos( angle - (90 * Math.PI / 180) );
				} else {
					toX = Math.sqrt(3) * r * 0.5 * (2 * Math.sin(angle + (60 * Math.PI / 180)) - 1) - r * Math.cos(angle);
					toY = Math.sqrt(3) * r * 0.5 * (2 * Math.sin(angle + (30 * Math.PI / 180))  - 1) - r * Math.sin(angle);
				}
				this.graphics.moveTo(toX, toY);
				this.graphics.lineStyle(0, 0x0000FF, 0.2);
				this.graphics.lineTo(toX + r * Math.cos(angle), toY + r * Math.sin(angle));
				
			}
		}
		
	}

}