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.

playSegments + loop : currentFrame shift to 0 after segment's completed

See original GitHub issue

Hi !

So I have an issue about the playSegments method. I want the animation to play a certain part and then loop on another part, example on this codepen : https://codepen.io/airnan/pen/RawvLB

This works just fine, however here is my problem : I want to get the currentFrame every frame (using onEnterFrame) to play my animation backward once the mouse leave the animation div. I succeded to save the currentFrame but it shift to 0 every time a segment is complete.

For example if I do :

anim.playSegments([[0,30],[30,40], true];

anim.onEnterFrame = fSaveFrame;

function fSaveFrame() {
    curFrame = anim.currentFrame;
    console.log(curFrame);
}

After the [0,30] part is complete, curFrame will shift to 0 & display from 0 to 10 for the [30,40] part.

Because of that i’m not able to get the right frame and play my animation backward in a smooth way. Is there a way to get the right frame in the anim ? (I already tried currentRawFrame which displays the same thing) Or maybe a way to know which segment is playing ?

Thanks a lot, Sebastien

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
appeyecommented, Sep 3, 2019

Ah, thank u UstymUkhman. I will try this solution also. I managed to solve my issue by making the two first frames identical and then do like this: anim.playSegments([[20-10],[1-0]], true);

a bit odd but it seems to do the job.

1reaction
Eklorcommented, Jan 30, 2019

I understand better now thank you, it’s like getting out of the closed context of AE composition and having a broader way to interact with the layers. It was hard to visualise at first for my designer formated view, do you plan on working on more documentation on how to use this tool? I think for instance completing the wiki for every single code elements (events, methods, …) including what they refer to and some usage exemples? That would really help people like me. Thanks again for your work and your help! The tool is awesome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I use Lottie's onSegmentStart event handler?
I just used the playSegments([40,70]) function which reports frames 0 through 29 in enterFrame (not very helpful!). – Simon_Weaver. Oct 15 at 2: ......
Read more >
Lottie/Bodymovin HTML template help needed - General
I'm currently having difficulty getting inputs from the client. Is there any way i could tell casparcg to input the json data into...
Read more >
Playing a Lottie file on a button click - Tumult Forums
Hi, is there a way to get the current frame on a mouseover? I have an ani…mation that is looping via playSegments() -...
Read more >
bodymovin — Blog — GANNON.TV
This is an animation I created in After Effects using Shape layers. I exported it using Bodymovin, added in an SVG slider created...
Read more >
Diff - external/github.com/airbnb/lottie-web - Google Git
0 : d / max), + v = max / 255; + + switch (max) { + case min: h = 0; break;...
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