Microsoft Small Basic

Program Listing: HNC322
GraphicsWindow.Height = 300
GraphicsWindow.Width = GraphicsWindow.Height*2
GraphicsWindow.BackgroundColor = "DeepSkyBlue"
GraphicsWindow.CanResize = 0
CenterX = GraphicsWindow.Width/2
CenterY = GraphicsWindow.Height/2
SunDiameter = 80
AmountOfRays = 32
DistanceFromCenter = 48
LengthOfRays = 10
SunColor = "Gold"
InitializeSun()
Sub InitializeSun
_SunRadius = SunDiameter/2
_AngleStep = 360/AmountOfRays
_StepRadians = Math.GetRadians(_AngleStep)
GraphicsWindow.BrushColor = SunColor
GraphicsWindow.PenColor = SunColor
_SunCircle = Shapes.AddEllipse(SunDiameter,SunDiameter)
Shapes.Move(_SunCircle,CenterX-_SunRadius,CenterY-_SunRadius)
For _Angle = 0 To 359 Step _AngleStep
_Radians = Math.GetRadians(_Angle)
_X1 = CenterX+Math.Cos(_Radians)*DistanceFromCenter
_Y1 = CenterY+Math.Sin(_Radians)*DistanceFromCenter
_X2 = CenterX+Math.Cos(_Radians+_StepRadians/2)*DistanceFromCenter
_Y2 = CenterY+Math.Sin(_Radians+_StepRadians/2)*DistanceFromCenter
_X3 = CenterX+Math.Cos((_Radians+_Radians+_StepRadians/2)/2)*(DistanceFromCenter+LengthOfRays)
_Y3 = CenterY+Math.Sin((_Radians+_Radians+_StepRadians/2)/2)*(DistanceFromCenter+LengthOfRays)
_Triangle[_Angle] = Shapes.AddTriangle(_X1,_Y1,_X2,_Y2,_X3,_Y3)
_CircleDiameter = Math.SquareRoot((_X2-_X1)*(_X2-_X1)+(_Y2-_Y1)*(_Y2-_Y1))+2
_Circle[_Angle] = Shapes.AddEllipse(_CircleDiameter,_CircleDiameter)
Shapes.Move(_Circle[_Angle],(_X1+_X2)/2-_CircleDiameter/2,(_Y1+_Y2)/2-_CircleDiameter/2)
EndFor
EndSub