REM ************************************************
REM  You Will Obey The Almighty Spiral! by OBese87
REM ************************************************
 
rem setup screen
`hide mouse
hide mouse
sync on
sync rate 60
box_size= 1
 
DO
  For angle= 0 to 360
    ink rgb(0,255,255),0
    for boxes= 1 to 80
      `spiral animal 1
      x= spiral_x(200,0,boxes,cos(angle*4)*8)
      y= spiral_y(240,0,boxes,cos(angle*4)*8)
      box x-box_size,y-box_size,x+box_size,y+box_size
      spiral(x,y,0,40,cos(angle*4)*8)
 
      `spiral animal 2
      x= spiral_x(440,0,boxes,cos(angle*4)*8)
      y= spiral_y(240,0,boxes,cos(angle*4)*8)
      box x-box_size,y-box_size,x+box_size,y+box_size
      spiral(x,y,0,40,sin(angle*4)*8)
    next boxes
 
    sync:cls
  Next angle
LOOP
 
End
 
rem subroutines ---------------------------------------------------------------------------------------------------
 
Function spiral_x(x,angle,radius,coil#)
  ans= x + cos(angle+coil#*(radius+1)) * radius
Endfunction ans
`//
 
Function spiral_y(y,angle,radius,coil#)
  ans= y + sin(angle+coil#*(radius+1)) * radius
Endfunction ans
`//
 
Function spiral(x,y,angle,radius,coil#)
  xx=x
  yy=y
  a#= angle
  for r= 0 to radius
     inc a#,coil#
     oldx= xx
     oldy= yy
     xx= x + cos(a#) * r
     yy= y + sin(a#) * r
     dot xx,yy
  next r
Endfunction
`//