MENU

99 Lines

99 Lines. The outer ends precess clockwise. The inner ends precess counter-clockwise at half the rate. Simple rules create entrancing patterns. Programmed in the Processing language. Displayed at Projector Party II; Somerville, MA; 2014.

View the code

boolean toggleLoop = false;

 

void setup() {

  noLoop();

  frameRate(80);

  size(800, 800);

  fill(255,255,255,255);

  strokeWeight(3);

}

 

void draw() {

 

  background(#ffffff);

  noStroke();

  ellipse(width/2, height/2, 0.99*min(width, height), 0.99*min(width, height));

  stroke(0,0,0,255);

 

  float revCount = 6300; // multiple of 300

 

  int numEnds = 99; // multiple of 3

  float endRadius = 0.97*min(width/2, height/2);

 

  float[] startX = new float[numEnds];

  float[] startY = new float[numEnds];

  float[] endX = new float[numEnds];

  float[] endY = new float[numEnds];

 

  for (int i = 0; i < numEnds; i = i+1) {

    startX[i] = width/2+endRadius/2*cos(i*TWO_PI/numEnds-(frameCount-1)*TWO_PI/revCount);

    startY[i] = height/2+endRadius/2*sin(i*TWO_PI/numEnds-(frameCount-1)*TWO_PI/revCount);

    endX[i] = width/2+endRadius*cos(i*TWO_PI/numEnds+2*(frameCount-1)*TWO_PI/revCount);

    endY[i] = height/2+endRadius*sin(i*TWO_PI/numEnds+2*(frameCount-1)*TWO_PI/revCount);

  }

 

  for (int i = 0; i < numEnds; i = i+1) {

    line(startX[i], startY[i], endX[i], endY[i]);

  }

  

  if (toggleLoop == false) {

      textBox();

  }

 

}

 

void mousePressed() {

  if (mouseButton == LEFT) {

    if (toggleLoop) { noLoop(); toggleLoop = false; textBox();}

    else { loop(); toggleLoop = true; }

  }

}

 

void textBox() {

  noStroke();

  fill(0,0,0,80);

  rect(0.5*width-0.5*0.7*width,0.5*height-0.5*0.1*height,0.7*width,0.1*height);

  textAlign(CENTER, CENTER);

  textSize(60);

  text("click to start/stop",0.5*width,0.485*height);

  stroke(0,0,0,255);

  fill(255,255,255,255);
}