flash on 2011-12-6
/**
* Copyright danlab ( http://wonderfl.net/user/danlab )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/bcE0
*/
package {
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
// Sprite インスタンスを生成する
var myLine:Sprite = new Sprite();
var theta:Number;
var r:int;
var i:int;
// スタイルの設定
myLine.graphics.lineStyle( 0, 0xFFFF00, 1.0 );
myLine.graphics.beginFill( 0xFFFF00, 1.0 );
// 線の描画
theta = 0.0 - Math.PI / 2;
myLine.graphics.moveTo( 550 / 2 + 100 * Math.cos( theta ), 400 / 2 + 100 * Math.sin( theta ) );
for( i = 1; i <= 10; i++ ){
if( i % 2 == 0 ){
r = 100;
}
else{
r = Math.sin( 18 * 2 * Math.PI / 360 ) / Math.sin( 126 * 2 * Math.PI / 360 ) * 100;
}
theta = i * 2 * Math.PI / 10 - Math.PI / 2;
myLine.graphics.lineTo( 550 / 2 + r * Math.cos( theta ), 400 / 2 + r * Math.sin( theta ) );
}
// ステージに表示する
addChild( myLine );
}
}
}