Skip to content

Instantly share code, notes, and snippets.

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 dadouf/37852a521d9ec8f4ef8b2c80dcd503dc to your computer and use it in GitHub Desktop.
Save dadouf/37852a521d9ec8f4ef8b2c80dcd503dc to your computer and use it in GitHub Desktop.
val translationDirection = if (childCenter > containerCenter) -1 else 1
val translationXFromScale = translationDirection * child.width * (1 - scale) / 2f
child.translationX = translationXFromScale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment