REM ************************************************
REM  You Will Obey The Almighty Spiral! by OBese87
REM ************************************************
 
rem setup screen
`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
      x= spiral_x(mousex(),angle,boxes,8)
      y= spiral_y(mousey(),angle,boxes,8)
      box x-box_size,y-box_size,x+box_size,y+box_size
 
      spiral(x,y,angle,40,16)
    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
`//