> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://processing-101.sketchpad.cc/sp/pad/view/ro.bYe2qTd$bXs/rev.2
 * 
 * authors: 
 *   Ben Chun

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



/**
 * BubbleField
 * by Ben Chun
 *
 **/

class Bubble
{
  float x, y;
  int d, v;

  void show()
  {
    ellipse(x,y, d,d);
  }
  
  void move()
  {
    x += ( mouseX - width/2  ) * 0.01 * v;
    y += ( mouseY - height/2 ) * 0.01 * v;
  }

}


Bubble[] s;


void setup()
{
  size(470,470);
  smooth();
  stroke(240);
  fill(255,230);

  s = new Bubble[1000];
  for(int i=0; i<s.length; i++)
  {
    s[i] = new Bubble();
    s[i].x = random(-width,width*2);
    s[i].y = random(-height,height*2);
    s[i].d = (int)random(10,90);
    s[i].v = (int)random(1,10);
  } 
}

void draw()
{
  background(135,206,250);
  for(int i=0; i<s.length; i++)
  {
    s[i].move();
    s[i].show();
  } 
}