Sirop4ik
Sirop4ik

Reputation: 5243

Lottie anim does not play to the end. How to fix?

I have such lottie anim

https://dropmefiles.com/uweF8

You can check it on Lottie preview web site

https://lottiefiles.com/preview

In preview this file is working well

But if you will try to add this anim to the project like this

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.airbnb.lottie.LottieAnimationView
    android:id="@+id/animation_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:lottie_autoPlay="true"
    app:lottie_loop="false"
    app:lottie_rawRes="@raw/heart"
    app:lottie_scale="1.2"
    tools:background="@color/black_30_alpha"
    tools:layout_height="200dp"
    tools:layout_width="match_parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

So you will have such result

введите сюда описание изображения

And you can see that the animation does not meet the end.

What am I doing wrong?

I have tried to add this line in the code

mAnimHeart.setMaxProgress(1f);

But the result is the same

Upvotes: 0

Views: 1230

Answers (2)

Gabe
Gabe

Reputation: 1249

This has been fixed in Lottie 3.0 https://github.com/airbnb/lottie-android/issues/1034

Upvotes: 1

ashakirov
ashakirov

Reputation: 12350

In official Lottie app last frame of this json file is same as yours. So it looks like something wrong with that file. Maybe Lottie team doesn't add support for some features on android. Or maybe it is just bug. You can open issue on thier github repository.

enter image description here

Upvotes: 0

Related Questions