question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Define a set number of loops?

See original GitHub issue

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:

var animation = bodymovin.loadAnimation({
    container: document.getElementById('animation-test'),
    renderer: 'svg',
    loop: false,
    autoplay: true,
    path: 'data.json'
})

This works as expected, and it runs once.

Is there a way to define a set amount of loops?

Thank you!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
bodymovincommented, Jan 9, 2019

you can pass a number to the loop param instead of false.

3reactions
bodymovincommented, Jan 9, 2019
var animation = bodymovin.loadAnimation({
    container: document.getElementById('animation-test'),
    renderer: 'svg',
    loop: 4,
    autoplay: true,
    path: 'data.json'
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Looping a Set Number of Times - FutureLearn
You can do this by adjusting the way you use a for loop. To do something five times, you could create a for...
Read more >
For Loops: Repeating Operations a Set Number of Times - NI
A For Loop executes the section of code inside the loop, called a subdiagram, a set number of times. The count (N) terminal...
Read more >
Function with varying number of For Loops (python)
I want to create a function that contains nested for loops, the amount of which is proportional to an argument passed to the...
Read more >
19. For Loops | Python Tutorial
This kind of for loop iterates over an enumeration of a set of items. It is usually characterized by the use of an...
Read more >
For loop with range - Learn Python 3 - Snakify
The last number is not included. There's a reduced form of range() - range(max_value) , in which case min_value is implicitly set to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found