asyncUpdates
feature which moves the entire update phase of an animation off of the main thread. For more information, refer to this blog post. (#2276)LottieCompositionFactory
to not close input streams (#2286 and #2319)[Removed API] Removed the setScale(float)
APIs from LottieAnimationView
and LottieDrawable
. The expected behavior was highly ambiguous when paired with other scale types and canvas transformations. For the vast majority of cases, ImageView.ScaleType should be sufficient. For remaining cases, you may apply transformations to Canvas and use LottieDrawable#draw
directly.
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:
Benefits as a result of this change:
Lottie can now render outside of its composition bounds. To allow this with views such as LottieAnimationView, set clipToCompositionBounds
to false on LottieDrawable
or LottieAnimationView
and clipChildren
to false on the parent view. For Compose, use the clipToCompositionBounds
parameter.
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)
BREAKING CHANGES Before this release, drop shadows and blurs were completely ignored. They will now be rendered. In most cases, they will now be rendered correctly. However, you should read the implementation details here if they are not.
LottieProperty.TRANSFORM_POSITION_X
and LottieProperty.TRANSFORM_POSITION_Y
has been added to enable dynamic properties on transform positions that have split dimensions enabled (#1714)KeyPath
(#1710)ColorStateLists
in LottieAnimationView
lottie_colorFilter
xml attribute (#1708)LottieDrawable
bounds internally. It will not respect the bounds set on it (#1713)LottieAnimationView
with another drawable then setting it back would cause the animation to not render (#1703)Added a new global configuration to add a custom network stack, custom network cache, enable systrace markers, and more (#1629)
Lottie.initialize
and LottieConfig.Builder
.Add support for parsing dotLottie files (#1660)
Added support for pause listeners on LottieDrawable
and LottieAnimationView
(#1662)
LottieCompositionFactory.clearCache()
.setFailureListener
and resetFailureListener
(#1321).setFallbackResource
from code orlottie_fallbackRes
from xml.setApplyingOpacityToLayersEnabled
for more info.setMinFrame
, setMaxFrame
and setMinAndMaxFrame
with a marker name.enableHardwareAcceleration
with a new setRenderMode
API because it has a third (Automatic
) option. Refer to the docs for more info.invalidateSelf()
from being called and recalculating bounds many times per frame.fetchBitmap()
as @Nullable
LottieComposition.Factory
in favor of LottieCompositionFactory.LottieComposition#getImages()
to aid in preloading images.playAnimation(start, end)
. It has been removed in favor of explicit methods for setMinFrame/Progress
, setMaxFrame/Progress
and setMinAndMaxFrame/Progress
followed by an explicit call to playAnimation
or resumeAnimation
.reverseAnimation
and resumeReverseAnimation
apis have been removed in favor of play
and resume
with speed
< 0.play(startFrame, endFrame)
and play(startProgress, endProgress)
.enableMergePathsForKitKatAndAbove
and read the documentation before using it.LottieAnimationView
and LottieDrawable
LottieDrawable
public again.LottieDrawable
is used outside of LottieAnimationView