Page 1 of 1

momentum rotation of image

Posted: Mon Feb 27, 2012 11:15 am
by sanjiv
I'm new to iOS graphics and animation and would like to know to how to accomplish the effect of momentum rotation of an image upon flick as seen in the video below.

http://www.youtube.com/watch?v=ZIQs-OWgkgI

Even when not flicked the images have a nice sway. Is this something that can be easily accomplished using Chipmunk Pro.

Thanks.

Re: momentum rotation of image

Posted: Mon Feb 27, 2012 11:40 am
by slembcke
Relatively easy yes. You'd really just need to connect a pivot joint to the top of the square and could use the ChipmunkMultiGrab class to help with the touch input.

You can get a trial copy of Chipmunk Pro on the downloads page, and there are a number of examples on the documentation page to try out.

Re: momentum rotation of image

Posted: Mon Feb 27, 2012 11:50 am
by sanjiv
Thanks for the quick response. I'll start going through the docs and samples. Since I'm still relatively new to iOS development, can you give me a sense of how much value Chipmunk is adding here in implementing this? Would this also be pretty straightforward to implement without third party libraries?

I'm guessing the initial sway is the same functionality as the flick, just that it starts off with a very low velocity, correct?

Re: momentum rotation of image

Posted: Mon Feb 27, 2012 12:44 pm
by slembcke
It depends on how much you know about physics and vector math I guess. If you just want images that tilt and sway to gravity, that's not to hard. If you just wanted that, I'd say do it without a library. You'd spend more time learning the library than you would just learning the math you need. Implementing the finger flick, you'd need to track the velocity of the flick, figure out how to apply that to the image and do hit detection for the touches on the rotating image. Implementing any one of those things individually isn't too hard, but all together I think they end up being a fair amount of work.

Re: momentum rotation of image

Posted: Mon Feb 27, 2012 1:20 pm
by sanjiv
Great, thanks.