25.1 How to Animate Algorithms

This chapter introduces our recipe for creating animations of algorithms. Somewhat surprisingly, we found that the steps for producing algorithm animations are still basically the same as originally identified by Walt Disney for conventional (non-computer-) animation [Tho91]. The following seven-step process illustrates on a practical example, namely the list ranking algorithm to compute the distance from the end of a list for each object in a linked list [Cor90], how to get from the pseudocode description of the algorithm to the full animation.

Script
The first stage in any film production is the creation of a script. Contrarily to a live film, where the dialogue is in the center, the algorithm description in pseudocode describes the high-level action happening in the animation. Figure II.19 gives a pseudocode description of the list-rank algorithm described in [Cor90] used to compute the distance from the end of the list for each object in a linked list.

     LIST-RANK(L)
      1 for each processor i, in parallel
      2   do if next [i] = NIL
      3        then d[i] <- 0
      4        else d[i] <- 1
      5 while there exists an object i such that next [i] != NIL
      6   do for each processor i, in parallel
      7        do if next [i] != NIL
      8             then d[i] <- d[i] + d[next [i]]
      9               next [i] <- next [next [i]]

Figure II.19 List ranking algorithm to compute distance from
end of list for each object in a linked list (from [Cor90])
Storyboard
From the script, the animation director produces the storyboard, a series of drawn images that graphically illustrate the action described in the script. A similar process also applies to algorithm animation. The animation storyboard graphically visualizes the main steps during the execution of the algorithm. Figure II.20 shows a sample storyboard of the list-rank algorithm directly taken from the illustration in the textbook [Cor90].

Figure II.20 Graphical visualization of the list-rank algorithm in [Cor90]
Layout
Once the storyboard defines the main course of action, the film designer produces visual interpretations of all the characters featured in the film. Similarly, for an algorithm animation, the main elements (usually data structures) to be animated have to be specified graphically. Figure II.21 displays the main character of the list-rank animation, namely a processor element including a box storing the computed distance of the element from the list end.

Figure II.21 Sample layout of main element for list-rank animation
Sound Track
If there is a soundtrack for the animation, it has to be recorded before the final animation is produced. This fundamental animation producer wisdom applies also to algorithm animation, as for perfect synchronization the soundtrack has to be completed first, and then the animation produced to fit the soundtrack.
Animation
In this step the computer animation of the algorithm is produced based on storyboard and layout. The implementation of the animation can be done either with computer animation packages like MacroMedia Director [Vau94], scripting languages like HyperTalk, or animation systems like Zeus, XTango, or Pavane. Figure II.22 displays three keyframes of the list-rank animation. This animation was done with AddMotion [Add90], a computer animations package that allows to create animation elements graphically and then to control them through HyperTalk scripts.



Figure II.22 Keyframes for list-rank animation
Inbetweening
Once keyframes have been defined (as in figure II.22) in the animation authoring environment, the inbetweening is done automatically by the animation authoring system. The end product is a smoothly running movie.

The next two steps that were used by Walt Disney for producing his animated movies, namely Xeroxing, Inking, Painting, and Camera can in this case be omitted due to the capabilities of the computer that is automatically taking care of generating the final movie.

Editing
The last step in conventional animation, careful editing of the completed animation, should definitively not be omitted. The quality of the final product can easily double if a last deliberate editing process is applied to the completed algorithm animation.