nick /224 /oop_oneclass

/* data visualization for sesnon
   by nick lally
*/

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

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

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

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

class Line {
  float x, y; //position

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

  //move method
  void move() {
    x = x + random(-1, 1);
    y = y + 1;
    point(x,y);
  }
}

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