
Demo. Source here. Drag the path handles to bend the sprite.
The experiment makes use of a small library I just uploaded to google code called as3bend. It has the ability of bending a sprite along a given path. The library makes use of swfvector in order to extract the vector data of a Sprite. It then uses a small modifier to align that data onto a path.
How might this be useful? Well, in my case, I am trying to make a plant whose skeleton is controlled by box2d physics. I could have done it with Flash’s bones tools but I found that accessing bone’s data at run time is rather uncomfortable, plus using box2d instead yields much more realistic results. The bones tool can bend a shape to follow a bone, but all this happens in the Flash authoring tool, not allowing you to do it at run time dynamically via AS3. So this is where this little library comes in, you just wrap your graphics around an OpenSprite object, specify a path to the modifier, and your graphics can bend to any box2d kinematics at run time.
I imagine this is a common problem in Flash, so if you’d like to collaborate with the project just let me know. I suppose this could be expanded to some sort of 2D version of as3dmod.
so cool….
that is dynamic animation!.
checkout amazing flash mxp: Art Brush
http://blog.pinkandaint.com/new-and-improved-art-brush-now-with-backward-compatibility/
(it’s in JSFL)
It will scale Shape to the path, can as3bend do that?
reading as3bend source code. Nice work!! thanks your sharing.
No it can’t but I thought it would be useful too. It could be expanded to do that. So far AS3Bend is just a proposal. A suggestion on how it might be possible to work with dynamic vector instruction animation.
I am looking for some bend functions, seems good to me, get your source code to look, thanks.
Very nice work! If you wrote this from scratch then that’s awesome! Not too many people could get the math right for PathModifier::apply().