This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

'Tunnel' demo effect

This effect shows a tunnel in which you fly while the tunnel rotates, seemingly in 3D.

The animation of the tunnel actually isn't calculated on the fly while the animation runs, but is precalculated.
These calculations are stored in two tables: one for the angle and one for the distance.
For every frame, go through every pixel (x,y) and use the angle and distance tables to get which pixel of the texture it
should draw at the current pixel. To look like its rotating and zooming, the values of the angle and distance tables are shifted:

Source code: tunnel

Built with Processing