movie (draw_frame [, time_limit = 120.] [, min_interframe = 0.0] [, bracket_time = array ([ 2., 2.], Float )] [, lims = None] [, timing = 0])
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: def draw_frame (i) : # Input argument i is the frame number. # draw_frame should return non-zero if there are more # frames in this movie. A zero return will stop the # movie. # draw_frame must NOT include any fma command if the # making_movie variable is set (movie sets this variable # before calling draw_frame)
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.
The draw_frame function is as follows:
def demo5_light (i) : global making_movie if i >= 30 : return 0 theta = pi / 4 + (i -1) * 2 * pi/ 29 light3 (sdir = array ( [cos( theta), .25, sin( theta)], Float)) # without an explicit call to draw3, the light3 # function would cause no changes until Python # paused for input from the keyboard, since # unlike the primitive plotting functions (plg, plf, # plfp, ...) the fma call made by the movie function # will not trigger the 3-D display list. any movie # frame display function which uses the 3-D drawing # functions in pl3d. py will need to do this. the # !making_movie flag supresses the fma in draw3 if # this function is called by movie (which issues # its own fma), but allows it otherwise draw3 ( not making_movie ) return 1
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
), with a moving
light source. A few frames of the movie are shown on the next page.
set_draw3_(0) x = span (-1, 1, 64, 64) y = transpose (x) z = (x + y) * exp (-6.*( x* x+ y* y)) orient3 ( ) light3 (diffuse=. 2, specular= 1 ) limits_( square = 1) plwf (z, y, x, shade= 1, edges= 0) [xmin, xmax, ymin, ymax] = draw3 (1) limits (xmin, xmax, ymin, ymax) making_movie = 1 movie( demo5_light, lims = [xmin, xmax, ymin, ymax]) making_movie = 0