Doilies on plasma.bas

Can't get enough eye candy?

'doilies on plasma.bas for SmallBASIC 0.12.6 [B=+MGA] 2016-06-20

'maybe a little plasma?

'attempt to translate D's SpecBAS:
'10 REM Doilies
'20 DEF FN a(b)=360/INT(360/INT b)
'30 s$="Any key... ",tx=SCRw-(LEN s$*8),ty=SCRh-9
'40 DO: a1i=FN a(1+RND*22),a2i=FN a(1+RND*22),it=LCM(360/a1i,360/a2i): LOOP UNTIL a1i<>a2i AND it IN [50 TO 1000]
'50 a1,a2=0,cx=SCRw/2,cy=SCRh/2,r1=cy-1,r2=50+RND*(cy-50)
'60 PAPER 0: INK 1+RND*15: CLS: DEGREES
'70 CIRCLE cx,cy,r1;cx,cy,r2
'80 DO it: x1=cx+SIN a1*r1,y1=cy+COS a1*r1,x2=cx+SIN a2*r2,y2=cy+COS a2*r2
'90 DRAW x1,y1 TO x2,y2
'100 a1+=a1i,a2+=a2i: WAIT SCREEN: LOOP
'110 PRINT INK 15;MOVE tx,ty;s$: PAUSE 0: RUN

cx=xmax/2:cy=ymax/2
label restart
cls
r1=cy-10 : r2=50+rnd*(cy-75)

'ai <> bi
repeat
ra=int(rnd*23)+1:rb=int(rnd*22)+1
until ra<>rb
ai=2*pi/ra: bi=2*pi/rb

'does it matter?
'a=0 : b=0 :count =0
a=ai: b=bi :count=1

'optional
'circle cx,cy,r1 : circle cx,cy,r2

'plasma
e=rnd^2:c=rnd^2:d=rnd^2

'main drawing loop,esc quits, spacebar restarts another thing
repeat

k=inkey
if asc(k) = 32 then goto restart
if asc(k) = 27 then end

'update plasma
cl=RGB(127+127*sin(e*count/4),127+127*sin(c*count/4),127+127*sin(d*count/4))

'draw a line from one circle to the other
x1=cx + r1*cos(a): y1=cy + r1* sin(a)
x2=cx + r2*cos(b): y2=cy + r2* sin(b)
line x1,y1,x2,y2,cl

'increment stuff
a+=ai :b+=bi :count++
'delay 20

until a=b or count> 1000
beep
pause
goto
restart