Created
April 28, 2015 13:38
-
-
Save amyu/76692d84b195ad7636ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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