content: package com.allure.lbanners.transformer;
  
  import android.view.View;
  
  import com.nineoldandroids.view.ViewHelper;
  
  /**
   * Created by lm on 2016/7/8.
   */
  public class RotatePageTransformer extends LMPageTransformer {
      private float mMaxRotation = 15.0f;
  
      public RotatePageTransformer() {
      }
  
      public RotatePageTransformer(float maxRotation) {
          setMaxRotation(maxRotation);
      }
  
      @Override
      public void scrollInvisible(View view, float position) {
          ViewHelper.setPivotX(view, view.getMeasuredWidth() * 0.5f);
          ViewHelper.setPivotY(view, view.getMeasuredHeight());
          ViewHelper.setRotation(view, 0);
      }
  
      @Override
      public void scrollLeft(View view, float position) {
          float rotation = (mMaxRotation * position);
          ViewHelper.setPivotX(view, view.getMeasuredWidth() * 0.5f);
          ViewHelper.setPivotY(view, view.getMeasuredHeight());
          ViewHelper.setRotation(view, rotation);
      }
  
      @Override
      public void scrollRight(View view, float position) {
          scrollLeft(view, position);
      }
  
      public void setMaxRotation(float maxRotation) {
          if (maxRotation >= 0.0f && maxRotation <= 40.0f) {
              mMaxRotation = maxRotation;
          }
      }
  
  
  }