remember Lottie Composition
Takes a LottieCompositionSpec, attempts to load and parse the animation, and returns a LottieCompositionResult.
LottieCompositionResult allows you to explicitly check for loading, failures, call LottieCompositionResult.await, or invoke it like a function to get the nullable composition.
LottieCompositionResult implements State<LottieComposition?> so if you don't need the full result class, you can use this function like:
val compositionResult: LottieCompositionResult = lottieComposition(spec)
// or...
val composition: State<LottieComposition?> by lottieComposition(spec)
The loaded composition will automatically load and set images that are embedded in the json as a base64 string or will load them from assets if an imageAssetsFolder is supplied.
Parameters
The LottieCompositionSpec that defines which LottieComposition should be loaded.
A subfolder in src/main/assets that contains the exported images that this composition uses. DO NOT rename any images from your design tool. The filenames must match the values that are in your json file.
An optional callback that will be called if loading the animation fails. It is passed the failed count (the number of times it has failed) and the exception from the previous attempt to load the composition. onRetry is a suspending function so you can do things like add a backoff delay or await an internet connection before retrying again. rememberLottieRetrySignal can be used to handle explicit retires.