List of usage examples for android.view View setRotationX
public void setRotationX(float rotationX)
From source file:banner.transformer.ABaseTransformer.java
/** * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}. * <p>//w w w. j av a 2 s. c o m * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do * not modify the same page properties. For instance changing from a transformation that applies rotation to a * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied * alpha. * * @param page * Apply the transformation to this page * @param position * Position of page relative to the current front-and-center position of the pager. 0 is front and * center. 1 is one full page position to the right, and -1 is one page position to the left. */ protected void onPreTransform(View page, float position) { final float width = page.getWidth(); page.setRotationX(0); page.setRotationY(0); page.setRotation(0); page.setScaleX(1); page.setScaleY(1); page.setPivotX(0); page.setPivotY(0); page.setTranslationY(0); page.setTranslationX(isPagingEnabled() ? 0f : -width * position); if (hideOffscreenPages()) { page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f); // page.setEnabled(false); } else { // page.setEnabled(true); page.setAlpha(1f); } }
From source file:com.ruint.lib.viewpager.transforms.ABaseTransformer.java
/** * Called each {@link #transformPage(android.view.View, float)} before {{@link #onTransform(android.view.View, float)}. * <p>//from ww w . j a va 2s .co m * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do * not modify the same page properties. For instance changing from a transformation that applies rotation to a * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied * alpha. * * @param page * Apply the transformation to this page * @param position * Position of page relative to the current front-and-center position of the pager. 0 is front and * center. 1 is one full page position to the right, and -1 is one page position to the left. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) protected void onPreTransform(View page, float position) { final float width = page.getWidth(); page.setRotationX(0); page.setRotationY(0); page.setRotation(0); page.setScaleX(1); page.setScaleY(1); page.setPivotX(0); page.setPivotY(0); page.setTranslationY(0); page.setTranslationX(isPagingEnabled() ? 0f : -width * position); if (hideOffscreenPages()) { page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f); } else { page.setAlpha(1f); } }
From source file:Anim.ABaseTransformer.java
/** * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}. * <p>/*w w w . j a va 2s . c o m*/ * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do * not modify the same page properties. For instance changing from a transformation that applies rotation to a * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied * alpha. * * @param page * Apply the transformation to this page * @param position * Position of page relative to the current front-and-center position of the pager. 0 is front and * center. 1 is one full page position to the right, and -1 is one page position to the left. */ protected void onPreTransform(View page, float position) { final float width = page.getWidth(); page.setRotationX(0); page.setRotationY(0); page.setRotation(0); page.setScaleX(1); page.setScaleY(1); page.setPivotX(0); page.setPivotY(0); page.setTranslationY(0); page.setTranslationX(isPagingEnabled() ? 0f : -width * position); if (hideOffscreenPages()) { page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f); page.setEnabled(false); } else { page.setEnabled(true); page.setAlpha(1f); } }
From source file:com.ljw.device3x.customview.ABaseTransformer.java
/** * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}. * <p>/*from www . j a v a2 s .co m*/ * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do * not modify the same page properties. For instance changing from a transformation that applies rotation to a * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied * alpha. * * @param page * Apply the transformation to this page * @param position * Position of page relative to the current front-and-center position of the pager. 0 is front and * center. 1 is one full page position to the right, and -1 is one page position to the left. */ protected void onPreTransform(View page, float position) { final float width = page.getWidth(); page.setRotationX(0); page.setRotationY(0); page.setRotation(0); page.setScaleX(1); page.setScaleY(1); page.setPivotX(0); page.setPivotY(0); page.setTranslationY(0); page.setTranslationX(isPagingEnabled() ? 0f : -width * position); page.setEnabled(true); if (hideOffscreenPages()) { page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f); page.setEnabled(true); } else { page.setEnabled(true); page.setAlpha(1f); } }
From source file:com.howell.transformer.ABaseTransformer.java
/** * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}. * <p>/* w ww . j a v a2 s . com*/ * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do * not modify the same page properties. For instance changing from a transformation that applies rotation to a * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied * alpha. * * @param page * Apply the transformation to this page * @param position * Position of page relative to the current front-and-center position of the pager. 0 is front and * center. 1 is one full page position to the right, and -1 is one page position to the left. */ @SuppressWarnings("ResourceType") protected void onPreTransform(View page, float position) { final float width = page.getWidth(); page.setRotationX(0); page.setRotationY(0); page.setRotation(0); page.setScaleX(1); page.setScaleY(1); page.setPivotX(0); page.setPivotY(0); page.setTranslationY(0); page.setTranslationX(isPagingEnabled() ? 0f : -width * position); if (hideOffscreenPages()) { page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f); page.setEnabled(false); } else { page.setEnabled(true); page.setAlpha(1f); } }
From source file:com.dbeginc.dbweather.utils.animations.BasePageTransformer.java
/** * Called each {@link #transformPage(android.view.View, float)} before {{@link #onTransform(android.view.View, float)}. * <p>//from w w w .ja v a2 s.c o m * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do * not modify the same page properties. For instance changing from a transformation that applies rotation to a * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied * alpha. * * @param page Apply the transformation to this page * @param position Position of page relative to the current front-and-center position of the pager. 0 is front and * center. 1 is one full page position to the right, and -1 is one page position to the left. */ protected void onPreTransform(final View page, final float position) { final float width = page.getWidth(); page.setRotationX(0); page.setRotationY(0); page.setRotation(0); page.setScaleX(1); page.setScaleY(1); page.setPivotX(0); page.setPivotY(0); page.setTranslationY(0); page.setTranslationX(isPagingEnabled() ? 0f : -width * position); if (hideOffscreenPages()) { page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f); page.setEnabled(false); } else { page.setEnabled(true); page.setAlpha(1f); } }
From source file:com.animpagetransformer.transformer.AnimPageTransformer.java
/** * ?/* w w w. jav a 2 s .c om*/ * * @param page * @param position */ private void reset(View page, float position) { /* ?page? */ mWidth = page.getWidth(); mHeight = page.getHeight(); /* ??page */ page.setRotationX(0); page.setRotationY(0); page.setRotation(0); page.setScaleX(1); page.setScaleY(1); page.setPivotX(0); page.setPivotY(0); page.setTranslationY(0); page.setTranslationX(0); page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f); }
From source file:com.runmit.sweedee.view.flippablestackview.StackPageTransformer.java
@Override public void transformPage(View view, float position) { int dimen = view.getHeight(); if (!mInitialValuesCalculated) { mInitialValuesCalculated = true; calculateInitialValues(dimen);// w w w . j a va2s. c om } view.setRotationX(0); view.setPivotY(dimen / 2f); view.setPivotX(view.getWidth() / 2f); if (position < -mNumberOfStacked - 1) { view.setAlpha(0f); } else if (position <= 0) { float scale = mZeroPositionScale + (position * mStackedScaleFactor); float baseTranslation = (-position * dimen); float shiftTranslation = calculateShiftForScale(position, scale, dimen); view.setScaleX(scale); view.setScaleY(scale); view.setAlpha(1.0f + (position * mAlphaFactor)); Log.d("position", "baseTranslation=" + baseTranslation + ",shiftTranslation=" + shiftTranslation + ",transY=" + (baseTranslation + shiftTranslation)); view.setTranslationY(baseTranslation + shiftTranslation); } else if (position <= 1) { view.bringToFront(); float baseTranslation = position * dimen; float scale = mZeroPositionScale - mValueInterpolator.map(mScaleInterpolator.getInterpolation(position)); scale = (scale < 0) ? 0f : scale; float shiftTranslation = (1.0f - position) * mOverlap; float rotation = -mRotationInterpolator.getInterpolation(position) * 90; rotation = (rotation < -90) ? -90 : rotation; float alpha = 1.0f - position; alpha = (alpha < 0) ? 0f : alpha; view.setAlpha(alpha); view.setPivotY(dimen); view.setRotationX(rotation); view.setScaleX(mZeroPositionScale); view.setScaleY(scale); view.setTranslationY(-baseTranslation - mBelowStackSpace - shiftTranslation); } else if (position > 1) { view.setAlpha(0f); } }
From source file:android.improving.utils.views.cardsview.StackPageTransformer.java
@Override public void transformPage(View view, float position) { int dimen = 0; switch (mOrientation) { case VERTICAL: dimen = view.getHeight();/*from w ww . j a v a2 s .c om*/ break; case HORIZONTAL: dimen = view.getWidth(); break; } if (!mInitialValuesCalculated) { mInitialValuesCalculated = true; calculateInitialValues(dimen); } switch (mOrientation) { case VERTICAL: view.setRotationX(0); view.setPivotY(dimen / 2f); view.setPivotX(view.getWidth() / 2f); break; case HORIZONTAL: view.setRotationY(0); view.setPivotX(dimen / 2f); view.setPivotY(view.getHeight() / 2f); break; } if (position < -mNumberOfStacked - 1) { view.setAlpha(0f); } else if (position <= 0) { float scale = mZeroPositionScale + (position * mStackedScaleFactor); float baseTranslation = (-position * dimen); float shiftTranslation = calculateShiftForScale(position, scale, dimen); view.setScaleX(scale); view.setScaleY(scale); view.setAlpha(1.0f + (position * mAlphaFactor)); switch (mOrientation) { case VERTICAL: view.setTranslationY(baseTranslation + shiftTranslation); break; case HORIZONTAL: view.setTranslationX(baseTranslation + shiftTranslation); break; } } else if (position <= 1) { float scale = mZeroPositionScale + (position * mStackedScaleFactor); view.setScaleX(scale); view.setScaleY(scale); view.setAlpha(1.0f + (position * mAlphaFactor)); view.setTranslationY(position); } else if (position > 1) { view.setAlpha(0f); } }
From source file:cn.edu.nuc.seeworld.view.flippablestackview.StackPageTransformer.java
@Override public void transformPage(View view, float position) { int dimen = 0; switch (mOrientation) { case VERTICAL: dimen = view.getHeight();/*from w w w . j a v a 2 s . com*/ break; case HORIZONTAL: dimen = view.getWidth(); break; } if (!mInitialValuesCalculated) { mInitialValuesCalculated = true; calculateInitialValues(dimen); } switch (mOrientation) { case VERTICAL: view.setRotationX(0); view.setPivotY(dimen / 2f); view.setPivotX(view.getWidth() / 2f); break; case HORIZONTAL: view.setRotationY(0); view.setPivotX(dimen / 2f); view.setPivotY(view.getHeight() / 2f); break; } if (position < -mNumberOfStacked - 1) { view.setAlpha(0f); } else if (position <= 0) { float scale = mZeroPositionScale + (position * mStackedScaleFactor); float baseTranslation = (-position * dimen); float shiftTranslation = calculateShiftForScale(position, scale, dimen); view.setScaleX(scale); view.setScaleY(scale); view.setAlpha(1.0f + (position * mAlphaFactor)); switch (mOrientation) { case VERTICAL: view.setTranslationY(baseTranslation + shiftTranslation); break; case HORIZONTAL: view.setTranslationX(baseTranslation + shiftTranslation); break; } } else if (position <= 1) { float baseTranslation = position * dimen; float scale = mZeroPositionScale - mValueInterpolator.map(mScaleInterpolator.getInterpolation(position)); scale = (scale < 0) ? 0f : scale; float shiftTranslation = (1.0f - position) * mOverlap; float rotation = -mRotationInterpolator.getInterpolation(position) * 90; rotation = (rotation < -90) ? -90 : rotation; float alpha = 1.0f - position; alpha = (alpha < 0) ? 0f : alpha; view.setAlpha(alpha); switch (mOrientation) { case VERTICAL: view.setPivotY(dimen); view.setRotationX(rotation); view.setScaleX(mZeroPositionScale); view.setScaleY(scale); view.setTranslationY(-baseTranslation - mBelowStackSpace - shiftTranslation); break; case HORIZONTAL: view.setPivotX(dimen); view.setRotationY(-rotation); view.setScaleY(mZeroPositionScale); view.setScaleX(scale); view.setTranslationX(-baseTranslation - mBelowStackSpace - shiftTranslation); break; } } else if (position > 1) { view.setAlpha(0f); } }