Java Code Examples for androidx.core.view.ViewCompat#setPivotY()
The following examples show how to use
androidx.core.view.ViewCompat#setPivotY() .
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: MyPageTransform.java From android with MIT License | 6 votes |
@Override public void transformPage(View page, float position) { float scale = (position < 0) ? ((1 - SCALE_MAX) * position + 1) : ((SCALE_MAX - 1) * position + 1); float alpha = (position < 0) ? ((1 - ALPHA_MAX) * position + 1) : ((ALPHA_MAX - 1) * position + 1); //为了滑动过程中,page间距不变,这里做了处理 if (position < 0) { ViewCompat.setPivotX(page, page.getWidth()); ViewCompat.setPivotY(page, page.getHeight() / 2); } else { ViewCompat.setPivotX(page, 0); ViewCompat.setPivotY(page, page.getHeight() / 2); } ViewCompat.setScaleX(page, scale); ViewCompat.setScaleY(page, scale); ViewCompat.setAlpha(page, Math.abs(alpha)); }
Example 2
Source File: IModeActivity.java From AndroidAnimationExercise with Apache License 2.0 | 6 votes |
@Override public void transformPage(View view, float position) { if (position < -1) { ViewCompat.setPivotX(view, view.getMeasuredWidth()); ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f); ViewCompat.setRotationY(view, 0); } else if (position <= 0) { ViewCompat.setPivotX(view, view.getMeasuredWidth()); ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f); ViewCompat.setRotationY(view, baseRotate * position); } else if (position <= 1) { ViewCompat.setPivotX(view, 0); ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f); ViewCompat.setRotationY(view, baseRotate * position); } else { ViewCompat.setPivotX(view, view.getMeasuredWidth()); ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f); ViewCompat.setRotationY(view, 0); } }
Example 3
Source File: IModeActivity.java From AndroidAnimationExercise with Apache License 2.0 | 5 votes |
@Override public void transformPage(View view, float position) { if (position < -1) { } else if (position <= 0) { ViewCompat.setTranslationX(view, -view.getWidth() * position); ViewCompat.setPivotX(view, view.getWidth() * 0.5f); ViewCompat.setPivotY(view, view.getHeight() * 0.5f); ViewCompat.setScaleX(view, 1 + position); ViewCompat.setScaleY(view, 1 + position); if (position < -0.95f) { ViewCompat.setAlpha(view, 0); } else { ViewCompat.setAlpha(view, 1); } } else if (position <= 1) { ViewCompat.setTranslationX(view, -view.getWidth() * position); ViewCompat.setPivotX(view, view.getWidth() * 0.5f); ViewCompat.setPivotY(view, view.getHeight() * 0.5f); ViewCompat.setScaleX(view, 1 - position); ViewCompat.setScaleY(view, 1 - position); if (position > 0.95f) { ViewCompat.setAlpha(view, 0); } else { ViewCompat.setAlpha(view, 1); } } }
Example 4
Source File: ViewHelper.java From recyclerview-animators with Apache License 2.0 | 5 votes |
public static void clear(View v) { ViewCompat.setAlpha(v, 1); ViewCompat.setScaleY(v, 1); ViewCompat.setScaleX(v, 1); ViewCompat.setTranslationY(v, 0); ViewCompat.setTranslationX(v, 0); ViewCompat.setRotation(v, 0); ViewCompat.setRotationY(v, 0); ViewCompat.setRotationX(v, 0); ViewCompat.setPivotY(v, v.getMeasuredHeight() / 2); ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2); ViewCompat.animate(v).setInterpolator(null).setStartDelay(0); }