All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.kottieComposition.KottieComposition.desktop.kt Maven / Gradle / Ivy

There is a newer version: 1.9.6
Show newest version
package kottieComposition

import skiaComposition.SkiaCompositionSpec
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue


@Composable
actual fun kottieComposition(
    spec: KottieCompositionSpec
): Any? {
    var skiaSpec by remember {  mutableStateOf( null) }
    LaunchedEffect(spec){
        skiaSpec = when(spec){
            is KottieCompositionSpec.File -> {
                SkiaCompositionSpec.File(spec.path)
            }
            is KottieCompositionSpec.Url -> {
                SkiaCompositionSpec.Url(spec.url)
            }
            is KottieCompositionSpec.JsonString -> {
                SkiaCompositionSpec.JsonString(spec.jsonString)
            }
        }
    }
    return skiaSpec
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy