ismai117 / kottie

Render After Effects Animations Library - Compose Multiplatform | Inspired by Airbnb/Lottie
Apache License 2.0
215 stars 9 forks source link

Compose Multiplatform, white background instead of transparent on Ios. #22

Closed Kognitivist closed 2 months ago

Kognitivist commented 3 months ago

@OptIn(ExperimentalResourceApi::class) @Composable fun Kottie(resPath: String) { var animation by remember { mutableStateOf("") }

LaunchedEffect(Unit) {
    animation = Res.readBytes(resPath).decodeToString()
}
val composition = rememberKottieComposition(spec = KottieCompositionSpec.File(animation))
val animationState by animateKottieCompositionAsState(
    composition = composition,
    isPlaying = true,
    iterations = Int.MAX_VALUE
)

KottieAnimation(
    composition = composition,
    progress = { animationState.progress },
    modifier = Modifier,
    backgroundColor = Color.Transparent
)

} Simulator Screenshot - iPhone 15 - 2024-08-09 at 16 22 02

on android OK Screenshot_20240809_162137

ismai117 commented 2 months ago

https://github.com/JetBrains/compose-multiplatform/issues/3154