package com.forfan.bigbang.view;
import android.animation.TypeEvaluator;
import android.graphics.Rect;
public class RectEvaluator implements TypeEvaluator<Rect> {
private Rect mRect;
public RectEvaluator() {
}
public RectEvaluator(Rect reuseRect) {
mRect = reuseRect;
}
@Override
public Rect evaluate(float fraction, Rect startValue, Rect endValue) {
int left = startValue.left + (int) ((endValue.left - startValue.left) * fraction);
int top = startValue.top + (int) ((endValue.top - startValue.top) * fraction);
int right = startValue.right + (int) ((endValue.right - startValue.right) * fraction);
int bottom = startValue.bottom + (int) ((endValue.bottom - startValue.bottom) * fraction);
if (mRect == null) {
mRect=new Rect(left, top, right, bottom);
} else {
mRect.set(left, top, right, bottom);
}
return mRect;
}
}