Inculde

  • Gradle
The compile 'com. Simplepeng. Library: transformslibrary: 1.0.0'Copy the code

  • Maven
Com. Simplepeng. Library transformslibrary 1.0.0 pomCopy the code

useage

TransformUtil.reverse(mViewPager,new StackZoomInTransform());
Copy the code

or

TransformUtil.forward(mViewPager,new StackZoomInTransform());
Copy the code

View

  • CardSlideTransformer

  • Flip3DTransform

  • FlipHorizontalTransformer

  • RotateDownTransformer

  • ZoomInTransform

  • other view library code

Custom

extends TransformAdapter to custom view animations,for example:

public class ZoomBothTransform extends TransformAdapter { @Override public void onRightScorlling(View view, float position) { view.setScaleX(1 - position / 2); view.setScaleY(1 - position / 2); } @Override public void onLeftScorlling(View view, float position) { view.setScaleX(1 + position / 2); view.setScaleY(1 + position / 2); }}Copy the code

TransformAdapter has 4 can override method

  • onRightScorlling
/**
    * @param view     right view
    * @param position right to center 1->0
    *                 center to right 0->1
    */
   public void onRightScorlling(View view, float position) {

   }
Copy the code

  • onLeftScorlling
/**
     * @param view     left view
     * @param position left to center  -1->0
     *                 center to left  0->-1
     */
    public void onLeftScorlling(View view, float position) {

    }
Copy the code

  • onCenterIdle
public void onCenterIdle(View view) {

    }
Copy the code

  • onTransform
/** ** @param view left and right view both callback * @param position [-1,1] */ public void onTransform(view view, float position) { }Copy the code