AnimatedScreenTransform

Defines the animated transitions fo a Screen based on particular AnimatedNavEvents.

This interface allows you to customize the EnterTransition, z-index, and SizeTransform for a Screen as it becomes the top screen or is replaced by another Screen in the navigation stack. You can also customize the ExitTransition for a screen that is no longer the top screen.

Each of these can be customized based on the AnimatedNavEvent that triggered the transition.

Example

object CustomScreenAnimatedTransform : AnimatedScreenTransform {

override fun AnimatedContentTransitionScope<AnimatedNavState>.enterTransition(
animatedNavEvent: AnimatedNavEvent
): EnterTransition? {
// Coming from `HomeScreen` we override the transition to slide in horizontally.
return if (initialState.screen is HomeScreen) slideInHorizontally() else null
}

override fun AnimatedContentTransitionScope<AnimatedNavState>.exitTransition(
animatedNavEvent: AnimatedNavEvent
): ExitTransition? {
// Going to `HomeScreen` we override the transition fade out.
return if (targetState.screen is HomeScreen) fadeOut() else null
}
}

Inheritors

Functions

Link copied to clipboard

Defines the transition used when this screen is becoming the top screen.

Link copied to clipboard

Defines the transition used when this screen is no longer the top screen.

Link copied to clipboard

Defines the ContentTransform.sizeTransform to use when this screen is becoming the top screen.

Link copied to clipboard

Defines the ContentTransform.targetContentZIndex of the screen when it is becoming the top screen.