I recently discovered a framework from Facebook called POP. It gives you the whole package of real world physics-based animations. And the best part is that its APIs are almost as easy as the default one.
Let me show you.
POP has three build in types of animations: POPBasicAnimation, POPSpringAnimation and POPDecayAnimation.
After you initialise them:
You need to pick one of supported properties to animate ex:
Then set fromValue and toValue respectively:
Set begin time:
Lastly you add the animation to the desired object:
The key property here is used to identify the animation. As the documentation states: “The 'key' may be any string such that only one animation per unique key is added per object”.
And that’s it, you just gave your app a cute animation kick!
You can probably imagine that there are lots of properties to edit. To give you an idea the ones I use the most are:
And those go as far as velocity, friction or even animating your custom properties. You can use delegate callbacks to chain animations. Add support for user gestures. The possibilities are endless.
There are further reading materials and tutorials about all of this on the GitHub page, with this one - 5 Steps For Using Facebook Pop - being a good starting point.
And here is how above code, repeated for three elements work:
I highly encourage you to try it and use this over and over. Adding cute animations is way easier then it appears to be.
Great results and happy users are guaranteed!
Found this article useful? You might like these ones too!
A senior iOS developer who is part of an agile iOS team and empowers individuals in achieving their dreams and goals.
People who read this post, also found these interesting: