Have fun...
REM *** Morphing 3D Dot Plane
REM *** Made in 14 lines, by Martin Enderleit
REM *** Can be compressed to 2 lines, but that would be REALLY unreadable... :D
REM - Comment format = REM [LineNo] - Useful comment... ;)
REM [1] - Set syncing...
sync on : sync rate 50
REM [2] - A few variables for ease and speed...
sw = screen width() : sh = screen height() : ang# = 0.0
REM [3] - Main Loop
do
REM [4] - Increase angle value, wrap it, and clear screen to black.
inc ang#, 1.0 : ang# = wrapvalue(ang#) : cls 0
REM [5] - Transformation and draw loop.
for z#=-15.0 to 15.0 step 1.0 : for x#=-15.0 to 15.0 step 1.0
REM [6] - Generate the wave effect using sin/cos and the angle value...
y# = sin(ang# + ((cos(ang#)*360.0+360.0)/31.0)*x#) * 5.0 : inc y#, cos(ang# + ((sin(ang#*1.5)*360.0+360.0)/31.0)*z#) * 5.0
REM [7] - Rotate the plane around the Y-Axis...
rx# = x# * cos(ang#) + z# * sin(ang#) : rz# = x# * -sin(ang#) + z# * cos(ang#)
REM [8] - Rotate the plane 45 degrees around the X-Axis to get a better view...
ry# = y# * cos(-45.0) - rz# * sin(-45.0) : rz# = y# * sin(-45.0) + rz# * cos(-45.0)
REM [9] - Project to 2D coordinates...
px# = rx# / (rz# + 35.0) : py# = (ry#) / (rz# + 35.0)
REM [10] - Map the coordinates to the screen...
sx = px# * sw / 2.0 + (sw / 2.0) : sy = -py# * sh / 2.0 + (sh / 2.0)
REM [11] - Color pixels based on distance, and draw the dots...
col = 255.0 / 62.0 * -(rz#+35.0) : dot sx, sy, rgb(col,col,col)
REM [12] - End Transformation and Draw loop...
next x# : next z#
REM [13] - Sync
sync
REM [14] - End of Main Loop
loop