AnticipateOvershootInterpolatorpublic class AnticipateOvershootInterpolator extends BaseInterpolator implements com.android.internal.view.animation.NativeInterpolatorFactoryAn interpolator where the change starts backward then flings forward and overshoots
the target value and finally goes back to the final value. |
Fields Summary |
---|
private final float | mTension |
Constructors Summary |
---|
public AnticipateOvershootInterpolator()
mTension = 2.0f * 1.5f;
| public AnticipateOvershootInterpolator(float tension)
mTension = tension * 1.5f;
| public AnticipateOvershootInterpolator(float tension, float extraTension)
mTension = tension * extraTension;
| public AnticipateOvershootInterpolator(android.content.Context context, android.util.AttributeSet attrs)
this(context.getResources(), context.getTheme(), attrs);
| public AnticipateOvershootInterpolator(android.content.res.Resources res, android.content.res.Resources.Theme theme, android.util.AttributeSet attrs)
TypedArray a;
if (theme != null) {
a = theme.obtainStyledAttributes(attrs, AnticipateOvershootInterpolator, 0, 0);
} else {
a = res.obtainAttributes(attrs, AnticipateOvershootInterpolator);
}
mTension = a.getFloat(AnticipateOvershootInterpolator_tension, 2.0f) *
a.getFloat(AnticipateOvershootInterpolator_extraTension, 1.5f);
setChangingConfiguration(a.getChangingConfigurations());
a.recycle();
|
Methods Summary |
---|
private static float | a(float t, float s)
return t * t * ((s + 1) * t - s);
| public long | createNativeInterpolator()
return NativeInterpolatorFactoryHelper.createAnticipateOvershootInterpolator(mTension);
| public float | getInterpolation(float t)
// a(t, s) = t * t * ((s + 1) * t - s)
// o(t, s) = t * t * ((s + 1) * t + s)
// f(t) = 0.5 * a(t * 2, tension * extraTension), when t < 0.5
// f(t) = 0.5 * (o(t * 2 - 2, tension * extraTension) + 2), when t <= 1.0
if (t < 0.5f) return 0.5f * a(t * 2.0f, mTension);
else return 0.5f * (o(t * 2.0f - 2.0f, mTension) + 2.0f);
| private static float | o(float t, float s)
return t * t * ((s + 1) * t + s);
|
|