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

forked from: 曲線が描かれる。(成功例)

Get Adobe Flash player
by pykgg476 06 Aug 2009
    Embed
/**
 * Copyright pykgg476 ( http://wonderfl.net/user/pykgg476 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/4l2U
 */

// forked from pykgg476's 曲線が描かれる。(失敗例)
package {
	import flash.display.Sprite;

	public class MultiCurves extends Sprite
	{
		private var numPoints:uint = 9;
		
		public function MultiCurves()
		{
			init();
		}
		
		private function init():void{
			var points:Array = new Array();
			for(var i:int = 0;i< numPoints; i++){
				points[i] = new Object();
				points[i].x = Math.random() * stage.stageWidth;
				points[i].y = Math.random() * stage.stageHeight;
			}
			graphics.lineStyle(1);
			
			graphics.moveTo(points[0].x,points[0].y);
			
			for(i = 1;i < numPoints-2; i++){
				var xc:Number = (points[i].x + points[i+1].x)/2
				var yc:Number = (points[i].y + points[i+1].y)/2
				graphics.curveTo(points[i].x , points[i].y , xc , yc);
			}
			
			graphics.curveTo(points[i].x , points[i].y , points[i+1].x , points[i+1].y);
		}
	}
}