Note: All but the first argument are keyword arguments, with defaults as shown.
This function runs a movie based on the given draw_frame function. The movie stops after a total elapsed time of time_limit seconds, which defaults to 60 (one minute), or when the draw_frame function returns zero. (N. B. Currently the timing option described here and in a subsequent paragraph is not completely implemented.)
draw_frame is a function described as follows:
If min_interframe is specified, a pause will be added as necessary to slow down the movie. min_interframe is a time in seconds (default 0). The keyword bracket_time (again a time in seconds) can be used to adjust the duration of the pauses after the first and last frames. It may also be a two element array [beg, end]. If the pause at the end is greater than five seconds, you will be prompted to explain that hitting <RETURN> will abort the final pause. (Well, the Python version does not currently have this capability due to the difficulty of implementing it consistently over various platforms.)
timing = 1 enables a timing printout for your movie.
If every frame of your movie has the same limits, use the lims keyword argument to fix the limits during the movie.
In the following example, the movie demonstrates the effect of a moving light source on the currently drawn surface. (The plot functions creating the surface have not been shown; it is assumed that the data for the surface is on the current display list.)
The draw_frame function is as follows:
Here is the Python code necessary to run a movie. This particular animation shows the surface with a peak and valley which we saw earlier in this chapter(See "Examples" on page 68), with a moving light source. A few frames of the movie are shown on the next page.
spin3 is a function which takes an existing 3-D plot and spins it about an axis. It actually calls movie for you, with a draw_frame function which is internal to the pl3d module and not available outside this module, because its name begins with an underscore.
Spin the current 3-D display list about axis (default [-1, 1, 0]) over nframes (default 30). Note that all arguments are keywords. Also note that the timing keywords are allowed but are not currently implemented. Their meanings are:
tlimit: the total time allowed for the movie in seconds (default 60).
dtmin: the minimum allowed interframe time in seconds (default 0.0).
bracket_time: (as for movie function in movie.py).
lims: the axis limits, if you wish to specify them.
timing = 1 if you want timing measured and printed out, 0 if not.
angle: the total angle about the axis through which the object will be rotated. During each step of the rotation, the object will rotate angle / (nframes - 1).
In this example, we take the surface discussed previously (see "Example" on page 75) and rotate it about an axis. Assume that the sequence of code given there has been executed, giving the figure shown there. Then we do the following to run the movie:
Four frames from the resulting movie are shown on the next page.