public interface PlaceholderSize
PlaceholderSize defines the size of the space that was or will be occupied by the exiting or entering sharedElement/sharedBounds.
Functions
calculateSize
public fun calculateSize(contentSize: IntSize, animatedSize: IntSize): IntSize
Returns the size of the placeholder based on contentSize and animatedSize. Note: contentSize for exiting content is the size before it starts exiting. For entering content, contentSize is the lookahead size of the content (i.e. target size of the shared transition).
Members
Companion
public companion object
Properties
AnimatedSize
public val AnimatedSize: PlaceholderSize = PlaceholderSize { _, animatedSize ->
animatedSize
}
AnimatedSize is a pre-defined SharedTransitionScope.PlaceholderSize that lets the parent layout of shared elements or shared bounds observe the animated size during an active shared transition. Therefore the layout parent will most likely resize itself and re-layout its children to adjust to the new animated size.
ContentSize
public val ContentSize: PlaceholderSize = PlaceholderSize { contentSize, _ ->
contentSize
}
ContentSize is a pre-defined SharedTransitionScope.PlaceholderSize that allows the parent layout of shared elements or shared bounds to see the content size of the shared content during an active shared transition. For outgoing content, this ContentSize is the initial size before the animation, whereas for incoming content ContentSize will return the lookahead/target size of the content. This is the default value for shared elements and shared bounds. The effect is that the parent layout does not resize during the shared element transition, hence giving a sense of stability, rather than dynamic motion. If it's preferred to have parent layout dynamically adjust its layout based on the shared element's animated size, consider using AnimatedSize.