//Jeffrey Kaye
//Interactive Media
//November 29, 2004

//Dot Class - it's snowing!

Dot[] myDots; 
int numDots = 20;
int maxValue = 75;

void setup() {
  size(300, 300);
  noStroke();
  angleMode(DEGREES);
  framerate(60);
  
  myDots = new Dot[numDots]; 
  for(int i=0; i<numDots; i++) { 
    myDots[i] = new Dot(random(height), random(width), random(10, maxValue), maxValue); 
  }

}

void draw() {
  background(255);
  for(int i=0; i<numDots; i++) { 
    myDots[i].update(); 
    myDots[i].display();
  }
}

class Dot {
  float x, y, tempy, yspeed, xspeed, rad, trans, transTemp, angle, sinval, range;
  int myMax;
  boolean place = true;
  
  Dot(float startyi, float startxi, float radi, int myMaxi) {
    y = startyi;
    x = startxi;
    tempy = startyi;
    rad = radi;
    myMax = myMaxi;
  }
  
  void update() {    
    if(x > width+25) {
      x = -25;
      y = tempy;
    }
    getRange();
    getSpeed();
    getTrans();
    x += xspeed;
    angle = angle + yspeed;
    sinval = sin(angle);
  }
  
  void display() {
    fill(150, 180, 250, trans);
    ellipse(x, y+(sinval*range), rad, rad);
  }
  
  void getRange() {
    range = (myMax - rad)*.25;
  }
  
  void getSpeed() {
    xspeed = (myMax - rad)*.025;
    yspeed = (myMax - rad)*.025;
  }
  
  void getTrans() {
    trans = ((myMax-rad)/myMax)*255;
  }
}
Exercise 4.B: Dot
Write your own unique Dot class which has a different behavior than the one presented in the example. Design a kinetic composition with 20 of your Dots.