When I shrink a Card using a tween animation, how ...
# compose
c
When I shrink a Card using a tween animation, how can change the size another card as soon as the tween animation is finished? Traditionally, I’d think of an end-Listener and start an animation on another View
j
How are you firing the animation? the
animate
composable takes an
endListener: (Float) -> Unit
Or if you're using an
AnimatedFloat
, the
animateTo
method takes an
onEnd: (AnimationEndReason, T) -> Unit
c
I’m using a
transitionDefinition
Than I’m starting a
transition()
with that definition
Can I achieve that with these tools?
j
Great! Then there is an optional parameter that composable takes which is a
onStateChangeFinished: (T) -> Unit
👍 1
So if you have let's say t wo states: Visible and Collapsed, that callback will be called when the animation changes from one to the other
c
I should’ve seen that. 😕
Perfect, just what I needed!
1
Thank you very much!
j
No problem
c
I need to pay more attention but the signatures, but some are really long. Anyways, bad excuse!
j
No worries, one can easily miss them among that many parameters. Even the definition of the
transition
states
// TODO: The list of params is getting a bit long. Consider grouping them.
So that will most probably change for the better in the future