ランダムネスを加えた渦巻きを重ねる [generative art, fig4.5a]

昼のprocessing

ランダムネスを加えた渦巻きを重ねる.
fig4.5a

f:id:ksumiya0318:20160929165337p:plain

size(1000, 1000);
background(255);
smooth();


float angminBase =     0;
float angmaxBase = 4*360;
float x, y;

int imin =    0;
int imax = 1000;

for (int i = imin; i < imax; i++) {
  float xold = 0;
  float yold = 0;
  float seed = random(255);
  float radius = 10;
  float centFluctx = noise(width *seed) * width  / PI;
  float centFlucty = noise(height*seed) * height / PI;
  stroke(abs(sin(seed*seed))*255, abs(cos(seed))*255, seed, random(seed));
  strokeWeight(2*noise(seed));

  float centx = width/2  + random(2*centFluctx) - centFluctx;
  float centy = height/2 + random(2*centFlucty) - centFlucty;
  float noiseCoe = 100;
  float angmin = int(random(angminBase));
  float angmax = angmaxBase + int(random(angmaxBase));
  float angstep = 5 + int(random(3));
  
  for (float ang = angmin; ang <= angmax; ang += angstep) {
    seed   += 0.05;
    radius += 0.5;
    float thisRadius = radius + noiseCoe * (2 * noise(seed) - 1);
    float rad = radians(ang);
    x = centx + thisRadius*cos(rad);
    y = centy + thisRadius*sin(rad);
    
    if (ang != angmin) {
      line(x, y, xold, yold);
    }
    xold = x;
    yold = y;
  }
}

saveFrame("img.png");