Has anyone requested Enter/ExitTransitions to scal...
# compose
t
Has anyone requested Enter/ExitTransitions to scale content?
Trying to implement shared Z-axis transitions from https://material.io/design/motion/the-motion-system.html#shared-axis
But it appears that
AnimatedContent
and
AnimatedVisibility
are working against me
d
For now you could add a scale animation to the transition provided in
AnimatedVisibilityScope
like the example here: https://developer.android.com/reference/kotlin/androidx/compose/animation/AnimatedVisibilityScope
t
Yep, the main problem I have is that I need a different animation for "pushing" vs. "popping" a composable. I get both
initialState
and
targetState
to choose the correct ContentTransform, but I only get the current state in the AnimatedVisibilityScope.
So I would need to maintain my own Transition state and basically duplicate what AnimatedContent does so I can apply the correct animation in the AnimatedVisibilityScope.
d
Consider creating your own
Transition
, and using
Transition.AnimatedContent
instead. That way you could read the initial/target state from
Transition
in the AnimatedVisibilityScope : https://developer.android.com/reference/kotlin/androidx/compose/animation/package-summary#(androidx.compose.animation[…].Alignment,kotlin.Function2)
AnimatedVisibilityScope
is designed to host additional enter/exit animations from children. So this would be a work around until we add support for more types enter/exit on the ContentTransform level. 🙂 Thanks for the feature request