protected void transformPage(View view,float position){
  int pageWidth=view.getWidth();
  if (position < -1) {
    view.setAlpha(0);
  }
 else   if (position <= 0) {
    view.setAlpha(1);
    if (virtualPos > 0) {
      view.setTranslationX(pageWidth * -position * 2);
    }
 else {
      view.setTranslationX(0);
    }
    float scaleFactor=MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
    view.setScaleX(scaleFactor);
    view.setScaleY(scaleFactor);
  }
 else   if (position <= 1) {
    view.setAlpha(1 - position);
    view.setTranslationX(pageWidth * -position);
    float scaleFactor=MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
    view.setScaleX(scaleFactor);
    view.setScaleY(scaleFactor);
  }
 else {
    view.setAlpha(0);
  }
}

protected void transformPage ( View view , float position ) { int pageWidth = view . getWidth ( ) ; if ( position < - 1 ) { view . setAlpha ( 0 ) ; } else if ( position <= 0 ) { view . setAlpha ( 1 ) ; if ( virtualPos > 0 ) { view . setTranslationX ( pageWidth * - position * 2 ) ; } else { view . setTranslationX ( 0 ) ; } float scaleFactor = MIN_SCALE + ( 1 - MIN_SCALE ) * ( 1 - Math . abs ( position ) ) ; view . setScaleX ( scaleFactor ) ; view . setScaleY ( scaleFactor ) ; } else if ( position <= 1 ) { view . setAlpha ( 1 - position ) ; view . setTranslationX ( pageWidth * - position ) ; float scaleFactor = MIN_SCALE + ( 1 - MIN_SCALE ) * ( 1 - Math . abs ( position ) ) ; view . setScaleX ( scaleFactor ) ; view . setScaleY ( scaleFactor ) ; } else { view . setAlpha ( 0 ) ; } }
transforms the top and bottom pages with changing scroll . if top page is moving to the right side ( virtualpos > 0 ) we need to counteract the scroll by twice as much .
