SharedTransitionScope.OverlayClip



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

Summary

Public functions

Path?
getClipPath(
    state: SharedTransitionScope.SharedContentState,
    bounds: Rect,
    layoutDirection: LayoutDirection,
    density: Density
)

Creates a clip path based using current animated bounds of the sharedBounds or sharedElement, their state (to query parent state's bounds if needed), and layoutDirection and density.

Cmn

Public functions

getClipPath

fun getClipPath(
    state: SharedTransitionScope.SharedContentState,
    bounds: Rect,
    layoutDirection: LayoutDirection,
    density: Density
): Path?

Creates a clip path based using current animated bounds of the sharedBounds or sharedElement, their state (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.

It is recommended to modify the same Path object and return it here, instead of creating new Paths.