How to implement animated vector drawable with Jetpack Compose

Viewed 369

compose.animation:animation-graphics API will certainly be removed and so I want to know what is the best way to use animated vector drawable with JetPack Compose?
Here is the ancient code of using the API:

val image = animatedVectorResource(drawableId)
var atEnd by remember { mutableStateOf(false) }
Image(
    painter = image.painterFor(atEnd),
    contentDescription = "Your content description",
    modifier = Modifier.size(64.dp).clickable {
        atEnd = !atEnd
    }
)

From android docs:

Note: This API is transient and will be likely removed for encouraging async resource loading.

0 Answers
Related