fig4.8 円に沿ったランダム(my noise): generative art

fig4.8 円に沿ったランダム(my noise)
processing
generative art

f:id:ksumiya0318:20161014215859p:plain

void setup(){
  size(500,300);
  background(255);
  strokeWeight(5);
  smooth();
  
  float radBase = 100;
  float centx = width/2;
  float centy = height/2;
  
  stroke(0, 30);
  noFill();
  ellipse(centx, centy, 2*radBase, 2*radBase);
  
  stroke(0);
  strokeWeight(1);
  
  float x, y;
  float seed = random(10);
  float radFluct, rad, theta;
  
  beginShape();
  fill(0, 50);
  for (theta = 0; theta <= 2*PI; theta += 2*PI/360){
    seed += 0.1;
    radFluct = 30 * myNoise(seed);    
    rad = radBase + radFluct;
    x = centx + (rad * cos(theta));
    y = centy + (rad * sin(theta));
    
    curveVertex(x, y);
  }
  endShape();

  saveFrame("img.png");
}

float myNoise(float value){
  int count = int((value % 12));
  float retValue = pow(sin(value), count);
  return retValue;
}