Skip to content

Releases: airbnb/lottie-android

Compose 1.0.0-rc02-1

18 Jul 20:42
Compare
Choose a tag to compare
  • Upgrade to Compose rc02
  • Add support for ContentScale and Alignment just like the Image composable (#1844)
  • Automatically load fonts if possible and allow setting fonts via dynamic properties (#1842)
  • Add LottieCancellationBehavior support to animateLottieCompositionAsState (#1846)
  • Allow custom cache keys/cache skipping (#1847)
  • Always respect LottieClipSpec (#1848)

3.7.1

08 Jul 04:48
Compare
Choose a tag to compare

Bugs Fixed

  • Made TextDelegate.getText public (#1792)
  • Fixed an incorrect time stretch calculation (#1818)
  • Use the application context in NetworkFetcher to prevent memory leaks (#1832)

Compose 1.0.0-rc01-1

08 Jul 04:48
Compare
Choose a tag to compare

Breaking Changes

LottieAnimation now takes a progress float instead of driving the animation internally. The driving of animations has been split into a new LottieAnimatable class and animateLottieCompositionAsState function. These are analogous to Jetpack's Animatable and animate*AsState functions. Properties that pertain to the animation such as speed, repeat count, and the new clip spec are part of animateLottieComposition whereas properties that are related to rendering such as enabling merge paths and setting an image asset delegate are on the LottieAnimation composable.

lottieComposition has also been renamed rememberLottieComposition.

The docs have been update to reflect the new API and there are lots of examples here.

There are overloaded version of LottieAnimation that merge the properties for convenience. Please refer to the docs for LottieAnimation, LottieAnimatable, animateLottieCompositionAsState and rememberLottieComposition for more information.

  • Added the ability to clip the progress bounds of an animation.
  • Added the ability to set and control dynamic properties.
  • Removed the existing imageAssetDelegate parameter and moved imageAssetsFolder to rememberLottieComposition.
    Images are now loaded from assets or decoded from the base64 string embedded in the json file during parsing
    and on the IO thread pool rather than upon first render on the main thread during animations. If you want to
    supply your own animations, call composition.images["your_image_id"].bitmap = yourBitmap. This lets you control
    exactly how and when the bitmaps get created and set. The previous implementation of calling a callback on every
    frame encouraged the incorrect behavior of doing IO tasks during the animation hot path. Check out ImagesExamplesPage.kt
    for usage.

Examples

@Composable
private fun PlayOnce() {
    val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.heart))
    LottieAnimation(composition)
}
@Composable
private fun RepeatForever() {
    val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.heart))
    LottieAnimation(
        composition,
        iterations = LottieConstants.IterateForever,
    )
}
@Composable
private fun RepeatForeverWithAnimateLottieCompositionAsState() {
    val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.heart))
    val progress by animateLottieCompositionAsState(
        composition,
        iterations = LottieConstants.IterateForever,
    )
    LottieAnimation(
        composition,
        progress,
    )
}
@Composable
private fun RepeatForeverWithLottieAnimatable() {
    val anim = rememberLottieAnimatable()
    val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.heart))
    LaunchedEffect(composition) {
        anim.animate(
            composition,
            iterations = LottieConstants.IterateForever,
        )
    }
    LottieAnimation(anim.composition, anim.progress)
}

Compose Beta 07 1

20 May 07:01
90b3709
Compare
Choose a tag to compare

Support for Jetpack Compose Beta 7

3.5.0

09 Nov 03:22
Compare
Choose a tag to compare

Features and Improvements

  • Added a new global configuration to add a custom network stack, custom network cache, enable systrace markers, and more (#1629)

    • To use it, checkout the docs for Lottie.initialize and LottieConfig.Builder.
  • Add support for parsing dotLottie files (#1660)

  • Added support for pause listeners on LottieDrawable and LottieAnimationView (#1662)

Bugs Fixed

  • Properly cache animations loaded via url in memory (#1657)

Compose 1.0.0 Alpha 1

09 Nov 03:23
Compare
Choose a tag to compare
  • Initial release of Lottie Compose
  • Compatible with Jetpack Compose alpha 6
  • Built with Lottie 3.5.0
  • Wraps the existing renderer with Jetpack Compose friendly APIs.
  • For up to date docs on how to use it, check out the docs.

3.4.4

02 Oct 04:24
Compare
Choose a tag to compare

Bugs Fixed

  • Properly clamp gradient values (#1636)
  • Fix some scaling issues with text (#1635)
  • Add a warning instead of crashing when parsing an unknown matte type (#1638)
  • Clear cached gradients when setting a new value callback (#1639)

3.4.2

28 Aug 22:31
Compare
Choose a tag to compare

Feature and Improvements

  • Disable hardware acceleration by default on Android 7.x (#1586)
  • Enable Lottie animations to preview in Android Studio (they may not be accurate, though)
    (#1572)
  • More leniently parse opacity and colors to render Telegram stickers better ([#1612]
    (#1612) and ([#1613](https://github
    .com//pull/1612))
  • Use the correct cacheKey when LottieAnimationView loads an rawRes animation ([#1617]
    (#1617))
  • Prevent animations from blinking if they are rendered on multiple threads ([#1575]
    (#1575))

3.4.1

28 Aug 22:31
Compare
Choose a tag to compare

Feature and Improvements

  • Added a KeyPath.COMPOSITION constant to set dynamic properties on the animation's root composition layer (#1559).
  • A default style can now be set for all AnimationViews with lottieAnimationViewStyle (#1524).

3.4.0

22 Feb 18:57
Compare
Choose a tag to compare

Features and Improvements

  • Added optional cache key parameters to url loading to enable skipping the cache.
  • Added the ability to clear the Lottie cache via LottieCompositionFactory.clearCache().

Bugs Fixed

  • Properly pass in progress to ValueCallbacks.
  • Clear existing ValueCallbacks if new ones overwrite old ones.
  • Clip interpolators that might loop back on themself to render something very close rather than crashing.
  • Fix time stretch + time remap when there is a start offset.
  • Ensure that the first frame is rendered when a new composition is set even if it is not yet playing.
  • Properly render Telegram stickers that use [0,1] for color but [0,255] for alpha.
  • Ensure that LottieDrawable has the correct bounds when the composition updates before Marshmallow.
  • Fully clear off screen buffers pre-pie to prevent artifacts.
  • Play, not resume animations if they are played while not shown.