Microsoft Small Basic

Program Listing: HZZ916-0
' Challenge of the month July 2012
' Make a National Flag ...... USA


USA()

Sub USA
GraphicsWindow.Show()

GraphicsWindow.Title=" USA ..... Natinal Flag "
GraphicsWindow.BackgroundColor="white"
GraphicsWindow.Width=800
GraphicsWindow.Height=35*2*6+35
'------------------------- Red bar -------------------------------
GraphicsWindow.BrushColor="red"
GraphicsWindow.PenColor="red"
For i=1 To 7
bar[i]=Shapes.AddRectangle(800,35)
Shapes.Animate(bar[i],0,2*35*(i-1),i*200)
EndFor
'------------------------- Blue rectangle -------------------------------
GraphicsWindow.BrushColor="navy"
GraphicsWindow.PenColor="navy"
brect=shapes.AddRectangle(350,35*7) '760 472
'------------------------- 50 white star -------------------------------
Px="1=0;2=44;3=88"
PY="1=0;2=29;3=0"
GraphicsWindow.BrushColor="white"
GraphicsWindow.PenColor="white"
For K=1 To 50
For j=1 To 3
a[k][J]= Shapes.AddTriangle(Px[1],PY[1],Px[2],PY[2],Px[3],PY[3])
Shapes.move(a[k][j],0,-80)
EndFor
Shapes.Rotate(a[k][2],-70)
Shapes.Rotate(a[k][3],72)
EndFor
Program.Delay(1000)

'------------------------- star positioning -------------------------------
X0=0
Y0=5
For K=1 To 50
X=x0+Math.Remainder(K-1,11)*50
Y=y0+(Math.Floor((k-1)/11))*52
F=k-11*math.Floor((k-1)/11)
dx= math.floor( ( F-1 )/6 )*275
dy= Math.Floor( math.floor( F-1 )/6 )*26
For j=1 To 3
Shapes.Animate(a[k][j],X-dx,Y+dy,K*5)
Shapes.Zoom(a[k][j],0.2,0.2)
EndFor
Program.Delay(K*5)
EndFor
EndSub