11-07-2025, 06:58 PM
It's amazing what you can do with sin and cos. Here is another, looks like the universe expanding and collapsing.
Code: (Select All)
handle& = _NewImage(800, 800, 32)
Screen handle&
stars = 360
Dim sr(stars + 1) As Integer 'radius of stars
Dim ss(stars + 1) As Integer 'step speed of stars
Dim sd(stars + 1) As Integer 'degrees of stars
Dim sx(stars + 1) As Single 'x position of stars
Dim sy(stars + 1) As Single 'y position of stars
Dim sxf, syf As Integer 'x,y final position of stars
Dim pi As Single
pi = 180 ' 3.14159
For i = 1 To stars
ss(i) = 1 'step
sr(i) = 180 - i '100'radius
sd(i) = 180 / i 'degrees
sx(i) = i * (360 / stars) 'x pos
sy(i) = i * (360 / stars) 'y pos
Next i
Do
Cls
For i = 1 To stars
sx(i) = sx(i) + ss(i): If sx(i) >= 360 Then sx(i) = 360 - sx(i)
sy(i) = sy(i) + ss(i): If sy(i) >= 360 Then sy(i) = 360 - sy(i)
sxf = Sin(pi * sx(i) / sd(i)) * (sr(i) / 1)
syf = Cos(pi * sy(i) / sd(i)) * (sr(i) / 1) + sx(i)
Line (300 + sxf, 200 + syf)-(304 + sxf, 204 + syf), _RGB(Rnd * 200, 110, 0), BF
Next i
_Delay .01
Loop Until InKey$ = Chr$(27)

