Simple Metaballs
Posted: January 2nd, 2009 | Author: John del Rosario | Filed under: AS 3.0, Experiments, Programming and Development | Tags: Experiments | 1 Comment »I stumbled upon Metaballs yesterday, and decided it would be cool to try it out. I’ve seen some very nice examples done in Flash, but no luck finding their sources.
After Googling around, I found this tutorial on Metaballs and computer graphics.
I ported the code into AS3, but the result is not very impressive. It is very slow and processor heavy. If you click on the stage, the last Metaball added will be moved, and as you can see, it takes a bit of time to redraw them. I’m not even thinking about animating this.
I’m still looking for a more elegant solution for Flash, hopefully one that uses the Vector-based drawing API of Flash, and not BitmapData.
UPDATE: I have an updated version here. Also, I linked the image above to the updated one. For comparison, the old one is here.

That’s a sweet effect; it’s impressive even at 15fps. I think the closest real-world substances to the meatballs are ferro-fluids (magnetic liquids). The nodes act like magnets, and the circles act like the fluid.