【Processing】くるくるねじねじ

 

float a = 0;
float b = 100;
float c = 200;

void setup() {
  size(800, 800, P3D);
}


void draw() {
  background(255);


  rotate(45);
  translate(500, -650, -300);

  strokeWeight(3);
  line(0, 0, 0, 1000);

  for (int i = 0; i <= 200; i++) {
    pushMatrix();
    translate(0, i*5);
    drawline(0, 0, a+i*5, 30);
    popMatrix();
  }

  a ++;
  b+=0.005;
}

void drawline(int x, int y, float g, float len) {

  rotate(radians(g));
  strokeWeight(1);
  stroke(0, 20);
  line(x, y, x + len, y);
  translate(x + len, 0);
  g = map(noise(b), 0, 1, 0, 30);
  if (len > 1) {
    drawline(x, y, g, len/1.01);
  }
}