Java Code Examples for com.nineoldandroids.view.ViewHelper#setRotationY()

The following examples show how to use com.nineoldandroids.view.ViewHelper#setRotationY() . 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: JazzyViewPager.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
protected void animateTablet(View left, View right, float positionOffset) {
    if (mState != State.IDLE) {
        if (left != null) {
            manageLayer(left, true);
            mRot = 30.0f * positionOffset;
            mTrans = getOffsetXForRotation(mRot, left.getMeasuredWidth(),
                    left.getMeasuredHeight());
            ViewHelper.setPivotX(left, left.getMeasuredWidth() / 2);
            ViewHelper.setPivotY(left, left.getMeasuredHeight() / 2);
            ViewHelper.setTranslationX(left, mTrans);
            ViewHelper.setRotationY(left, mRot);
            logState(left, "Left");
        }
        if (right != null) {
            manageLayer(right, true);
            mRot = -30.0f * (1 - positionOffset);
            mTrans = getOffsetXForRotation(mRot, right.getMeasuredWidth(),
                    right.getMeasuredHeight());
            ViewHelper.setPivotX(right, right.getMeasuredWidth() * 0.5f);
            ViewHelper.setPivotY(right, right.getMeasuredHeight() * 0.5f);
            ViewHelper.setTranslationX(right, mTrans);
            ViewHelper.setRotationY(right, mRot);
            logState(right, "Right");
        }
    }
}
 
Example 2
Source File: JazzyViewPager.java    From android-kernel-tweaker with GNU General Public License v3.0 6 votes vote down vote up
private void animateCube(View left, View right, float positionOffset, boolean in) {
	if (mState != State.IDLE) {
		if (left != null) {
			manageLayer(left, true);
			mRot = (in ? 90.0f : -90.0f) * positionOffset;
			ViewHelper.setPivotX(left, left.getMeasuredWidth());
			ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
			ViewHelper.setRotationY(left, mRot);
		}
		if (right != null) {
			manageLayer(right, true);
			mRot = -(in ? 90.0f : -90.0f) * (1-positionOffset);
			ViewHelper.setPivotX(right, 0);
			ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
			ViewHelper.setRotationY(right, mRot);
		}
	}
}
 
Example 3
Source File: JazzyViewPager.java    From Contacts with MIT License 6 votes vote down vote up
protected void animateTablet(View left, View right, float positionOffset) {		
	if (mState != State.IDLE) {
		if (left != null) {
			manageLayer(left, true);
			mRot = 30.0f * positionOffset;
			mTrans = getOffsetXForRotation(mRot, left.getMeasuredWidth(),
					left.getMeasuredHeight());
			ViewHelper.setPivotX(left, left.getMeasuredWidth()/2);
			ViewHelper.setPivotY(left, left.getMeasuredHeight()/2);
			ViewHelper.setTranslationX(left, mTrans);
			ViewHelper.setRotationY(left, mRot);
			logState(left, "Left");
		}
		if (right != null) {
			manageLayer(right, true);
			mRot = -30.0f * (1-positionOffset);
			mTrans = getOffsetXForRotation(mRot, right.getMeasuredWidth(), 
					right.getMeasuredHeight());
			ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
			ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
			ViewHelper.setTranslationX(right, mTrans);
			ViewHelper.setRotationY(right, mRot);
			logState(right, "Right");
		}
	}
}
 
Example 4
Source File: JazzyViewPager.java    From Gazetti_Newspaper_Reader with MIT License 6 votes vote down vote up
private void animateCube(View left, View right, float positionOffset, boolean in) {
	if (mState != State.IDLE) {
		if (left != null) {
			manageLayer(left, true);
			mRot = (in ? 90.0f : -90.0f) * positionOffset;
			ViewHelper.setPivotX(left, left.getMeasuredWidth());
			ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
			ViewHelper.setRotationY(left, mRot);
		}
		if (right != null) {
			manageLayer(right, true);
			mRot = -(in ? 90.0f : -90.0f) * (1-positionOffset);
			ViewHelper.setPivotX(right, 0);
			ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
			ViewHelper.setRotationY(right, mRot);
		}
	}
}
 
Example 5
Source File: JazzyViewPager.java    From android-kernel-tweaker with GNU General Public License v3.0 6 votes vote down vote up
protected void animateTablet(View left, View right, float positionOffset) {		
	if (mState != State.IDLE) {
		if (left != null) {
			manageLayer(left, true);
			mRot = 30.0f * positionOffset;
			mTrans = getOffsetXForRotation(mRot, left.getMeasuredWidth(),
					left.getMeasuredHeight());
			ViewHelper.setPivotX(left, left.getMeasuredWidth()/2);
			ViewHelper.setPivotY(left, left.getMeasuredHeight()/2);
			ViewHelper.setTranslationX(left, mTrans);
			ViewHelper.setRotationY(left, mRot);
			logState(left, "Left");
		}
		if (right != null) {
			manageLayer(right, true);
			mRot = -30.0f * (1-positionOffset);
			mTrans = getOffsetXForRotation(mRot, right.getMeasuredWidth(), 
					right.getMeasuredHeight());
			ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
			ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
			ViewHelper.setTranslationX(right, mTrans);
			ViewHelper.setRotationY(right, mRot);
			logState(right, "Right");
		}
	}
}
 
Example 6
Source File: PullToNextView.java    From Android-PullToNextLayout with Apache License 2.0 6 votes vote down vote up
public void reset(BaseAdapter adapter, int position) {
    setHeaderTopMargin(-mHeadViewHeight);
    initContentView(adapter, position);
    mScrollView=null;
    mWebView=null;
    ViewHelper.setAlpha(this, 1);
    ViewHelper.setTranslationY(this, 0);
    ViewHelper.setTranslationY(this, 0);
    ViewHelper.setScaleX(this, 1);
    ViewHelper.setScaleY(this, 1);
    ViewHelper.setScrollX(this, 0);
    ViewHelper.setScrollY(this, 0);
    ViewHelper.setRotationX(this, 0);
    ViewHelper.setRotationY(this, 0);


}
 
Example 7
Source File: JazzyViewPager.java    From ClockView with Apache License 2.0 6 votes vote down vote up
private void animateCubeOut(View left, View right, float positionOffset)
	{
		if (mState != State.IDLE)
		{
			if (left != null)
			{
				manageLayer(left, true);
				mRot =  -70.0f * positionOffset;
				ViewHelper.setPivotX(left, left.getMeasuredWidth());
				ViewHelper.setPivotY(left, left.getMeasuredHeight() * 0.5f);
//				ViewHelper.setScaleX(left,1 - positionOffset);
//				ViewHelper.setScaleY(left,1 - positionOffset);
				ViewHelper.setRotationY(left, mRot);
			}
			if (right != null)
			{
				manageLayer(right, true);
				mRot = 70.0f * (1 - positionOffset);
				ViewHelper.setPivotX(right, 0);
				ViewHelper.setPivotY(right, right.getMeasuredHeight() * 0.5f);
//				ViewHelper.setScaleX(right,positionOffset);
//				ViewHelper.setScaleY(right,positionOffset);
				ViewHelper.setRotationY(right, mRot);
			}
		}
	}
 
Example 8
Source File: JazzyViewPager.java    From JazzyViewPager with Apache License 2.0 5 votes vote down vote up
private void animateFlipHorizontal(View left, View right, float positionOffset, int positionOffsetPixels) {
	if (mState != State.IDLE) {
		if (left != null) {
			manageLayer(left, true);
			mRot = 180.0f * positionOffset;
			if (mRot > 90.0f) {
				left.setVisibility(View.INVISIBLE);
			} else {
				if (left.getVisibility() == View.INVISIBLE)
					left.setVisibility(View.VISIBLE);
				mTrans = positionOffsetPixels;
				ViewHelper.setPivotX(left, left.getMeasuredWidth()*0.5f);
				ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
				ViewHelper.setTranslationX(left, mTrans);
				ViewHelper.setRotationY(left, mRot);
			}
		}
		if (right != null) {
			manageLayer(right, true);
			mRot = -180.0f * (1-positionOffset);
			if (mRot < -90.0f) {
				right.setVisibility(View.INVISIBLE);
			} else {
				if (right.getVisibility() == View.INVISIBLE)
					right.setVisibility(View.VISIBLE);
				mTrans = -getWidth()-getPageMargin()+positionOffsetPixels;
				ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
				ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
				ViewHelper.setTranslationX(right, mTrans);
				ViewHelper.setRotationY(right, mRot);
			}
		}
	}
}
 
Example 9
Source File: IndicatorBaseAnimator.java    From FlycoPageIndicator with MIT License 5 votes vote down vote up
public static void reset(View view) {
    ViewHelper.setAlpha(view, 1);
    ViewHelper.setScaleX(view, 1);
    ViewHelper.setScaleY(view, 1);
    ViewHelper.setTranslationX(view, 0);
    ViewHelper.setTranslationY(view, 0);
    ViewHelper.setRotation(view, 0);
    ViewHelper.setRotationY(view, 0);
    ViewHelper.setRotationX(view, 0);
}
 
Example 10
Source File: TwirlEffect.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void initView(View view, int i, int j)
{
    ViewHelper.setPivotX(view, view.getWidth() / 2);
    ViewHelper.setPivotY(view, view.getWidth() / 2);
    ViewHelper.setRotationX(view, 80F);
    ViewHelper.setRotationY(view, j * 70);
    ViewHelper.setRotation(view, 10F);
}
 
Example 11
Source File: FlipPageViewTransformer.java    From AndroidImageSlider with MIT License 5 votes vote down vote up
private void setRotation(View view, float position, float percentage) {
    if (position > 0) {
        ViewHelper.setRotationY(view,-180 * (percentage + 1));
    } else {
        ViewHelper.setRotationY(view,180 * (percentage + 1));
    }
}
 
Example 12
Source File: JazzyViewPager.java    From JazzyViewPager with Apache License 2.0 5 votes vote down vote up
protected void animateScroll(int position, float positionOffset) {
	if (mState != State.IDLE) {
		mRot = (float)(1-Math.cos(2*Math.PI*positionOffset))/2*30.0f;
		ViewHelper.setRotationY(this, mState == State.GOING_RIGHT ? mRot : -mRot);
		ViewHelper.setPivotX(this, getMeasuredWidth()*0.5f);
		ViewHelper.setPivotY(this, getMeasuredHeight()*0.5f);
	}
}
 
Example 13
Source File: JazzyViewPager.java    From ClockView with Apache License 2.0 5 votes vote down vote up
private void animateCubeIn(View left, View right, float positionOffset)
{
	if (mState != State.IDLE)
	{
		if (left != null)
		{
			manageLayer(left, true);
			mRot = 90.0f * positionOffset;
			Log.e(TAG, "left.getMeasuredWidth()= " + left.getMeasuredWidth() + " ,left.getMeasuredHeight() = "
					+ left.getMeasuredHeight());

			ViewHelper.setPivotX(left, left.getMeasuredWidth());
			ViewHelper.setPivotY(left, left.getMeasuredHeight() * 0.5f);
			ViewHelper.setScaleX(left,1 - positionOffset);
			ViewHelper.setScaleY(left,1 - positionOffset);
			ViewHelper.setRotationY(left, mRot);
		}
		if (right != null)
		{
			manageLayer(right, true);
			mRot = -90.0f * (1 - positionOffset);
			Log.e(TAG, "right.getMeasuredWidth()= " + right.getMeasuredWidth() + " ,right.getMeasuredHeight() = "
					+ right.getMeasuredHeight());


			ViewHelper.setPivotX(right, 0);
			ViewHelper.setPivotY(right, right.getMeasuredHeight() * 0.5f);
			ViewHelper.setScaleX(right,positionOffset);
			ViewHelper.setScaleY(right,positionOffset);
			ViewHelper.setRotationY(right, mRot);
		}
	}
}
 
Example 14
Source File: FlipPageViewTransformer.java    From ImageSliderWithSwipes with Apache License 2.0 5 votes vote down vote up
private void setRotation(View view, float position, float percentage) {
    if (position > 0) {
        ViewHelper.setRotationY(view,-180 * (percentage + 1));
    } else {
        ViewHelper.setRotationY(view,180 * (percentage + 1));
    }
}
 
Example 15
Source File: Util.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static void reset(View target) {
    ViewHelper.setAlpha(target, 1);
    ViewHelper.setScaleX(target, 1);
    ViewHelper.setScaleY(target, 1);
    ViewHelper.setTranslationX(target, 0);
    ViewHelper.setTranslationY(target, 0);
    ViewHelper.setRotation(target, 0);
    ViewHelper.setRotationY(target, 0);
    ViewHelper.setRotationX(target, 0);
    ViewHelper.setPivotX(target, target.getMeasuredWidth() / 2.0f);
    ViewHelper.setPivotY(target, target.getMeasuredHeight() / 2.0f);
}
 
Example 16
Source File: JazzyViewPager.java    From android-kernel-tweaker with GNU General Public License v3.0 5 votes vote down vote up
private void animateFlipHorizontal(View left, View right, float positionOffset, int positionOffsetPixels) {
	if (mState != State.IDLE) {
		if (left != null) {
			manageLayer(left, true);
			mRot = 180.0f * positionOffset;
			if (mRot > 90.0f) {
				left.setVisibility(View.INVISIBLE);
			} else {
				if (left.getVisibility() == View.INVISIBLE)
					left.setVisibility(View.VISIBLE);
				mTrans = positionOffsetPixels;
				ViewHelper.setPivotX(left, left.getMeasuredWidth()*0.5f);
				ViewHelper.setPivotY(left, left.getMeasuredHeight()*0.5f);
				ViewHelper.setTranslationX(left, mTrans);
				ViewHelper.setRotationY(left, mRot);
			}
		}
		if (right != null) {
			manageLayer(right, true);
			mRot = -180.0f * (1-positionOffset);
			if (mRot < -90.0f) {
				right.setVisibility(View.INVISIBLE);
			} else {
				if (right.getVisibility() == View.INVISIBLE)
					right.setVisibility(View.VISIBLE);
				mTrans = -getWidth()-getPageMargin()+positionOffsetPixels;
				ViewHelper.setPivotX(right, right.getMeasuredWidth()*0.5f);
				ViewHelper.setPivotY(right, right.getMeasuredHeight()*0.5f);
				ViewHelper.setTranslationX(right, mTrans);
				ViewHelper.setRotationY(right, mRot);
			}
		}
	}
}
 
Example 17
Source File: JazzyViewPager.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void animateFlipHorizontal(View left, View right, float positionOffset, int positionOffsetPixels) {
    if (mState != State.IDLE) {
        if (left != null) {
            manageLayer(left, true);
            mRot = 180.0f * positionOffset;
            if (mRot > 90.0f) {
                left.setVisibility(View.INVISIBLE);
            } else {
                if (left.getVisibility() == View.INVISIBLE)
                    left.setVisibility(View.VISIBLE);
                mTrans = positionOffsetPixels;
                ViewHelper.setPivotX(left, left.getMeasuredWidth() * 0.5f);
                ViewHelper.setPivotY(left, left.getMeasuredHeight() * 0.5f);
                ViewHelper.setTranslationX(left, mTrans);
                ViewHelper.setRotationY(left, mRot);
            }
        }
        if (right != null) {
            manageLayer(right, true);
            mRot = -180.0f * (1 - positionOffset);
            if (mRot < -90.0f) {
                right.setVisibility(View.INVISIBLE);
            } else {
                if (right.getVisibility() == View.INVISIBLE)
                    right.setVisibility(View.VISIBLE);
                mTrans = -getWidth() - getPageMargin() + positionOffsetPixels;
                ViewHelper.setPivotX(right, right.getMeasuredWidth() * 0.5f);
                ViewHelper.setPivotY(right, right.getMeasuredHeight() * 0.5f);
                ViewHelper.setTranslationX(right, mTrans);
                ViewHelper.setRotationY(right, mRot);
            }
        }
    }
}
 
Example 18
Source File: JazzyViewPager.java    From ClockView with Apache License 2.0 4 votes vote down vote up
private void animateFlipHorizontal(View left, View right,
		float positionOffset, int positionOffsetPixels)
{
	if (mState != State.IDLE)
	{
		if (left != null)
		{
			manageLayer(left, true);
			mRot = 180.0f * positionOffset;
			if (mRot > 90.0f)
			{
				left.setVisibility(View.INVISIBLE);
			} else
			{
				if (left.getVisibility() == View.INVISIBLE)
					left.setVisibility(View.VISIBLE);
				mTrans = positionOffsetPixels;
				ViewHelper.setPivotX(left, left.getMeasuredWidth() * 0.5f);
				ViewHelper.setPivotY(left, left.getMeasuredHeight() * 0.5f);
				ViewHelper.setTranslationX(left, mTrans);
				ViewHelper.setRotationY(left, mRot);
			}
		}
		if (right != null)
		{
			manageLayer(right, true);
			mRot = -180.0f * (1 - positionOffset);
			if (mRot < -90.0f)
			{
				right.setVisibility(View.INVISIBLE);
			} else
			{
				if (right.getVisibility() == View.INVISIBLE)
					right.setVisibility(View.VISIBLE);
				mTrans = -getWidth() - getPageMargin()
						+ positionOffsetPixels;
				ViewHelper
						.setPivotX(right, right.getMeasuredWidth() * 0.5f);
				ViewHelper.setPivotY(right,
						right.getMeasuredHeight() * 0.5f);
				ViewHelper.setTranslationX(right, mTrans);
				ViewHelper.setRotationY(right, mRot);
			}
		}
	}
}
 
Example 19
Source File: FlipAnimater.java    From JPTabBar with Apache License 2.0 4 votes vote down vote up
@Override
public void onPageAnimate(View v,float offset) {
    ViewHelper.setRotationY(v, 180*offset);
}
 
Example 20
Source File: HelixEffect.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public void initView(View view, int i, int j)
{
    ViewHelper.setRotationY(view, 180F);
}