AnimationService.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:Pocket-Plays-for-Twitch 作者:
/**
 * For the Card Views
 */
public static AnimationSet startAlphaRevealAnimation(int delay, final View VIEW, boolean includeTransition) {
    final int ANIMATION_DURATION = 300;

    final Animation mAlphaAnimation = new AlphaAnimation(0f, 1f);
    mAlphaAnimation.setDuration(ANIMATION_DURATION);
    mAlphaAnimation.setFillAfter(true);

    final AnimationSet mRevealAnimations = new AnimationSet(true);
    mRevealAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
    mRevealAnimations.addAnimation(mAlphaAnimation);
    mRevealAnimations.setFillAfter(true);

    if (includeTransition) {
        final Animation mTransitionAnimation = new TranslateAnimation(0, 0, VIEW.getHeight()/2, 0);
        mTransitionAnimation.setDuration(ANIMATION_DURATION);
        mTransitionAnimation.setFillAfter(false);

        mRevealAnimations.addAnimation(mTransitionAnimation);
    }

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
               if(VIEW != null)
                VIEW.startAnimation(mRevealAnimations);
        }
    }, delay);

    return mRevealAnimations;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号