matrix - How to do diagonal flip animation in android? -


<scale     xmlns:android="http://schemas.android.com/apk/res/android"     android:duration="5000"     android:fromxscale="1.0"     android:fromyscale="1.0"     android:pivotx="50%"     android:pivoty="50%"     android:toxscale="1.0"     android:toyscale="0"> </scale>  <rotate     xmlns:android="http://schemas.android.com/apk/res/android"     android:duration="5000"     android:fromdegrees="0"     android:pivotx="50%"     android:pivoty="50%"     android:todegrees="45"> </rotate> 

using these not able diagonal flip. there way flip.

i have tried matrix.setskew don't know how work on matrix.

try object animator. if want read object animator have @ following link. http://developer.android.com/reference/android/animation/objectanimator.html

and horizontal flip create xml file under animator directory in resources folowing code.

<set xmlns:android="http://schemas.android.com/apk/res/android"> <objectanimator     android:duration="900"     android:propertyname="rotationy"     android:valuefrom="0"     android:valueto="90"     android:id="@+id/anim1"> </objectanimator>  <objectanimator     android:duration="900"     android:propertyname="rotationy"     android:valuefrom="90"     android:valueto="0" > </objectanimator> 

and can call animation on view using below code. r.animator.flip name of xml.

animatorset manimation = (animatorset) animatorinflater.loadanimator(context, r.animator.flip);  manimation.addlistener(new animator.animatorlistener() {     @override     public void onanimationstart(animator animation) {        //what want on animation start     }      @override     public void onanimationend(animator animation) {       //what want on animation ended     }      @override     public void onanimationcancel(animator animation) {         //what want on animation canceled     }      @override     public void onanimationrepeat(animator animation) {         //what want on animation repeated     } }); 

this gives lot of control on want do.

you start animation

manimation.settarget(<the view want target>); manimation.start();  

the listener optional, if not need control on animation , want execute xml can create xml file , use above 2 lines.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -