// DOTMOVE - included by other programs to get animated dot or "crawler" effects.
// Uses the currently active pointlist (which must already be loaded/captured).
// Current fill color is used for "lit" dots.
// Current line color is used to outline all dots.
//
// Parameters: 
//  :ndots = number of dots to move around
//  :spacing = number of cells between dots (+1)
//  :offcolor = color to fill dots that aren't "lit" 
//  :dotsize = radius of dot
//  :wait = amount of time to wait in 1/100 sec

to dotmove  :ndots  :spacing  :offcolor :dotsize :waitval

logo animation  // disable printing
set npts = pointlist size

set dotcolor = fillcolor
set ptnum = 1
repeat untilbreak [

  if keypress = 1 [ break ]

  set rep = 0;
  repeat :ndots [
    moveto point (calc :ptnum + :rep)
    pd
    circle :dotsize
    logo fillcolor = :dotcolor
    fillshape 
    incr rep by :spacing
    pu
    ]

  wait :waitval

  set rep = 0;
  repeat :ndots [
    moveto point (calc :ptnum + :rep)
    pd
    circle :dotsize
    logo fillcolor = :offcolor
    fillshape 
    incr rep by :spacing
    pu  // try commenting this out for an interesting effect
    ]

  incr ptnum by 1
  if :ptnum >= :npts [ set ptnum = 1 ]
  ]

logo fillcolor = :dotcolor   // restore to original
end


demo sayc "See orbiter (and others) for a demo of 'dotmove'.."
