Here is the code modified to produce colors similar to the SPL version. I condensed Dutchman's palet function to the minimum size I could, but it still requires many lines to duplicate the single SPL command that converts hsv values to rgb. I have highlighted the function in green in the editor. Using it slows the drawing slightly.
Code: Select all
set toolbar off ! graphics ! graphics clear 0,0,0 ! refresh off
w=screen_width() ! h=screen_height()
o=floor(h-20)/2 ! yc=o+10 ! xc=o+150 ! pi2=8*atan(1)
for f=1 to 100 step .05
rr=.6+.4*cos(f) ! g=.6+.4*cos(1.37*f) ! b=.6+.4*cos(.89*f)
circle_modulo(xc,yc,o,200,f)
next f
end
def circle_modulo(xc,yc,o,mod,fac)
dt=.pi2/mod
graphics clear 0,0,0
for t=0 to .pi2 step dt
pal(t/.pi2,1,1,1)
draw color pal.r,pal.g,pal.b
draw circle xc+o*cos(t),yc+o*sin(t) size 2
next t
for k=1 to mod
e=(fac*k)%mod
tb=k*dt ! xk=xc+o*cos(tb) ! yk=yc+o*sin(tb)
te=e*dt ! xe=xc+o*cos(te) ! ye=yc+o*sin(te)
pal(k/mod,1,1,1)
draw color pal.r,pal.g,pal.b
draw line xk,yk to xe,ye
get touch 0 as x,y
if x <> -1 then end
next k
draw circle xc,yc size R ! refresh
end def
' condensed version of Dutchman's Palet function
'g'!def pal(tnt,sat,brt,iny)!tnt%=1
sat=abs(sat)!if sat>1 then sat%=1
iny=abs(iny)!if iny>1 then iny%=1
brt=abs(brt)!if brt>1 then brt%=1
tnt*=6!sect=int(0.5+tnt)!tnt%=1
on sect goto s1,s2,s3,s4,s5,s6
s1:b=1!r=0!g=tnt!goto satr
s2:g=1!r=0!b=1-tnt!goto satr
s3:g=1!b=0!r=tnt!goto satr
s4:r=1!b=0!g=1-tnt!goto satr
s5:r=1!g=0!b=tnt!goto satr
s6:b=1!g=0!r=1-tnt!satr:if sat<1 then
y=0.3*r+0.59*g+0.11*b!u=b-Y!u*=sat
v=r-Y!v*=sat!w=g-Y!w*=sat!r=y+v!g=y+w!b=y+u
if brt<>0 then!ysup=1-max(max(r,g),b)
ysup*=brt!r+=ysup!g+=ysup!b+=ysup!endif!endif
if iny<1 then!r*=iny!g*=iny!b*=iny!endif
y=0.3*r+0.59*g+0.11*b!enddef
The only thing that gets me down is gravity...