StandardAnimations.java 文件源码

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

项目:UTubeTV 作者:
public static void rubberClick(final View theView) {
  ObjectAnimator rotateAnim = ObjectAnimator.ofFloat(theView, "rotationY", 60f);
  ObjectAnimator rotateBack = ObjectAnimator.ofFloat(theView, "rotationY", 0f);
  ObjectAnimator scaleXDown = ObjectAnimator.ofFloat(theView, "scaleX", .4f);
  ObjectAnimator scaleYDown = ObjectAnimator.ofFloat(theView, "scaleY", .4f);
  ObjectAnimator scaleXBack = ObjectAnimator.ofFloat(theView, "scaleX", 1f);
  ObjectAnimator scaleYBack = ObjectAnimator.ofFloat(theView, "scaleY", 1f);

  AnimatorSet bouncer = new AnimatorSet();
  bouncer.setInterpolator(new AnticipateOvershootInterpolator());
  bouncer.play(scaleXDown).with(scaleYDown);
  bouncer.play(scaleXBack).with(scaleYBack);
  bouncer.play(scaleXBack).after(scaleXDown);
  bouncer.play(rotateAnim).after(scaleXBack);
  bouncer.play(rotateBack).after(rotateAnim);

  ObjectAnimator fadeOut = ObjectAnimator.ofFloat(theView, "alpha", 0f);
  ObjectAnimator fadeBack = ObjectAnimator.ofFloat(theView, "alpha", 1f);
  fadeOut.setDuration(250);
  fadeBack.setDuration(250);
  AnimatorSet animatorSet = new AnimatorSet();
  animatorSet.play(bouncer).before(fadeOut);
  animatorSet.play(fadeBack).after(fadeOut);
  animatorSet.start();

  //    theView.animate().scaleX(.8f).scaleY(.8f).setDuration(200).setInterpolator(new AnticipateOvershootInterpolator()).withEndAction(new Runnable() {
  //      @Override
  //      public void run() {
  //        theView.animate().setDuration(100).scaleX(1.0f).scaleY(1.0f).setInterpolator(new AnticipateOvershootInterpolator()).start();
  //      }
  //    });
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号