Alex
09/01/2021, 12:59 PMLottieAnimation
in compose with a LottieAnimatable
but it is not playing.. can anyone tell me what I am doing wrong?Alex
09/01/2021, 12:59 PMLottieAnimation
in compose with a LottieAnimatable
but it is not playing.. can anyone tell me what I am doing wrong?val startComposition by rememberLottieComposition(
spec = LottieCompositionSpec.RawRes(R.raw.barmer_loading_spinner_start),
)
val animatable: LottieAnimatable = rememberLottieAnimatable()
LaunchedEffect(key1 = Unit) {
animatable.animate(
composition = startComposition,
iteration = 1,
)
}
Column(
horizontalAlignment = Alignment.CenterHorizontally,
) {
LottieAnimation(
modifier = Modifier
.size(48.dp)
.then(modifier),
composition = animatable.composition,
progress = animatable.progress,
)
Text(
modifier = Modifier
.padding(16.dp)
.then(modifier),
text = "Progress ${animatable.progress}",
)
}
This results in progress not changing from 0.0 and the animation not playingval startComposition by rememberLottieComposition(
spec = LottieCompositionSpec.RawRes(R.raw.barmer_loading_spinner_start),
)
val startProgress by animateLottieCompositionAsState(
composition = startComposition,
iterations = 1,
)
Column(
horizontalAlignment = Alignment.CenterHorizontally,
) {
LottieAnimation(
modifier = Modifier
.size(48.dp)
.then(modifier),
composition = startComposition,
progress = startProgress,
)
Text(
modifier = Modifier
.padding(16.dp)
.then(modifier),
text = "Progress $startProgress",
)
}
key1=Unit
is the issue, if I use the composition as key then it works