QB64 Phoenix Edition
Big Symmetrical Tree - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7)
+---- Thread: Big Symmetrical Tree (/showthread.php?tid=850)



Big Symmetrical Tree - SierraKen - 09-04-2022

Well, not exactly symmetrical, but close. So I call it: A Big Tree.


[Image: A-Big-Tree-app.jpg]



Code: (Select All)
'Big Tree by SierraKen - September 3, 2022.
'Feel free to use this in any code.
'The screen cannot have _RGB32(255, 125, 127) or _RGB32(255, 127, 127) because they use that for points as a plot value.
Screen _NewImage(1000, 600, 32)
_Title "A Big Tree"
start:
_Limit 20
Cls
'sky
blue = 75
For y = 0 To 500
    blue = blue + .5
    Line (0, y)-(1000, y), _RGB32(0, 0, blue)
Next y
blue = 0
'Ground
green = 75
For y = 501 To 600
    green = green + 2
    Line (0, y)-(1000, y), _RGB32(0, green, 0)
Next y
green = 0
Line (499, 500)-(501, 480), _RGB32(255, 127, 127), BF
PSet (500, 480), _RGB32(255, 125, 127)
limbsy = 490
size = 115
seconds = 12
seconds2 = 48
For stories = 1 To 6
    size = size - 1.5
    For yy = 0 To 600
        For xx = 0 To 1000
            If Point(xx, yy) = _RGB32(255, 125, 127) Then
                seconds = seconds - .25
                seconds2 = seconds2 + .25
                limbsx = xx
                limbsy = yy
                s = (60 - seconds) * 6 + 180
                x = Int(Sin(s / 180 * 3.141592) * size) + limbsx
                y = Int(Cos(s / 180 * 3.141592) * size) + limbsy
                Line (limbsx + b, limbsy)-(x + b, y), _RGB32(255, 127, 127)
                PSet (x, y), _RGB32(255, 125, 127)
                s = (60 - seconds2) * 6 + 180
                x = Int(Sin(s / 180 * 3.141592) * size) + limbsx
                y = Int(Cos(s / 180 * 3.141592) * size) + limbsy
                Line (limbsx, limbsy)-(x, y), _RGB32(255, 127, 127)
                PSet (x, y), _RGB32(255, 125, 127)
            End If
        Next xx
    Next yy
Next stories
For leaves = 1 To 60000
    leafx = Rnd * 1000
    leafy = Rnd * 480
    If Point(leafx, leafy) = _RGB32(255, 127, 127) Then
        For sz = .25 To 4 Step .25
            Circle (leafx, leafy + 4), sz, _RGB32(0, 255, 0), , , 2.5
        Next sz
    End If
Next leaves

Do:
    _Limit 20
    a$ = InKey$
    If a$ = Chr$(27) Then End
Loop



RE: Big Symmetrical Tree - SierraKen - 09-05-2022

Using the idea James had for his big tree using circles, I decided to add that onto this tree to make thicker branches. Thanks for the idea James. Smile


[Image: Ken-s-Big-Tree-2.jpg]



Code: (Select All)
'A Big Tree by SierraKen - September 3, 2022.
'Feel free to use this in any code.
'The screen cannot have _RGB32(255, 125, 127) or _RGB32(255, 127, 127) because they use that for points as a plot value.
Screen _NewImage(1000, 600, 32)
_Title "A Big Tree"
start:
_Limit 20
Cls
'sky
blue = 75
For y = 0 To 500
    blue = blue + .5
    Line (0, y)-(1000, y), _RGB32(0, 0, blue)
Next y
blue = 0
'Ground
green = 75
For y = 501 To 600
    green = green + 2
    Line (0, y)-(1000, y), _RGB32(0, green, 0)
Next y
green = 0
Line (499, 500)-(501, 480), _RGB32(255, 127, 127), BF
PSet (500, 480), _RGB32(255, 125, 127)
limbsy = 490
size = 115
seconds = 12
seconds2 = 48
For stories = 1 To 6
    size = size - 1.5
    For yy = 0 To 600
        For xx = 0 To 1000
            If Point(xx, yy) = _RGB32(255, 125, 127) Then
                seconds = seconds - .25
                seconds2 = seconds2 + .25
                limbsx = xx
                limbsy = yy
                s = (60 - seconds) * 6 + 180
                x = Int(Sin(s / 180 * 3.141592) * size) + limbsx
                y = Int(Cos(s / 180 * 3.141592) * size) + limbsy
                Line (limbsx + b, limbsy)-(x + b, y), _RGB32(255, 127, 127)
                PSet (x, y), _RGB32(255, 125, 127)
                s = (60 - seconds2) * 6 + 180
                x = Int(Sin(s / 180 * 3.141592) * size) + limbsx
                y = Int(Cos(s / 180 * 3.141592) * size) + limbsy
                Line (limbsx, limbsy)-(x, y), _RGB32(255, 127, 127)
                PSet (x, y), _RGB32(255, 125, 127)
            End If
        Next xx
    Next yy
Next stories

cc = 100
cc2 = 100
cc3 = 100
For x2 = 0 To 1000
    For y2 = 0 To 500
        If Point(x2, y2) = _RGB32(255, 127, 127) Then
            t = t + 1
            For yy2 = y2 To y2 + 5 Step .25
                cc = cc + 1
                cc2 = cc2 + 1
                cc3 = cc3 + 1
                If cc > 255 Then cc = 100
                If cc2 > 127 Then cc2 = 100
                If cc3 > 127 Then cc3 = 100
                For sz = .25 To 4 Step .25
                    Circle (x2, yy2), sz, _RGB32(cc, cc2, cc3)
                Next sz
                If t / 3 = Int(t / 3) Then
                    For sz = .25 To 4 Step .25
                        Circle (x2 + Rnd * 3, y2 + 15), sz, _RGB32(0, 255, 0), , , 2.5
                    Next sz
                End If
            Next yy2
        End If
    Next y2
Next x2


Do:
    _Limit 20
    a$ = InKey$
    If a$ = Chr$(27) Then End
Loop



RE: Big Symmetrical Tree - James D Jarvis - 09-06-2022

Neato. I showed my tree gen to youngest kid and of course I got "Nice picture but trees don't really look like that" so i had to fire up the old web-browser for a picture of a dragontree.


RE: Big Symmetrical Tree - SierraKen - 09-06-2022

LOL awesome Smile