forked from: flash on 2009-12-31

by naokey0221
AS Practice: drawing two circles
Original Code: 010213
Textbook: "It's a wonderfl World"
♥0 | Line 44 | Modified 2010-06-01 22:58:10 | MIT License
play

ActionScript3 source code

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

// forked from JustinO's flash on 2009-12-31
// AS Practice: drawing two circles
// Original Code: 010213
// Textbook: "It's a wonderfl World"
package { 
    import flash.display.MovieClip; 
    public class Index extends MovieClip { 
        public function Index() { 
           var myCircle1:drawCircle = new drawCircle(); 
           var myCircle2:drawCircle = new drawCircle();
           myCircle1.x = 50;
           myCircle2.y = 100;
           addChild(myCircle1);
           addChild(myCircle2);
        } 
    } 
} 
import flash.display.MovieClip; 
class drawCircle extends MovieClip { 
        public function drawCircle() { 
            var centerX:Number = 100; 
            var centerY:Number = 200; 
            var r:Number = 50; 
             
            graphics.moveTo(centerX+r, centerY); 
            graphics.lineStyle(2, 0x0FFCC00); //線の色:黄色で書き出し 
                    
            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.lineStyle(2, 0x0FF0006); //以下、線の色を赤で描画 
                      
            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); 
        } 
    }