repeat untilbreak [
  logo backcolor = buttonchoice "Select background color" "white|black|darkblue"
  set density = buttonchoice "Density" "1|2|3|5|10|15|20|30"
  set ballscale = buttonchoice "Size of little balls" "None|2|4|8|12"
  if :ballscale = "none" [ set ballscale = 0 ]
  else [ set ballscale = calc 100 / :ballscale ]
  
  message "Click with mouse on graphic area" "Done"
  logo linethick 0.5
  repeat untilbreak [
    pu
    getkey
    if whichkey = "Done" [ break ]
  
    moveto whereclick
  
    // get overall size..
    set size = calc 30 + random 150
  
    // this allows us to convert from sine (0-100) to sphere size...
    set sizefactor = calc (:size / 100)  // since sine is based on 100
  
    // get random colors..
    set color1 = randomcolor
    logo fillcolor = randomcolor
  
    set center = turtlepos
    set i = 0   
    repeat 20 [
       incr i by 5
       set w = sine calc (:i + 100)
       set w = calc (:w * :sizefactor)
       if :w < 1 [ continue ]
    
       // draw the ellipse and capture the ellipse points
       // (randomize the granularity of the ellipse)
       pu
       logo circpoints (calc 50 + random 65)  
       pointlist clearall
       pointlist startcapture
         ellipse :w :size
       pointlist endcapture
    
       // now draw lines from center 
       // out to random locations on ellipse..
       logo linecolor = :color1
       set npts = pointlist size
       repeat :density [
         moveto :center
         pd 
         moveto point (random :npts)
  
         // put the litte ball on the end..
         if :ballscale > 0 [ circle (calc :size / :ballscale); fillshape ]
         pu
         ]
       moveto :center
       ]
    ]
 if (buttonchoice "Go again?" "Yes|No") = "no" [ break ]
 ]
