Tufts University Logo
Computational Geometry
Department of Computer Science
Home Research Topics People Papers & Presentations Courses
Software
Geometry Links
Generic XML Interpolator
Introduction
Although interpolating XML documents isn't conceptually hard, we couldn't find an open source interpolation package. The GXI package aims to address this by providing an open framework to facilitate interpolating XML files.

To use GXI you'll need:
Usage
To run GXI you'll need an "animation" XML file that describes the interpolation you wish to perform as well as "drawing" XML file that serves as your initial frame. To simplify GXI, certain XML tags are assumed to be present in the "animation" XML file. Specifically, GXI expects the animation file to have a top level tag containing a frame count attribute. In addition, key frames are described as children of the tag as tags and contain id, attribute, and value attributes.

Example:

<?xml version='1.0'?>
<animation framecount='30'>
<keyframe id='t1' attribute='value' frame='30' value='xscale:1.3' />
</animation>

The only assumption GXI makes about the drawing XML is that every tag that is being interpolated has an id attribute. Finally, you must run GXI with the following arguments in order:

interpolateClass pathToDrawingXml pathToAnimateXml
Connector Internals
By design, every connector must extend the abstract XMLinterpolator class. The logic of the interpolation is handled in the interpolateItem() function. This function will be called for every XML tag that needs interpolation for each frame being interpolated. The main logic of the connector lives in interpolateItem().

The basic idea would be to look at tagName and attrName to determine what kind of value is being interpolated. Then, either handle the interpolation locally or in a function and return a new value that represents the fraction represented by "fraction" between valueStart and valueEnd.

The other function in XMLinterpolator, afterAnimate(), is called after a single frame has finished interpolating. The function is called with the XML for the current frame and the current frame number.

That's about it. Where to go from here? Check out the drawing/animation samples and the SVG connector.