hide mouse
sync on
 
`Dline Real
c#=0
Repeat
   r = (c#/360)*255
   ink rgb(r,255-r,0),0
   @dline(320,240,320+@Round(sin(c#)*50),240+@Round(cos(c#)*50))
   inc c#,0.1
Until c#>359
 
sync
wait key
end
 
`----------------------
` FUNCTIONS
`----------------------
`Round up
FUNCTION @Round(n#)
   dec# = n# - int(n#)
   n = n# + dec#
ENDFUNCTION n
 
`DLine Function by OBese87
FUNCTION @dline(l,t,r,b)
   w = r-l : h = b-t
   if w >= 0 then xstep = 1 else xstep = -1
   if h >= 0 then ystep = 1 else ystep = -1
   w# = ABS(w) : h# = ABS(h)
   if w#=0 then w#=0.1
   if h#=0 then h#=0.1
   xfact# = w#/h#
   yfact# = h#/w#
 
   x = 0 : y = 0
   repeat
      `don't overshoot
      if abs(x+xstep) > abs(w) then xstep = 0
      if abs(y+ystep) > abs(h) then ystep = 0
 
      dot x+l,y+t
      if yfact# > xfact#
         inc y,ystep
         if ABS(x) < ABS(y*xfact#) then inc x,xstep
      else
         inc x,xstep
         if ABS(y) < ABS(x*yfact#) then inc y,ystep
      endif
   until xstep = 0 and ystep = 0
ENDFUNCTION