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
Asked
Active
Viewed 9,860 times
-2
-
1Just pass `loop={false}` – Ben Kane Mar 29 '18 at 18:41
3 Answers
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);

melih.murat.pesmen
- 316
- 2
- 4
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