CraigFahner-13-9-65

by craig @ 12:48 am 24 January 2012

Processing Code

size(600, 600);
smooth();
strokeWeight(2);
background(255);
int[] yLines = new int[9];
int[] yVariations = new int[8];
int[] xVariations = new int[8];
int[] xSteps = new int[8];
int[] ySteps = new int[8];
int[][] xCoord = new int[9][8];
int[][] yCoord = new int[9][8];
int xCumulative = 0;
int yCumulative = 0;
 
 
//draw bounding box
line(0, 0, 0, width-1);
line(0, 0, width-1, 0);
line(width-1, 0, width-1, width-1);
line(0, width-1, width-1, width-1);
 
// determine distance between horizontal lines
for (int i = 0; i<9; i++) {
  yLines[i] = int(random(40, 90));
}
 
//draw horizontal lines
for (int q=0; q<9; q++) {
 
  yCumulative = yCumulative + yLines[q];
  for (int n = 0; n<8; n++) {
    yVariations[n] = int(random(-20, 20));
    xVariations[n] = int(random(60, 110));
    xCumulative = xCumulative+xVariations[n];
    xSteps[n] = xCumulative;
    println(xCumulative);
  }
  xCoord[q][0]=0;
  yCoord[q][0]=yCumulative;
  xCoord[q][1]=xSteps[0];
  yCoord[q][1]=yCumulative+yVariations[0];
  line(xCoord[q][0], yCoord[q][0], xCoord[q][1], yCoord[q][1]);
  for (int z = 0; z<5; z++) {
    xCoord[q][z+1]=xSteps[z];
    yCoord[q][z+1]=yCumulative+yVariations[z];
    line(xSteps[z], yCumulative+yVariations[z], xSteps[z+1], yCumulative+yVariations[z+1]);
  }
  xCoord[q][6]=xSteps[5];
  yCoord[q][6]=yCumulative+yVariations[5];
  xCoord[q][7]=width;
  yCoord[q][7]=yCumulative+yVariations[6];
  line(xSteps[5], yCumulative+yVariations[5], width, yCumulative+yVariations[6]);
  xCumulative = 0;
}
 
 
//draw vertical lines
for (int c = 0; c<8; c++) {
  for (int i = 0; i<7; i++) {
    int rando1 = int(random(4));
    if (rando1 == 1) {
      for (int d = 0; d<18; d++) {
        int vx1 = int(random(xCoord[c][i], xCoord[c][i+1]));
        int vx2 = 0;
        if (xCoord[c+1][i]  xCoord[c][i+1]) {
          vx2 = vx1;
        } 
        else {
          vx2 = int(random(xCoord[c+1][i], xCoord[c+1][i+1]));
        }
        int vy1 = int(map(vx1, xCoord[c][i], xCoord[c][i+1], yCoord[c][i], yCoord[c][i+1]));
        int vy2 = int(map(vx2, xCoord[c+1][i], xCoord[c+1][i+1], yCoord[c+1][i], yCoord[c+1][i+1]));
        line(vx1, vy1, vx2, vy2);
      }
    }
  }
}
 
 
//draw circles
int rando2 = int(random(5, 10));
 
for (int i = 0; i<rando2; i++) {
  fill(0, 0, 0, 0);
  int diam = int(random(4, 120));
  ellipse(random(0, width), random(0, width), diam, diam);
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2024 Interactive Art and Computational Design, Spring 2012 | powered by WordPress with Barecity