airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
35.03k stars 5.41k forks source link

Discrepancy between lottie animation in Jetpack Compose and Lottie Preview #2375

Closed NicolaiNisbeth closed 1 year ago

NicolaiNisbeth commented 1 year ago

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.

gpeal commented 1 year ago

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.