Example usage for android.view View setRotationY

List of usage examples for android.view View setRotationY

Introduction

In this page you can find the example usage for android.view View setRotationY.

Prototype

public void setRotationY(float rotationY) 

Source Link

Document

Sets the degrees that the view is rotated around the vertical axis through the pivot point.

Usage

From source file:Anim.ABaseTransformer.java

/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
 * <p>//from  w w  w  . ja va 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.ljw.device3x.customview.ABaseTransformer.java

/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
 * <p>/*from ww w.ja  va 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);
    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>//from   w w  w .  j  av  a  2s .  c om
 * 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:net.tjohns.badgescanner.widget.CardBack.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.card_back, container, false);

    // by default the card back is not visible, set it up so that it's ready to animate in
    if (Build.VERSION.SDK_INT > 11) {
        v.setRotationY(-90);
    }// w  w w  .  j a v  a2s  .c om
    v.setVisibility(View.GONE);
    return v;
}

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>/*w  ww .  jav a  2  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.
 */
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.suyonoion.easystlviewpagerui.CubeOutTransformer.java

public void transformPage(View view, float position) {
    final float rotation = (position < 0 ? 90f : -90f) * Math.abs(position);
    view.setAlpha(rotation > 90f || rotation < -90f ? 0f : 1f);
    view.setPivotX(position < 0f ? view.getWidth() : 0f);
    view.setPivotY(view.getHeight() * 0.5f);
    view.setRotationY(90f * position);
}

From source file:com.suyonoion.easyviewpagerui.CubeOutTransformer.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void transformPage(View view, float position) {
    final float rotation = (position < 0 ? 90f : -90f) * Math.abs(position);
    view.setAlpha(rotation > 90f || rotation < -90f ? 0f : 1f);
    view.setPivotX(position < 0f ? view.getWidth() : 0f);
    view.setPivotY(view.getHeight() * 0.5f);
    view.setRotationY(90f * position);
}

From source file:com.animpagetransformer.transformer.AnimPageTransformer.java

/**
 * ?/*ww  w .  ja  va 2 s. c  o m*/
 * 
 * @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.waz.zclient.pages.main.conversationpager.CustomPagerTransformer.java

public void transformPage(View page, float position) {
    final float alpha;
    final float scale;
    final float translationX;

    switch (transformType) {
    case FLOW://  w ww .j a va  2 s .co m
        page.setRotationY(position * -30f);
        return;

    case SLIDE_OVER:
        if (position < 0 && position > -1) {
            // this is the page to the left
            scale = Math.abs(Math.abs(position) - 1) * (1.0f - SCALE_FACTOR_SLIDE) + SCALE_FACTOR_SLIDE;
            alpha = Math.max(MIN_ALPHA_SLIDE, 1 - Math.abs(position));
            int pageWidth = page.getWidth();
            float translateValue = position * (-pageWidth);
            if (translateValue > -pageWidth) {
                translationX = translateValue;
            } else {
                translationX = 0;
            }
        } else {
            alpha = 1;
            scale = 1;
            translationX = 0;
        }
        break;

    case SLIDE_IN:
        if (position < 0 && position > -1) {
            // this is the page to the left
            scale = 1;
            alpha = 1;
            int pageWidth = page.getWidth();
            float translateValue = position * -pageWidth + position * (-ViewUtils.toPx(page.getContext(), 64));
            if (translateValue > -pageWidth) {
                translationX = translateValue;
            } else {
                translationX = 0;
            }

        } else {
            alpha = 1;
            scale = 1;
            translationX = 0;
        }
        break;

    case DEPTH:
        if (position > 0 && position < 1) {
            // moving to the right
            alpha = (1 - position);
            scale = MIN_SCALE_DEPTH + (1 - MIN_SCALE_DEPTH) * (1 - Math.abs(position));
            translationX = (page.getWidth() * -position);
        } else {
            // use default for all other cases
            alpha = 1;
            scale = 1;
            translationX = 0;
        }
        break;

    case ZOOM:
        if (position >= -1 && position <= 1) {
            scale = Math.max(MIN_SCALE_ZOOM, 1 - Math.abs(position));
            alpha = MIN_ALPHA_ZOOM + (scale - MIN_SCALE_ZOOM) / (1 - MIN_SCALE_ZOOM) * (1 - MIN_ALPHA_ZOOM);
            float vMargin = page.getHeight() * (1 - scale) / 2;
            float hMargin = page.getWidth() * (1 - scale) / 2;
            if (position < 0) {
                translationX = (hMargin - vMargin / 2);
            } else {
                translationX = (-hMargin + vMargin / 2);
            }
        } else {
            alpha = 1;
            scale = 1;
            translationX = 0;
        }
        break;

    default:
        return;
    }

    page.setAlpha(alpha);
    page.setTranslationX(translationX);
    page.setScaleX(scale);
    page.setScaleY(scale);
}

From source file:com.qs.qswlw.view.Mypager.transformer.UltraDepthScaleTransformer.java

@Override
public void transformPage(View view, float position) {
    final float scale = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
    final float rotation = MAX_ROTATION * Math.abs(position);

    if (position <= 0f) {
        view.setTranslationX(view.getWidth() * -position * 0.19f);
        view.setPivotY(0.5f * view.getHeight());
        view.setPivotX(0.5f * view.getWidth());
        view.setScaleX(scale);//from w  w w  .  j  a v  a2s  . c o m
        view.setScaleY(scale);
        view.setRotationY(-rotation);
    } else if (position <= 1f) {
        view.setTranslationX(view.getWidth() * -position * 0.19f);
        view.setPivotY(0.5f * view.getHeight());
        view.setPivotX(0.5f * view.getWidth());
        view.setScaleX(scale);
        view.setScaleY(scale);
        view.setRotationY(rotation);
    }
}