円を沢山書いてみた by wonderfl本

by kazuyuki forked from forked from: flash on 2010-2-7 (diff: 16)
♥0 | Line 38 | Modified 2010-02-14 00:17:38 | MIT License
play

ActionScript3 source code

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

// forked from kazuyuki's forked from: flash on 2010-2-7
// forked from kazuyuki's flash on 2010-2-7
package {
	import flash.events.Event;
    import flash.display.MovieClip;
    public class FlashTest extends MovieClip {
        public function FlashTest() {
        		var xList:Array = new Array(100,200,300,250,150);
        		var yList:Array = new Array(500,400,300,200,100);
        		var rList:Array = new Array(10,100,200,20,150);
        		for(var i=0; i<xList.length; i++){
        		var myCircle:DrawCircle = new DrawCircle(xList[i],yList[i],rList[i]);
        		addChild(myCircle);
        		}
        	}
    }
} 
import flash.display.MovieClip;
class DrawCircle extends MovieClip{
	public function DrawCircle(centerX:int, centerY:int, r:int){
            
            graphics.lineStyle(2,0x888888);
            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); 
	}
}

Forked