nick /224 /curves


/* data visualization for sesnon
   by nick lally
*/

int numLines = 10; //number of lines
Line[] lines = new Line[numLines]; //create array for lines

void setup() {
 size(600, 600);
 colorMode(HSB);
 smooth();
 background(255);
 fill(100);

 //initialize starting points of lines
 for (int i = 0; i < numLines; i++) {
   lines[i] = new Line(0 + i*60, 0, random(10));
 }
}

void draw() {
  for (int i = 0; i < numLines; i++) {
    lines[i].move();
  }
}

class Line {
  float x, y; //position
  float prevX, prevY; //previous position
  int count;
  float radius;

  //contructor
  Line(float xpos, float ypos, float r) {
    x = xpos;
    y = ypos;
    radius = r;
  }

  //move method
  void move() {
    prevX = x;
    prevY = y;
    radius += random(.05);
    x = x + sin(radius);
    y = y + cos(radius)+.1;
    color cp;
    float b;
    /*if (int(prevX) != int(x) && int(prevY) != int(y)) {
      cp = get(int(x),int(y));
      b = brightness(cp);
      if (b == 0);
        y = y + 1;
    }*/
   stroke(100);
   point(x, y);
    cp = get(int(x+1),int(y));
    b = brightness(cp);
    if (b != 0){
      stroke(200);
      point(x+1,y);
    }
    cp = get(int(x-1),int(y));
    b = brightness(cp);
    if (b != 0){
       stroke(200);
       point(x-1,y);
        point(x + random(4), y+ random(4));
    }
    stroke(random(220,240));
    point(x + random(1,4), y + random(1,4));
    stroke(random(220,240));
    point(x + random(1,4), y + random(1,4));
    stroke(random(220,240));
    point(x - random(1,4), y - random(1,4));
    stroke(random(220,240));
    point(x - random(1,4), y - random(1,4));


  }

}


Page Details
Contact DANM  |  Digital Arts and New Media  |  Arts Division  |  Grad Division
login