Skip to content

Instantly share code, notes, and snippets.

@guyca
Created June 14, 2020 07:44
Show Gist options
  • Save guyca/564dcf443fd1b04c87743fe6b19b23e9 to your computer and use it in GitHub Desktop.
Save guyca/564dcf443fd1b04c87743fe6b19b23e9 to your computer and use it in GitHub Desktop.
Create the animators and animate the appearing view
private fun animateSharedElement(from: View, to: View): AnimatorSet {
AnimatorSet().apply {
playTogether(
listOf(
MatrixAnimatorCreator(from, to),
XAnimatorCreator(from, to),
YAnimatorCreator(from, to),
RotationAnimatorCreator(from, to),
ScaleXAnimatorCreator(from, to),
ScaleYAnimatorCreator(from, to),
BackgroundColorAnimatorCreator(from, to),
TextChangeAnimatorCreator(from, to)
)
.filter { animatorCreator -> animatorCreator.shouldAnimateProperty() }
.map { animatorCreator -> animatorCreator.create() }
)
.start()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment