🌈 Create new beautiful Compose Gradients with our new wesite ->
Interface

SharedTransitionScope.PlaceholderSize

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

Source set: Common
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

Source set: Common
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

Source set: Common
public companion object

Properties

AnimatedSize

Source set: Common
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

Source set: Common
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.

Content updated: