Java Code Examples for android.view.View#setRotationY()
The following examples show how to use
android.view.View#setRotationY() .
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: Trebuchet File: Flip.java License: 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 Project: PowerFileExplorer File: ABaseTransformer.java License: 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 Project: android-slideshow-widget File: SlideAndZoomTransitionFactory.java License: 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 Project: TurboLauncher File: PagedView.java License: 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 Project: music-player File: LinkageCoverTransformer.java License: 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 Project: EasyTabs File: EasyTabletTransformer.java License: 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 Project: BannerPager File: DepthCardTransformer.java License: 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 Project: HomeApplianceMall File: FlipHorizontalTransformer.java License: 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 Project: Android-Image-Slider File: VerticalFlipTransformation.java License: 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 Project: RecyclerBanner File: BannerLayoutManager.java License: 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 11
Source Project: AutoTest File: BaseAnimatorSet.java License: 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 12
Source Project: adt-leanback-support File: ViewCompatHC.java License: Apache License 2.0 | 4 votes |
public static void setRotationY(View view, float value) { view.setRotationY(value); }
Example 13
Source Project: WanAndroid File: CubeOutTransformer.java License: 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 14
Source Project: KJFrameForAndroid File: ViewHelper.java License: Apache License 2.0 | 4 votes |
static void setRotationY(View view, float rotationY) { view.setRotationY(rotationY); }
Example 15
Source Project: litho File: MountState.java License: Apache License 2.0 | 4 votes |
private static void unsetRotationY(View view, NodeInfo nodeInfo) { if (nodeInfo.isRotationYSet() && view.getRotationY() != 0) { view.setRotationY(0); } }
Example 16
Source Project: PowerFileExplorer File: CubeOutTransformer.java License: 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 17
Source Project: JazzyListView File: CurlEffect.java License: 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 18
Source Project: imsdk-android File: ViewHelper.java License: MIT License | 4 votes |
static void setRotationY(View view, float rotationY) { view.setRotationY(rotationY); }
Example 19
Source Project: ViewPagerTabIndicator File: CubeOutTransformer.java License: 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 20
Source Project: TvLauncher File: CubeOutTransformer.java License: 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); }