I've come across various sources stating that when you call reverse()
while an animation is playing, it should have the same effect as setting playbackRate
to -1. However, in my case, using reverse()
makes my animation behave erratically and jump around uncontrollably, whereas using playbackRate
works perfectly fine. I really want to utilize reverse()
because of its state-independent nature, but I'm struggling to understand why it's not cooperating for me.
I created a simple example of a rotating square on codesandbox, which you can view here:
Check out the example on CodeSandbox
Could I be overlooking something crucial, or is there more complexity involved in using reverse()
than expected?
UPDATE:
It's possible that there may be a bug specific to CodeSandbox, as demonstrated by this fiddle created by @Kaiido, which seems to work flawlessly.
I am currently using Firefox 75.0 on MacOS. Interestingly, Chrome appears to handle the animation correctly without issues.