An Animation2d object is a container for the controls for a two dimensional animation. The user supplies these controls, which are functions (written in Python) that initialize internal variables in the object, compute the coordinates for each frame, and update the internal variables. To see the animation performed, give the object to a Graph2d and ask the Graph to plot itself.
Currently Animation2d is not implemented in PyNarcisse.
Animation2d accepts the following keyword arguments:
It also has methods new and set, which work the same as the methods with the same names in other 2d objects. See "Description" on page 9, for instance.
The following keyword arguments can be specified with Animation2d:
initialize = <name of an initialization function>. This function should have one argument, the name of an Animation2d instantiation, say `anim', and when called should initialize any of anim's internal variables needed before beginning to compute the animation.
calculations = <calculation function(s) for coordinates>: the value of this keyword is the name of a function, or a list of names of functions. Each of the calculations routines should have `anim' as the argument. This routine (or these routines) are called from within a loop in the Plotter(s) associated with anim. They should compute the current values of anim.x and anim.y, the coordinates of the curve(s) in this step of the animation. The first frame starts with the results of initialize, then in subsequent calls, use the results of update (below). If more than one calculation is specified, then a plot command will be issued after each one.
update = <function to update the variables used in calculations>. This function, when called with `anim' as its sole argument, updates (increments, decrements) variables used in calculating the frames.
animation = 0/1 (If 1, supplies a smoother, less jerky animation. Default value 1.)
nsteps = number of animation steps desired. Default: 100.
color = <value> where <value> is an integer representing an index into a color chart, or a common color name like "red", "blue", "background", etc. In the interest of speed, other keywords relating to curve type, thickness, etc., are currently not allowed.
The following is an interesting example of ``dancing curves'', sine waves which appear to jump up and down and go around in circles.
We have been unable to capture steps in the animation for this document; below is a pisture of the two curves after the animation has finished. You will have to try this example yourself to see the incredible effects!