半径rに内接する美しい×マークを moveTo, lineTo を使用して書きなさい。

by pon
♥0 | Line 23 | Modified 2010-07-01 16:48:29 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var r:uint=50;
            var a:Number = Math.cos(Math.PI/4) * r;
            
            x=100
            y=100
            this.graphics.lineStyle(1,0)
            this.graphics.drawCircle(0,0,r)
            this.graphics.moveTo(a,a);
            this.graphics.lineTo(a*-1,a*-1)
            this.graphics.moveTo(a*-1,a);
            this.graphics.lineTo(a,a*-1);
            
            a=r/Math.sqrt(2)
            this.graphics.drawCircle(100,0,r)
            this.graphics.moveTo(a+100,a)
            this.graphics.lineTo(a*-1+100,a*-1)
            this.graphics.moveTo(a*-1+100,a);
            this.graphics.lineTo(a+100,a*-1);
        }
    }
}