本文整理汇总了Java中android.view.ViewAnimationUtils.createCircularReveal方法的典型用法代码示例。如果您正苦于以下问题:Java ViewAnimationUtils.createCircularReveal方法的具体用法?Java ViewAnimationUtils.createCircularReveal怎么用?Java ViewAnimationUtils.createCircularReveal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ViewAnimationUtils
的用法示例。
在下文中一共展示了ViewAnimationUtils.createCircularReveal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doCircularExitAnimation
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
/**
* Circular reveal exit animation
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void doCircularExitAnimation() {
final int revealRadius = (int) Math.hypot(getWidth(), getHeight());
Animator exitAnimator = ViewAnimationUtils.createCircularReveal(this,
mCenterX, mCenterY, revealRadius, 0f);
exitAnimator.setDuration(mAnimationDuration);
exitAnimator.setInterpolator(AnimationUtils.loadInterpolator(mActivity,
android.R.interpolator.decelerate_cubic));
exitAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
removeView();
if (mAnimationListener != null) {
mAnimationListener.onExitAnimationEnd();
}
}
});
exitAnimator.start();
}
示例2: hideEditText
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
private void hideEditText(final LinearLayout view) {
int cx = view.getRight() - 30;
int cy = view.getBottom() - 60;
int initialRadius = view.getWidth();
Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
view.setVisibility(View.INVISIBLE);
}
});
isEditTextVisible = false;
anim.start();
}
示例3: show
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
/**
* 向四周伸张,直到完成显示。
*/
@SuppressLint("NewApi")
public static void show(View myView, float startRadius, long durationMills) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
myView.setVisibility(View.VISIBLE);
return;
}
int cx = (myView.getLeft() + myView.getRight()) / 2;
int cy = (myView.getTop() + myView.getBottom()) / 2;
int w = myView.getWidth();
int h = myView.getHeight();
// 勾股定理 & 进一法
int finalRadius = (int) Math.sqrt(w * w + h * h) + 1;
Animator anim =
ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius);
myView.setVisibility(View.VISIBLE);
anim.setDuration(durationMills);
anim.start();
}
示例4: performCircularReveal
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
private void performCircularReveal() {
show.setBackgroundColor(0xffff0000);
ViewCompat.setTranslationY(show, 0);
ViewCompat.setTranslationX(show, 0);
show.getLayoutParams().height = 500;
show.getLayoutParams().width = 1920;
show.requestLayout();
int centerX = (show.getLeft() + show.getRight()) / 2;
int centerY = (show.getTop() + show.getBottom()) / 2;
float finalRadius = (float) Math.hypot((double) centerX, (double) centerY);
Animator mCircularReveal = ViewAnimationUtils.createCircularReveal(
show, centerX, centerY, 0, finalRadius);
mCircularReveal.setInterpolator(new AccelerateDecelerateInterpolator());
mCircularReveal.setDuration(500);
mCircularReveal.start();
}
示例5: reveal
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
/**
* Create the reveal effect animation
* @param view the View to reveal
* @param cx coordinate X
* @param cy coordinate Y
*/
@TargetApi(VERSION_CODES.LOLLIPOP)
public static void reveal(final View view, int cx, int cy) {
if (!hasLollipop()) {
view.setVisibility(View.VISIBLE);
return;
}
//Get the final radius for the clipping circle
int finalRadius = Math.max(view.getWidth(), view.getHeight());
//Create the animator for this view (the start radius is zero)
Animator animator =
ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);
//Make the view visible and start the animation
view.setVisibility(View.VISIBLE);
animator.start();
}
示例6: circularRevealActivity
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void circularRevealActivity() {
int cx = (rootLayout.getLeft() + rootLayout.getRight()) - getResources().getDimensionPixelSize(R.dimen.margin_xxxhigh);
int cy = (rootLayout.getTop() + rootLayout.getBottom()) - getResources().getDimensionPixelSize(R.dimen.margin_xxxhigh);
int finalRadius = (int) Math.hypot(rootLayout.getRight(), rootLayout.getBottom());
int initialRadius = getResources().getDimensionPixelSize(R.dimen.margin_xxhigh);
// create the animator for this view (the start radius is zero)
Animator circularReveal = ViewAnimationUtils.createCircularReveal(rootLayout, cx, cy, initialRadius, finalRadius);
circularReveal.setDuration(600);
// make the view visible and start the animation
rootLayout.setVisibility(View.VISIBLE);
circularReveal.start();
}
示例7: createAnimator
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
private Animator createAnimator(View targetView, boolean isAppearing) {
final int[] relativeLocation = getRelativeLocation(targetView);
final int width = targetView.getWidth();
final int height = targetView.getHeight();
final int relX = relativeLocation[0];
final int relY = relativeLocation[1];
int dx = Math.max(relX, width - relX);
int dy = Math.max(relY, height - relY);
int radius = calcRadius(dx, dy);
return ViewAnimationUtils.createCircularReveal(
targetView,
relX,
relY,
isAppearing ? startRadius : radius,
isAppearing ? radius : startRadius
);
}
示例8: hide
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
/**
* 由满向中间收缩,直到隐藏。
*/
@SuppressLint("NewApi")
public static void hide(final View myView, float endRadius, long durationMills) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
myView.setVisibility(View.INVISIBLE);
return;
}
int cx = (myView.getLeft() + myView.getRight()) / 2;
int cy = (myView.getTop() + myView.getBottom()) / 2;
int w = myView.getWidth();
int h = myView.getHeight();
// 勾股定理 & 进一法
int initialRadius = (int) Math.sqrt(w * w + h * h) + 1;
Animator anim =
ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, endRadius);
anim.setDuration(durationMills);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
myView.setVisibility(View.INVISIBLE);
}
});
anim.start();
}
示例9: getCircularHideAnimtion
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
@NonNull
public static Animator getCircularHideAnimtion(@NonNull View view) {
int cx = view.getWidth() / 2;
int cy = view.getHeight() / 2;
int finalRadius = (int) Math.hypot(view.getWidth(), view.getHeight());
Animator animation = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);
animation.setDuration(500);
return animation;
}
示例10: createAnimator
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
private Animator createAnimator(View view, float startRadius, float endRadius) {
int centerX = view.getWidth() / 2;
int centerY = view.getHeight() / 2;
Animator reveal = ViewAnimationUtils.createCircularReveal(view, centerX, centerY,
startRadius, endRadius);
return new NoPauseAnimator(reveal);
}
示例11: animateWindowInCircular
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateWindowInCircular(@Nullable View anchor, @NonNull View contentView) {
Pair<Integer, Integer> coordinates = getClickOrigin(anchor, contentView);
Animator animator = ViewAnimationUtils.createCircularReveal(contentView,
coordinates.first,
coordinates.second,
0,
Math.max(contentView.getWidth(), contentView.getHeight()));
animator.setDuration(ANIMATION_DURATION);
animator.start();
}
示例12: unReveal
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
/**
* Create the un-reveal effect animation
* @param view the View to hide
* @param cx coordinate X
* @param cy coordinate Y
*/
@TargetApi(VERSION_CODES.LOLLIPOP)
public static void unReveal(final View view, int cx, int cy) {
if (!hasLollipop()) {
view.setVisibility(View.GONE);
return;
}
//Get the initial radius for the clipping circle
int initialRadius = view.getWidth();
//Create the animation (the final radius is zero)
Animator animator =
ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0);
//Make the view invisible when the animation is done
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
view.setVisibility(View.GONE);
}
});
//Start the animation
animator.start();
}
示例13: onAppear
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
@Override
public Animator onAppear(ViewGroup sceneRoot, View view,
TransitionValues startValues,
TransitionValues endValues) {
if (view == null || view.getHeight() == 0 || view.getWidth() == 0) return null;
ensureCenterPoint(sceneRoot, view);
return new PauseLessAnimator(ViewAnimationUtils.createCircularReveal(
view,
center.x,
center.y,
startRadius,
getFullyRevealedRadius(view)));
}
示例14: createCircularReveal
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
private Animator createCircularReveal(View view, float startRadius, float endRadius) {
int centerX = view.getWidth() / 2;
int centerY = view.getHeight() / 2;
Animator reveal = ViewAnimationUtils.createCircularReveal(view, centerX, centerY,
startRadius, endRadius);
return new NoPauseAnimator(reveal);
}
示例15: onAppear
import android.view.ViewAnimationUtils; //导入方法依赖的package包/类
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
Animator animator = ViewAnimationUtils.createCircularReveal(view, mEpicenter.x, mEpicenter.y,
mSmallRadius, mBigRadius);
animator.setDuration(mDuration);
return new PauseableAnimator(animator);
}