lidev!
  • Blog
  • Portfolio
  • Li

AS3 Bend

March 20, 2011


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.

6 Responses to AS3 Bend

  • Demos.Chen March 24, 2011

    so cool….
    that is dynamic animation!.

  • tamt April 14, 2011

    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?

  • tamt April 15, 2011

    reading as3bend source code. Nice work!! thanks your sharing.

  • Li April 17, 2011

    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.

  • ray November 27, 2011

    I am looking for some bend functions, seems good to me, get your source code to look, thanks.

  • milkplus December 26, 2011

    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().

Leave a Reply

Click here to cancel reply.

Post Comment

 

Topics

3D AGAL Arduino Audio Flash Fluids Fractals General Minimole OpenFrameworks Portfolio Processing Shaders Tutorials

Links

  • Away3D
  • Cinder
  • Der Scmale
  • EzeQL
  • Fabrice Closier
  • Flight404

email me?

Your message was successfully sent. Thank You!

Follow me on EmailFollow me on FacebookFollow me on RSSFollow me on TwitterFollow me on YouTube