Microsoft Small Basic

Program Listing: VRN586
' Fidget Spinner
' Copyright © 2018 Nonki Takahashi. The MIT License.
' Last update 2018-07-20

GraphicsWindow.Title = "Fidget Spinner"
Init()
da = 45
While "True"
a = a + da
If 360 <= a Then
a = a - 360
EndIf
For i = 1 To 3
_a = Math.GetRadians(a + (i - 1) * 120)
x = ox + r * Math.Sin(_a)
y = oy - r * Math.Cos(_a)
Shapes.Move(out[i], x - 35, y - 35)
Shapes.Move(in[i], x - 25, y - 25)
EndFor
Program.Delay(100)
EndWhile

Sub Init
gw = 598
gh = 428
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
ox = gw / 2
oy = gh / 2
r = 60
i = 0
GraphicsWindow.BrushColor = "Transparent"
GraphicsWindow.PenWidth = 12
color = "GreenYellow"
For i = 1 To 3
a = (i - 1) * 120
_a = Math.GetRadians(a)
x = ox + r * Math.Sin(_a)
y = oy - r * Math.Cos(_a)
GraphicsWindow.PenColor = color
out[i] = Shapes.AddEllipse(70, 70)
Shapes.Move(out[i], x - 35, y - 35)
GraphicsWindow.PenColor = "Black"
in[i] = Shapes.AddEllipse(48, 48)
Shapes.Move(in[i], x - 24, y - 24)
EndFor
GraphicsWindow.BrushColor = color
GraphicsWindow.PenWidth = 0
ell = Shapes.AddEllipse(70, 70)
Shapes.Move(ell, ox - 35, oy - 35)
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "DimGray"
ell = Shapes.AddEllipse(50, 50)
Shapes.Move(ell, ox - 25, oy - 25)
EndSub