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/fe63f8b454dd12f289b469eaeba8a637 to your computer and use it in GitHub Desktop.
Save dadouf/fe63f8b454dd12f289b469eaeba8a637 to your computer and use it in GitHub Desktop.
var translationXForward = 0f
for (i in 0 until childCount) {
val translationXFromScale = ... // like before
child.translationX = translationXForward + translationXFromScale
translationXForward = 0f
if (translationXFromScale > 0 && i >= 1) {
// Edit previous child
getChildAt(i - 1)!!.translationX += 2 * translationXFromScale
} else if (translationXFromScale < 0) {
// Pass on to next child
translationXForward = 2 * translationXFromScale
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment