Toolkits for 2D Animation?
profBill asks: "I work in the area of complex adaptive systems, that is understanding the emergence of complexity from the interactions of many elements (immune systems, economies, ecosystems, etc.). In particular we are using evolutionary computation to create elements/creatures that can co-exist in an ecosystem with certain interactions and relationships. All that is very interesting, but in the end, assuming we create such creatures, I have to show them to the ecologists and biologists so they can understand what is going on. The only way I can imagine doing it easily, other than with graphs and charts, is to create a 2D animation of the creatures and their interactions that these folks can watch. My problem is that there are so many choices for a toolkit to build such a 2D animation. My goal is not a movie of ILM quality, but something 'good enough'."
"'Good enough' for me means:
- Quick and dirty, that I can tune as needed.
- Zoom capability on a grid
- Pop up menus on any one grid element to get information.
- Scrolling, resizing, the typical.
- Be able to hook to a C/C++ program to get a creature's behavior
...then WHY DON'T YOU JUST PICK ONE?
If all you want to do is display simple "good-enough" 2D-animation, any 2D-toolkit would do. If you want zooming, etc, you will probably have to write that yourself, I can't imagine what features a 2D-toolkit could offer, that would avoid you having to write the actual code for display.
I know that people have been doing 2D animation in flash for a while now... we even have a new video series that uses it. ( Larry Boy ) I imagine you could throw something together using perltk and perl::flash to create flash movies. I haven't played with the perl::flash stuff, but I imagine it isn't too steep of learning curve. -Tim
-I just work here... how am I supposed to know?
Q: What would you use to build such an animation?
A: A programming language. Say, C or C++?
Seriously. Consider your criteria:
Quick and dirty, that I can tune as needed.
So to produce a frame, you have each "creature" draw themselves if they overlap the present view area. The detail of each creature's "look" is local to that creature, so you can tune/tweak it at need. Done.
Zoom capability on a grid
The "present view" data includes a view-center and a scale factor, which all the drawing primatives use to translate from world coordinates to screen coordinates. Clicking on a point on the grid may make that point the new screen center and increase/decrease the scale factor, depending on which "tool" (the magnifying glass, etc.) the user has sellected. Done.
Pop up menus on any one grid element to get information.
Trivial. When the mouse hovers, or they right click, or press control-yada-yada-cokebottle, or wahatever, pop up your menu. If you also want information about each creature, use a (perhap subtilly) different colour for each creature and check the colour of the creature under the mouse to determine what to pop up. Done.
Scrolling, resizing, the typical.
Done.
Be able to hook to a C/C++ program to get a creature's behavior
Done.
It shouldn't take much longer to write than it took to ask the question, or to answer it.
-- MarkusQ
Both of these are crossplatform solutions for doing the kind of thing you require.
Java2D is easier to develop with, especially if you are not a C/C++ person, and comes with a full set of widgets for supporting UI purposes.
I might suggest you prototype your application in Java2D, and if you cannot extract useful speed out of it, to port to SDL or OpenGL, if you require interactive framerates.
OpenGL is most often used as a 3D API, but using textured polygons (or compiled display-lists of lines/polygons for better zooming/resolution independence) for your elements in orthographic projection will provide optimum performance on a plaform with hardware 3D acceleration.
However, properly written, there is no reason why Java will not provide you with adequate-to-good speed.
There is also no reason why you couldn't do this with GTK, Qt, etc.
Really, you should be looking at this from the point of view of 'which language do i feel most comfortable with, and is there a mature 2D graphics libabry for this language?' If so, use it.
I gots ta ding a ding dang my dang a long ling long
I did an REU last summer analyzing various ecology-oriented datasets collected in beaver meadows. One of the things we used for this analysis was an application I wrote for visualization. 10 plots in the window, scrolled in unison, click to get details on each point, zoom-in and out &c. In any case, this got me excited, and I've been searching for an existing model of an ecological system for which I could create a plugin for my visualizer.
My setup for the 2D non-animated data browser I created: Squeak 3.0 with some classes borrowed (PlotMorph) and a bunch of others that I wrote myself.
I've not started my animation/modeling work yet, that will be something I'll be working on after finals for a fun project. But my software setup will be the same, but manipulating the information and thus changing the direction of the modeled and animated creatures in real-time.
I may do this using Alice3D, which is a 3D environment within Squeak, or just by using the native GUI toolkit of Squeak, Morphic, which really accommodates doing this kind of work. 2D animation is trivial. You just have each object have a #step method that applies whatever needed changes are required, and a #stepTime method that determines what the interval between updates is.
If you're a C/C++/Java bigot, Smalltalk may come as a bit of a shock. But if you're interested in the best tool for the job, and are looking for an intuitive way to do 2D modelling and animation, Squeak is definitely worth evaluation.
You can email me if there's any other questions you have about my work, or about how useful Squeak is for this kind of stuff- I'd be happy to help.
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
I know a guy working on this project:
http://sourceforge.net/projects/lmljpeg/
Part of the project includes what has been described as a "Multiplane camera", wbich emulates a stack of cels, which can be defined by XML data, and the individual cels can be programatically defined in C++, ie a cell that shows falling snow/rain/etc. It was originally intended for 2d cel animation, but may be workable for your purposes.
The other part is a MJPEG software encoder/decoder for the zoran MJPEG chipset.
BBK