playSegments + loop : currentFrame shift to 0 after segment's completed
See original GitHub issueHi !
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:
- Created 5 years ago
- Comments:13

Top Related StackOverflow Question
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.
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!