ismai117 / kottie

Render After Effects Animations Library - Compose Multiplatform | Inspired by Airbnb/Lottie

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preview does not occupy full width

ArleyPereira opened this issue · comments

Preview does not occupy full width...

kottie = "1.9.6-alpha02"

@OptIn(ExperimentalResourceApi::class)
@Composable
private fun SplashContent(
    navigateToHomeAuthScreen: () -> Unit
) {
    var animation by remember { mutableStateOf("") }

    LaunchedEffect(Unit) {
        animation = Res.readBytes("files/splash.json").decodeToString()
    }

    val composition = rememberKottieComposition(
        spec = KottieCompositionSpec.File(animation)
    )

    val animationState by animateKottieCompositionAsState(
        composition = composition,
        isPlaying = true
    )

    LaunchedEffect(animationState.isPlaying) {
        if (animationState.isCompleted) {
            navigateToHomeAuthScreen()
        }
    }

    KottieAnimation(
        modifier = Modifier
            .fillMaxSize(),
        composition = composition,
        progress = { animationState.progress }
    )
}

screenshot-1720147214131
Simulator Screenshot - iPhone 15 Pro Max - 2024-07-04 at 23 39 41

would you be able to provide the lottie file so I can check it out?

Can I send it on a private channel

@ArleyPereira yeah, you can dm on slack or check social links on my GitHub profile

@ismai117 Submitted by LinkedIn

@ArleyPereira I've added ContentScale to 1.9.6-alpha03, it fixes the problem you're facing.

        KottieAnimation(
            composition = composition,
            progress = { animationState.progress },
            modifier = modifier.fillMaxSize(),
            contentScale = ContentScale.FillBounds
        )