Created
August 4, 2016 21:05
-
-
Save code-crusher/9e75fc01ebcb8b7e69e8fcf2210818d4 to your computer and use it in GitHub Desktop.
Reverse Interpolator Android Animation
This file contains hidden or 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
import android.view.animation.DecelerateInterpolator; | |
import android.view.animation.Interpolator; | |
class ReverseInterpolator implements Interpolator { | |
private Interpolator interpolator; | |
public ReverseInterpolator(Interpolator interpolator) { | |
this.interpolator = interpolator; | |
} | |
public ReverseInterpolator() { | |
this(new DecelerateInterpolator()); | |
} | |
@Override | |
public float getInterpolation(float input) { | |
return 1 - interpolator.getInterpolation(input); | |
} | |
} |
It doesn't always work. Best thing is to get the bezier points used to generate the interpolation then create a reverse version of it. You then use the new bezier points in the bezier basis formula
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To see it live in action check out my library :
https://github.com/code-crusher/Image-Zoomer