Saturday, February 07, 2009

Clutter animation paths with Inkscape+Inkface (v0.1.3)

While I am working on inkface v0.2, I will keep releasing dot versions for 0.1.x that will have some improvements that are independent of altsvg backend. So I have posted v0.1.3 source tarballs.

Only major improvement in v0.1.3 is the exporting of path data of SVG path elements. This path data can be used by clutter based applications to create "Knots" (animation paths along which objects can move). Check out the following video.



In this app, four paths were drawn in Inkscape. Then using inkface v0.1.3 library their path data was made available to clutter app. The clutter app created "BehaviourBspline" using this data and made the ball and star move along these splines.

As can be seen, any complicated paths can be created using this method. Without it, one will have to calculate coordinates of each point along which one wants to animate (very tedious to calculate control points for Bézier curves).

v0.1.3 source tarballs: libaltsvg, inkface

The clutter app is a single python script available here (also part of inkface tgz). You are looking for element_to_bspline

7 comments:

Anonymous said...

cool!

i'm not sure if i try to build inkface correctly, so didn't do a bug report on the tracker.

libaltsvg seems successfully build with the "standard" ./configure && make (&& sudo make install)

and for inkface i assume (INSTALL/README?) we need to use scons ? i have no experience with scons, so doing "scons" gives me:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Compiling src/bindings/c/inkface.os ...
In file included from src/bindings/c/inkface.c:12:
src/bindings/c/cinkface.h:7: error: expected specifier-qualifier-list before 'canvas_t'
src/bindings/c/inkface.c: In function 'inkface_loadsvg':
src/bindings/c/inkface.c:23: warning: passing argument 1 of 'load_element_list' from incompatible pointer type
src/bindings/c/inkface.c: In function 'inkface_create_X_canvas':
src/bindings/c/inkface.c:35: error: 'canvas_t' undeclared (first use in this function)
src/bindings/c/inkface.c:35: error: (Each undeclared identifier is reported only once
src/bindings/c/inkface.c:35: error: for each function it appears in.)
src/bindings/c/inkface.c:35: error: 'cobject' undeclared (first use in this function)
scons: *** [src/bindings/c/inkface.os] Error 1
scons: building terminated because of errors.

...

btw. they added this in clutter 0.9 http://www.clutter-project.org/docs/clutter/0.9/ClutterPath.html

Jayesh said...

Time to add that README. I just checked it in. Please refer to it for SCons build instructions.

> btw. they added this in clutter 0.9 http://www.clutter-project.org/docs/clutter/0.9/ClutterPath.html

Cool. While trying to understand how "Knots" work; I was expecting Clutter would implement animation paths based on curve_to, line_to, move_to API. That's exactly what they seem to have done in v0.9. That doesn't however preclude inkface. Inkface will do the job of pulling the path information from SVG file. What clutter v0.9 will achieve is the code inside "element_to_bspline" routine. Instead of calculating knots, we can now simply use clutter_path_add_{line_to,move_to,curve_to} APIs.

Anonymous said...

Thanks for the README, really appreciate it! But is there another way to install Inkface than installing the .deb ?

ps. i have scons v0.98.5.r3057 and the build seemed to work.

Jayesh said...

Hmmm...

RPM builds were on my TODO list for today. Fortunately I got it working in few hours.

libaltsvg-0.1.3-1.x86_64.rpm ,
inkface-python-0.1.3-1.x86_64.rpm

These are Fedora 10 x86_64 RPMs. It will take me some time though to setup environments for other architectures/distro versions. Let me know if you try it.

Anonymous said...

er...

i was thinking more on the standard "./configure --prefix=/where/ever && make && (sudo) make install" (extra points for "uninstall";) like most? of the source code in FLOSS world does...
i assume scons is able to do that ?

i don't want to start installing "broken" packages, nor do i want to start use checkinstall instead of "make install".

and there are systems that don't use a package manager, or at least not deb/rpm.

Jayesh said...

I see.

Well, in the process of setting up rpmbuild, I added 'install' target to the SCons script as well.

Following should install inkface-python library (it's only a single file so far) to your environment.

scons -Q python-lib
scons -Q install prefix=$BUILD_ROOT

libaltsvg already has "make install".

HTH.

Jayesh said...

Forgot to mention that this is not part of the tarball yet. If you check-out trunk/altcanvas/inkface at r886, it will have the bits of v0.1.3 + the install target changes for SCons.