'Blushing snowflakes.sdlbas 2016-03-01 [B+=MGA]
 'a t and t line-art  for sdlbasic  (Windows, Unix etc etc)
 '  S Shaw, 2013 http://shawweb.myzen.co.uk/stephen/sdlbasic.htm
 sq=740
 SetDisplay(sq,sq,32,1)
 autoback(-2)
 scale=sq/2: ofs=sq/2
 maxdist=(2*(ofs^2))^.5
 n=4 : d=43 : flag=0
 while 1
     for rosey=.01 to 1.41 step .2
         ink(rgb(0,128,0))
         bar(0,0,sq,sq)
         a=0 : a=a+d
         newx=ofs : newy=ofs :flag=0
         while a>0.001
             a=a+d
             a=(a/360-INT(a/360))*360 : a=INT(a+0.0001)
             X=n*a : X=(X/360-INT(X/360))*6.283185307
             R=SIN (X)
             T=a*0.0174532925
             oldx=newx : oldy=newy
             newx=R*SIN(T)*scale+ofs : newy=R*COS(T)*scale+ofs
     '        do not plot first line to reduce asymetry
             flag=flag+1
                 if flag>1 then
                 leng=((oldy-newy)^2+(oldx-newx)^2)^.5
                 if leng<>0 then
                     dx = (newx-oldx)/leng
                     dy = (newy-oldy)/leng
                     for i=0 to leng
                         cc=255/rosey*(((oldx+dx*i-ofs)^2+(oldy+dy*i-ofs)^2)^.5)/maxdist
                         ink(rgb(max(255-cc,0),min(255,cc),min(255,cc)))
                         fillcircle(oldx+dx*i,oldy+dy*i,2)
                     next
                 end if
             end if
         wend
         ink(0)
         text(0,0,16,"n= "+str(n)+" d="+str(d)+" rosey="+str(rosey))
         screenswap
         wait(2)
     next
     n+=2: if n>359 then : n=1 : end if
     d+=1 : if d>359 then : d=1 : end if
     wait (2000)
     'newx=ofs : newy=ofs : flag=0
 wend
 


 
Make a Free Website with Yola.