ViewPropertyAnimatorActivity.java 文件源码

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

项目:AnimationShowcase 作者:
@OnClick(R.id.adaptive_rotation)
public void onAdaptiveRotation() {
    float targetRotation = animateForward
            ? 180.0f
            : 0.0f;
    float currentRotation = icon.getRotation();
    float actualRotationDelta = Math.abs(targetRotation - currentRotation);
    long duration = (long) (FULL_ANIMATION_DURATION * actualRotationDelta / 180.0f);
    ViewPropertyAnimator animator = icon.animate();
    if (duration < FULL_ANIMATION_DURATION / 2) {
        animator.setInterpolator(new AccelerateInterpolator());
    } else {
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
    }
    animator
            .rotation(targetRotation)
            .setDuration(duration);
    animateForward = !animateForward;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号