How to Use Springy Facebook Rebound?

2
162
Springy Facebook Rebound
Springy Facebook Rebound

Springy Facebook Rebound is a java library that models spring dynamics. Rebound spring models can be used to create animations that feel natural by introducing real world physics to your application.

It is not a general purpose physics library; however, spring dynamics can be used to drive a wide variety of animations. The simplicity of Rebound makes it easy to integrate and use as a building block for creating more complex components like pagers, toggles, and scrollers.

You must see this  : Top 30 Android Tools Every Developer should Know

Springy Facebook Rebound is About Motion and Animation on Android platform, you can make smooth and clean property animations. The Rebound library uses spring models to create animations, which can add some pop to your application. This application demonstrates how to use it in your Android app.

Recommended for AnimationLottie – Convert Adobe After Effects to Kotlin

Scale, Translate, Alpha, Rotate.

media player

How to use Springy Facebook Rebound?

1Gradle

First Need to add dependency in your Gradle.

compile 'com.facebook.rebound:rebound:0.3.8'

2Springy constructor

Then Create Springy Animator instance and you can initialize by one of it’s two constructors.

  • With Spring Config:
SpringyAnimator(SpringAnimationType.SCALEXY,TENSION, FRACTION, ANIMATION_START_VALUE, ANIMATION_END_VALUE);
  • Without Spring Config:
SpringyAnimator(SpringAnimationType.SCALEXY, ANIMATION_START_VALUE, ANIMATION_END_VALUE);

{

  SpringyAnimator iconSpring = new SpringyAnimator(SpringAnimationType.SCALEXY, 4, 2.5, 0, 1);
  
  // start spring with you view.            
  iconSpring.startSpring(myView);      
}

You can set Delay:

iconSpring.setDelay(200);

Do you want this : Add Tinder like SwipeView in Android

SpringyAnimationTypes you can use:

  • TRANSLATEX,
  • TRANSLATEY,
  • ROTATEX,
  • ROTATEY,
  • SCALEXY,
  • SCALEX,
  • SCALEY,
  • ALPHA,
  • ROTATION

3Springy For RecyclerView

Creat initialize SpringyAdapterAnimator in you Adapter Constructor.

// pass recyclerView in it.
      springyAdapterAnimator = new SpringyAdapterAnimator(recyclerView);
       // set SpringyAdapterAnimationType
      springyAdapterAnimator.setSpringAnimationType(SpringyAdapterAnimationType.SLIDE_FROM_BOTTOM);
       // (optional) add Spring Config
      springyAdapterAnimator.addConfig(85,15);    
      
      // call this method in  onCreateViewHolder 
              springyAdapterAnimator.onSpringItemCreate(itemView);
              
              
       // call this method in  onBindViewHolder 
             springyAdapterAnimator.onSpringItemBind(holder.itemView, position);

4SpringyAdapterAnimation Types you can use:

SLIDE_FROM_BOTTOM.

recylcer viewSLIDE_FROM_RIGHT.

from right

SLIDE_FROM_LEFT.

from left

SCALE.

scale

5Download

Share to get Download linkimage/svg+xml
Unlock this exclusive content by using one of the sharing buttons below.

Hope you enjoy this library and explore something new with it. Please share and comment us.

Share your thoughts

2 COMMENTS

Loading Facebook Comments ...
Loading Disqus Comments ...