Playing around with doing a dragon curve fractal, altering the looks of it, making it animated, produced an interesting effect. Uses a recursive SUB.
- Dav
- Dav
Code: (Select All)
'dragoncurve.bas
'A play on a dragon curve fractal
'Adapted by Dav, OCT/2023
Screen _NewImage(800, 600, 32)
Dim Shared a, p: p = .001
Do
Cls: dragon 400, 300, 90 + (a * 3), a, 16
If a < 200 Then a = a + .15
If p < .002 Then p = p + .00000001
_Limit 15: _Display
Loop Until _KeyHit
Sub dragon (x, y, size, ang, depth)
If depth < 1 Then
PSet (x, y), _RGBA(50, 150, 255, 50 + Rnd * 200)
Else
size2 = size / 1.414214: ang2 = ang - _Pi / p
dragon x, y, size2, ang + _Pi / p, depth - 1
dragon x + size2 * Cos(ang), y + size2 * Sin(ang), size2, ang2, depth - 1
End If
End Sub