- UID
- 22171
- 帖子
- 418
- 精华
- 1
- 积分
- 1185
|
UF代码,由于才开始学习UF,照猫画虎做的,代码不够简练,而且着色很不得法啊!
heart {
init:
int iter = 0
float num = @n
float Xabs = 0
float Yabs = 0
float Dsgd0 = 0
float Circle = 0
float ZtoPsqd = 0
float Rc = @r
int n1 = @n
float RcSqd = Rc^2
bool Trapped = false
loop:
iter = iter + 1
if iter>skip && !Trapped
Xabs = real(#z)
Yabs = imag(#z)
Dsgd0 = (Xabs^2+Yabs^2-1/64)-Xabs^(2/3)*Yabs
if Dsgd0 < 0
Trapped = true
ZtoPsqd= abs(Dsgd0)
Circle = iter
endif
endif
final:
if !trapped
#solid = true
else
Circle = ((Circle + @off) % num)
float Ratio = sqrt(ZtoPsqd/Rcsqd)
float ColorIndex = 50 * Ratio + Circle * 50
#index = (ColorIndex + 1) % 256 /256
endif
default:
title = "heart"
param r
caption = "Circle radius"
default = 0.4
endparam
param n
caption = "num"
default = 4
min = 1
max = 19
endparam
param skip
caption = "Iters to skip"
default = 0
hint = "Iterations to skip."
endparam
param off
caption = "Hue cycle"
default = 1
min = 0
max = 7
hint = "This rotates the coloring order of the balls."
endparam
} |
|