Refactor(Animation): Optimize animation
This commit is contained in:
@@ -20,11 +20,11 @@ fun NavGraphBuilder.aboutScreen(
|
||||
composable(
|
||||
route = ABOUT_ROUTE,
|
||||
enterTransition = {
|
||||
slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth })
|
||||
slideInHorizontally { it }
|
||||
},
|
||||
popEnterTransition = null,
|
||||
popExitTransition = {
|
||||
slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth })
|
||||
slideOutHorizontally { it }
|
||||
}
|
||||
) {
|
||||
AboutRoute(
|
||||
|
||||
@@ -19,11 +19,11 @@ fun NavGraphBuilder.librariesScreen(
|
||||
composable(
|
||||
route = LIBRARIES_ROUTE,
|
||||
enterTransition = {
|
||||
slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth })
|
||||
slideInHorizontally { it }
|
||||
},
|
||||
popEnterTransition = null,
|
||||
popExitTransition = {
|
||||
slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth })
|
||||
slideOutHorizontally { it }
|
||||
}
|
||||
) {
|
||||
LibrariesRoute(onBackClick = onBackClick)
|
||||
|
||||
@@ -25,8 +25,8 @@ fun NavGraphBuilder.starScreen(
|
||||
enterTransition = {
|
||||
when (initialState.destination.route) {
|
||||
TOOL_STORE_ROUTE, TOOLS_ROUTE ->
|
||||
if (isVertical) slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth })
|
||||
else slideInVertically(initialOffsetY = { fullHeight -> fullHeight })
|
||||
if (isVertical) slideInHorizontally { it }
|
||||
else slideInVertically { it }
|
||||
|
||||
else -> null
|
||||
}
|
||||
@@ -34,8 +34,8 @@ fun NavGraphBuilder.starScreen(
|
||||
exitTransition = {
|
||||
when (targetState.destination.route) {
|
||||
TOOL_STORE_ROUTE, TOOLS_ROUTE ->
|
||||
if (isVertical) slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth })
|
||||
else slideOutVertically(targetOffsetY = { fullHeight -> fullHeight })
|
||||
if (isVertical) slideOutHorizontally { it }
|
||||
else slideOutVertically { it }
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ fun NavGraphBuilder.toolStoreScreen(
|
||||
enterTransition = {
|
||||
when (initialState.destination.route) {
|
||||
TOOLS_ROUTE, STAR_ROUTE ->
|
||||
if (isVertical) slideInHorizontally(initialOffsetX = { fullWidth -> -fullWidth })
|
||||
else slideInVertically(initialOffsetY = { fullHeight -> -fullHeight })
|
||||
if (isVertical) slideInHorizontally { -it }
|
||||
else slideInVertically { -it }
|
||||
|
||||
else -> null
|
||||
}
|
||||
@@ -35,8 +35,8 @@ fun NavGraphBuilder.toolStoreScreen(
|
||||
exitTransition = {
|
||||
when (targetState.destination.route) {
|
||||
TOOLS_ROUTE, STAR_ROUTE ->
|
||||
if (isVertical) slideOutHorizontally(targetOffsetX = { fullWidth -> -fullWidth })
|
||||
else slideOutVertically(targetOffsetY = { fullHeight -> -fullHeight })
|
||||
if (isVertical) slideOutHorizontally { -it }
|
||||
else slideOutVertically { -it }
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ fun NavGraphBuilder.toolsScreen(
|
||||
enterTransition = {
|
||||
when (initialState.destination.route) {
|
||||
TOOL_STORE_ROUTE ->
|
||||
if (isVertical) slideInHorizontally(initialOffsetX = { fullWidth -> fullWidth })
|
||||
else slideInVertically(initialOffsetY = { fullHeight -> fullHeight })
|
||||
if (isVertical) slideInHorizontally { it }
|
||||
else slideInVertically { it }
|
||||
|
||||
STAR_ROUTE ->
|
||||
if (isVertical) slideInHorizontally(initialOffsetX = { fullWidth -> -fullWidth })
|
||||
else slideInVertically(initialOffsetY = { fullHeight -> -fullHeight })
|
||||
if (isVertical) slideInHorizontally { -it }
|
||||
else slideInVertically { -it }
|
||||
|
||||
else -> null
|
||||
}
|
||||
@@ -40,12 +40,12 @@ fun NavGraphBuilder.toolsScreen(
|
||||
exitTransition = {
|
||||
when (targetState.destination.route) {
|
||||
TOOL_STORE_ROUTE ->
|
||||
if (isVertical) slideOutHorizontally(targetOffsetX = { fullWidth -> fullWidth })
|
||||
else slideOutVertically(targetOffsetY = { fullHeight -> fullHeight })
|
||||
if (isVertical) slideOutHorizontally { it }
|
||||
else slideOutVertically { it }
|
||||
|
||||
STAR_ROUTE ->
|
||||
if (isVertical) slideOutHorizontally(targetOffsetX = { fullWidth -> -fullWidth })
|
||||
else slideOutVertically(targetOffsetY = { fullHeight -> -fullHeight })
|
||||
if (isVertical) slideOutHorizontally { -it }
|
||||
else slideOutVertically { -it }
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user