つよくなりたいなあ

地に足をつけず世界を生きぬくブログです

181024

@deconbatchさんのnote記事見てrandomをnoiseに変換してみたやつ

note.mu

/*
 * 2018/10/24
 * 
 */

void setup() {
  size(720, 720);
  colorMode(HSB, 360, 1, 1, 1);
  smooth();
  noFill();
  frameRate(60);
}


void draw() {
  background(0, 0, 0, 1);
  translate(width/2, height/2);

  int drawCntMax = 16;
  float hueBase = random(360);

  for (int drawCnt = 0; drawCnt < drawCntMax; drawCnt++) {
    float seed = random(0.01,0.02);
    float scope = 130.0;
    float pA = seed * floor(random(-scope, scope));
    float pB = seed * floor(noise(scope, scope));
    float pC = seed * floor(random(-scope, scope));
    float pD = seed * floor(random(scope, -scope));

    float prevX = random(-2.0, 4.0);
    float prevY = random(-4.0, 2.0);

    float hueApply = (hueBase + (drawCnt % 3) * 45.0) % 360.0;
    float satApply = map(drawCnt % 6, 0, 5, 20.0, 20.0);
    float briApply = map(drawCnt % 5, 0, 4, 40.0, 60.0);
    int lineCntMax = floor(map(drawCnt, 0, drawCntMax, -30, 60));
    strokeWeight(map(drawCnt % 4, 0, 3, 0.2, 0.8));

    rotate(PI * 0.25);

    for (int i = 0; i < lineCntMax; i++) {
      float currX = sin(pA * prevY) - cos(pB * prevX);
      float currY = sin(pC * prevX) - cos(pD * prevY);

      stroke(hueApply, satApply, briApply, 100.0);
      strokeWeight(1.5);
      line(
        prevX * width/6.0, prevY * height/6.0, 
        currX * width/6.0, currY * height/6.0
        );

      prevX = currX;
      prevY = currY;
    }
  }
}

f:id:heyassy:20181027222454p:plain