Microsoft Small Basic

Program Listing: KQC202
' Challenge of the Month - October 2017 -- Graphics Challenge -- by NaochanON
GraphicsWindow.Width=1000
GraphicsWindow.Height=700
GraphicsWindow.BackgroundColor="Lightcyan"

makeshapes()
Program.Delay(1000)

While "True"
ds=2
For i=1 To Fn
angle[i]=angle[i]+ds
setting()
EndFor
Program.Delay(100)
endwhile

Sub makeshapes
Fn=16 ' Max 16
color="1=#FFDB4F;2=#FFEA00;3=#F08300;4=#EC6D71;5=#E60033;6=#E60033;7=#98D98E;8=#69B076;9=#3EB370;10=#007B43;11=#2CA9E1;12=#007B43;13=#00A3AF;14=#1E50A2;15=#17184B;16=#BC64A4;17=#E95295"
DR="0=250;1=10;2=80;3=10;4=100;5=380;6=75"
x0=500
y0=20+DR[0]
'Boxes
For i=1 To Fn
GraphicsWindow.BrushColor=color[i] 'GraphicsWindow.GetRandomColor()
GraphicsWindow.penColor=color[i+1] 'GraphicsWindow.GetRandomColor()
GraphicsWindow.PenWidth=2
deg=360/Fn*(i-1)
angle[i]=deg ' initial angle
shp[1][i]=Shapes.AddEllipse(DR[1],DR[1])
shp[2][i]=Shapes.AddEllipse(DR[2],DR[2]*0.75)
shp[3][i]=Shapes.AddRectangle(DR[3],DR[0])
setting()
EndFor
' Frame
deg=360/12
rad=math.GetRadians(deg)
GraphicsWindow.BrushColor="#007B43"
GraphicsWindow.penColor="#2F5D50"
shp[4][1]=Shapes.AddEllipse(DR[4],DR[4])
Shapes.Move(shp[4][1],x0-DR[4]/2,y0+DR[1]-DR[4]/2)
shp[5][1]=Shapes.AddRectangle(DR[1]*2,DR[5])
Shapes.Move(shp[5][1],Shapes.GetLeft(shp[4][1])+DR[4]/2-DR[1]-DR[5]*Math.Sin(rad)/2,Shapes.Gettop(shp[4][1])+DR[4]/2-DR[5]*(1-Math.Cos(rad))/2)
Shapes.Rotate(shp[5][1],deg)
shp[5][2]=Shapes.AddRectangle(DR[1]*2,DR[5])
Shapes.Move(shp[5][2],Shapes.GetLeft(shp[4][1])+DR[4]/2-DR[1]+DR[5]*Math.Sin(rad)/2,Shapes.Gettop(shp[4][1])+DR[4]/2-DR[5]*(1-Math.Cos(rad))/2)
Shapes.Rotate(shp[5][2],-deg)
shp[5][3]=Shapes.AddRectangle(DR[5]/2,DR[1]*2)
Shapes.Move(shp[5][3],x0-DR[5]/2/2,y0+DR[5]/2-DR[1]*2)
GraphicsWindow.BrushColor="#C1D8AC"
shp[6][1]=Shapes.AddEllipse(DR[6],DR[6])
Shapes.Move(shp[6][1],x0-DR[6]/2,y0+DR[1]-DR[6]/2)
' ground
GraphicsWindow.BrushColor="#D8E698"
GraphicsWindow.FillRectangle(0,Shapes.Gettop(shp[5][1])+DR[5]-(DR[5]*(1-Math.Cos(rad))/2),1000,200)
EndSub

Sub setting
rad=math.GetRadians(angle[i])
Shapes.move(shp[1][i],x0+DR[0]*Math.Sin(rad)-5,y0-DR[0]*Math.cos(rad)-5)
Shapes.move(shp[2][i],Shapes.GetLeft(shp[1][i])-(DR[2]-DR[1])/2,Shapes.Gettop(shp[1][i])+DR[1])
Shapes.move(shp[3][i],Shapes.GetLeft(shp[1][i])-DR[0]*Math.Sin(rad)/2,Shapes.Gettop(shp[1][i])+DR[1]/2-DR[0]*(1-Math.Cos(rad))/2)
Shapes.Rotate(shp[3][i],angle[i])
endsub