Flip Animation for Android:
The recent project has used a small animation, so that the object to achieve a certain 3D rotation effect, is now recorded as follows:
public class Flipanimation extends Animation {private Camera mcamera; Private View Mfromview; Private View Mtoview; private float Mcenterx; private float mcentery; Private Boolean mforward = true; /** * Creates a 3D flip animation between. * * @param fromview First view in the transition. * @param toview Second view in the transition. */Public Flipanimation (view Fromview, view toview) {Mfromview = Fromview; Mtoview = Toview; Setduration (700); Setfillafter (FALSE); Setinterpolator (New Acceleratedecelerateinterpolator ()); } public void reverse () {Mforward = false; View SwitchView = Mtoview; Mtoview = Mfromview; Mfromview = SwitchView; } @Override public void Initialize (int width, int height, int parentwidth, int parentheight) {Super.initiali Ze (width, height, parentwidth, parentheight); Mcenterx = WIDTH/2; Mcentery = HEIGHT/2; Mcamera = new Camera (); } @Override protected void applytransformation (float interpolatedtime, transformation t) {final double Radia NS = Math.PI * INTERPOLATEDTIME; float degrees = (float) (180.0 * radians/math.pi); if (interpolatedtime >= 0.5f) {degrees-= 180.F; Mfromview.setvisibility (View.gone); Mtoview.setvisibility (view.visible); } if (Mforward) {degrees =-degrees; } final Matrix Matrix = T.getmatrix (); Mcamera.save (); Mcamera.rotatey (degrees); Mcamera.getmatrix (matrix); Mcamera.restore (); Matrix.pretranslate (-mcenterx,-mcentery); Matrix.posttranslate (Mcenterx, mcentery); }}