简体   繁体   中英

How to make text number animated when display in jetpack compose?

I want to show text with numbers and I wanted to achieve is to animate that text while displaying it. The animation is it should increase the counter from zero to the target value number. I tried using animateIntAsState<\/strong> but it's not working.

 val daysCounter by animateIntAsState(
        targetValue = days ,
        animationSpec = tween(
            durationMillis = 5000,
            easing = FastOutSlowInEasing
        )
    )

From animateIntAsState<\/code><\/a> :

For example, you can use LaunchedEffect<\/code> if you need to start the animation instantly(or with some delay) when the screen appears:

"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM