Function

calculateDefaultExitTransition

Calculates the default ExitTransition of the pane associated to the given role when it's hiding.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free

calculateDefaultExitTransition

Common
@ExperimentalMaterial3AdaptiveApi
fun <Role : PaneScaffoldRole> PaneScaffoldMotionDataProvider<Role>.calculateDefaultExitTransition(
    role: Role
) =
    when (this[role].motion) {
        PaneMotion.ExitToLeft ->
            slideOutHorizontally(PaneMotionDefaults.OffsetAnimationSpec) { slideOutToLeftOffset }
        PaneMotion.ExitToRight ->
            slideOutHorizontally(PaneMotionDefaults.OffsetAnimationSpec) { slideOutToRightOffset }
        PaneMotion.ExitWithShrink -> {
            shrinkHorizontally(PaneMotionDefaults.SizeAnimationSpec, Alignment.CenterHorizontally) +
                slideOutHorizontally(PaneMotionDefaults.OffsetAnimationSpec) {
                    getHidingPaneTargetLeft(role) - this[role].currentLeft
                }
        }
        PaneMotion.ExitAsModal -> {
            fadeOut(animationSpec = PaneMotionDefaults.VisibilityAnimationSpec)
        }
        else -> ExitTransition.None
    }

Calculates the default ExitTransition of the pane associated to the given role when it's hiding. The PaneMotion and pane measurement data provided by PaneScaffoldMotionDataProvider will be used to decide the transition type and relevant values like sliding offsets.

Parameters

role the role of the pane that is supposed to perform the ExitTransition when hiding.