OpeningActivity.java 文件源码

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

项目:StarWarsOpening 作者:
private void startLogoAnimation() {
    if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Animator logoAnimator = AnimatorInflater.loadAnimator(this, R.animator.logo);
        logoAnimator.setTarget(logoView);
        logoAnimator.start();
    } else {
        AnimatorSet animatorSet = new AnimatorSet();
        PropertyValuesHolder pvh = PropertyValuesHolder.ofKeyframe("alpha",
                Keyframe.ofFloat(0f, 1),
                Keyframe.ofFloat(.5f, 1),
                Keyframe.ofFloat(1f, 0));
        ObjectAnimator alphaAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);

        pvh = PropertyValuesHolder.ofKeyframe("scaleX", Keyframe.ofFloat(0f, 2.75f), Keyframe.ofFloat(1f, .1f));
        ObjectAnimator scaleXAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);

        pvh = PropertyValuesHolder.ofKeyframe("scaleY", Keyframe.ofFloat(0f, 2.75f), Keyframe.ofFloat(1f, .1f));
        ObjectAnimator scaleYAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);

        animatorSet.setInterpolator(new DecelerateInterpolator());
        animatorSet.setDuration(9000).setStartDelay(9000);
        animatorSet.playTogether(alphaAnimator, scaleXAnimator, scaleYAnimator);
        animatorSet.start();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号