forked from: 図形を描こう
forked from 図形を描こう (diff: 11)
ActionScript3 source code
/**
* Copyright umhr ( http://wonderfl.net/user/umhr )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mRb4
*/
// forked from umhr's 図形を描こう
package {
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var shikaku:Sprite = new Sprite();
shikaku.graphics.beginFill(0xFF0000,0.5);
shikaku.graphics.drawRect(20,20,50,50);
shikaku.graphics.endFill();
this.addChild(shikaku);
var waku:Sprite = new Sprite();
//waku.graphics.beginFill(0xFF0000,0.5);
waku.graphics.lineStyle(0,0x00FF00);
waku.graphics.drawRect(-25,-25,50,50);
waku.graphics.endFill();
waku.x = 100;
waku.y = 100;
waku.rotation = 45;
this.addChild(waku);
var maru:Sprite = new Sprite();
maru.graphics.beginFill(0x00FF00,0.5);
maru.graphics.drawCircle(120,40,30);
maru.graphics.endFill();
this.addChild(maru);
/*
var sen:Sprite = new Sprite();
sen.graphics.lineStyle(2,0x00FF00);
sen.graphics.moveTo(200,200);
sen.graphics.lineTo(250,300);
sen.graphics.lineTo(350,250);
sen.graphics.lineTo(400,350);
this.addChild(sen);
var kyokusen:Sprite = new Sprite();
kyokusen.graphics.lineStyle(2,0x0000FF);
kyokusen.graphics.moveTo(200,200);
kyokusen.graphics.curveTo(150,200,250,300);
kyokusen.graphics.lineTo(350,250);
kyokusen.graphics.lineTo(400,350);
this.addChild(kyokusen);
var fune:Sprite = new Sprite();
fune.graphics.lineStyle(2,0xFF0000);
fune.graphics.moveTo(0,0);
fune.graphics.curveTo(100,100,200,0);
fune.graphics.lineTo(0,0);
fune.graphics.drawRect(130,-50,20,50);
fune.graphics.endFill();
fune.x = 200;
fune.y = 200;
this.addChild(fune);
*/
var line:Sprite = new Sprite();
line.graphics.lineStyle(2,0xFF00FF);
line.graphics.moveTo(0,0);
line.graphics.lineTo(Math.cos(30*0 * Math.PI/180)*100,Math.sin(30*0 * Math.PI/180)*100);
line.graphics.moveTo(0,0);
line.graphics.lineTo(Math.cos(30*1 * Math.PI/180)*100,Math.sin(30*1 * Math.PI/180)*100);
line.graphics.moveTo(0,0);
line.graphics.lineTo(Math.cos(30*2 * Math.PI/180)*100,Math.sin(30*2 * Math.PI/180)*100);
line.graphics.moveTo(0,0);
line.graphics.lineTo(Math.cos(30*3 * Math.PI/180)*100,Math.sin(30*3 * Math.PI/180)*100);
line.x = 220;
line.y = 220;
this.addChild(line);
}
}
}
