ViewAnimator

Android/Libraries 2016. 2. 2. 17:35

https://github.com/florent37/ViewAnimator



A fluent Android animation library !

png

Usage

Animate multiple view from one method

ViewAnimator
       .animate(image)
           .translationY(-1000, 0)
           .alpha(0,1)
       .andAnimate(text)
           .dp().translationX(-20, 0)
       .descelerate()
       .duration(2000)

       .thenAnimate(image)
            .scale(1f,0.5f,1f)
       .accelerate()
       .duration(1000)

       .start();

gif

Without ViewAnimator

AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(
  ObjectAnimator.ofFloat(image,"translationY",-1000,0),
  ObjectAnimator.ofFloat(image,"alpha",0,1),
  ObjectAnimator.ofFloat(text,"translationX",-200,0)
);
animatorSet.setInterpolator(new DescelerateInterpolator());
animatorSet.setDuration(2000);
animatorSet.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(Animator animation) {

      AnimatorSet animatorSet2 = new AnimatorSet();
      animatorSet2.playTogether(
          ObjectAnimator.ofFloat(image,"scaleX",1f,0.5f,1f),
          ObjectAnimator.ofFloat(image,"scaleY",1f,0.5f,1f)
      );
      animatorSet2.setInterpolator(new AccelerateInterpolator());
      animatorSet2.setDuration(1000);
      animatorSet2.start();

    }
});
animatorSet.start();

More

gif

'Android > Libraries' 카테고리의 다른 글

라이브러리 사이트  (0) 2016.02.18
viewpager ProductTour  (0) 2016.02.02
GlidePalette  (0) 2016.01.15
블로그 이미지

코딩저장소

,