Programming Project #3: Keyframe Animation

CSE 169: Computer Animation


Due: Wednesday, Feb 18, 11:59pm


Write a program that loads a keyframe animation from an .anim file (described below) and plays it back on a skinned character.


The program should be able to load any .skin, .skel, and .anim file given to it, and should accept them as command line arguments. For example:


project3  monster.skel  monster_walk.anim


If no file name is given, it should default to ‘test.skel’, ‘’, and ‘test.anim’.

Anim File Description

The .anim file contains an array of channels, each channel containing an array of keyframes. For a simple example, see sample.anim. The sample is just a very basic example of an anim file and doesn’t correspond to any useful animation.


The structure of the anim file is as follows:


animation {

    range [time_start] [time_end]

    numchannels  [num]

    channel {

        extrapolate [extrap_in] [extrap_out]

        keys [numkeys] {

            [time]  [value]  [tangent_in]  [tangent_out]




    channel {






The [time_start] and [time_end] describe the time range in seconds that the animation is intended to play. This range doesn’t necessarily correspond to the times of the first and last keyframes.


The number of channels [num] will be 3 times the number of joints in the character, plus an additional 3 for the root translation. The channels are listed with the 3 root translations first in x,y,z order, followed by the x,y,z rotation channels for each joint in depth-first order.


The extrapolation modes [extrap_in] and [extrap_out] will be one of the following: “constant”, “linear”, “cycle”, “cycle_offset”, or “bounce”.


[numkeys] specifies the number of keyframes in the channel. The keys themselves will be listed in increasing order based on their time.


Each key specifies its [time] and [value] in floating point. The tangent types [tangent_in] and [tangent_out] will be one of the following: “flat”, “linear”, “smooth”, or it will be an actual floating point slope value indicating the fixed tangent mode.

Animation Sample

As an example, try the wasp walking animation: wasp_walk

The skel and skin file in this version of the wasp are slightly different from those used in project 2, so make sure you use all of these files together. You don’t have to use the .rig file if you don’t want to.


This project is worth 15 points:


4:         Loads an animation and stores it internally

3:         Ability to evaluate channel within key ranges

3:         All tangent types working properly

3:         All extrapolation modes working properly

2:            Reasonable use of object oriented design in code

15:       Total


Extra Credit:

1:         Display the animation curves for the active joint (or active DOF). It should show the curve itself, the actual keyframes, and the tangents. It can be in a separate window or overlayed in the main 3D window.


2:         Write a simple channel editor that allows the user to insert a key at some arbitrary time, adjust the value of a key, delete a key, and select the tangent types and extrapolation modes. It could start by just loading a character (skel & skin) and allow the user to create channels for every joint, then save out the animation. (it should also be able to start with an existing animation).