Circular Pattern Using Triangles
#1
I've seen this before, probably from B+, but I wanted to see if I could do it from a fresh start. After a few attempts I figured it out! I used radians on the circle and also saved the points in memory so I could then go to a DO/LOOP to use them how I wish. Smile After many triangles it starts over again with a random color again.

Code: (Select All)
'Circular Pattern Using Triangles by SierraKen
'October 11, 2022
'
'Thanks to B+ and others for the inspiration to make my own.

Dim x(1000), y(1000)
Screen _NewImage(800, 600, 32)
_Title "Circular Pattern Using Triangles by SierraKen - Esc to quit"
For t = 0 To 1000 Step 1 / 3
    x(t) = (Sin(t) * 180) + 400
    y(t) = (Cos(t) * 180) + 300
    Circle (x(t), y(t)), 2, _RGB32(0, 255, 0)
Next t
Randomize Timer
c1 = (Rnd * 155) + 100: c2 = (Rnd * 155) + 100: c3 = (Rnd * 155) + 100
Do
    _Limit 20
    'This uses radians in the circle. I used a radian chart online to get each formula with _PI
    Line (x(7 * (_Pi / 6) + a), y(7 * (_Pi / 6) + a))-(x(11 * (_Pi / 6) + a), y((11 * _Pi / 6) + a)), _RGB32(c1, c2, c3)
    Line (x(11 * (_Pi / 6) + a), y(11 * (_Pi / 6) + a))-(x((_Pi / 2) + a), y((_Pi / 2) + a)), _RGB32(c1, c2, c3)
    Line (x((_Pi / 2) + a), y((_Pi / 2) + a))-(x(7 * (_Pi / 6) + a), y(7 * (_Pi / 6) + a)), _RGB32(c1, c2, c3)
    a = a + 1 / 3
    If a > 300 Then
        a = 0
        Cls
        For tt = 0 To 2000 Step 1 / 3
            xx = (Sin(tt) * 180) + 400
            yy = (Cos(tt) * 180) + 300
            Circle (xx, yy), 2, _RGB32(0, 255, 0)
        Next tt
        c1 = (Rnd * 155) + 100: c2 = (Rnd * 155) + 100: c3 = (Rnd * 155) + 100
    End If
Loop Until InKey$ = Chr$(27)
Reply


Messages In This Thread
Circular Pattern Using Triangles - by SierraKen - 10-12-2022, 12:35 AM
RE: Circular Pattern Using Triangles - by bplus - 10-12-2022, 03:23 PM



Users browsing this thread: 2 Guest(s)