見出し画像

ProcessingでGenerative art#13

パーリンノイズがかなり馴染んできた気がします。やりすぎないように意識してやわらかさを作りました。
ご存知”Wave clock”を自分なりにいじったものです。
これぞGenerative artって感じがして素敵です。

Code

Wave w = new Wave();
void setup() {
  size(960, 540, P3D);
  pixelDensity(2);
  colorMode(HSB, 360, 100, 100, 100);
  bg();
}

void draw() {
  w.run();
}

void mousePressed(){
  bg();
}

void keyPressed(){
  if(key==' ')saveFrame("####.png");
}

void bg(){
  color c1 = color(0);
  color c2 = color(260,50, 30);
  for(float i=1400;i>0; i-=5){
  color c = lerpColor(c1, c2, i / 1400);
  fill(c);
  noStroke();
  ellipse(width/2, height/2, i, i);
  }
}

//----------------------------------------------------------
class Wave {
  float x, y;
  float centerX, centerY;
  float rad = 300;
  float angleX, angleY, angleZ;
  float noiseX, noiseY;
  color col;
  float colNoise;
  
  Wave() {
    angleX = random(TWO_PI);
    angleY = random(TWO_PI);
    angleZ = random(TWO_PI);
    colNoise = random(10);
  }

  void display() {
    col = color(map(noise(colNoise), 0, 1, 150, 360), 10);
    centerX = map(noise(noiseX), 0, 1, width/2 - 200, width/2 + 200);
    centerY = map(noise(noiseY), 0, 1, height/2 - 50, height/2 + 50);
    pushMatrix();
    translate(centerX, centerY);
    rotateY(angleY);
    rotateZ(angleZ);
    rotateX(angleX);
    for (int i=0; i<=360; i+=360/5) {
      float I = radians(i);
      float x = rad * cos(I);
      float y = rad * sin(I);
      strokeWeight(0.5);
      stroke(col);
      noFill();
      line(0, 0, x, y);
      strokeWeight(2);
      point(x, y);
    }
    popMatrix();
  }

  void update() {
    angleX += 0.001;
    angleY += 0.002;
    angleZ+= 0.0014;
    colNoise += 0.001;
    noiseX += 0.0006;
    noiseY += 0.0001;
  }

  void run() {
    update();
    display();
  }
}

Happy coding!



応援してくださる方!いつでもサポート受け付けてます!