Previous topic TOC

Make snapshots and video clips

Next topic

Animation

Now we are able to set up a scene and define objects, it is a small step to let the objects move around in a predefined way. Example:

var a=Box(10,10,10);    // create a cube
var t = 0;		// define a counter
while (t<10)	        // as long as t < 10 loop:
{	
	a.move(1,0,0);   // move 'a' 1 units in x direction
	WaitFrame();	 // synchronize with render window
	t++;             // increment t with 1
};

Two concepts are introduced here: one is a control loop (in this case the while statement) that enables us to evaluate a block of statements repeatedly as long as a criterion is met (in this case t<10). Secondly, the WaitFrame function will halt the evaluation of the script to let the render window display the current scene. With the help of this function, the display is synchronized with the evaluation of the script.

Replay After evaluation of the script, you can replay the movements of the objects with the Replay command (Script->Start Replay). This command will move all objects again as occurred during the evaluation of the script. It only replays the last evaluation, and is available after the evaluation of the script was ended. You can pause and stop the replay by using the commands Script->Pause Replay and Script->Stop Replay
Snapshot You can take a snapshot of the scene at any time. The snapshot is saved in bitmap, jpeg, png or gif format. The picture gets the same dimensions as the current size of the render window.
Capture You can capture the animation into a video clip (avi format) by using the Capture->Start command. The preferrable way of using this command is to first evaluate the scene, then resize the render window to an appropriate size. Next use the Capture->Start command and enter a filename to save the video-data into. Then use the replay function to start replay. When the replay starts, capturing will start also, and you will see the video file size indicated in the caption bar of the render window. You can stop capturing by stopping replay, or by stopping capturing (Capture->Stop). The resulting avi file is an uncompressed video file.  
VRML Finally, the animation can be saved as a VRML file. Use the command File->Export VRML to export the scene data and animation as a VRML file.  You can watch the file with for example the Cartona VRML Client (Parallel Graphics). Click on an object to start the animation in the VRML renderer.