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

Mehmet Peker

03/09/2021, 10:45 PM
what is the equivalent of ValueAnimator on jetpack compose?
r

romainguy

03/09/2021, 10:47 PM
I would recommend you check out this guide if you haven’t already: https://developer.android.com/jetpack/compose/animation
animateFloatAsState
might be what you want
m

Mehmet Peker

03/09/2021, 10:49 PM
I have already read but i cant implement what i want.I want to animate value from 0f to 360f in 1000 ms and one time.
I tried animateFloatAsState but condition required .I havent condition true or false.
z

Zach Klippenstein (he/him) [MOD]

03/09/2021, 10:52 PM
sounds like you want
Animatable
.
🙌 1
probably with a
tween
AnimationSpec
🙌 1
l

Louis Pullen-Freilich [G]

03/09/2021, 10:53 PM
Copy code
val animation = remember { Animatable(0f) }
LaunchedEffect(animation) {
    animation.animateTo(
        360f,
        animationSpec = tween(durationMillis = 1000)
    )
}
👀 1
3
🙌 2
m

Mehmet Peker

03/09/2021, 11:01 PM
Thank you all for helping.I have been busy for hours, but I have missed this part of the documentation.Thank you again i solved