Really cool Ken!
Here are Polygon Ferris Wheels:
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 + ...