_TITLE "Psychedelic Star Swirl bplus 2018-03-04" ' translated from
' Psychedelic Star Swirl.bas SmallBASIC 0.12.8 [B+=MGA] 2017-03-03
' Spiral Pearl Swirl 4 SB.bas SmallBASIC 0.12.8 [B+=MGA] 2017-03-01
' from Spiral Pearl Swirl.bas for FreeBASIC [B+=MGA] 2017-02-28
' from SdlBasic 3d version 2017-02-28
' inspired by spiral Bang
'whatever screen size your device here is middle
cx
= xmax
/ 2: cy
= ymax
/ 2: r
= RND: g
= RND: b
= RND: k$
= " " size = 1
radius = .06
angle = sangle
r2 = (x ^ 2 + y ^ 2) ^ .5
size = 4 * r2 ^ .25
'cc = 160 + 95 * radius/400 - r/size*120
chColor
star cx
+ x
, cy
+ y
, r
/ 3, r
* 1.6, 5, RND * 360 angle = angle - .4
radius = radius + 1
_LIMIT 15 '<<<<<<<<<<<<<<<<<<<<<<<<<< adjust to higher speeds if you dare sangle
= sangle
+ _PI(1 / 18)
SUB star
(x
, y
, rInner
, rOuter
, nPoints
, angleOffset
) ' 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
pAngle = RAD(360 / nPoints): radAngleOffset = RAD(angleOffset)
x1
= x
+ rInner
* COS(radAngleOffset
) y1
= y
+ rInner
* SIN(radAngleOffset
) 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
) x1 = x3: y1 = y3
clr = clr + 1