title: Processing following control
body: <p>Processing code as below:</p>
  
  <pre><code>int maxCircle = 200;
  float minDistance=2;
  float distance;
  Circle [] circles= new Circle[maxCircle];
  
  
  void setup(){
    size(800,800);
    smooth();
    for(int i=0;i&lt;maxCircle;i++){
     circles[i] = new Circle(random(width),random(height),random(2,20));
    }
   }
  
   void draw(){
     background(255,255);
     for(int i=0;i&lt;maxCircle;i++){
     circles[i].update(width,height);
  
  
   for(int j=0;j&lt;maxCircle;j++){
    distance = dist(circles[i].x,circles[i].y,circles[j].x,circles[j].y);
    if(distance&lt;minDistance){
      stroke(0,50);
      noFill();
      line(circles[i].x,circles[i].y,circles[j].x,circles[j].y);}}
  
  
  circles[i].display();
  
   }
  
  }
  
   void mouseMoved(){
     for(int i = 0; i&lt;maxCircle;i++){
      circles[i].x+=(mouseX-circles[i].x)*.2;
      circles[i].y+=(mouseX-circles[i].y)*.2;}}
  
  
  
  
    class Circle{
        float x,y,vx,vy,r,speed;
  
    Circle(float tempx, float tempy, float tempr){  
       x=tempx;
       y=tempy;
       vx=random(-1,1);
       vy=random(-1,1);
       r=tempr;
      }
  
    void update(int w,int h){
     x+=vx;
     y+=vy;
  
     if(x&lt;r || x&gt;w-r){
       vx*=-1;};
     if(y&lt;r || y&gt;h-r){
       vy*=-1;};
      }
  
  
     void display(){
        fill(0,50);
        noStroke();
        ellipse(x,y,r,r);
      }  
  
      } 
  </code></pre>
  
  <p>Two questions:</p>
  
  <ol>
  <li><p>Why doesn't the line function work?</p></li>
  <li><p>How can i make circles move smoothly(respectively) following my mouse instead of squeezing into one point abruptly?</p></li>
  </ol>