06-06-2025, 12:36 PM
with zoom-in/zoom-out
Code: (Select All)
_Title "Schraf Brot Animated (per Aurel 2025-06-06)"
w = 1280
h = 720
Screen _NewImage(w, h, 32): _ScreenMove 0, 0
Cls
Dim zoom As Double, dmin As Double, frame As Integer
Do
Cls
frame = frame + 1
zoom = 3 / w * (1 + 0.5 * Sin(frame * 0.05)) ' zoom oscillates over time
dmin = 0.06 * (1 + 0.3 * Cos(frame * 0.07)) ' dmin varies to make fractal edges flicker
For a = 0 To w - 1
For b = 0 To 1.5 * h
x = (a - w) * zoom
y = (b - h) * zoom
i = 0
d = 100
Do
u = x * x
v = y * y
If u + v > 4.8 Or i > 30 Or d < dmin Then Exit Do
t = u - v
y = 2 * x * y + 0.156
x = t - 0.8
i = i + 1
n = Abs(u + v - 1)
If n < d Then d = n
Loop
If d < dmin Then
coul = 255 - Int(4000 * d)
If coul < 0 Then coul = 0
If coul > 255 Then coul = 255
red = coul
green = (i * 8) Mod 256
blue = 255 - coul
x1 = a - w / 2
y1 = b - h / 2
x2 = w + w / 2 - 1 - a
y2 = h + h / 2 - b
Line (x1, y1)-(x1 + 1, y1 + 1), _RGB(red, green, blue)
Line (x2, y2)-(x2 + 1, y2 + 1), _RGB(red, green, blue)
End If
Next b
Next a
_Display
_Limit 20 ' frame rate control
Loop Until _KeyDown(27) ' ESC to exit
End

