My Hexaville
Spead the Word
android vector path animations

Android Vector Path Animations Easy


Using Animated Vector Drawable with path transformation has never been a trivial thing. You need to have the same number of commands in start and end of the animation. Which means that just downloading 2 vector icons and telling Android

You figure it out!

Won’t work.But there’s a tool which does exactly that!

So I recently saw a tweet from Alex Lockwood about a tool which does that magic that you always wanted Android to do itself. It finds missing SVG commands and fills them, of course it’s not going to be as perfect if you spent half of the day manually writing commands, if shapes are very different.

android vector path animations

Create AVD

All you need is two SVG’s, I use this site to get any vectors, then upload them to shape shifter and click the magic button.

android vector path animations

Now you can download it and only thing needed for AVD is animated_vector_drawable.xml

Enjoy on Android

Set it for any ImageView of FAB with

and start

android vector path animations

 

This is so much fun, the best thing Shape shifter doesn’t require any actions from, everything is automated. Don’t expect it to do extraordinary job. If you’re interested in doing some manual work, check Roman Nurik’s AndroidIconAnimator as well, it’s more complicated, but it gives more control.

And technically you can use it not only for icon animations, but for shapes as well, svg is much easier that writing canvas path Java code. It’s not pre L compatible, but on those you can just disable animation, plus those phones are so slow, they better off without animations anyways

Ok, you can check GitHub repo here, it has bunch of other stuff, but you’ll find animated plus fab in there. Don’t forget to subscribe, follow me on Twitter, Facebook, G+ and share with friends if you think they will benefit from it!

 

 


About the Author Ihor Klimov

Android developer, love statically typed programming languages and hate JavaScript. This blog is everything that I find exciting about Android development and more. Stay tuned and hope to see you again!

follow me on: