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

The following are Jave code examples for showing how to use setRotationY() of the com.nineoldandroids.view.ViewHelper class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: JewelryUI   File: JazzyViewPager.java   View Source Code Vote up 6 votes
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
Project: JewelryUI   File: JazzyViewPager.java   View Source Code Vote up 6 votes
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
Project: JazzyViewPager   File: JazzyViewPager.java   View Source Code Vote up 6 votes
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
Project: JazzyViewPager   File: JazzyViewPager.java   View Source Code Vote up 6 votes
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
Project: JewelryUI   File: JazzyViewPager.java   View Source Code Vote up 5 votes
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 6
Project: JewelryUI   File: JazzyViewPager.java   View Source Code Vote up 5 votes
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 7
Project: Sega   File: FlipHorizontalTransformer.java   View Source Code Vote up 5 votes
@Override
protected void onTransform(View view, float position) {
	final float rotation = 180f * position;
       ViewHelper.setAlpha(view,rotation > 90f || rotation < -90f ? 0 : 1);
       ViewHelper.setPivotY(view,view.getHeight()*0.5f);
	ViewHelper.setPivotX(view,view.getWidth() * 0.5f);
	ViewHelper.setRotationY(view,rotation);
}
 
Example 8
Project: Sega   File: TabletTransformer.java   View Source Code Vote up 5 votes
@Override
protected void onTransform(View view, float position) {
	final float rotation = (position < 0 ? 30f : -30f) * Math.abs(position);

	ViewHelper.setTranslationX(view,getOffsetXForRotation(rotation, view.getWidth(), view.getHeight()));
       ViewHelper.setPivotX(view,view.getWidth() * 0.5f);
       ViewHelper.setPivotY(view,0);
       ViewHelper.setRotationY(view,rotation);
}
 
Example 9
Project: Sega   File: FlipPageViewTransformer.java   View Source Code Vote up 5 votes
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 10
Project: GongXianSheng   File: BaseViewAnimator.java   View Source Code Vote up 5 votes
/**
 * reset the view to default status
 *
 * @param target
 */
public 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 11
Project: MyAnimeViewer   File: BaseItemAnimator.java   View Source Code Vote up 5 votes
public static void clear(View v) {
    ViewHelper.setAlpha(v, 1);
    ViewHelper.setScaleY(v, 1);
    ViewHelper.setScaleX(v, 1);
    ViewHelper.setTranslationY(v, 0);
    ViewHelper.setTranslationX(v, 0);
    ViewHelper.setRotation(v, 0);
    ViewHelper.setRotationY(v, 0);
    ViewHelper.setRotationX(v, 0);
    // @TODO https://code.google.com/p/android/issues/detail?id=80863
    //        ViewHelper.setPivotY(v, v.getMeasuredHeight() / 2);
    v.setPivotY(v.getMeasuredHeight() / 2);
    ViewHelper.setPivotX(v, v.getMeasuredWidth() / 2);
    ViewPropertyAnimator.animate(v).setInterpolator(null);
}
 
Example 12
Project: JazzyViewPager   File: JazzyViewPager.java   View Source Code Vote up 5 votes
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
Project: JazzyViewPager   File: JazzyViewPager.java   View Source Code Vote up 5 votes
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 14
Project: Shared-Route   File: BaseAnimatorSet.java   View Source Code Vote up 5 votes
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 15
Project: MenuSet   File: MenuAdapter.java   View Source Code Vote up 5 votes
/**
 * Set starting params to vertical animations
 */
private void resetVerticalAnimation(View view, boolean toTop) {
    if (!mIsMenuOpen) {
        ViewHelper.setRotation(view, 0);
        ViewHelper.setRotationY(view, 0);
        ViewHelper.setRotationX(view, -90);
    }
    ViewHelper.setPivotX(view, mMenuItemSize / 2);
    ViewHelper.setPivotY(view, !toTop ? 0 : mMenuItemSize);
}
 
Example 16
Project: MenuSet   File: MenuAdapter.java   View Source Code Vote up 5 votes
/**
 * Set starting params to side animations
 */
private void resetSideAnimation(View view) {
    if (!mIsMenuOpen) {
        ViewHelper.setRotation(view, 0);
        ViewHelper.setRotationY(view, -90);
        ViewHelper.setRotationX(view, 0);
    }
    ViewHelper.setPivotX(view, mMenuItemSize);
    ViewHelper.setPivotY(view, mMenuItemSize / 2);
}
 
Example 17
Project: Sega   File: BaseTransformer.java   View Source Code Vote up 4 votes
/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)} is called.
 *
 * @param view
 * @param position
 */
protected void onPreTransform(View view, float position) {
    final float width = view.getWidth();

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

    if (hideOffscreenPages()) {
        ViewHelper.setAlpha(view,position <= -1f || position >= 1f ? 0f : 1f);
    } else {
        ViewHelper.setAlpha(view,1f);
    }
    if(mCustomAnimationInterface != null){
        if(!h.containsKey(view) || h.get(view).size() == 1){
            if(position > -1 && position < 1){
                if(h.get(view) == null){
                    h.put(view,new ArrayList<Float>());
                }
                h.get(view).add(position);
                if(h.get(view).size() == 2){
                    float zero = h.get(view).get(0);
                    float cha = h.get(view).get(1) - h.get(view).get(0);
                    if(zero > 0){
                        if(cha > -1 && cha < 0){
                            //in
                            mCustomAnimationInterface.onPrepareNextItemShowInScreen(view);
                        }else{
                            //out
                            mCustomAnimationInterface.onPrepareCurrentItemLeaveScreen(view);
                        }
                    }else{
                        if(cha > -1 && cha < 0){
                            //out
                            mCustomAnimationInterface.onPrepareCurrentItemLeaveScreen(view);
                        }else{
                            //in
                            mCustomAnimationInterface.onPrepareNextItemShowInScreen(view);
                        }
                    }
                }
            }
        }
    }
}