flash on 2011-11-10
四角形の四つの形状指定:
@author shmdmoto
/**
* Copyright sss ( http://wonderfl.net/user/sss )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/bEUi
*/
package
{
import frocessing.display.F5MovieClip2D;
/**
* 四角形の四つの形状指定:
* @author shmdmoto
*/
public class GraphicExample extends F5MovieClip2D
{
public function setup() : void
{
// ここに描画命令を記述します.
drawGridGuide();
noFill();
// 初期設定の形状指定モード CORNER:左上角, 幅,高さ
rectMode(CORNER);
rect( 0, 100, 100, 50 );
// CORNERS: 左上角,右下角
rectMode(CORNERS);
rect( 200, 80, 300, 200 );
// CENTER: 中心,幅,高さ
rectMode(CENTER);
rect( 100, 300, 100, 120 );
// RADIUS: 中心,半分の幅幅, 半分の高さ
rectMode(RADIUS);
rect( 300, 300, 100, 50 );
// CENTER: 中心,幅,高さ
rectMode(CENTER);
rect( 200, 200, 200, 300 );
/*
var w:Number=50;
var p1:int=200;
var p2:int=50;
var p3:int=350;
var p4:int=200;
rectMode(CENTER);
fill(200,200,200);
rect(p1,p2,w,w);
rect(p2,p1,w,w);
rect(p3,p4,w,w);
rect(p4,p3,w,w);
stroke(0,0,0);
point(p1,p2);
point(p2,p1);
point(p3,p4);
point(p4,p3);
*/
rectMode(CORNERS);
rect(50,50,150,150);
rect(150,150,300,300);
rect(300,300,400,400);
}
// 位置をわかり安くするガイドを表示
public function drawGridGuide() : void
{
var x : int;
var y : int;
stroke(192,192,192);
for( x = 0 ; x < 465 ; x += 50 )
line( x, 0, x, 465);
for( y = 0 ; y < 465 ; y += 50 )
line( 0, y, 465, y);
stroke(0,0,0);
ellipse(100,100,5,5);
ellipse(300,100,5,5);
ellipse(100,300,5,5);
ellipse(300,300,5,5);
}
}
}