Here is FB version:
'Psychedelic Star Swirl.bas for FreeBASIC [B+=MGA] 2017-03-15
'from SmallBASIC version 2017-03-01
Randomize Timer
Const As Double PI = ACos(-1)
Const As Double RAD = PI / 180
Common Shared As Double r, g, b, clr
'Set screen size here
dim as integer sw = 600, sh = 600, depth = 32
screenres sw, sh, depth, 2
WindowTitle "Psychedelic Star Swirl - Press esc to exit"
sub star( x As Integer, y As Integer, rInner As Double, rOuter As Double, nPoints As Integer, angleOffset As Double)
' x, y are same as for circle,
' rInner is center circle radius
' rOuter is the outer most point of star
' nPoints is the number of points,
' angleOffset = angle offset IN DEGREES, it will be converted to radians in sub
' this is to allow us to spin the polygon of n sides
Dim As Double pAngle, radAngleOffset, x1, y1, x2, y2, x3, y3
Dim As Integer i
pAngle = RAD * (360 / nPoints) : radAngleOffset = RAD * (angleOffset)
x1 = x + rInner * cos(radAngleOffset)
y1 = y + rInner * sin(radAngleOffset)
For i = 0 to nPoints - 1
x2 = x + rOuter * cos(i * pAngle + radAngleOffset + .5 * pAngle)
y2 = y + rOuter * sin(i * pAngle + radAngleOffset + .5 * pAngle)
x3 = x + rInner * cos((i + 1) * pAngle + radAngleOffset)
y3 = y + rInner * sin((i + 1) * pAngle + radAngleOffset)
Line (x1, y1) - (x2, y2)
Line (x2, y2) - (x3, y3)
x1 = x3 : y1 = y3
Next
end sub
sub chColor()
clr = clr + 1
Color rgb(127 + 127 * sin(r * clr), 127 + 127 * sin(g * clr), 127 + 127 * sin(b * clr))
If clr > 50000 then r = Rnd(1) : g = Rnd(1): b = Rnd(1) : clr = 0
End Sub
Dim As Integer page, notpage, rd, cx, cy
Dim As Double size, radius, angle, sangle, x, y, r2
Dim ky as String
notpage = 1 : cx = sw/2 : cy = sh/2
sangle = 0.0 : r = Rnd(1) : g = Rnd(1) : b = Rnd(1)
While ky <> Chr(27)
If page = 0 Then page = 1 ELSE page = 0 'These two lines flip the page and the
If notpage = 1 THEN notpage = 0 ELSE notpage = 1 'backpage
SCREENSET page, notpage 'This flips the page
size = 1
radius = .06
angle = sangle
cls
While radius < 400
x = cos(angle) * radius
y = sin(angle) * radius
r2 = (x ^ 2 + y ^ 2) ^ .5
size = 4 * r2 ^ .25
For rd = size to 1 step -10
chColor
star cx + x, cy + y, rd/3, rd*1.3, 7, 90
Next
angle -= .4
radius += 1
Wend
Sleep(60)
sangle = sangle + pi/18
ky = InKey
Wend