09-23-2024, 05:52 AM
Here's one I was playing around with for a bit. There's a lot of ways to tweak this to get a ton of different effects. Play around and experiment with it and see how quickly you can unravel time!
Code: (Select All)
$Color:32
Screen _NewImage(1024, 720, 32)
Type Circle_type
x As Single
y As Single
r As Single
t As Single
c As _Unsigned Long
End Type
Dim circles(110) As Circle_type
For i = 0 To 110
circles(i).x = 512
circles(i).y = 360
circles(i).r = 20 * i
circles(i).t = 20
If i Mod 2 Then circles(i).c = Black Else circles(i).c = White 'Change these two line from black/white to color
'circles(i).c = &HFF000000&& + Rnd * &HFFFFFF&&
Next
xchange = 10 'speed settings. experiment with them for some wild effects
ychange = 10
schange = .5
speed = 10
Do
Cls
For i = 0 To 43 'unremark some of the lines below or remark out others and play around
circles(i).x = circles(i).x + xchange: If circles(i).x > 800 Or circles(i).x < 200 Then xchange = -xchange
' circles(i).y = circles(i).y + ychange: If circles(i).y > 500 Or circles(i).y < 200 Then ychange = -ychange
circles(i).r = circles(i).r + speed: If circles(i).r > 860 Then circles(i).r = 0
thickCircle circles(i).x, circles(i).y, circles(i).r, circles(i).t, circles(i).c
Next
' speed = speed + schange: If speed > 100 Or speed < 10 Then schange = -schange
_Display
Loop Until _KeyHit
Sub thickCircle (x As Single, y As Single, radius As Single, thickness As Single, colour As _Unsigned Long)
Dim rp As Single, rm As Single, rp2 As Single, rm2 As Single
Dim sm As Single, rpi2 As Single, rmi2 As Single, sp As Single
Dim i As Single
rp = radius + thickness / 2
rm = radius - thickness / 2
rp2 = rp ^ 2
rm2 = rm ^ 2
For i = -rp To -rm Step .2
rpi2 = rp2 - i ^ 2
sp = Sqr(rpi2)
Line (x + i, y)-(x + i, y + sp), colour, BF
Line (x + i, y)-(x + i, y - sp), colour, BF
Next
For i = -rm To 0 Step .2
rpi2 = rp2 - i ^ 2
rmi2 = rm2 - i ^ 2
sm = Sqr(rmi2)
sp = Sqr(rpi2)
Line (x + i, y + sm)-(x + i, y + sp), colour, BF
Line (x - i, y + sm)-(x - i, y + sp), colour, BF
Line (x + i, y - sm)-(x + i, y - sp), colour, BF
Line (x - i, y - sm)-(x - i, y - sp), colour, BF
Next
For i = rm To rp Step .2
rpi2 = rp2 - i ^ 2
sp = Sqr(rpi2)
Line (x + i, y)-(x + i, y + sp), colour, BF
Line (x + i, y)-(x + i, y - sp), colour, BF
Next
End Sub