void setup(){
   size(500,500); 
   smooth();
}

void mousePressed(){
   r = new Ring(3);
}

Ring r = new Ring(3);
void draw(){
  background(250,128,0);
  pushMatrix();
  translate(mouseX,mouseY);
  r.draw();
  popMatrix();
}


class Ring{
   // color c = color(random(255),random(255),random(255));;
    color c = color(random(100,255));
    float x = 250;
    float y = 250;
    float sz = random(10,100);
    float w = random(8,12);
    float a;
    float rot = random(-.1,.1);
    
    Ring(int numkids){
        for(int i = 0; i < numkids;i++){
           kids.put(new Float(random(PI*2)),new Ring(numkids - 1)); 
        }
    }
    
    HashMap<Float,Ring>kids = new HashMap<Float,Ring>();
    void draw(){

       a -= rot;
       noFill();
       stroke(c);
       strokeWeight(w);
       pushMatrix();
       ellipse(0,0,sz,sz);
      
        rotate(a);
       for(Float f : kids.keySet()){
           Ring r = kids.get(f);
           pushMatrix();
           rotate(f);
           translate(0,(sz+r.sz)/2);
           r.draw();
           
           popMatrix();

       }
       
       popMatrix();
       
    }
  
}