https://kotlinlang.org logo
Title
t

theapache64

09/18/2021, 2:20 PM
[ SOLVED] Animation:
expandHorizontally
and
shrinkHorizontally
accept a param named
expandFrom
and
shrinkTowards
respectively. But it looks like it doesn’t consider that param. OR am I doing anything wrong? More details inside 🧵
Here’s my code
@Composable
fun ExpandInShrinkOutHorizontallyDemo(isVisible: Boolean) {
    AnimatedVisibility(
        visible = isVisible,
        enter = expandHorizontally(
            expandFrom = Alignment.End
        ),
        exit = shrinkHorizontally(
            shrinkTowards = Alignment.CenterHorizontally
        )
    ) {
        Square()
    }
}
Got the problem 🤦‍♂️ Can see the difference with an image rather than a single colored
Square
! TIL: Don’t use colors when experimenting with animations. Instead use an image 😬
👍 1
h

Halil Ozercan

09/18/2021, 5:55 PM
@theapache64 or you can always use box in a box, gradient, and etc. Something obvious to track with your eyes during fast animations. Also, slowing the animation can help 😄
t

theapache64

09/18/2021, 5:55 PM
Yeah, that’d also work 😄
s

Sam Marz

09/18/2021, 9:48 PM
@theapache64 have you eer tried with box and it worked for you?
t

theapache64

09/19/2021, 4:11 PM
@Sam Marz I don’t know If I understood ur question, but my
Square
was a box, and yeah, it was working but my eyes couldn’t track it 😄
1