generative art: fig3-4

あかん, 三日坊主してた. fig3-4までをやった.

f:id:ksumiya0318:20160928014447p:plain

size(500, 100);
background(255);
strokeWeight(5);
smooth();

// float y = height/2;
int xmin = 20;
int xmax = width - xmin;
float xstep = 10;
float ystep = 10;
float xold = xmin;
float yold = height/2;
float y = height/2;
stroke(0, 30);
line(xmin, y, xmax, y);
stroke(0);
for (int x = xmin; x <= xmax; x += xstep) {
  ystep = random(-10, 10);
  y += ystep;
  line(x, y, xold, yold);
  xold = x;
  yold = y;
}
saveFrame( "img.png");