Skip to content

Instantly share code, notes, and snippets.

@mukeshsolanki
Created Jul 17, 2022
Embed
What would you like to do?
@Composable
fun SplashScreen(navController: NavHostController) {
Box(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colors.primary)
) {
val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.logo))
val logoAnimationState =
animateLottieCompositionAsState(composition = composition)
LottieAnimation(
composition = composition,
progress = { logoAnimationState.progress }
)
if (logoAnimationState.isAtEnd && logoAnimationState.isPlaying) {
navController.navigate(Screen.Home.route)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment