-
-
Save mukeshsolanki/1035dc9dc49ba3297d048466cc247891 to your computer and use it in GitHub Desktop.
used for https://medium.com/@themukeshsolanki/animated-splash-screen-in-android-with-compose-4b7dc1baecc5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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