feat: try new navigation transitions
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
74fe6e96a8
commit
fc2c3f6f6f
|
|
@ -13,6 +13,7 @@ import androidx.compose.animation.AnimatedContentTransitionScope
|
||||||
import androidx.compose.animation.core.EaseInOutExpo
|
import androidx.compose.animation.core.EaseInOutExpo
|
||||||
import androidx.compose.animation.core.FiniteAnimationSpec
|
import androidx.compose.animation.core.FiniteAnimationSpec
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
|
import androidx.compose.animation.fadeIn
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
|
@ -254,6 +255,9 @@ val RevoltTweenFloat: FiniteAnimationSpec<Float> = tween(400, easing = EaseInOut
|
||||||
val RevoltTweenDp: FiniteAnimationSpec<Dp> = tween(400, easing = EaseInOutExpo)
|
val RevoltTweenDp: FiniteAnimationSpec<Dp> = tween(400, easing = EaseInOutExpo)
|
||||||
val RevoltTweenColour: FiniteAnimationSpec<Color> = tween(400, easing = EaseInOutExpo)
|
val RevoltTweenColour: FiniteAnimationSpec<Color> = tween(400, easing = EaseInOutExpo)
|
||||||
|
|
||||||
|
val NavTweenInt: FiniteAnimationSpec<IntOffset> = tween(350, easing = EaseInOutExpo)
|
||||||
|
val NavTweenFloat: FiniteAnimationSpec<Float> = tween(350, easing = EaseInOutExpo)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppEntrypoint(
|
fun AppEntrypoint(
|
||||||
windowSizeClass: WindowSizeClass,
|
windowSizeClass: WindowSizeClass,
|
||||||
|
|
@ -278,26 +282,30 @@ fun AppEntrypoint(
|
||||||
enterTransition = {
|
enterTransition = {
|
||||||
slideIntoContainer(
|
slideIntoContainer(
|
||||||
AnimatedContentTransitionScope.SlideDirection.Left,
|
AnimatedContentTransitionScope.SlideDirection.Left,
|
||||||
animationSpec = RevoltTweenInt
|
animationSpec = NavTweenInt,
|
||||||
)
|
initialOffset = { it / 3 }
|
||||||
|
) + fadeIn(animationSpec = NavTweenFloat)
|
||||||
},
|
},
|
||||||
exitTransition = {
|
exitTransition = {
|
||||||
slideOutOfContainer(
|
slideOutOfContainer(
|
||||||
AnimatedContentTransitionScope.SlideDirection.Left,
|
AnimatedContentTransitionScope.SlideDirection.Left,
|
||||||
animationSpec = RevoltTweenInt
|
animationSpec = NavTweenInt,
|
||||||
) + fadeOut(animationSpec = RevoltTweenFloat)
|
targetOffset = { it / 3 }
|
||||||
|
) + fadeOut(animationSpec = NavTweenFloat)
|
||||||
},
|
},
|
||||||
popEnterTransition = {
|
popEnterTransition = {
|
||||||
slideIntoContainer(
|
slideIntoContainer(
|
||||||
AnimatedContentTransitionScope.SlideDirection.Right,
|
AnimatedContentTransitionScope.SlideDirection.Right,
|
||||||
animationSpec = RevoltTweenInt
|
animationSpec = NavTweenInt,
|
||||||
)
|
initialOffset = { it / 3 }
|
||||||
|
) + fadeIn(animationSpec = NavTweenFloat)
|
||||||
},
|
},
|
||||||
popExitTransition = {
|
popExitTransition = {
|
||||||
slideOutOfContainer(
|
slideOutOfContainer(
|
||||||
AnimatedContentTransitionScope.SlideDirection.Right,
|
AnimatedContentTransitionScope.SlideDirection.Right,
|
||||||
animationSpec = RevoltTweenInt
|
animationSpec = NavTweenInt,
|
||||||
)
|
targetOffset = { it / 2 }
|
||||||
|
) + fadeOut(animationSpec = NavTweenFloat)
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
composable("default") {
|
composable("default") {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue