Skip to content

Instantly share code, notes, and snippets.

@meet30997
Created September 7, 2022 11:50
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 meet30997/ee1a15e781144a5a5997ad11d0472848 to your computer and use it in GitHub Desktop.
Save meet30997/ee1a15e781144a5a5997ad11d0472848 to your computer and use it in GitHub Desktop.
Translate Anim
fun View.translateYBy(
alpha: Float = 0f,
translateBy: Float = 50f,
duration: Long = 0L,
startingDelay: Long = 0
) {
animate().alpha(alpha).translationYBy(context.toPx(translateBy))
.setStartDelay(startingDelay)
.setDuration(duration).start()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment