日常の進捗

主に自分のための,行為とその習慣化の記録

まっすぐな線が引けない

f:id:takawo:20170801171208j:plain

f:id:takawo:20170801171215j:plain

まるで人生のようだ。

float offset = 100;
float step = (width - offset * 2)/10;
size(960, 540); // ウィンドウサイズを960px,540pxに
colorMode(HSB, 360, 100, 100); // HSBでの色指定にする
translate(width*1/4, 0);
int t = 1;
int n = 0;
strokeCap(PROJECT);
for (float y = offset; y <= height*3; y = y+step) {
  strokeWeight(step/t);
  stroke(0,0,0);
  line(0, y, y, 0);
  line(0, y, -y, 0);
  if(n%2 == 0){
    stroke(0,80,100);
  }else{
    stroke(0,0,80);
  }
  strokeWeight(step/t-4);
  line(0, y, y, 0);
  line(0, y, -y, 0);
  n++;
} 
size(960, 540);
float offset = 50;
float step = (width - offset * 2)/16;
int t = 10;
int n = 0;
strokeCap(PROJECT);
for (float x = offset; x <= width-offset; x = x+step) {
  if (n%2==1) {
    strokeWeight(step/t*1.5);
    line(x-step/t, offset, x-step/t, height-offset);
    line(x+step/t, offset, x+step/t, height-offset);
  } else {
    strokeWeight(step/t);
    point(x, offset);
    point(x, height-offset);
  }
  n = n + 1;
} 

n = 0;
for (float y = offset; y <= height-offset; y = y+step) {
  if (n%2==1) {
    strokeWeight(step/t*1.5);
    line(offset, y-step/t, width-offset, y-step/t);
    line(offset, y+step/t, width-offset, y+step/t);
  } else {
    strokeWeight(step/t);
    point(offset, y);
    point(width-offset, y);
  }
  n = n + 1;
}