Circlesbelt {
init:
int iter = 0
float num = @cnum
float Xabs = 0
float Yabs = 0
float Dsgd0 = 0
float Circle = 0
float ZtoPsqd = 0
float Rc = @r;/#magn
float Rm = @Rr
float RcSqd = Rc
bool Trapped = false
loop:
if (@tran==0 &&!Trapped) || @tran==1
iter = iter + 1
if iter > @skip
Xabs = real(#z)
Yabs = imag(#z)
Dsgd0 = abs(sqrt((Xabs+0.0)^2 + (Yabs -0)^2) - Rm)
if Dsgd0 < RcSqd
Trapped = true
ZtoPsqd= Dsgd0
Circle = iter
float argz = atan2(#z)
if argz<0
argz = argz + 2*#pi
endif
argz = argz/(2*#pi)
endif
endif
endif
final:
if !trapped
#solid = true
else
Circle = ((Circle -1 + @off) % num)/num
float Ratio = sqrt(ZtoPsqd/Rcsqd)
; float ColorIndex = 110 * Ratio + Circle * 140
;#index = (ColorIndex + 1) % 256 /256
#color = hsl(argz*6.0 ,Ratio*0.5 +0.5,(0.90-0.6*Ratio)*0.9)
endif
default:
title = "1 belt"
param tran
caption="type Trap"
default=1
enum="first" "last"
endparam
param cnum
caption = "color num"
default = 6.0
endparam
param r
caption = "Circle radius"
default = 0.3
endparam
param Rr
caption = "Out radius"
default = 1.5
endparam
param skip
caption = "Iters to skip"
default = 0
hint = "Iterations to skip."
endparam
param off
caption = "Hue cycle"
default = 0
min = 0
max = 7
hint = "This rotates the coloring order of the balls."
endparam
}
;忘了,忘完了,贴出代码,为了纪念 |