include "window.inc"

Window "Spiro", 800, 800, 2
Font 12,24,0,"courier"
sys_mode=4


'VELOCITIES
'==========
'
'alter these 3 oarams to create 
'different shapes
'
'------------------------------
float ti1,ti2,ti3
ti1=0.666  'x angle
ti2=0.999  'y angle
ti3=0.334  'both x and y angles
'==============================

int x1,y1,x2,y2,xc,yc
int cr,cg,cb,e,i
float xa,ya,an1,an2,an3,st,da
x1=0      'start of line x
y1=0      'start of line y
x2=0      'end of line x
y2=0      'end of line y
xc=400    'centre x
yc=400    'centre y
xa=370.0  'size x
ya=370.0  'size y
an1=0.0   'angle for x
an2=pi/2  'angle for y
an3=0.0   'angle for both x and y
st=0.1    'line step size
cr=32     'line color red
cg=32     'line color green
cb=96     'line color blue
e=5000    'number of steps
da=.9999  'decay of amplitude

'backgound color r g b

ClsColor 200,200,248


'calculating point position

macro pos(x,y)
  x=cos(an1)*xa*cos(an3)+xc
  y=sin(an2)*ya*sin(an3)+yc
end macro
'
'draw shape
'
pos(x1,y1)
for i=1 to e
  pos(x2,y2)
  Line x1, y1, x2, y2, 1, cr,cg,cb
  an1+=st*ti1
  an2+=st*ti2
  an3+=st*ti3
  xa*=da
  ya*=da
  x1=x2
  y1=y2
next

'Esc to exit

WaitKey(27)
WinEnd