Toolkits for 2D Animation? 21
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
Flash would work, right? (Score:1, Insightful)
Re:Flash would work, right? Wrong! (Score:1, Informative)
On a related note, I've concentrated quite a bit over the past year in generating charts and graphs to multiple output formats simultaneously. Of interest here are some new versions of old standard apps, Gnuplot [sourceforge.net] and Graphviz [att.com]. Both applications contain SVG output capabilities in their latest builds. I've been using both to generate both PNG, but also PS and SVG. I will generally convert the PS to PDF via Ghostscript [ghostscript.com]. To me this represents an incredible time savings by allowing me to generate PNG's to act as thumbnails for the SVG and PDF versions of the same graph. Consider also the ability to nest SVG objects within a larger SVG picture (or animation). To aid in technical illustration you could actually embed SVG chart animations with the other custom 2D animations that you seek to create to further clarify the idea you are trying to present.
Raster, vector and publication quality visualizations in one fell swoop without spending a dime. Schweet!
Well, if there are so many.... (Score:2)
...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.
perl::flash (Score:2)
The obvious answer (Score:3, Insightful)
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
Qt anyone? (Score:1, Insightful)
I just coded the front end to a networked AI simulation with creatures that play, eat, interact, etc. I basically did everything you said you wanted...2d grid with mouse zooming/panning, tweakable creatures, interfacing with c++ AI and network packages. Did the whole thing using Qt's 2d graphics library...was generally quite straightforward (albeit not the fastest). If you can deal with c++ coding I'd recommend it highly.
Info can be found at http://www.trolltech.com
Java2D, SDL, OpenGL (Score:4, Informative)
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.
Sounds like fun (Score:4, Informative)
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.
Re:Sounds like fun (Score:2)
Re:convincing your employer to open source (Score:1)
Just cause you can toss around jargon doesn't mean you know anything.
2D animation: you could invest the time to hand-draw it, label it 'high art' and sell it for the cube of what it would otherwise sell for.
some pointers (Score:3, Informative)
You may look at this (Score:2)
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
Good 2D Toolkit (Score:1)
Also, you might look at Squeak and Morphic [squeak.org].