In Android Compose, is it possible to always play an AnimatedVectorResource forwards?

Viewed 44

Given this code sample from the docs, it's rather straightforward to have it play but to have the animation play again, it always plays in reverse.

Is there a way to trigger the animation to play again, but forwards?

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
    }
)

It seems that you can only trigger the animation to play again, by toggling the atEnd variable, which is fine. BUT the problem is that the animation always plays in reverse. Is there a way around this?

0 Answers
Related