@@ -18,20 +18,24 @@ package androidx.navigation3.ui
1818
1919import androidx.compose.animation.AnimatedContentTransitionScope
2020import androidx.compose.animation.ContentTransform
21+ import androidx.compose.animation.ExperimentalAnimationApi
2122import androidx.compose.animation.core.CubicBezierEasing
2223import androidx.compose.animation.core.LinearEasing
2324import androidx.compose.animation.core.spring
2425import androidx.compose.animation.core.tween
2526import androidx.compose.animation.fadeIn
2627import androidx.compose.animation.fadeOut
2728import androidx.compose.animation.scaleOut
29+ import androidx.compose.animation.unveilIn
30+ import androidx.compose.animation.veilOut
2831import androidx.navigation3.scene.Scene
2932import androidx.navigationevent.NavigationEvent.Companion.EDGE_LEFT
3033import androidx.navigationevent.NavigationEvent.SwipeEdge
3134
3235private const val DEFAULT_TRANSITION_DURATION_MILLISECOND = 500
3336private val IosTransitionEasing = CubicBezierEasing (0.2833f , 0.99f , 0.31833f , 0.99f )
3437
38+ @OptIn(ExperimentalAnimationApi ::class )
3539public actual fun <T : Any > defaultTransitionSpec ():
3640 AnimatedContentTransitionScope <Scene <T >>.() -> ContentTransform = {
3741 ContentTransform (
@@ -43,17 +47,22 @@ public actual fun <T : Any> defaultTransitionSpec():
4347 towards = AnimatedContentTransitionScope .SlideDirection .Left ,
4448 targetOffset = { it / 4 },
4549 animationSpec = tween(DEFAULT_TRANSITION_DURATION_MILLISECOND , easing = IosTransitionEasing ),
50+ ) + veilOut(
51+ animationSpec = tween(DEFAULT_TRANSITION_DURATION_MILLISECOND , easing = IosTransitionEasing ),
4652 ),
4753 )
4854}
4955
56+ @OptIn(ExperimentalAnimationApi ::class )
5057public actual fun <T : Any > defaultPopTransitionSpec ():
5158 AnimatedContentTransitionScope <Scene <T >>.() -> ContentTransform = {
5259 ContentTransform (
5360 slideIntoContainer(
5461 towards = AnimatedContentTransitionScope .SlideDirection .Right ,
5562 initialOffset = { it / 4 },
5663 animationSpec = tween(DEFAULT_TRANSITION_DURATION_MILLISECOND , easing = IosTransitionEasing ),
64+ ) + unveilIn(
65+ animationSpec = tween(DEFAULT_TRANSITION_DURATION_MILLISECOND , easing = IosTransitionEasing )
5766 ),
5867 slideOutOfContainer(
5968 towards = AnimatedContentTransitionScope .SlideDirection .Right ,
@@ -62,6 +71,7 @@ public actual fun <T : Any> defaultPopTransitionSpec():
6271 )
6372}
6473
74+ @OptIn(ExperimentalAnimationApi ::class )
6575public actual fun <T : Any > defaultPredictivePopTransitionSpec ():
6676 AnimatedContentTransitionScope <Scene <T >>.(@SwipeEdge Int ) -> ContentTransform = { edge ->
6777 val towards = if (edge == EDGE_LEFT ) {
@@ -74,6 +84,8 @@ public actual fun <T : Any> defaultPredictivePopTransitionSpec():
7484 towards = towards,
7585 initialOffset = { it / 4 },
7686 animationSpec = tween(DEFAULT_TRANSITION_DURATION_MILLISECOND , easing = LinearEasing ),
87+ ) + unveilIn(
88+ animationSpec = tween(DEFAULT_TRANSITION_DURATION_MILLISECOND , easing = LinearEasing ),
7789 ),
7890 slideOutOfContainer(
7991 towards = towards,
0 commit comments