Java Code Examples for android.view.View#setRotationX()

The following examples show how to use android.view.View#setRotationX() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: EasyTabs   File: ABaseTransformer.java    License: MIT License 6 votes vote down vote up
/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
 * <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);
		page.setEnabled(false);
	} else {
		page.setEnabled(true);
		page.setAlpha(1f);
	}
}
 
Example 2
/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
 * <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);
		page.setEnabled(false);
	} else {
		page.setEnabled(true);
		page.setAlpha(1f);
	}
}
 
Example 3
@Override
public Animator getInAnimator(View target, SlideShowView parent, int fromSlide, int toSlide) {
    target.setAlpha(0);
    target.setScaleX(SCALE_FACTOR);
    target.setScaleY(SCALE_FACTOR);
    target.setTranslationX(0);
    target.setTranslationY(0);
    target.setRotationX(0);
    target.setRotationY(0);

    final PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
    final PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);
    final PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 1);

    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(target, scaleX, scaleY, alpha);
    animator.setDuration(getDuration());
    animator.setInterpolator(getInterpolator());

    return animator;
}
 
Example 4
Source Project: Nibo   File: ViewAnimationUtilties.java    License: MIT License 6 votes vote down vote up
/**
 * Lifting view
 *
 * @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);

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

}
 
Example 5
Source Project: YCRefreshView   File: BaseTransformer.java    License: Apache License 2.0 6 votes vote down vote up
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);
	}
}
 
Example 6
@Override
protected void onTransform(View view, float position, boolean forwardDirection, int mOrientation) {
	final float rotation = (position < 0 ? 30f : -30f) * Math.abs(position);
	if (mOrientation == OnPageDataListener.HORIZONTAL) {
		view.setTranslationX(getOffsetForRotation(rotation, view.getWidth(), view.getHeight(), mOrientation));
		view.setPivotX(view.getWidth() * 0.5f);
		view.setPivotY(0);
		view.setRotationY(rotation);
	} else {
		view.setTranslationY(getOffsetForRotation(rotation, view.getWidth(), view.getHeight(), mOrientation));
		view.setPivotY(view.getHeight() * 0.5f);
		view.setPivotX(0);
		view.setRotationX(-rotation);
	}

}
 
Example 7
protected void setItemViewProperty(View itemView, float targetOffset) {
    float scale = calculateScale(targetOffset + mSpaceMain);
    itemView.setScaleX(scale);
    itemView.setScaleY(scale);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        itemView.setElevation(0);
    }
    final float rotation = calRotation(targetOffset);
    if (getOrientation() == HORIZONTAL) {
        itemView.setRotationY(rotation);
    } else {
        itemView.setRotationX(-rotation);
    }
}
 
Example 8
Source Project: Flubber   File: FlubberUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static void clearAnimation(View view) {
    view.setAlpha(1);
    view.setScaleX(1);
    view.setScaleY(1);
    view.setTranslationX(0);
    view.setTranslationY(0);
    view.setRotation(0);
    view.setRotationX(0);
    view.setRotationY(0);
}
 
Example 9
private void resetAnimatedView(View child) {
    child.setAlpha(1.f);
    child.setTranslationX(0.f);
    child.setTranslationY(0.f);
    child.setRotation(0.f);
    child.setRotationY(0.f);
    child.setRotationX(0.f);
    child.setScaleX(1.f);
    child.setScaleY(1.f);
}
 
Example 10
Source Project: EasyTabs   File: EasyFlipVerticalTransformer.java    License: MIT License 5 votes vote down vote up
@Override
protected void onTransform(View view, float position) {
	final float rotation = -180f * position;

	view.setAlpha(rotation > 90f || rotation < -90f ? 0f : 1f);
	view.setPivotX(view.getWidth() * 0.5f);
	view.setPivotY(view.getHeight() * 0.5f);
	view.setRotationX(rotation);
}
 
Example 11
Source Project: FloatingView   File: YumFloating.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setRotationX(float rotationX) {
    View targetView;
    if ((targetView = getTargetView()) != null){
        targetView.setRotationX(rotationX);
    }
}
 
Example 12
Source Project: PictureSelector   File: ViewHelper.java    License: Apache License 2.0 5 votes vote down vote up
public static void clear(View v) {
    v.setAlpha(1);
    v.setScaleY(1);
    v.setScaleX(1);
    v.setTranslationY(0);
    v.setTranslationX(0);
    v.setRotation(0);
    v.setRotationY(0);
    v.setRotationX(0);
    v.setPivotY(v.getMeasuredHeight() / 2);
    v.setPivotX(v.getMeasuredWidth() / 2);
    ViewCompat.animate(v).setInterpolator(null).setStartDelay(0);
}
 
Example 13
@Override
protected void onTransform(View view, float position) {
	final float rotation = -180f * position;

	view.setAlpha(rotation > 90f || rotation < -90f ? 0f : 1f);
	view.setPivotX(view.getWidth() * 0.5f);
	view.setPivotY(view.getHeight() * 0.5f);
	view.setRotationX(rotation);
}
 
Example 14
Source Project: AutoTest   File: BaseAnimatorSet.java    License: MIT License 5 votes vote down vote up
public static void reset(View view) {
    view.setAlpha(1);
    view.setScaleX(1);
    view.setScaleY(1);
    view.setTranslationX(0);
    view.setTranslationY(0);
    view.setRotation(0);
    view.setRotationY(0);
    view.setRotationX(0);
}
 
Example 15
Source Project: CircularReveal   File: DynamicAnimation.java    License: MIT License 4 votes vote down vote up
@Override
public void setValue(View view, float value) {
  view.setRotationX(value);
}
 
Example 16
Source Project: letv   File: ViewCompatHC.java    License: Apache License 2.0 4 votes vote down vote up
public static void setRotationX(View view, float value) {
    view.setRotationX(value);
}
 
Example 17
Source Project: imsdk-android   File: ViewHelper.java    License: MIT License 4 votes vote down vote up
static void setRotationX(View view, float rotationX) {
    view.setRotationX(rotationX);
}
 
Example 18
Source Project: MiBandDecompiled   File: a.java    License: Apache License 2.0 4 votes vote down vote up
static void e(View view, float f1)
{
    view.setRotationX(f1);
}
 
Example 19
Source Project: Auie   File: UEViewHelper.java    License: GNU General Public License v2.0 4 votes vote down vote up
static void setRotationX(View view, float rotationX) {
    view.setRotationX(rotationX);
}
 
Example 20
Source Project: UltimateAndroid   File: ViewHelper.java    License: Apache License 2.0 4 votes vote down vote up
static void setRotationX(View view, float rotationX) {
    view.setRotationX(rotationX);
}