-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define a set number of loops? #1450
Comments
you can pass a number to the loop param instead of |
Thank you for the answer! Is it possible to show a code example? |
var animation = bodymovin.loadAnimation({
container: document.getElementById('animation-test'),
renderer: 'svg',
loop: 4,
autoplay: true,
path: 'data.json'
}) |
Thank you. Can't believe it was that easy, I was looking at all sorts of complicated solutions. Much appreciated. |
This only works the first time I play my animation. If I goToAndPlay(0) after that it only plays once, even if I set anim.loop = 2 before playing again. |
I found out how `playSegments()` and `loop` interact through this issue, which I found would be helpful to include in the documentation: airbnb#689 (comment)
@bodymovin 4 years later and this advice still works. Amazing how the docs list the "loop" property as a simple boolean in the React docs, yet passing an integer worked perfectly! https://docs.lottiefiles.com/lottie-player/components/lottie-react/properties |
Hi,
I'm new to lottie/bodymovin and not very fluent in JS. So I would love to get a bit of help getting my animation to run twice (or loop once if you like) – or preferably a way to define a set amount of loops.
Javascript:
This works as expected, and it runs once.
Is there a way to define a set amount of loops?
Thank you!
The text was updated successfully, but these errors were encountered: