-
Notifications
You must be signed in to change notification settings - Fork 491
Description
First of all, nice library and great animation. However, I think the interpolators at the moment is created based on some pre-calculated constants. For example, in ActionBarInterpolator
:
private static final float FIRST_BOUNCE_PART = 0.375f;
private static final float SECOND_BOUNCE_PART = 0.625f;
@Override
public float getInterpolation(float t) {
if (t < FIRST_BOUNCE_PART) {
return (-28.4444f) * t * t + 10.66667f * t;
} else if (t < SECOND_BOUNCE_PART) {
return (21.33312f) * t * t - 21.33312f * t + 4.999950f;
} else {
return (-9.481481f) * t * t + 15.40741f * t - 5.925926f;
}
}
The constants used in getInterpolation
(e.g., -28.4444f) are pre-calculated based on the values of FIRST_BOUNCE_PART
and SECOND_BOUNCE_PART
. If either or both of these values are changed, the constant values need to be recalculated.
This limit users of this library from changing the value of FIRST_BOUNCE_PART
and/or SECOND_BOUNCE_PART
to whatever they want because if they change these values, they have to do their own math to work out formulas for the interpolators.
So I think it would be nicer to provide generic formulas for interpolators with perhaps FIRST_BOUNCE_PART
and SECOND_BOUNCE_PART
are variables to avoid users being worrying about the formulas themselves.
What do you think?