I have an image that is occupying the whole screen. It is like a background.
I am rendering using a Canvas
with the method drawImage(...)
which renders it just fine, and to my expectations. I want to change the source of the Image
upon clicking on it.
How do I animate this change?
I don't think Canvas
offers animation APIs for anything, much less for an image. Any sort of animation would work. Cross-Fade, Slide (Preferred, by the way). Is it even possible in Canvas? If not, what would be the correct way to implement this?
My image drawing code:
Canvas(modifier = Modifier.fillMaxSize()) {
drawImage(
background,
srcSize = IntSize(background.width, background.height),
dstSize = IntSize(size.width.roundToInt(), size.height.roundToInt())
)
}