In this tutorial we'll show how an animation can be created that changes the visibility of objects over time.
This tutorial is done using the Animation sample project. Set the working directory to /base/Ex.1-Visibility to run this example.
Creating the script
To create the animation script, run the command Tex/Animations/Create animation script.
On the general tab, enter the following data:
|Animation script name||animation||The name of the script file created will be CameraPath.py|
|Duration||10||Animation will be 10 seconds long (in the AVI created - it may take more or less time to actually create the animation in the 3D window).|
|Frames per second||24||24 frames are generated for each second of video.|
|Clear graphics on run||True||The 3D window will be cleared of all geometry prior to running the animation.|
|Hide scalebar||True||The scalebar will be hidden prior to the animation and restored at the end of it.|
|Hide orientation widget||True||The XYZ orientation widget will be hidden prior to the animation and restored at the end of it.|
The next tab to populate is the Visibility tab.
|Start time (row 1)||0.0||The time at which the object becomes visible in the animation (in seconds)|
|Start time (row 2)||3|
|Start time (row 3)||4|
|End time (row 1)||3||The time at which the object becomes hidden in the animation|
|End time (row 2)||10|
|End time (row 3)||10|
Geometry (row 1)
|../grid+.mgrid||The geometry to show when visible.|
Geometry (row 2)
Geometry (row 3)
|To add new rows in the table, right click the header row and click Add rows from the popup menu.|
The final tab that needs to be edited is the Camera tab. We're going to add a single camera that records the screen as is.
|Camera type||screen||Sets the camera to record the 3D window.|
|Name||Camera1||The name of the camera and the name of the AVI file that will be created.|
|Start time||0||The time at which the camera becomes active.|
|End time||10||The time at which the camera becomes inactive.|
|Path||<Nothing>||Not needed for this camera type.|
Hit OK to generate the script and it will be written into the working directory.
Running the script
To run the animation and create the AVI, simply drag and drop the animation.py file into the 3D window.
|For the 'screen' camera type, its a good idea to load some of the geometry prior to running the animation. The animation script doesn't reset the view/zoom each time geometry is loaded.|
Once the animation is complete, there will be an AVI file in the working directory, named after the Camera name.