airbnb / lottie-web

Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
MIT License
30.42k stars 2.86k forks source link

lottie_worker.min.js stop() doesn't behave the same as lottie.min.js #2988

Open samuelOsborne opened 1 year ago

samuelOsborne commented 1 year ago

Hey folks, @bodymovin

Using the lottie_worker.min.js script and calling stop() once pauses the animation, calling stop() again goes to frame 0.

This is not the same behaviour as lottie.min.js that goes straight to frame 0 when you call stop.

Example case of having to click twice to get to frame 0 on the worker script:

https://codepen.io/Osbro/pen/mdQdKNe

Same code but with lottie-web:

https://codepen.io/Osbro/pen/ZEmERPx

samuelOsborne commented 1 year ago

Seems like goToAndStop(0, true) is behaving the same way on the worker as well, need to call it twice to go to frame 0

bodymovin commented 1 year ago

it seems that the animation correctly goes to frame 0 but the currentFrame property is not correctly reporting it. Is that right?

samuelOsborne commented 1 year ago

@bodymovin Yep seems to be whats happening

samuelOsborne commented 1 year ago

@bodymovin the resetSegments() method seems to missing from the worker script too?

https://codepen.io/Osbro/pen/mdQdKNe?editors=1010