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:com.facebook.react.uimanager.BaseViewManager.java

private static void resetTransformProperty(View view) {
    view.setTranslationX(PixelUtil.toPixelFromDIP(0));
    view.setTranslationY(PixelUtil.toPixelFromDIP(0));
    view.setRotation(0);// ww w.  j  a  v  a 2 s  .c o  m
    view.setRotationX(0);
    view.setRotationY(0);
    view.setScaleX(1);
    view.setScaleY(1);
    view.setCameraDistance(0);
}

From source file:com.facebook.react.uimanager.BaseViewManager.java

private static void setTransformProperty(View view, ReadableArray transforms) {
    TransformHelper.processTransform(transforms, sTransformDecompositionArray);
    MatrixMathHelper.decomposeMatrix(sTransformDecompositionArray, sMatrixDecompositionContext);
    view.setTranslationX(PixelUtil.toPixelFromDIP((float) sMatrixDecompositionContext.translation[0]));
    view.setTranslationY(PixelUtil.toPixelFromDIP((float) sMatrixDecompositionContext.translation[1]));
    view.setRotation((float) sMatrixDecompositionContext.rotationDegrees[2]);
    view.setRotationX((float) sMatrixDecompositionContext.rotationDegrees[0]);
    view.setRotationY((float) sMatrixDecompositionContext.rotationDegrees[1]);
    view.setScaleX((float) sMatrixDecompositionContext.scale[0]);
    view.setScaleY((float) sMatrixDecompositionContext.scale[1]);

    double[] perspectiveArray = sMatrixDecompositionContext.perspective;

    if (perspectiveArray.length > PERSPECTIVE_ARRAY_INVERTED_CAMERA_DISTANCE_INDEX) {
        float invertedCameraDistance = (float) perspectiveArray[PERSPECTIVE_ARRAY_INVERTED_CAMERA_DISTANCE_INDEX];
        if (invertedCameraDistance == 0) {
            // Default camera distance, before scale multiplier (1280)
            invertedCameraDistance = 0.00078125f;
        }//from   ww  w  .  ja v  a 2s .  c o  m
        float cameraDistance = -1 / invertedCameraDistance;
        float scale = DisplayMetricsHolder.getScreenDisplayMetrics().density;

        // The following converts the matrix's perspective to a camera distance
        // such that the camera perspective looks the same on Android and iOS.
        // The native Android implementation removed the screen density from the
        // calculation, so squaring and a normalization value of
        // sqrt(5) produces an exact replica with iOS.
        // For more information, see https://github.com/facebook/react-native/pull/18302
        float normalizedCameraDistance = scale * scale * cameraDistance
                * CAMERA_DISTANCE_NORMALIZATION_MULTIPLIER;
        view.setCameraDistance(normalizedCameraDistance);

    }
}

From source file:android.support.transition.ChangeTransform.java

private static void setTransforms(View view, float translationX, float translationY, float translationZ,
        float scaleX, float scaleY, float rotationX, float rotationY, float rotationZ) {
    view.setTranslationX(translationX);//  w  ww  . j  a v  a2 s.  com
    view.setTranslationY(translationY);
    ViewCompat.setTranslationZ(view, translationZ);
    view.setScaleX(scaleX);
    view.setScaleY(scaleY);
    view.setRotationX(rotationX);
    view.setRotationY(rotationY);
    view.setRotation(rotationZ);
}

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

@Override
public void transformPage(View page, float position) {
    page.setPivotX(position < 0f ? page.getWidth() : 0f);
    page.setPivotY(page.getHeight() * 0.5f);
    page.setRotationY(90f * position);
}

From source file:com.aran.bang.widget.BaseTransformer.java

/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)} is called.
 *
 * @param view/*from   w ww.  j a v  a 2s  .c om*/
 * @param position
 */
protected void onPreTransform(View view, float position) {
    final float width = view.getWidth();

    view.setRotationX(0);
    view.setRotationY(0);
    view.setRotation(0);
    view.setScaleX(1);
    view.setScaleY(1);
    view.setPivotX(0);
    view.setPivotY(0);
    view.setTranslationY(0);
    view.setTranslationX(isPagingEnabled() ? 0f : -width * position);

    if (hideOffscreenPages()) {
        view.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
    } else {
        view.setAlpha(1f);
    }
}

From source file:pl.hypeapp.wykopolka.extra.pagetransformer.BaseTransformer.java

/**
 * Called each {@link #transformPage(android.view.View, float)} before {{@link #onTransform(android.view.View, float)} is called.
 *
 * @param view//  w  w w .jav  a 2 s  .  c  o  m
 * @param position
 */
protected void onPreTransform(View view, float position) {
    final float width = view.getWidth();

    view.setRotationX(0);
    view.setRotationY(0);
    view.setRotation(0);
    view.setScaleX(1);
    view.setScaleY(1);
    view.setPivotX(0);
    view.setPivotY(0);
    view.setTranslationY(0);
    if (isPagingEnabled())
        view.setTranslationX(0f);
    else
        view.setTranslationX(-width * position);

    if (hideOffscreenPages()) {
        view.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
    } else {
        view.setAlpha(1f);
    }
}

From source file:com.cesards.samples.cropimageview.ABaseTransformer.java

/**
 * Called each {@link #transformPage(android.view.View, float)} before {{@link #onTransform(android.view.View,
 * float)}.//from   w w w .  j  a  v a  2  s.c om
 * <p>
 * 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);
    } else {
        page.setAlpha(1f);
    }
}

From source file:com.wuzhanglao.niubi.utils.transformer.BaseTransformer.java

/**
 * Called each {@link #transformPage(android.view.View, float)} before {{@link #onTransform(android.view.View, float)}.
 * <p>/* w w w  .  jav a2s . 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);
    if (isPagingEnabled())
        page.setTranslationX(0f);
    else
        page.setTranslationX(-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:banner.transformer.ABaseTransformer.java

/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
 * <p>/*from w  ww .  j  a v  a2s.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);

    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  w  w w. jav  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.
 */
@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);
    }
}