TranslationAnimator2.java 文件源码

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

项目:AndroidSkinAnimator 作者:
@Override
public SkinAnimator apply(@NonNull View view, @Nullable final Action action) {
    this.targetView = view;
    preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("translationX",
                    view.getLeft(), view.getRight()))
            .setDuration(PRE_DURATION * 3);
    preAnimator.setInterpolator(new AccelerateInterpolator());
    afterAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("translationX",
                    view.getLeft() - view.getWidth(), view.getLeft()))
            .setDuration(AFTER_DURATION * 3);
    afterAnimator.setInterpolator(new BounceInterpolator());

    preAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (action != null) {
                action.action();
            }
            afterAnimator.start();
        }
    });
    return this;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号