Yet Another Interpolator is Inkscape with a spreadsheet slapped on, and with a python interpreter for good measure.
What is this, really?
Yet Another Interpolator is a modification of Inkscape with a two-dimensional array to allow easier selection and copying of objects. This is useful if you have many SVG objects (groups, paths, etc) that are really the same object but indexed by time.
Yet Another Interpolator also includes an interpolator that allows generating an object (indexed by time) at intermediate values of time. It can automatically answer these queries:
x(0) = (0,0), x(1) = (50,100), x(0.5) = ???
The answer is not always (25,50)
. This depends on the interpolant chosen. The answer may not even be of the form (t,2t)
. (Right now, piecewise linear and Catmull-Rom cubic spline are implemented for interpolation in space (x
versus y
), polynomial and simple harmonic motion ("elastic") are implemented for interpolation in time (x
versus t
). But you can define whatever function you want.)
Yet Another Interpolator includes an ipython interpreter so that you can programmatically (and instantly)
- Alter the XML tree representing the SVG file being edited.
- Alter the GTK+ user interface. Add buttons, keyboard shortcuts, etc
- Alter YAI's own code (requires a reload but no program restart).
More features coming soon, possibly.
Basic usage
With YAI as editor and renderer
- Create a path (using the pen or pencil tool).
- Change this path's
id
tomypath-0
. To quickly do this, change the entry of text box below the frame table next to Set tomypath-0
and then click Set. - Click Track. A new row labelled
mypath
is created. - Click on the only filled cell (row
mypath
, column0
). The cell turns cyan. - Click
Mark
. The cell should turn purple. - Click on the cell next to it (row
mypath
, column1
). - Click
Paste
. This creates a new path namedmypath-1
. - Edit this newly created path (move it around, change its points and handles, change fill and stroke hues and opacity).
- Click
Interpolate
. - Drag the slider next to the
Interpolate
button. You should see a path move (progressively transform) from the first path you created the second path you created. - Type
wrap.animator.anim(0.5)
in the ipython interpreter. This has the same effect as moving the slider to the midpoint. - Type
wrap.animator.run(1.0)
in the ipython interpreter. This will move the slider from0
to1
at0.1
second increments.
With YAI as a renderer only
- Create 2 paths with the same number of nodes however you want.
- Change the
id
of one path tomypath-0
and theid
of the other path tomypath-1
. - Select one of the paths and click
Track
. - Click
Interpolate
.
You could also just follow steps 1 and 2 and then use an external script (not yet available iwth YAI) on an SVG created with any version of Inkscape or any other program.
Why make this?
Many programs with UIs mix data specification (drawing the frames in this case) and data interpretation (rendering in this case). But I want mix and match. I discovered Inkscape by accident and really like its interface. But I also want to use that interface enter data that wasn't just vector graphics (animation for the moment).
Sometimes a programming language is the best thing for generating data. Sometimes being able to visually place points is much easier and faster.
So YAI was made. Right now, YAI is designed to work with Inkscape since its my preferred program for entering data of this kind. But ultimately, if you can separate the data entry from the data interpretation portion of a different program, YAI could be added to it too.
Eventually I'd like to enter any kind of data: audio, video, webpages using Inkscape's interface (and then parsing the output SVG). With the help of some default functions, each time I want to create the editor I need to create the document I want to making this a tedious task.
If the user knows what document they want to create and can describe it succinctly and precisely, it should be easy to make the document, even if its unorthodox.
Compiling
Pre-requisite
Since this is an Inkscape fork, everything for compiling Inkscape itself is needed. See Compiling Inkscape on the Inkscape Wiki.
Extra requirements
- Cython >= 1.8 (?)
- Python header files (for your version of Python. Currently YAI works with Python 2.x only.)
Linux
Tested on Ubuntu. Please e-mail me with any hints for other distributions.
Install extra packages if this isn't already done.
cython python-gtk2-dev pygtk
Build pybind
$ mkdir build $ cd build $ ../configure --with-python $ make
You can now either make install
and run
$ inkscape #The binary's name needs to change soon.
Or test things first. In that case, you'll need to copy the default configuration files.
$ cp -a share /usr/loca/share/inkscape
Running
$ export PYTHONPATH=$PYTHONPATH:/path/to/pyink $ /path/to/pybind/build/src/inkscape