Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package com.list.view.amyu.twitterfavorite;
import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.Interpolator;
/**
* Created by amyu on 15/04/28.
*/
public class StarInterpolator implements Interpolator {
public StarInterpolator() {
}
@SuppressWarnings({"UnusedDeclaration"})
public StarInterpolator(Context context, AttributeSet attrs) {
}
private static float bounce(float t) {
return t * t * 8.0f;
}
@Override
public float getInterpolation(final float v) {
float x = v * 1.1226f;
if (x < 0.7408f) {
return (float) (0.65 * Math.sin(6.28 * v - Math.PI / 2) + 0.65);
} else if (x < 0.9644f) {
return bounce(x - 0.8526f) + 0.9f;
} else {
return bounce(x - 1.0435f) + 0.95f;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment