iosMain.kottieComposition.KottieComposition.ios.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kottie Show documentation
Show all versions of kottie Show documentation
Kotlin Multiplatform Animation Library
package kottieComposition
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
import lottie.lottieComposition.LottieCompositionSpec
@Composable
actual fun kottieComposition(
spec: KottieCompositionSpec
): Any? {
var lottieSpec by remember { mutableStateOf( null) }
LaunchedEffect(spec){
lottieSpec = when(spec){
is KottieCompositionSpec.File -> {
LottieCompositionSpec.File(spec.path)
}
is KottieCompositionSpec.Url -> {
LottieCompositionSpec.Url(spec.url)
}
is KottieCompositionSpec.JsonString -> {
LottieCompositionSpec.JsonString(spec.jsonString)
}
}
}
return lottieSpec
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy