Skip to content

Commit

Permalink
Set fadeIn/fadeOut transitions for media screen
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandarIlic committed May 13, 2024
1 parent cb60a0c commit a72bac4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ import androidx.compose.animation.core.tween
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.animation.slideOutVertically

val primalSlideInHorizontallyFromEnd = slideInHorizontally(animationSpec = tween(), initialOffsetX = { it })

val primalSlideOutHorizontallyToEnd = slideOutHorizontally(animationSpec = tween(), targetOffsetX = { it })

val primalSlideInVerticallyFromBottom = slideInVertically(initialOffsetY = { it })

val primalSlideOutVerticallyToBottom = slideOutVertically(targetOffsetY = { it })

val primalScaleIn = scaleIn(animationSpec = tween(), initialScale = 0.9f)

val primalScaleOut = scaleOut(animationSpec = tween(), targetScale = 0.9f)
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package net.primal.android.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleOut
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
Expand Down Expand Up @@ -946,10 +949,10 @@ private fun NavGraphBuilder.media(
) = composable(
route = route,
arguments = arguments,
enterTransition = { primalSlideInVerticallyFromBottom },
exitTransition = { primalSlideOutVerticallyToBottom },
popEnterTransition = { primalScaleIn },
popExitTransition = { primalSlideOutVerticallyToBottom },
enterTransition = { fadeIn() },
exitTransition = { fadeOut() },
popEnterTransition = { EnterTransition.None },
popExitTransition = { fadeOut() },
) { navBackEntry ->
val viewModel = hiltViewModel<MediaGalleryViewModel>(navBackEntry)
PrimalTheme(primalTheme = PrimalTheme.Sunset) {
Expand Down

0 comments on commit a72bac4

Please sign in to comment.