Refactor(Animation): Optimize navigation switch animation

Optimize AboutNavigation and LibrariesNavigation switch animation
This commit is contained in:
2024-04-24 17:23:28 +08:00
parent b11ae055c3
commit 4d047247f1
2 changed files with 10 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
package top.fatweb.oxygen.toolbox.navigation
import androidx.compose.animation.scaleIn
import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
@@ -20,16 +20,11 @@ fun NavGraphBuilder.aboutScreen(
composable(
route = ABOUT_ROUTE,
enterTransition = {
scaleIn()
},
exitTransition = {
slideOutVertically { it }
},
popEnterTransition = {
scaleIn()
slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth })
},
popEnterTransition = null,
popExitTransition = {
slideOutVertically { it }
slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth })
}
) {
AboutRoute(

View File

@@ -1,7 +1,7 @@
package top.fatweb.oxygen.toolbox.navigation
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
@@ -19,16 +19,11 @@ fun NavGraphBuilder.librariesScreen(
composable(
route = LIBRARIES_ROUTE,
enterTransition = {
scaleIn()
},
exitTransition = {
scaleOut()
},
popEnterTransition = {
scaleIn()
slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth })
},
popEnterTransition = null,
popExitTransition = {
scaleOut()
slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth })
}
) {
LibrariesRoute(onBackClick = onBackClick)