Example usage for android.animation TimeInterpolator getInterpolation

List of usage examples for android.animation TimeInterpolator getInterpolation

Introduction

In this page you can find the example usage for android.animation TimeInterpolator getInterpolation.

Prototype

float getInterpolation(float input);

Source Link

Document

Maps a value representing the elapsed fraction of an animation to a value that represents the interpolated fraction.

Usage

From source file:com.taobao.weex.ui.animation.DimensionUpdateListener.java

@Override
public void onAnimationUpdate(ValueAnimator animation) {
    if (view.getLayoutParams() != null) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        TimeInterpolator interpolator = animation.getInterpolator();
        float fraction = animation.getAnimatedFraction();
        int preWidth = layoutParams.width;
        int preHeight = layoutParams.height;
        if (width != null) {
            layoutParams.width = intEvaluator.evaluate(interpolator.getInterpolation(fraction), width.first,
                    width.second);//from   w  w w  .j a  v  a  2s .co  m
        }
        if (height != null) {
            layoutParams.height = intEvaluator.evaluate(interpolator.getInterpolation(fraction), height.first,
                    height.second);
        }
        if (preHeight != layoutParams.height || preWidth != layoutParams.width) {
            view.requestLayout();
        }
    }
}