Is it possible to modify `animateContentSize` to ...
# compose
j
Is it possible to modify
animateContentSize
to expand the component from the center instead of from the left to right?
the use case is animating a button to change its size, left part corners are round, right part are not rounded until the animation finished, which looks ugly My solution is animating it from center so both sizes look same, probably not rounded, but would be great it they keep rounded during the animation
d
Have you tried putting the
animateContentSize
on the direct child of Button instead of on the Button itself, like this: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]roidx/compose/animation/demos/AnimateContentSizeDemo.kt;l=105 This would preserve the corner shape of the button during animation.
Animating from center may not be super helpful for this particular case, but could be useful to have. 🙂 Could you file a feature request please?
j
I am going to try, and yes I will file an issue
now it works perfectly 🙂