```
Strict
Import mojo
Function Main:Int()
New Game
Return 1
End Function
Class Game Extends App
Field vortex:Vortex
Method OnCreate:Int()
vortex = New Vortex()
SetUpdateRate 0
Return 1
End Method
Method OnUpdate:Int()
vortex.Update()
Return 1
End Method
Method OnRender:Int()
Cls
vortex.Render()
Return 1
End Method
End Class
Class Point
Field x:Float
Field y:Float
Field z:float
End Class
Class Vortex
Field cyl:Point[][]
Field slicex:Int[][]
Field slicey:Int[][]
Field mnv:Float
Field mn:Int
Field gadd:Float
Field rings:Int
Const CAMERAWIDTH:Int = 800
Const CAMERAHEIGHT:Int = 600
Method New()
rings = 26
cyl = New Point[ 17][]
slicex = New Int[17][]
slicey = New Int[17][]
For Local i:Int = 0 Until 17
cyl[i] = New Point[rings]
slicex[i] = New Int[rings]
slicey[i] = New Int[rings]
Next
Local d1:Float[17], d2:Float[17]
For Local i:Int = 0 Until 17
d1[i] = Cos((360.0/16.0)*i)
d2[i] = Sin((360.0/16.0)*i)
Next
For Local i:Int =0 To 16
cyl[i][0] = New Point
cyl[i][0].x = d1[i] * 2500
cyl[i][0].y = d2[i] * 2500
Next
Local ps:Float = rings
For Local M:Int = 0 Until rings
For Local L:Int=0 To 16
If cyl[L][M] = Null cyl[L][M] = New Point
cyl[L][M].z = ps
If M>0 Then
cyl[L][M].x = cyl[L][0].x
cyl[L][M].y = cyl[L][0].y
Endif
Next
ps = ps - 1
Next
End Method
Method Update:Void()
gadd=gadd + 0.15
Local YO:Float,XO:Float
Local hw:Int = CAMERAWIDTH/2
Local hh:Int = CAMERAHEIGHT/2
For Local k:Int=0 To rings-1
XO=CAMERAWIDTH *(Cos((((k+gadd)-mnv)*90)/9))
YO=CAMERAHEIGHT*(Sin((((k+gadd)-mnv)*90)/8))
For Local j:Int=0 To 16
slicex[j][k] = (cyl[j][k].x+XO) / (cyl[j][k].z+mnv) + hw
slicey[j][k] = (cyl[j][k].y+YO) / (cyl[j][k].z+mnv) + hh
Next
Next
mnv=mnv - 0.01
If mnv<0.0 Then mnv=mnv+4.0
End Method
Method Render:Void()
Local MD:Int = 0
For Local k:Int= 1 To (rings -2)
For Local j:Int= 0 To 15 Step 2
If MD=0 Then
'blue
DrawQuad(slicex[j ][k], slicey[j ][k], slicex[j ][k+1], slicey[j ][k+1], slicex[j+1][k+1], slicey[j+1][k+1], slicex[j+1][k ], slicey[j+1][k ], k*1.0, k, k*12.0)
' DrawQuad(slicex[j+1][k], slicey[j+1][k], slicex[j+1][k+1], slicey[j+1][k+1], slicex[j+2][k+1], slicey[j+2][k+1], slicex[j+2][k ], slicey[j+2][k ], k*8.0, k, k )
Else
'red
' DrawQuad(slicex[j ][k], slicey[j ][k], slicex[j+1][ k], slicey[j+1][k ], slicex[j+1][k+1], slicey[j+1][k+1], slicex[j ][k+1], slicey[j ][k+1], k,k,k*8.0)
DrawQuad(slicex[j+1][k], slicey[j+1][k], slicex[j+2][ k], slicey[j+2][k ], slicex[j+2][k+1], slicey[j+2][k+1], slicex[j+1][k+1], slicey[j+1][k+1], k*12.0,k,k)
End If
Next
MD=1-MD
Next
End Method
Method DrawQuad:Void(x1:Int, y1:Int, x2:Int, y2:Int, x3:Int, y3:Int,x4:Int,y4:Int, r:Int, g:Int, b:Int)
Local p:Float[8]
p[0] = x1-80
p[1] = y1-80
p[2] = x2-80
p[3] = y2-80
p[4] = x3-80
p[5] = y3-80
p[6] = x4-80
p[7] = y4-80
mojo.SetColor r,g,b
DrawPoly p
End Method
End Class
```