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

The following examples show how to use android.view.View#setRotationX() . 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 File: ABaseTransformer.java    From EasyTabs with 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
Source File: TabletTransformer.java    From PageRecyclerView with Apache License 2.0 6 votes vote down vote up
@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 3
Source File: BaseTransformer.java    From YCRefreshView with 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 4
Source File: ABaseTransformer.java    From Expert-Android-Programming with 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 5
Source File: ViewAnimationUtilties.java    From Nibo with 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 6
Source File: ZoomTransitionFactory.java    From android-slideshow-widget with Apache License 2.0 6 votes vote down vote up
@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 7
Source File: FlipVerticalTransformer.java    From HomeApplianceMall with 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 8
Source File: BaseAnimatorSet.java    From AutoTest with 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 9
Source File: OverFlyingLayoutManager.java    From RecyclerBanner with Apache License 2.0 5 votes vote down vote up
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 10
Source File: ViewHelper.java    From PictureSelector with 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 11
Source File: YumFloating.java    From FloatingView with 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 File: EasyFlipVerticalTransformer.java    From EasyTabs with 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 13
Source File: CardStreamLinearLayout.java    From android-BatchStepSensor with Apache License 2.0 5 votes vote down vote up
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 14
Source File: FlubberUtil.java    From Flubber with 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 15
Source File: DynamicAnimation.java    From CircularReveal with MIT License 4 votes vote down vote up
@Override
public void setValue(View view, float value) {
  view.setRotationX(value);
}
 
Example 16
Source File: ViewCompatHC.java    From letv with Apache License 2.0 4 votes vote down vote up
public static void setRotationX(View view, float value) {
    view.setRotationX(value);
}
 
Example 17
Source File: ViewHelper.java    From imsdk-android with MIT License 4 votes vote down vote up
static void setRotationX(View view, float rotationX) {
    view.setRotationX(rotationX);
}
 
Example 18
Source File: a.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
static void e(View view, float f1)
{
    view.setRotationX(f1);
}
 
Example 19
Source File: UEViewHelper.java    From Auie with 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 File: ViewHelper.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
static void setRotationX(View view, float rotationX) {
    view.setRotationX(rotationX);
}