airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native

Home Page:http://airbnb.io/lottie/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discrepancy between lottie animation in Jetpack Compose and Lottie Preview

NicolaiNisbeth opened this issue · comments

Description:
There is an issue where the lottie animation does not match the animation preview. However, it works as expected on iOS.

What version of Lottie did you test this on?
6.1.0
6.0.0
5.2.0

What version of Android did you test this on?
Emulator - Android 13
Oneplus Nord - Android 12

Steps to reproduce the behavior:

var selected by remember { mutableStateOf(false) }
val lottieComposition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.lottie))
val lottieAnimatable = rememberLottieAnimatable()

LaunchedEffect(lottieComposition, lottieAnimatable, selected) {
    if (selected) lottieAnimatable.animate(lottieComposition)
    else lottieAnimatable.resetToBeginning()
}

Button(onClick = { selected = !selected }) {
    LottieAnimation(
        composition = lottieComposition,
        progress = lottieAnimatable::progress
    )
}

Additional info:
The issue still remains when using the xml way of doing lottie animations, and the file doesn't seem to use any unsupported features according to the supported feature list.

Thanks in advance for your help.

Lottie doesn't support 3D on Android, unfortunately. I've spent some time on it but the underlying Android graphics APIs are 2D so supporting 3D isn't trivial.