curveToを使って円を描く
/**
* Copyright tomonori855 ( http://wonderfl.net/user/tomonori855 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8rBe
*/
// forked from tomonori855's 三角関数を使って円を描く
// forked from tomonori855's forked from: forked from: 線を描くクラスを使って線を描く
package {
import flash.display.Sprite;
public class DrawCircle3 extends Sprite {
public function DrawCircle3(){
var centerX:Number = 100;
var centerY:Number = 200;
var r:Number = 50;
graphics.lineStyle(2, 0xFF0006);
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);
}
}
}