SharedTransitionScope.PlaceHolderSize


PlaceHolderSize defines the size of the space that was or will be occupied by the exiting or entering sharedElement/sharedBounds.

Summary

Public companion properties

SharedTransitionScope.PlaceHolderSize

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.

Cmn
SharedTransitionScope.PlaceHolderSize

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.

Cmn

Public functions

IntSize
calculateSize(contentSize: IntSize, animatedSize: IntSize)

Returns the size of the place holder based on contentSize and animatedSize.

Cmn

Public companion properties

animatedSize

val animatedSizeSharedTransitionScope.PlaceHolderSize

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

val contentSizeSharedTransitionScope.PlaceHolderSize

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.

Public functions

calculateSize

fun calculateSize(contentSize: IntSize, animatedSize: IntSize): IntSize

Returns the size of the place holder 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).