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

Konyaco

03/07/2021, 5:20 AM
https://issuetracker.google.com/181968398 Animation doesn't work when durationMillis >= 4295
d

Doris Liu

03/07/2021, 6:11 AM
For infinite animation, it's a known issue fixed in beta-02. See: https://issuetracker.google.com/180199994 In the bug linked above, you mention this snippet below with single iteration animation didn't work.
Copy code
val anim = Animatable(0f)
LaunchedEffect(key1 = Unit, block = {
    while (isActive) {
        anim.animateTo(360f, tween(durationMillis = 4295, easing = LinearEasing))
        anim.snapTo(0f)
    }
})
What's the behavior?
k

Konyaco

03/07/2021, 6:19 AM
Oh... That's my mistake.... But how can I achieve the same effect by using Animatable?
d

Doris Liu

03/07/2021, 6:23 AM
Yes. 🙂
k

Konyaco

03/07/2021, 6:31 AM
Oh.. I just forgot to use remember {}...
d

Doris Liu

03/07/2021, 7:25 AM
Uh yes, I recently had that happen to me too.😅 Started thinking about adding a lint check for it.