当前位置: 首页>>代码示例>>Java>>正文


Java ViewAnimationUtils类代码示例

本文整理汇总了Java中android.view.ViewAnimationUtils的典型用法代码示例。如果您正苦于以下问题:Java ViewAnimationUtils类的具体用法?Java ViewAnimationUtils怎么用?Java ViewAnimationUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ViewAnimationUtils类属于android.view包,在下文中一共展示了ViewAnimationUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performCircularReveal

import android.view.ViewAnimationUtils; //导入依赖的package包/类
private void performCircularReveal(View show) {
    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();
}
 
开发者ID:teisun,项目名称:SunmiUI,代码行数:17,代码来源:ImageSharedTransitionActivity.java

示例2: 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();


}
 
开发者ID:faruktoptas,项目名称:FancyShowCaseView,代码行数:25,代码来源:FancyShowCaseView.java

示例3: roundLoad

import android.view.ViewAnimationUtils; //导入依赖的package包/类
public void roundLoad(View myView) {
    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    // get the final radius for the clipping circle
    int finalRadius = Math.max(myView.getWidth(), myView.getHeight());
    AnimatorSet animatorSet = new AnimatorSet();
    // create the animator for this view (the start radius is zero)
    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
    anim.setDuration(1000);
    anim.setInterpolator(new AccelerateInterpolator());

    Animator anim1 = ObjectAnimator.ofFloat(myView, "translationZ", 0f, 50f);
    anim1.setDuration(1500);
    anim1.setInterpolator(new AccelerateInterpolator());

    animatorSet.play(anim).with(anim1);
    // make the view visible and start the animation
    myView.setVisibility(View.VISIBLE);
    animatorSet.start();
}
 
开发者ID:shenhuanet,项目名称:OpenEyesReading-android,代码行数:23,代码来源:BaseLoginLayout1.java

示例4: 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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:CircularAnimUtil.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:Utils.java

示例6: circularReveal

import android.view.ViewAnimationUtils; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void circularReveal(@NonNull final View anchor) {
    final View contentView = getContentView();
    contentView.post(new Runnable() {
        @Override
        public void run() {
            final int[] myLocation = new int[2];
            final int[] anchorLocation = new int[2];
            contentView.getLocationOnScreen(myLocation);
            anchor.getLocationOnScreen(anchorLocation);
            final int cx = anchorLocation[0] - myLocation[0] + anchor.getWidth()/2;
            final int cy = anchorLocation[1] - myLocation[1] + anchor.getHeight()/2;

            contentView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
            final int dx = Math.max(cx, contentView.getMeasuredWidth() - cx);
            final int dy = Math.max(cy, contentView.getMeasuredHeight() - cy);
            final float finalRadius = (float) Math.hypot(dx, dy);
            Animator animator = ViewAnimationUtils.createCircularReveal(contentView, cx, cy, 0f, finalRadius);
            animator.setDuration(500);
            animator.start();
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:ExampleCardPopup.java

示例7: onViewClicked

import android.view.ViewAnimationUtils; //导入依赖的package包/类
@OnClick({R.id.iv_pic1, R.id.iv_pic2})
public void onViewClicked(View view) {
    switch (view.getId()) {
        case R.id.iv_pic1:

            if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
                Animator animator = ViewAnimationUtils.createCircularReveal(ivPic1, ivPic1.getWidth() / 2, ivPic1.getHeight() / 2,
                        ivPic1.getHeight() / 2, 0);

                animator.setDuration(2000);
                animator.start();
            }
            break;
        case R.id.iv_pic2:
            if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
                Animator animator1 = ViewAnimationUtils.createCircularReveal(ivPic2, 0, 0, 0,
                        (float) Math.hypot(ivPic2.getWidth(), ivPic2.getHeight()));
                animator1.setDuration(2000);
                animator1.start();
            }
            break;
    }
}
 
开发者ID:penghuanliang,项目名称:Rxjava2.0Demo,代码行数:24,代码来源:ToolTitleActivity.java

示例8: animateRevealHide

import android.view.ViewAnimationUtils; //导入依赖的package包/类
private void animateRevealHide(final View viewRoot) {
    int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
    int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
    int initialRadius = viewRoot.getWidth();

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, initialRadius, 0);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            viewRoot.setVisibility(View.INVISIBLE);
        }
    });
    anim.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
    anim.start();
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:17,代码来源:RevealActivity.java

示例9: 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();
}
 
开发者ID:teisun,项目名称:SunmiUI,代码行数:17,代码来源:CustomSharedTransitionActivity.java

示例10: conceal

import android.view.ViewAnimationUtils; //导入依赖的package包/类
/**
 * Conceal the view from the given centerX and centerY.
 *
 * @param view        the target view.
 * @param duration    animation duration.
 * @param centerX     the pivotX
 * @param centerY     the pivotY
 * @param startRadius the radius of the end of the animation, which is generally the maximum of the view's height and width.
 * @param endRadius   the radius of the beginning of the animation, which is generally zero.
 */
private static void conceal(final View view, final int duration, final int centerX, final int centerY, final float startRadius, final float endRadius) {
    versionCheck(new Runnable() {
        @Override
        public void run() {
            Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius);
            animator.setDuration(duration);
            animator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    view.setVisibility(View.GONE);
                }
            });
            animator.start();
        }
    }, REVEAL_WARNING);
}
 
开发者ID:Mindjet,项目名称:LiteReader,代码行数:27,代码来源:RevealUtil.java

示例11: concealActivity

import android.view.ViewAnimationUtils; //导入依赖的package包/类
public static void concealActivity(final Activity activity, final int duration, final int centerX, int centerY) {
    if (takeEffect) {
        final View rootView = activity.findViewById(android.R.id.content);
        Animator animator = ViewAnimationUtils.createCircularReveal(rootView, centerX, centerY, getMaxRadius(rootView) * 2, 0);
        animator.setDuration(duration);
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                rootView.setVisibility(View.GONE);
                activity.finish();
                activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            }
        });
        animator.start();
    } else {
        activity.finish();
    }
}
 
开发者ID:Mindjet,项目名称:LiteReader,代码行数:19,代码来源:RevealUtil.java

示例12: doCircularReveal

import android.view.ViewAnimationUtils; //导入依赖的package包/类
private void doCircularReveal() {

        int centerX = (movieBackdrop.getLeft() + movieBackdrop.getRight()) / 2;
        int centerY = movieBackdrop.getTop();
        int startRadius = 0;
        int endRadius = Math.max(movieBackdrop.getWidth(), movieBackdrop.getHeight());

        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
            Animator animator = ViewAnimationUtils
                    .createCircularReveal(movieBackdrop, centerX, centerY, startRadius, endRadius);
            animator.setDuration(500);
            movieBackdrop.setVisibility(View.VISIBLE);
            animator.start();
        } else {
            movieBackdrop.setVisibility(View.VISIBLE);
        }
    }
 
开发者ID:prakh25,项目名称:MovieApp,代码行数:18,代码来源:MovieDetailFragment.java

示例13: 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();
}
 
开发者ID:hypertrack,项目名称:hypertrack-live-android,代码行数:17,代码来源:Home.java

示例14: createCheckoutRevealAnimator

import android.view.ViewAnimationUtils; //导入依赖的package包/类
protected Animator createCheckoutRevealAnimator(final ClipRevealFrame view, int x, int y, float startRadius, float endRadius) {
    setMenuVisibility(false);
    Animator retAnimator;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        retAnimator = ViewAnimationUtils.createCircularReveal(view, x, y, startRadius, endRadius);
    } else {
        view.setClipOutLines(true);
        view.setClipCenter(x, y);
        view.setClipRadius(startRadius);

        retAnimator = ObjectAnimator.ofFloat(view, "clipRadius", startRadius, endRadius);
    }
    retAnimator.setDuration(ANIM_DURATION);
    retAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            view.setClipOutLines(false);
            removeOldSideFragment();
            isAnimRunning = false;
        }
    });

    retAnimator.setInterpolator(new AccelerateInterpolator(2.0f));
    return retAnimator;
}
 
开发者ID:woxingxiao,项目名称:GracefulMovies,代码行数:26,代码来源:SideFragment.java

示例15: showVideoStartTip

import android.view.ViewAnimationUtils; //导入依赖的package包/类
private void showVideoStartTip() {
    mRlVideoTip.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Animator circularReveal = ViewAnimationUtils.createCircularReveal(mRlVideoTip,
                mIvCover.getWidth() - ArmsUtils.dip2px(VideoDetailActivity.this, mAnchorX),
                mIvCover.getHeight() - ArmsUtils.dip2px(VideoDetailActivity.this, mAnchorY),
                0,
                ((float) Math.hypot(mIvCover.getWidth(), mIvCover.getHeight())));
        circularReveal.setDuration(800);
        circularReveal.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                mIvCover.setVisibility(View.GONE);
                mPresenter.loadPlayUrl(aid);
            }
        });
        circularReveal.start();
    } else {
        mPresenter.loadPlayUrl(aid);
    }
    // 锁定AppBarLayout
    AppBarLayout.LayoutParams layoutParams = (AppBarLayout.LayoutParams) mAppbar.getChildAt(0).getLayoutParams();
    layoutParams.setScrollFlags(0);
    mAppbar.getChildAt(0).setLayoutParams(layoutParams);
}
 
开发者ID:GitLqr,项目名称:LQRBiliBlili,代码行数:27,代码来源:VideoDetailActivity.java


注:本文中的android.view.ViewAnimationUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。