Skip to content

Commit

Permalink
Added Animations
Browse files Browse the repository at this point in the history
  • Loading branch information
aritra-tech committed Jun 15, 2024
1 parent af4a54b commit 91738f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions composeApp/src/commonMain/kotlin/navigation/Navigation.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package navigation

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.tween
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.Scaffold
Expand Down Expand Up @@ -33,6 +35,8 @@ import ui.backgroundLight
import ui.onPrimaryContainerLight
import ui.onSurfaceVariantLight
import ui.primaryDark
import utils.FadeIn
import utils.FadeOut

val LocalNavHost = staticCompositionLocalOf<NavHostController> {
error("No Parameter is available")
Expand Down Expand Up @@ -62,6 +66,8 @@ fun Navigation() {
modifier = Modifier.fillMaxWidth(),
navController = navController,
startDestination = Screens.Home.route,
enterTransition = { FadeIn },
exitTransition = { FadeOut }
) {

composable(route = Screens.Home.route) {
Expand Down
14 changes: 14 additions & 0 deletions composeApp/src/commonMain/kotlin/utils/Animation.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package utils

import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn

val FadeIn = fadeIn(animationSpec = tween(220, delayMillis = 90)) +
scaleIn(
initialScale = 0.92f,
animationSpec = tween(220, delayMillis = 90)
)

val FadeOut = fadeOut(animationSpec = tween(90))

0 comments on commit 91738f8

Please sign in to comment.