Skip to content
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

getCurrentFrame not working as intended #3108

Open
pixelmultiplo opened this issue Aug 8, 2024 · 1 comment
Open

getCurrentFrame not working as intended #3108

pixelmultiplo opened this issue Aug 8, 2024 · 1 comment

Comments

@pixelmultiplo
Copy link

I'm setting up a new animation and i want to store the current frame in a variable. Then i play the animation for the first 10 frames, then for the frames from 10 to 20.

The value of instance.currenFrame is wrong, it goes from 0 to 10 both times. Is there any way to know at which point of the whole animation i am at? This does not seem like something so hard to have, why is the instance.currenFrame behaviour is so counter-intuitive?

const instance = lottie.loadAnimation({
      container: document.querySelector("#lottie"),
      animationData: battery,
      autoplay: false,
      loop: false,
      renderer: "svg",
    });

    instance.addEventListener('drawnFrame', (e) => {
      setCurrentFrame(instance.currenFrame)
    })

instance.playSegments([0, 10], true)
instance.playSegments([10, 20], true)
@melMass
Copy link

melMass commented Oct 14, 2024

CurrentFrame works fine, but not totalFrame when using segments.. it seems to miscalculate it

Screen.Recording.2024-10-14.at.6.06.29.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants