Processing - 01 - translate와 rotate 및 PI를 사용한 드로잉

7624 단어 processing

void setup () {
  size (600, 600);
}

void draw () {
  background (100);
  smooth ();
  strokeWeight (50);              //lineの太さ 

  translate(width/2, height /2);  //座標軸を 画面サイズの中央に
  stroke (255);                   //lineの色            
  line (0, 0, 250, 0);

  rotate(PI/6);                   //180度/6 = 30度→座標軸を 30°回転
  stroke (233.25);                //255 - 21.25 = 233.25
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (212.5);
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (191.25);
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (170);
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (148.25);
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (127.5);
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (106.25);
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (85.5);
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (63.75);
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (42.5);
  line (0, 0, 250, 30);

  rotate(PI/6);
  stroke (21.25);
  line (0, 0, 250, 30);
}

좋은 웹페이지 즐겨찾기