Skip to content

Instantly share code, notes, and snippets.

@amyu
Created April 28, 2015 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amyu/76692d84b195ad7636ad to your computer and use it in GitHub Desktop.
Save amyu/76692d84b195ad7636ad to your computer and use it in GitHub Desktop.
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