Lottie for Android, iOS, and React Native v5.0.0 Release Notes

  • ๐Ÿ†• New Features

    • โž• Added support for the "Rounded Corners" effect on Shape and Rect layers (#1953)
    • Prior to 5.0, LottieAnimationView would always call setLayerType with either HARDWARE or SOFTWARE. In the hardware case, this would case Android to allocate a dedicated hardware buffer for the animation that had to be uploaded to the GPU separately. In the software case, LottieAnimationView would rely on View's internal drawing cache.

      This has a few disadvantages:

      • The hardware/software distinction happened at the LottieAnimationView level. That means that consumers of LottieDrawable (such as lottie-compose) had no way to choose a render mode.
      • Dedicated memory for Lottie was always allocated. In the software case, it would be a bitmap that is the size of the LottieAnimationView and in the hardware case, it was a dedicated hardware layer.

    Benefits as a result of this change:

    • Reduced memory consumption. In the hardware case, no new memory is allocated. In the software case, Lottie will create a bitmap that is the intersection of your View/Composition bounds mapped with the drawing transformation which often yields a surface are that is smaller than the entire LottieAnimationView.
    • lottie-compose now supports setting a RenderMode.
    • Custom uses of LottieDrawable now support setting a RenderMode via useSoftwareRendering.
    • Lottie can now render outside of its composition bounds via setClipToCompositionBounds. Unless you are using one of the new APIs, you should not have to change anything in your code as a result of this page. It is intended to be an entirely internal implementation detail that should improve performance by default and allow for new functionality.

      Please report any bugs or unexpected behavior that you experience as a result of this change. #1952, #1973.

      • โšก๏ธ Prior to 5.0, LottieAnimationView handled all animation controls when the view's visibility or attach state changed. This worked fine for consumers of LottieAnimationView. However, custom uses of LottieDrawable were prone to leaking infinite animators if they did not properly handle cancelling animations correctly. This opens up the possibility for unexpected behavior and increased battery drain. Lottie now behaves more like animated drawables in the platform and moves this logic into the Drawable via its setVisible API. This should lead to no explicit behavior changes if you are using LottieAnimationView. However, if you are using LottieDrawable directly and were explicitly pausing/cancelling animations on lifecycle changes, you may want to cross check your expected behavior with that of LottieDrawable after this update. This change also resolved a long standing bug when Lottie is used in RecyclerViews due to the complex way in which RecyclerView handles View lifecycles (#1495). #1981
      • โž• Add an API setClipToCompositionBounds on LottieAnimationView, LottieDrawable, and the LottieAnimation composable to prevent Lottie from clipping animations to the composition bounds.
      • โž• Add an API to always render dynamically set bitmaps at the original animation bounds. Previously, dynamically set bitmaps would be rendered at their own size anchored to the top left of the original bitmap. This meant that if you wanted to supply a lower resolution bitmap to save memory, it would render smaller. The default behavior remains the same but you can enable setMaintainOriginalImageBounds to be able to supply lower resolution bitmaps (#1706).
      • โž• Add support for LottieProperty.TEXT to use dynamic properties for text. This enables dynamic text support for lottie-compose (#1995).
      • โž• Add getters for Marker fields (#1998)
      • โž• Add support for reversed polystar paths (#2003)

    ๐Ÿ› Bugs Fixed

    • ๐Ÿ›  Fix a rare NPE multi-threaded race condition (#1959)
    • ๐Ÿ‘ Don't cache dpScale to support moving Activities between different displays (#1915)
    • ๐Ÿ›  Fix some cases that would prevent LottieAnimationView or LottieDrawable from being rendered by the Android Studio layout preview (#1984)
    • ๐Ÿ‘ Better handle animations in which there is only a single color in a gradient (#1985)
    • ๐Ÿ›  Fix a rare race condition that could leak a LottieTask object (#1986)
    • Call onAnimationEnd when animations are cancelled to be consistent with platform APIs (#1994)
    • ๐Ÿ›  Fix a bug that would only render part of a path if the trim path extended from 0-100 and had an offset (#1999)
    • Add support for languages that use DIRECTIONALITY_NONSPACING_MARK like Hindi (#2001)
    • Prevent LottieAnimationView from overwriting user actions when restoring instance state (#2002)