commonMain.cafe.adriel.voyager.transitions.FadeTransition.kt Maven / Gradle / Ivy
package cafe.adriel.voyager.transitions
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.core.FiniteAnimationSpec
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.with
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import cafe.adriel.voyager.navigator.Navigator
@ExperimentalAnimationApi
@Composable
public fun FadeTransition(
navigator: Navigator,
modifier: Modifier = Modifier,
animationSpec: FiniteAnimationSpec = spring(stiffness = Spring.StiffnessMediumLow),
content: ScreenTransitionContent = { it.Content() }
) {
ScreenTransition(
navigator = navigator,
modifier = modifier,
content = content,
transition = { fadeIn(animationSpec = animationSpec) with fadeOut(animationSpec = animationSpec) }
)
}