Generative sketches with Processing #1

void setup(){
  size(800, 800);
  background(#eeeeee);
  noLoop();
}

void draw(){
  background(#eeeeee);
  translate(width/2, height/2);
  for (int a = 0; a<360; a +=1){
    float x = random(130, 150);
    float xx = random(100, 350);
    pushMatrix();
    rotate(radians(a));
    strokeCap(ROUND);
    if (abs(x - xx)<20){
      strokeWeight(5);
      stroke(50);
      line(x, 0, xx, 0);
    }else{
      strokeWeight(2);
      stroke(300, 100, random(20, 200));
      line(x, 0, xx, 0);
      stroke(100);
      circle(x, 200, 100);
      stroke(50);
      circle(x*2, 200, 100);
      stroke(50);
      circle(x*3, 200, 100);
    } 
    popMatrix();
  }
}

void keyPressed(){
  redraw();
}

Leave a Comment