Posts

Showing posts from March, 2017

How to do Flip Animation in Android

Image
In the last  post , I list a category of Animations in Android platform, that’s my road map to learn android animation and this post will give a specific live example about the flip transformation which is really common in our apps. In the last post, I list the two kinds of animation strategies in Android, Animation and more powerful Animator. Both of them can implement the flip animation in our case, and my purpose is to compare those two ways. Animation We can’t use the predefined Animation subclass directly, there are scale, rotate, alpha and translate Animations, but we can’t use rotate animation to build the card flip effect. We should subclass Animation class to define the flip effect. package suzp1984.github.io.exapidemo.animation import android.graphics.Camera import android.view.animation.Animation import android.view.animation.Transformation class FlipAnimation(fromDegre: Float, toDegre: Float, centerX : Float, centerY : Float) : Ani