ArcBasicDocs

samples/mak/flag

flag.abs

59 lines of ArcBasic. Words in colour that are commands link to their help page. To run it, download ArcBasic, open the file and press F5.

Download flag.absAll files in this folder

flag.abs
Global info1$="Flag demo"Global info2$="Features mesh deformation"Include "../start.abs"Const segs=128,width#=4,depth#=.125mesh=CreateMesh()surf=CreateSurface( mesh )For k=0 To segs	x#=Float(k)*width/segs-width/2	u#=Float(k)/segs	AddVertex surf,x,1,0,u,0	AddVertex surf,x,-1,0,u,1NextFor k=0 To segs-1	AddTriangle surf,k*2,k*2+2,k*2+3	AddTriangle surf,k*2,k*2+3,k*2+1Nextb=LoadBrush( "ablogo.jpg" )PaintSurface surf,bcamera=CreateCamera()PositionEntity camera,0,0,-5light=CreateLight()TurnEntity light,45,45,0While Not KeyHit(1)	ph#=MilliSecs()/4	cnt=CountVertices(surf)-1	For k=0 To cnt		x#=VertexX(surf,k)		y#=VertexY(surf,k)		z#=Sin(ph+x*300)*depth		VertexCoords surf,k,x,y,z	Next	UpdateNormals mesh		If KeyDown(26) TurnEntity camera,0,1,0	If KeyDown(27) TurnEntity camera,0,-1,0	If KeyDown(30) MoveEntity camera,0,0,.1	If KeyDown(44) MoveEntity camera,0,0,-.1		If KeyDown(203) TurnEntity mesh,0,1,0,True	If KeyDown(205) TurnEntity mesh,0,-1,0,True	If KeyDown(200) TurnEntity mesh,1,0,0,True	If KeyDown(208) TurnEntity mesh,-1,0,0,True		UpdateWorld	RenderWorld	FlipWendEnd