-2

I was wondering how I can run a Lottie animation only once since it is looping by default. Here is a link to the code I am trying to modify: https://docs.expo.io/versions/latest/sdk/lottie.html

TylerH
  • 20,799
  • 66
  • 75
  • 101
Romo Islam
  • 9
  • 1
  • 2

3 Answers3

3

You can use loop prop to set looping behavior of the component. More info about the properties you can use with lottie can be found here.

 // A boolean flag indicating whether or not the animation should loop.
 loop: boolean = false,
bennygenel
  • 23,896
  • 6
  • 65
  • 78
2

In java disable looping in lottie animation like this maybe help this:

First, declare LottieAnimationView : LottieAnimationView myAnim;

Then find with ID: myAnim = v.findViewById(R.id.upload_anim); // v is view here, i use it because i work in fragment.

Now you can change looping option with boolean: myAnim.loop(false);

2

In flutter , just do repeat:false after asset

Like this :

Lottie.asset('assets/lottie.json',repeat: false)
STA
  • 30,729
  • 8
  • 45
  • 59
Vivek Negi
  • 71
  • 2
  • 6