Example usage for android.view View setRotationX

List of usage examples for android.view View setRotationX

Introduction

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

Prototype

public void setRotationX(float rotationX) 

Source Link

Document

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

Usage

From source file:com.grottworkshop.gwscirclereveal.animation.ViewAnimationUtils.java

/**
 * Lifting view//from w w  w .  j a  v  a2  s .c  o  m
 *
 * @param view The animation target
 * @param baseRotation initial Rotation X in 3D space
 * @param duration aniamtion duration
 */
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, int duration) {
    view.setRotationX(baseRotation);
    view.setTranslationY(view.getHeight() / 3);

    animate(view).setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(duration).rotationX(0)
            .translationY(0).start();

}

From source file:com.grottworkshop.gwscirclereveal.animation.ViewAnimationUtils.java

/**
 * Lifting view/* w w w  .ja v a 2 s . c  om*/
 *
 * @param view The animation target
 * @param baseRotation initial Rotation X in 3D space
 * @param duration aniamtion duration
 * @param startDelay start delay before animation begin
 */
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay) {
    view.setRotationX(baseRotation);
    view.setTranslationY(view.getHeight() / 3);

    animate(view).setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(duration)
            .setStartDelay(startDelay).rotationX(0).translationY(0).start();

}

From source file:com.grottworkshop.gwscirclereveal.animation.ViewAnimationUtils.java

/**
 * Lifting view//from www .ja va2s  .com
 *
 * @param view The animation target
 * @param baseRotation initial Rotation X in 3D space
 * @param fromY initial Y position of view
 * @param duration aniamtion duration
 * @param startDelay start delay before animation begin
 */
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay) {
    view.setRotationX(baseRotation);
    view.setTranslationY(fromY);

    animate(view).setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(duration)
            .setStartDelay(startDelay).rotationX(0).translationY(0).start();

}

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);//  w  ww  .j  ava 2s  .com
    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  w w w. j  a  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  w w  .  j a v  a2s  . c o m*/
    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.aran.bang.widget.BaseTransformer.java

/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)} is called.
 *
 * @param view/*from w  ww.  ja  v a2  s .co  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);
    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//from w ww. j  a v  a 2s  .  co 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)}.// w  ww  .  ja va  2s  . com
 * <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  .  j  a v a  2 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);
    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);
    }
}