図形の描画

セミコロン ; を忘れずに!

線を引く

line(x1, y1, x2, y2);
  • x1, y1:始点の座標
  • x2, x2:終点の座標

四角を描く

rect(x, y, w, h);
  • x:x座標
  • y:y座標
  • w:横幅
  • h:高さ

square

円を描く

ellipse(x, y, w, h);
  • w:x方向(横)の直経
  • h:y方向(縦)の直径

ellipse

三角形を描く

triangle(x1, y1, x2, y2, x3, y3);

サンプル

size(400, 400);
triangle(200, 20, 40, 300, 300, 350);

triangle

基本はこの4つ。

補足

あとに描いた図形が下の図形を上書きする。

plus_alpha

results matching ""

    No results matching ""