Microsoft Small Basic

Program Listing: CSQ869-1
While "true
GW=1200
GH=800
dR=20
GraphicsWindow.Left=10
GraphicsWindow.Top=10
GraphicsWindow.Title="Patternz
GraphicsWindow.BackgroundColor="Darkblue
GraphicsWindow.Width=GW -3*dR
GraphicsWindow.Height=GH
GraphicsWindow.PenWidth=0
NY=math.Round(GH/dR)
NX=math.Round(GW/dR)
add_mesh()
add_rect()
showMesh()
showrect()
Program.Delay (9999)
GraphicsWindow.Clear ()
endwhile

Sub add_mesh
For j= 1 To NY
For i=-NX/2 To NX*1.5 Step 8
GraphicsWindow.BrushColor=GraphicsWindow.GetRandomColor()
rect[J+":1"][i]=Shapes.AddRectangle(dR,dR)
Shapes.Move(rect[J+":1"][i],Math.GetRandomNumber(900),-2000)
rect[J+":2"][i]=Shapes.AddRectangle(dR,dR)
Shapes.Move(rect[J+":2"][i],Math.GetRandomNumber(900),2000)
EndFor
EndFor
EndSub

Sub add_rect
For j= -4 To NY Step 8
For i=-NX/2 To NX*1.5 Step 8
GraphicsWindow.BrushColor=LDColours.HSLtoRGB (math.Remainder (cc 360) 1 .6)
cc=cc+15
L_rect[J+":1"][i]=Shapes.AddRectangle(4*dR,4*dR)
Shapes.Move(L_rect[J+":1"][i],Math.GetRandomNumber(900),-2000)
LDEffect.DropShaddow (L_rect[J+":1"][i] "")
LDShapes.AnimateRotation(L_rect[J+":1"][i] 1500 5)
L_rect[J+":2"][i]=Shapes.AddRectangle(4*dR,4*dR)
Shapes.Move(L_rect[J+":2"][i],Math.GetRandomNumber(900),2000)
EndFor
EndFor
EndSub

Sub showmesh
For j= 1 To NY
For i=-NX/2 To NX*1.5 Step 8
Shapes.Animate(rect[J+":1"][i],dR*i+dR*J,dR*(J-1),2000)
Shapes.Animate(rect[J+":2"][i],dR*(i-1)-dR*J,dR*(J-1),2000)
EndFor
EndFor
EndSub

Sub showrect
For j= -4 To NY Step 8
For i=-NX/2 To NX*1.5 Step 8
Shapes.Animate(L_rect[J+":1"][i],dR*(i+2)+dR*J,dR*(J+5),2000)
Shapes.Rotate(L_rect[J+":1"][i],-45)
Shapes.Animate(L_rect[J+":2"][i],dR*(i-2)+dR*J,dR*(J+1),2000)
Shapes.Rotate(L_rect[J+":2"][i],-45)
EndFor
EndFor
EndSub