Sarah Keeling; 13-9-65

by sarah @ 4:55 am 24 January 2012

gauntlet_part1_try5

Click to generate different variations.
 

 

//Sarah Keeling's reproduction of Frieder Nake's 13/9/65 
//for Golan Levin's IACD at Carnegie Mellon University, Spring 2012

PVector line0 [];
PVector line1 [];
PVector line2 [];
PVector line3 [];
PVector line4 [];
PVector line5 [];
PVector line6 [];
PVector line7 [];
PVector line8 [];
PVector line9 [];

void setup() {
  size(600, 600);
  strokeWeight( 2 );
  smooth();
  background (255);
  frameRate (10);
}

void mousePressed() {
  loop();
}

void draw () {

  line0 = drawHLine( -20 ); 
  drawDiagonalLines( line0, line1, 4);

  line1 = drawHLine( 40 ); 
  drawVerticalLines( line1, line2, (int) random (3, 4) ); 
  drawDiagonalLines( line1, line2, 1 ); 
  drawDiagonalLines( line1, line2, (int) random (3) );
  drawDiagonalLines( line1, line2, (int) random (3, 5)); 

  line2 = drawHLine( 120 ); 
  drawVerticalLines( line2, line3, 1 ); 
  drawVerticalLines( line2, line3, (int)random (2, 4) ); 
  drawDiagonalLines( line2, line3, (int) random (3, 4)); 

  line3 = drawHLine( 220 ); 
  drawVerticalLines( line3, line4, (int) random (1)); 
  drawDiagonalLines( line3, line4, (int) random(2));
  drawDiagonalLines( line3, line4, (int) random(3, 5));

  line4 = drawHLine( 268 );
  drawVerticalLines( line4, line5, 1 ); 
  drawDiagonalLines( line4, line5, (int) random(2));
  drawDiagonalLines( line4, line5, (int) random(3, 5));

  line5 = drawHLine( 340 );
  drawVerticalLines( line5, line6, (int) random (3)); 
  drawVerticalLines( line5, line6, 3); 
  drawDiagonalLines( line5, line6, (int) random(1));
  drawDiagonalLines( line5, line6, (int)random (3, 4));

  line6 = drawHLine( 390 );
  drawVerticalLines( line6, line7, 2); 
  drawDiagonalLines( line6, line7, (int)random (4));

  line7 = drawHLine( 460 );
  drawVerticalLines( line7, line8, (int) random (2, 4)); 
  drawDiagonalLines( line7, line8, (int)random (2));
  drawDiagonalLines( line7, line8, 0 );

  line8 = drawHLine( 560 );
  drawDiagonalLines( line8, line9, (int)random(2, 4));

  line9 = drawHLine( 650 );


  circles ( 60, 3);
  circles ( 120, 5);

  noLoop();
}

void drawVerticalLines( PVector[] top, PVector[] bottom, int segment) {

  PVector left = top[segment];
  PVector right = top[segment+1];

  noStroke();
  // fill( #FF0000 );
  //ellipse( left.x, left.y, 8, 8);

  int numberOfLines = 20;

  strokeWeight( 1);
  stroke( #000000 ); 
  for ( int i = 0; i< numberOfLines; i++ ) {
    PVector temp = new PVector( (right.x - left.x), (right.y - left.y) );

    float whereItGoes = random(1);    
    line( (temp.x * whereItGoes + left.x), (temp.y * whereItGoes + left.y), 
    (temp.x * whereItGoes + left.x), (temp.y * whereItGoes + left.y) + 200 );
  }
}

void drawDiagonalLines( PVector[] top, PVector[] bottom, int segment) {

  PVector left = top[segment];
  PVector right = top[segment+1];

  noStroke();

  int numberOfLines = 20;

  strokeWeight( 1);
  stroke( #000000 ); 
  for ( int i = 0; i< numberOfLines; i++ ) {
    PVector temp = new PVector( (right.x - left.x), (right.y - left.y) );

    float whereItGoes = random(1);
    line( (temp.x * whereItGoes + left.x), (temp.y * whereItGoes + left.y), 
    (temp.x * (1-whereItGoes + random(.5)) + left.x), (temp.y * whereItGoes +
      left.y) + 150 );
  }
}


PVector[] drawHLine( int yStart ) {

  stroke (0);
  PVector [] tempLine = new PVector[9];
  PVector start = new PVector( 0, yStart );
  tempLine[0] = start;

  fill(255);
  beginShape();
  for ( int i = 0; i< 8; i++ ) {
    PVector next = new PVector( start.x + (int)random( 200 )+50, start.y +
      (int)random(30) - 20);     
    tempLine[i+1] = next ;

    if (i==0) {
      vertex (start.x, start.y);
    } 
    vertex (next.x, next.y );

    start = next;
  }

  vertex (600, 600);
  vertex (0, 600);
  endShape();

  return tempLine;
}

void circles ( int circleSize, int numCircles ) {
  int tempsize;
  stroke (0);
  strokeWeight (1);

  noFill ();
  strokeWeight (1);
  stroke (0);

  for ( int i = 0; i< numCircles; i++ ) {

    tempsize = (int) random ( 10, circleSize );

    if (tempsize/2 < width- tempsize/2) {
      
      ellipse( random( 0, width ), random( 0, height), tempsize, tempsize);
    }
  }
}



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