-
-
Save sabiou/d3f40661b3c89a1c4635ef46e478aad8 to your computer and use it in GitHub Desktop.
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
inline fun getValueAnimator(forward: Boolean = true, duration: Long, interpolator: TimeInterpolator, | |
crossinline updateListener: (progress: Float) -> Unit | |
): ValueAnimator { | |
val a = | |
if (forward) ValueAnimator.ofFloat(0f, 1f) | |
else ValueAnimator.ofFloat(1f, 0f) | |
a.addUpdateListener { updateListener(it.animatedValue as Float) } | |
a.duration = duration | |
a.interpolator = interpolator | |
return a | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment