Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Polygon Artwork
#1
I made this as an inspiration to B+'s a few years ago. It shows 17 different polygons in order, in random color, layered in giant circles. It changes every 2 seconds and loops back to 3 sides after 20 sides. Thanks B+ for helping me get this far. 

Code: (Select All)
'Polygon Artwork
'Thanks to B+ for the inspiration to make this.

Dim cl As Long
Screen _NewImage(800, 600, 32)
sides = 3
Do
    Locate 1, 1: Print "Sides: "; sides
    st = Int(360 / sides)
    cl = _RGB32(255 * Rnd, 255 * Rnd, 255 * Rnd)
    x = 250
    y = 300
    For tt = 0 To 360 Step 10
        For deg = 0 + tt To 360 + tt Step st
            oldx = x
            oldy = y
            For t = 1 To 40 Step .25
                x = (Sin(_D2R(deg)) * t) + oldx
                y = (Cos(_D2R(deg)) * t) + oldy
                Circle (x, y), 1, cl
            Next t
        Next deg
    Next tt
    sides = sides + 1
    If sides > 20 Then sides = 3
    _Delay 2
    _Display
    Cls
Loop Until InKey$ = Chr$(27)
Reply
#2
Really cool Ken!

Here are Polygon Ferris Wheels:
Code: (Select All)
' polygon demo 4.bas for QB64 (B+=MGA) 2017-09-18

Randomize Timer
Const xmax = 700
Const ymax = 700

Screen _NewImage(xmax, ymax, 32)
_Title "Polygon Demo 4 by bplus, Toggles: press spacebar + main poly 6 to 10, press enter + thick 1 to 6"
Common Shared dradius, thick
dradius = .315: thick = 0
x0 = xmax / 2: y0 = ymax / 2: a = _Pi(-.5): n = 6
Color _RGB(50, 150, 200)
While 1
    Cls
    If _KeyHit = 32 Then
        If n = 10 Then n = 6: dradius = .3 Else n = n + 1: dradius = dradius - .025
    End If
    If _KeyHit = 13 Then
        If thick = 5 Then thick = 0 Else thick = thick + 1
    End If
    radius = 240
    polygon x0, y0, radius, n, a
    a = a + _Pi(1 / 180)
    _Display
    _Limit 10
Wend
Sub polygon (xOrigin, yOrigin, radius, nVertex, RadianAngleOffset)
    polyAngle = _Pi(2) / nVertex
    x1 = xOrigin + radius * Cos(RadianAngleOffset)
    y1 = yOrigin + radius * Sin(RadianAngleOffset)
    For i = 1 To nVertex
        x2 = xOrigin + radius * Cos(i * polyAngle + RadianAngleOffset)
        y2 = yOrigin + radius * Sin(i * polyAngle + RadianAngleOffset)
        Select Case i Mod 7
            Case 1: Color _RGB(255, 0, 0)
            Case 2: Color _RGB(255, 255, 0)
            Case 3: Color _RGB(0, 0, 255)
            Case 4: Color _RGB(0, 165, 0)
            Case 5: Color _RGB(128, 0, 128)
            Case 6: Color _RGB(0, 128, 128)
            Case 0: Color _RGB(200, 100, 0)
        End Select
        For j = 0 To thick
            Line (x2 + j, y2 + j)-(x1 + j, y1 + j)
        Next
        If radius > 5 Then
            polygon x1, y1, radius * dradius, nVertex - 1, -2.3 * RadianAngleOffset
        End If
        x1 = x2: y1 = y2
    Next
End Sub
b = b + ...
Reply
#3
That's really impressive B+. Would make an awesome screen saver.
Reply




Users browsing this thread: 1 Guest(s)