forked from: 2010-6-5 まるをかいてみる(curve to)

by ameo
♥0 | Line 29 | Modified 2010-06-06 11:47:53 | MIT License
play

ActionScript3 source code

/**
 * Copyright ameo ( http://wonderfl.net/user/ameo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xJYH
 */

// forked from ameo's 2010-6-5 まるをかいてみる(curve to)
package {
    import flash.display.MovieClip;
    public class Index extends MovieClip {
        public function Index() {
        	   var xList:Array = [100,200,150,80,190];
        	   var yList:Array = [100,100,15,230,190];
        	   var rList:Array = [10,20,40,80,160];
        	   
        	   for(var i=0; i < xList.length; i++ ){
        	   var Circle:DrawCircle = new DrawCircle(xList[i],yList[i],rList[i]);
           addChild(Circle);

        	   }
        }
    }
}

    import flash.display.MovieClip;
    class DrawCircle extends MovieClip {
        public function DrawCircle(centerX:Number,centerY:Number,r:Number) {
         
            graphics.lineStyle(10,0x2ca9e1,1);
            graphics.moveTo(centerX+r,centerY);
            
            graphics.curveTo(r+centerX,Math.tan(Math.PI/8)*r+centerY,Math.sin(Math.PI/4)*r+centerX,Math.sin(Math.PI/4)*r+centerY);
            graphics.curveTo(Math.tan(Math.PI/8)*r+centerX,r+centerY,centerX,r+centerY);
            graphics.curveTo(-Math.tan(Math.PI/8)*r+centerX,r+centerY,-Math.sin(Math.PI/4)*r+centerX,Math.sin(Math.PI/4)*r+centerY);
            graphics.curveTo(-r+centerX,Math.tan(Math.PI/8)*r+centerY,-r+centerX,centerY);
            graphics.curveTo(-r+centerX,-Math.tan(Math.PI/8)*r+centerY,-Math.sin(Math.PI/4)*r+centerX,-Math.sin(Math.PI/4)*r+centerY);
            graphics.curveTo(-Math.tan(Math.PI/8)*r+centerX,-r+centerY,centerX,-r+centerY);
            graphics.curveTo(Math.tan(Math.PI/8)*r+centerX,-r+centerY,Math.sin(Math.PI/4)*r+centerX,-Math.sin(Math.PI/4)*r+centerY);
            graphics.curveTo(r+centerX,-Math.tan(Math.PI/8)*r+centerY,r+centerX,centerY);
 
        }
    }