Java Code Examples for android.view.View#setRotationY()
The following examples show how to use
android.view.View#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: Flip.java From Trebuchet with GNU General Public License v3.0 | 6 votes |
@Override public void screenScrolled(View v, float progress) { float rotation = -180.0f * Math.max(-1f, Math.min(1f, progress)); v.setCameraDistance(mPagedView.mDensity * CAMERA_DISTANCE); v.setPivotX(v.getMeasuredWidth() * 0.5f); v.setPivotY(v.getMeasuredHeight() * 0.5f); v.setRotationY(rotation); if (progress >= -0.5f && progress <= 0.5f) { v.setTranslationX(v.getMeasuredWidth() * progress); if (v.getVisibility() != View.VISIBLE) { v.setVisibility(View.VISIBLE); } } else { v.setTranslationX(v.getMeasuredWidth() * -10f); } }
Example 2
Source File: ABaseTransformer.java From PowerFileExplorer with GNU General Public License v3.0 | 6 votes |
/** * Called each {@link #transformPage(android.view.View, float)} before {{@link #onTransform(android.view.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
Source File: SlideAndZoomTransitionFactory.java From android-slideshow-widget with Apache License 2.0 | 6 votes |
@Override public Animator getInAnimator(View target, SlideShowView parent, int fromSlide, int toSlide) { target.setAlpha(0); target.setScaleX(1); target.setScaleY(1); target.setTranslationX(0); target.setTranslationY(0); target.setRotationX(0); target.setRotationY(0); final PropertyValuesHolder translationX = PropertyValuesHolder.ofFloat(View.TRANSLATION_X, parent.getWidth(), parent.getWidth()/3, 0); final PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat(View.SCALE_X, 0.5f, 0.6f, 1.0f); final PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.5f, 0.6f, 1.0f); final PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0, 1, 1); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(target, translationX, scaleX, scaleY, alpha); animator.setDuration(getDuration()); animator.setInterpolator(getInterpolator()); return animator; }
Example 4
Source File: PagedView.java From TurboLauncher with Apache License 2.0 | 5 votes |
@Override public void screenScrolled(View v, int i, float scrollProgress) { float rotation = (mIn ? 90.0f : -90.0f) * scrollProgress; if (mIn) { v.setCameraDistance(mPagedView.mDensity * PagedView.CAMERA_DISTANCE); } v.setPivotX(scrollProgress < 0 ? 0 : v.getMeasuredWidth()); v.setPivotY(v.getMeasuredHeight() * 0.5f); v.setRotationY(rotation); }
Example 5
Source File: LinkageCoverTransformer.java From music-player with MIT License | 5 votes |
@Override public void transformPage(View page, float position) { // Log.d(TAG,"position:"+position); if (scale != 0f) { float realScale = Utils.getFloat(1 - Math.abs(position * scale),SCALE_MIN,SCALE_MAX); page.setScaleX(realScale); page.setScaleY(realScale); } if (pagerMargin != 0) { float realPagerMargin = position * (pagerMargin); if (spaceValue != 0) { float realSpaceValue = Utils.getFloat(Math.abs(position * spaceValue),MARGIN_MIN,MARGIN_MAX); realPagerMargin += (position > 0) ? realSpaceValue : - realSpaceValue; } page.setTranslationX(realPagerMargin); } //TODO //rotate status if(rotationY!=0){ float realRotationY = Math.abs(position * rotationY); page.setRotationY(position < 0f ? realRotationY : -realRotationY); } }
Example 6
Source File: EasyTabletTransformer.java From EasyTabs with MIT License | 5 votes |
@Override protected void onTransform(View view, float position) { final float rotation = (position < 0 ? 30f : -30f) * Math.abs(position); view.setTranslationX(getOffsetXForRotation(rotation, view.getWidth(), view.getHeight())); view.setPivotX(view.getWidth() * 0.5f); view.setPivotY(0); view.setRotationY(rotation); }
Example 7
Source File: DepthCardTransformer.java From BannerPager with Apache License 2.0 | 5 votes |
@Override protected void onTransform(View page, float position) { if (position < -1) { /* [-Infinity,-1)*/ /*页面已经在屏幕左侧第一个*/ page.setCameraDistance(10000); page.setPivotX(page.getWidth() / 2); page.setPivotY(page.getWidth()); page.setRotationY(15); } else if (position <= 0) { /* [-1,0]*/ /*页面从左侧进入或者向左侧滑出的状态*/ page.setCameraDistance(10000); page.setPivotX(page.getWidth() / 2); page.setPivotY(page.getWidth()); page.setRotationY(-15 + (1 - position) * 15); } else if (position <= 1) { /* (0,1]*/ /*页面从右侧进入或者向右侧滑出的状态*/ page.setCameraDistance(10000); page.setPivotX(page.getWidth() / 2); page.setPivotY(page.getWidth()); page.setRotationY(-15 + (1 - position) * 15); } else if (position <= 2) { /*页面已经在屏幕右侧第一个*/ page.setCameraDistance(10000); page.setPivotX(page.getWidth() / 2); page.setPivotY(page.getWidth()); page.setRotationY(-15); } }
Example 8
Source File: FlipHorizontalTransformer.java From HomeApplianceMall with MIT License | 5 votes |
@Override protected void onTransform(View view, float position) { final float rotation = 180f * position; view.setAlpha(rotation > 90f || rotation < -90f ? 0 : 1); view.setPivotX(view.getWidth() * 0.5f); view.setPivotY(view.getHeight() * 0.5f); view.setRotationY(rotation); }
Example 9
Source File: VerticalFlipTransformation.java From Android-Image-Slider with Apache License 2.0 | 5 votes |
@Override public void transformPage(View page, float position) { page.setTranslationX(-position * page.getWidth()); page.setCameraDistance(12000); if (position < 0.5 && position > -0.5) { page.setVisibility(View.VISIBLE); } else { page.setVisibility(View.INVISIBLE); } if (position < -1){ // [-Infinity,-1) // This page is way off-screen to the left. page.setAlpha(0); } else if (position <= 0) { // [-1,0] page.setAlpha(1); page.setRotationY(180 *(1-Math.abs(position)+1)); } else if (position <= 1) { // (0,1] page.setAlpha(1); page.setRotationY(-180 *(1-Math.abs(position)+1)); } else { // (1,+Infinity] // This page is way off-screen to the right. page.setAlpha(0); } }
Example 10
Source File: BaseAnimatorSet.java From AutoTest with MIT License | 5 votes |
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 11
Source File: BannerLayoutManager.java From RecyclerBanner with Apache License 2.0 | 5 votes |
private void resetViewProperty(View v) { v.setRotation(0); v.setRotationY(0); v.setRotationX(0); v.setScaleX(1f); v.setScaleY(1f); v.setAlpha(1f); }
Example 12
Source File: CubeOutTransformer.java From TvLauncher with Apache License 2.0 | 4 votes |
@Override protected void onTransform(View view, float position) { view.setPivotX(position < 0f ? view.getWidth() : 0f); view.setPivotY(view.getHeight() * 0.5f); view.setRotationY(90f * position); }
Example 13
Source File: ViewCompatHC.java From adt-leanback-support with Apache License 2.0 | 4 votes |
public static void setRotationY(View view, float value) { view.setRotationY(value); }
Example 14
Source File: CubeOutTransformer.java From ViewPagerTabIndicator with Artistic License 2.0 | 4 votes |
@Override protected void onTransform(View view, float position) { view.setPivotX(position < 0f ? view.getWidth() : 0f); view.setPivotY(view.getHeight() * 0.5f); view.setRotationY(90f * position); }
Example 15
Source File: ViewHelper.java From imsdk-android with MIT License | 4 votes |
static void setRotationY(View view, float rotationY) { view.setRotationY(rotationY); }
Example 16
Source File: CurlEffect.java From JazzyListView with Apache License 2.0 | 4 votes |
@Override public void initView(View item, int position, int scrollDirection) { item.setPivotX(0); item.setPivotY(item.getHeight() / 2); item.setRotationY(INITIAL_ROTATION_ANGLE); }
Example 17
Source File: CubeOutTransformer.java From PowerFileExplorer with GNU General Public License v3.0 | 4 votes |
@Override protected void onTransform(View view, float position) { view.setPivotX(position < 0f ? view.getWidth() : 0f); view.setPivotY(view.getHeight() * 0.5f); view.setRotationY(90f * position); }
Example 18
Source File: MountState.java From litho with Apache License 2.0 | 4 votes |
private static void unsetRotationY(View view, NodeInfo nodeInfo) { if (nodeInfo.isRotationYSet() && view.getRotationY() != 0) { view.setRotationY(0); } }
Example 19
Source File: ViewHelper.java From KJFrameForAndroid with Apache License 2.0 | 4 votes |
static void setRotationY(View view, float rotationY) { view.setRotationY(rotationY); }
Example 20
Source File: CubeOutTransformer.java From WanAndroid with GNU General Public License v3.0 | 4 votes |
@Override protected void onTransform(View view, float position) { view.setPivotX(position < 0f ? view.getWidth() : 0f); view.setPivotY(view.getHeight() * 0.5f); view.setRotationY(90f * position); }