android 动画的实现

animatorSet = new AnimatorSet();
   ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(img_bg, "alpha", 1.0f, 0.5f, 0.5f);
   ObjectAnimator alphaAnimator2 = ObjectAnimator.ofFloat(img_bg, "alpha", 0.5f, 1.0f, 1.0f);
   ObjectAnimator scaleAnimatorY = ObjectAnimator.ofFloat(img_bg, "scaleY", 1.0f, 1.2f, 1.2f);
   ObjectAnimator scaleAnimatorX = ObjectAnimator.ofFloat(img_bg, "scaleX", 1.0f, 1.2f, 1.2f);

   animatorSet.play(scaleAnimatorY).with(scaleAnimatorX).with(alphaAnimator2);
   animatorSet.play(alphaAnimator).after(scaleAnimatorX);
   animatorSet.setDuration(8000);
   animatorSet.addListener(new AnimatorListener() {

    @Override
    public void onAnimationStart(Animator animation) {
     //  
     // Intent intent = new Intent(Constants.CONFIG_BROADCAST_ACTION_INTENT);
     // LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intent);
    }

    @Override
    public void onAnimationRepeat(Animator animation) {

    }

    @Override
    public void onAnimationEnd(Animator animation) {
     animatorSet.start();
    }

    @Override
    public void onAnimationCancel(Animator animation) {

    }
   });
   animatorSet.start();

你可能感兴趣的:(android 动画的实现)