3.9 Animation
Yorick's ordinary drawing commands make poor movies. In order to make
a good movie on your screen, you need to use more resources -- the
idea is to draw the picture into offscreen memory first, then use a
fast copy operation to make the entire frame appear instantly.
The animate command creates an offscreen pixmap, and redirects the
rendering routines there, and modifies the fma command to perform the
copy from offscreen to onscreen. A second animate command returns to
the ordinary mode of operation.
You can't use animate mode for ordinary interactive work, because you
don't get to see your picture until the fma. Typically, you need to
write a Yorick function which enters animate mode, loops producing
frames of the movie, then exits animate mode. Use the high level
movie interface by including
After this include, you can use the movie function, and let it manage
the low level animate function for you. You only need to write a
function (passed as an argument to movie) that draws the n-th frame of
your movie and returns a flag saying whether there are any more frames.
You can easily build and test this function a frame at a time in
ordinary non-animation mode. Study the `demo2.i', `demo3.i',
and `demo5.i' demonstration programs that come with the Yorick
distribution to learn more about making movies.
|