Utkarsh Tiwari
09/05/2024, 1:20 AMrenderInOverlayDuringTransition i.e. true, except it interferes with other animation effects on the screen.
So when I set it to renderInOverlayDuringTransition = false, the shared element at the origin disappears at the beginning of transition while the destination shared element gradually re-appears like it should. I have basically lost the crossfade after disabling this flag. I am not sure why this is happening.Doris Liu
09/17/2024, 12:47 AM// First screen
AnimatedContent(
modifier = modifier.sharedBounds(..), // shared bounds
label = animationLabel,
targetState = visible,
transitionSpec = { transition using SizeTransform(clip = false) }
) { show ->
val contentAlpha = if (show) 1f else 0f
Box {
Box(modifier = Modifier.alpha(contentAlpha)) {
AyncImage(modifier = Modifier.sharedElement(...)) // shared image
}
if (!show) {
placeholderContent()
}
}
}
This is doing a shared element between the placeholder image and the actual image within the AnimatedContent. It seems what you want is for one of the two images to match the image in the 2nd screen. I would recommend putting sharedElement on the AnimatedContent for the first screen, i.e. modifier = Modifier.sharedBounds(keyForBounds).sharedElement(keyForImage)Doris Liu
09/17/2024, 12:52 AMAlso, you might notice a second issue (in first video at [00:10]) and it's that the placeholder of theThis is likely due to a higher res image being requested due to the larger size for the image to fill. Our recommendation for this issue is to specify a memory cache key for the image, so that coil can use a lower res image in place before the high res image is loaded. See here for details: https://developer.android.com/develop/ui/compose/animation/shared-elements/common-use-cases(from coil) flashes for a second when I click a card for the very first time. However that doesn't happen when I re-open the same card again. It's strange.AsyncImage
Utkarsh Tiwari
10/11/2024, 10:42 PM.renderInSharedTransitionScopeOverlay(zIndexInOverlay = 1f)
only after the initial choreography animation has finished running.
Let me check the coil recommendation for image cache key.Utkarsh Tiwari
10/11/2024, 10:46 PMArcMode.ArcBelow, it looks somewhat similar but not exactly what my designer wants.
Is there way to implement custom path of the shared element transition animation?Doris Liu
10/11/2024, 11:04 PMkeyframesWithSplineUtkarsh Tiwari
10/11/2024, 11:22 PM