in compose we have some animateState such as animateIntAsState which we can use to make animate while changing value, but what if we want to make animate for String in Compose ???, example: Text(text = "SOME VALUE")
CodePudding user response:
Have a look at AnimatedContent
. The documentation is here.
CodePudding user response:
There's AnimatedContent
var text by remember { mutableStateOf ("SOME TEXT") }
AnimatedContent(text){
// You must use "it", not "text"
Text(it)
}
Now, it will animate the value, whenever the text
variable changes.
You could manipulate the animation type using the spec
parameter it provides.
More on that here