Issue
I created my vector drawable animation and I want to use in in Compose. I found in official documentation that I need to call animatedVectorResource. But whole AnimatedImageVector has been removed from compose till next versions. How to launch animated drawable in current compose version?
Solution
You need to update compose to 1.1.0-alpha01 and add the module androidx.compose.animation:animation-graphics as indicated in the last changelog
implementation("androidx.compose.animation:animation-graphics:1.1.0-alpha01")
val image = animatedVectorResource(id = R.drawable.animated_vector)
val atEnd by remember { mutableStateOf(false) }
Icon(
painter = image.painterFor(atEnd = atEnd),
contentDescription = null
)
Answered By - Stefano Sansone

0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.