Fractals
#5
And here is another Ashish fractal I started playing around with:
Code: (Select All)
_Title "Carbonated Circles Fractal by bplus 2017-10-15"
' working from Ashish simple Circle Fractal

Const xmax = 660
Const ymax = 700
DefInt A-Z
Screen _NewImage(xmax, ymax, 32)
_Delay .8 'sorry, my system needs .6 delay for _MIDDLE, yours may NOT
_ScreenMove _Middle ' not working with 32 in line above

Randomize Timer
Common Shared cx(), cy(), cr(), ci

ReDim cx(0): ReDim cy(0): ReDim cr(0)
r1 = 150: basey = ymax - r1 - 10
drawCircle xmax / 2, basey, r1
antigravity = -.6
nb = 60
Dim bx(nb), by(nb), br(nb), bdy(nb)
Dim bc&(nb)
For i = 1 To nb
    r = rand%(1, ci)
    bx(i) = cx(r): by(i) = rand(0, basey): br(i) = cr(r): bdy(i) = rand(-4, -2)
    bc&(i) = _RGB(Rnd * 155 + 100, Rnd * 155 + 100, Rnd * 155 + 100)
Next
Cls
Do
    While 1
        Cls
        For i = 1 To ci
            Color &HFF88DDDD
            Circle (cx(i), cy(i)), cr(i)
        Next
        For i = 1 To nb
            Color bc&(i)
            Circle (bx(i), by(i)), br(i)
            If by(i) - 4 + br(i) < 0 Then
                r = rand%(1, ci)
                bx(i) = cx(r): by(i) = cy(r): br(i) = cr(r): bdy(i) = rand(-4, -2)
                bc& = _RGB(rand%(100, 255), rand(100, 255), rand(100, 255))
            Else
                bdy(i) = bdy(i) + antigravity
                by(i) = by(i) + bdy(i)
            End If
        Next
        _Display
        _Limit 10
    Wend
Loop

Sub drawCircle (x, y, r)
    Circle (x, y), r
    ci = ci + 1
    ReDim _Preserve cx(ci): cx(ci) = x
    ReDim _Preserve cy(ci): cy(ci) = y
    ReDim _Preserve cr(ci): cr(ci) = r
    'PRINT cx(ci), cy(ci), cr(ci)
    If r > 2 Then
        drawCircle x + r, y, r / 2
        drawCircle x - r, y, r / 2
    End If
End Sub

Function rand% (lo%, hi%)
    rand% = Int(Rnd * (hi% - lo% + 1)) + lo%
End Function


[Image: Carbonated-Circles-Fractal.png]

Just another b+ mod Smile
b = b + ...
Reply


Messages In This Thread
Fractals - by bplus - 05-19-2022, 07:34 PM
RE: Fractals - by bplus - 05-19-2022, 07:46 PM
RE: Fractals - by bplus - 05-19-2022, 07:52 PM
RE: Fractals - by bplus - 05-19-2022, 08:03 PM
RE: Fractals - by bplus - 05-19-2022, 08:25 PM
RE: Fractals - by bplus - 05-19-2022, 08:33 PM
RE: Fractals - by TarotRedhand - 05-19-2022, 10:33 PM
RE: Fractals - by bplus - 05-20-2022, 01:14 AM
RE: Fractals - by TarotRedhand - 05-20-2022, 07:01 AM
RE: Fractals - by bplus - 05-20-2022, 03:55 PM
RE: Fractals - by TarotRedhand - 05-21-2022, 10:12 PM
RE: Fractals - by bplus - 05-21-2022, 11:16 PM
RE: Fractals - by bplus - 05-21-2022, 11:33 PM
RE: Fractals - by bplus - 06-03-2022, 03:37 PM
RE: Fractals - by bplus - 06-03-2022, 03:43 PM



Users browsing this thread: 4 Guest(s)