Interface

SharedTransitionScope.OverlayClip

OverlayClip defines a specific clipping that should be applied to a sharedBounds or sharedElement in the overlay.

Common
public interface OverlayClip

OverlayClip defines a specific clipping that should be applied to a sharedBounds or sharedElement in the overlay.

Functions

getClipPath

public fun getClipPath(
            sharedContentState: SharedContentState,
            bounds: Rect,
            layoutDirection: LayoutDirection,
            density: Density,
        ): Path?

Creates a clip path based on current animated bounds of the sharedBounds or sharedElement, their sharedContentState (to query parent state's bounds if needed), and layoutDirection and density. The topLeft of the bounds is the local position of the sharedElement/sharedBounds in the SharedTransitionScope.

Important: The returned Path needs to be offset-ed as needed such that it is in SharedTransitionScope.lookaheadScopeCoordinates's coordinate space. For example, if the path is created using bounds, it needs to be offset-ed by bounds.topLeft.

When implementing this method, it is recommended to modify the same Path object and return it here, instead of creating new Paths.