Circle Test #2

by Zahurdias.Calimero forked from flash on 2010-3-22 (diff: 55)
♥0 | Line 31 | Modified 2012-12-01 10:12:26 | MIT License
play

ActionScript3 source code

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

// forked from shotaroyama's flash on 2010-3-22
package {
    import flash.display.Sprite;
    //import flash.display.MovieClip;
    
    public class Index extends Sprite{
         public function Index(){
         addChild(new DrawCircle(100,100,45));
         addChild(new myCircle(200,100,45));
         }
    }
} //end package

// start of package

     import flash.display.Sprite;

     class DrawCircle extends Sprite {
        public function DrawCircle(centerX:Number,centerY:Number,r:Number) {
            graphics.lineStyle(2,0x000000);
            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);
    }
} // end package 

// start of package



     import flash.display.Sprite;



     class myCircle extends Sprite {

        public function myCircle(centerX:Number,centerY:Number,r:Number) {
             graphics.lineStyle(2,0x000000);
             graphics.drawCircle(centerX, centerY ,r);
        }

} // end package