' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.08.29.21.34]) on 2023.09.26 at 23:02 (Coordinated Universal Time)

_Title "Spinner by b+" 'b+ 2021-06-18 (QB64 / QBJS program) found at https://qb64.boards.net/post/1050

' QB64 / QBJS program ported to BAM by Charlie Veniot
' Changes to the QBJS program for the BAM port:
' 🟠 BAM requires subroutines to be declared before usage
' 🟠 BAM requires list of parameters in subroutine calls to be book-ended by parentheses 
' 🟠 BAM ignores the LIMIT statement, so commented that out
' 🟠 mod: added colour to the graphics

Dim As Long b, r, i
Dim a

DECLARE Sub arc (xCenter, yCenter, arcRadius, dAStart, dAMeasure)  ' 🟠 added declaration

Screen _NewImage(500, 500, 32)
Const rad = _Pi / 180
While 1
    Cls
    b = b + 5
    For r = 20 To 200 Step 20 ' tsh73 suggested fix for inner most
        a = b * r / 20
        For i = r - 15 To r
            arc (250, 250, i, a, 180)   ' 🟠 added parentheses
        Next
    Next
    _Display
    '_Limit 5 ' 🟠 BAM ignores the _LIMIT statement, so commented out

Wend

Sub arc (xCenter, yCenter, arcRadius, dAStart, dAMeasure)
    'notes:
    'you may want to adjust size and color for line drawing
    'using angle measures in degrees to match Just Basic ways with pie and piefilled
    'this sub assumes drawing in a CW direction if dAMeasure positive

    'for Just Basic angle 0 degrees is due East and angle increases clockwise towards South

    'dAStart is degrees to start Angle, due East is 0 degrees

    'dAMeasure is degrees added (Clockwise) to dAstart for end of arc

    Dim rAngleStart, rAngleEnd, Stepper, lastX, lastY, rAngle, nextX, nextY
    rAngleStart = rad * dAStart
    rAngleEnd = rad * dAMeasure + rAngleStart
    Stepper = rad / (.1 * arcRadius) 'fixed
    lastX = xCenter + arcRadius * Cos(rAngleStart)
    lastY = yCenter + arcRadius * Sin(rAngleStart)
    For rAngle = rAngleStart + Stepper To rAngleEnd Step Stepper
        nextX = xCenter + arcRadius * Cos(rAngle)
        nextY = yCenter + arcRadius * Sin(rAngle)
        Line (lastX, lastY)-(nextX, nextY), _rgb32(190, 250,255) 'int speeds things up ' 🟠 added colour to replace the default (white)
        lastX = nextX: lastY = nextY
    Next
End Sub