android - 像网易贵金属安装之后的导航页动画如何做到不卡的
PHPz
PHPz 2017-04-17 16:40:44
0
2
317

我用了属性动画,但是在内存低的手机上跑了一下感觉卡卡的,但是贵金属的就不卡
,属性动画和补间动画相比效率上比较差吗,
这是我的代码

private void setFirstAnimation() { if (firstAnimationState == 0) { firstAnimationState = 1; ObjectAnimator anim1 = ObjectAnimator.ofFloat(iv_first_calculator, "x", PhoneParameterUtils.getScreenWidth() / 2f - 200f - 323f, (PhoneParameterUtils.getScreenWidth() / 2f) - AppTools.dip2px(100)).setDuration(400); anim1.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { AnimatorSet set = new AnimatorSet(); ObjectAnimator anim2 = ObjectAnimator.ofFloat(iv_first_ball, "x", PhoneParameterUtils.getScreenWidth() / 2, PhoneParameterUtils.getScreenWidth() / 2 + AppTools.dip2px(40)).setDuration(400); ObjectAnimator anim3 = ObjectAnimator.ofFloat(iv_first_ball, "y", PhoneParameterUtils.getScreenHeight() / 2 - AppTools.dip2px(120), PhoneParameterUtils.getScreenHeight() / 2 - AppTools.dip2px(150)).setDuration(400); set.playTogether(anim2, anim3); set.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { iv_first_ball.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animator animator) { AnimatorSet set = new AnimatorSet(); ObjectAnimator anim4 = ObjectAnimator.ofFloat(iv_first_man, "x", PhoneParameterUtils.getScreenWidth(), PhoneParameterUtils.getScreenWidth() / 2).setDuration(500); ObjectAnimator anim5 = ObjectAnimator.ofFloat(iv_first_man, "x", PhoneParameterUtils.getScreenWidth() / 2, PhoneParameterUtils.getScreenWidth() / 2 + 10).setDuration(20); ObjectAnimator anim6 = ObjectAnimator.ofFloat(iv_first_man, "x", PhoneParameterUtils.getScreenWidth() / 2 + 10, PhoneParameterUtils.getScreenWidth() / 2).setDuration(20); set.playSequentially(anim4, anim5, anim6); iv_first_man.setVisibility(View.VISIBLE); set.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { firstAnimationState = 0; } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); set.start(); } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); set.start(); } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); anim1.start(); } }
PHPz
PHPz

学习是最好的投资!

全部回复 (2)
阿神

找到原因了,用了几个大的图,放到了drawable-hdpi中的 囧啊

    黄舟

    也许人家直接是一个短视频

      最新下载
      更多>
      网站特效
      网站源码
      网站素材
      前端模板
      关于我们 免责声明 Sitemap
      PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!