1
1
package com.dede.android_eggs.views.main
2
2
3
- import androidx.compose.animation.AnimatedContentTransitionScope.SlideDirection
4
- import androidx.compose.animation.core.EaseIn
5
- import androidx.compose.animation.core.EaseOut
6
- import androidx.compose.animation.core.LinearEasing
7
3
import androidx.compose.animation.core.tween
8
4
import androidx.compose.animation.fadeIn
9
5
import androidx.compose.animation.fadeOut
6
+ import androidx.compose.animation.slideInHorizontally
7
+ import androidx.compose.animation.slideOutHorizontally
10
8
import androidx.compose.runtime.Composable
11
9
import androidx.compose.runtime.CompositionLocalProvider
12
10
import androidx.compose.ui.Modifier
@@ -33,7 +31,7 @@ import com.dede.android_eggs.views.timeline.TimelineListDialog
33
31
import com.dede.basic.Utils
34
32
35
33
36
- private const val TRANSITION_DURATION = 320
34
+ private const val TRANSITION_DURATION = 400
37
35
38
36
@Composable
39
37
fun EasterEggsNavHost (
@@ -51,36 +49,20 @@ fun EasterEggsNavHost(
51
49
startDestination = EasterEggsScreen .route,
52
50
modifier = modifier,
53
51
enterTransition = {
54
- fadeIn(
55
- animationSpec = tween(TRANSITION_DURATION , easing = LinearEasing )
56
- ) + slideIntoContainer(
57
- animationSpec = tween(TRANSITION_DURATION , easing = EaseIn ),
58
- towards = SlideDirection .Start
59
- )
52
+ fadeIn(animationSpec = tween(TRANSITION_DURATION )) +
53
+ slideInHorizontally(animationSpec = tween(TRANSITION_DURATION )) { it }
60
54
},
61
55
exitTransition = {
62
- fadeOut(
63
- animationSpec = tween(TRANSITION_DURATION , easing = LinearEasing )
64
- ) + slideOutOfContainer(
65
- animationSpec = tween(TRANSITION_DURATION , easing = EaseIn ),
66
- towards = SlideDirection .Start
67
- )
56
+ fadeOut(animationSpec = tween(TRANSITION_DURATION )) +
57
+ slideOutHorizontally(animationSpec = tween(TRANSITION_DURATION ))
68
58
},
69
59
popEnterTransition = {
70
- fadeIn(
71
- animationSpec = tween(TRANSITION_DURATION , easing = LinearEasing )
72
- ) + slideIntoContainer(
73
- animationSpec = tween(TRANSITION_DURATION , easing = EaseOut ),
74
- towards = SlideDirection .End ,
75
- )
60
+ fadeIn(animationSpec = tween(TRANSITION_DURATION ), initialAlpha = 0.3f ) +
61
+ slideInHorizontally(animationSpec = tween(TRANSITION_DURATION ))
76
62
},
77
63
popExitTransition = {
78
- fadeOut(
79
- animationSpec = tween(TRANSITION_DURATION , easing = LinearEasing )
80
- ) + slideOutOfContainer(
81
- animationSpec = tween(TRANSITION_DURATION , easing = EaseOut ),
82
- towards = SlideDirection .End
83
- )
64
+ fadeOut(animationSpec = tween(TRANSITION_DURATION )) +
65
+ slideOutHorizontally(animationSpec = tween(TRANSITION_DURATION )) { it }
84
66
},
85
67
) {
86
68
composable(route = EasterEggsScreen .route) {
0 commit comments