https://kotlinlang.org logo
#compose
Title
# compose
c

Christian Maier

12/31/2020, 4:20 PM
Let’s say I’d like to animate a Card() using a FloatPropKey with values from 0f to 1f. How could I approach this currently?
d

Dominaezzz

12/31/2020, 4:24 PM
What property do you want to animate?
c

Christian Maier

12/31/2020, 4:24 PM
The width
d

Dominaezzz

12/31/2020, 4:25 PM
I believe you can easily achieve that with the
animate
function.
1
How do you currently specify the width?
Modifier.width(...)
?
c

Christian Maier

12/31/2020, 4:26 PM
I use fillMaxWidth()
d

Dominaezzz

12/31/2020, 4:27 PM
Perfect!
Modifier.fillMaxWidth(animate(amount))
.
amount
can change from 1f to 0f and it'll just work.
👍 1
c

Christian Maier

12/31/2020, 4:27 PM
Cool thank you, I’ll take a look into it!
Finally got the time look into it: It’s working perfectly, thank you! 🙂
d

Dominaezzz

01/02/2021, 1:09 PM
Nice
2 Views