chenglou / chenglou/react-motion
Restarting logic causes slow animations to be stuck forever
- Dominant language
- JavaScript
- Stars
- 21.9k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Sometimes animations with a low frame rate seem to get stuck forever, jumping back and forth. Here's a demo case: http://bl.ocks.org/herrstucki/cf4978db089df7b25262
I traced it to this bit of code:
``` js
// more than 10 frames? prolly switched browser tab. Restart
if (this.accumulatedTime > msPerFrame * 10) {
this.accumulatedTime = 0;
}
```
https://github.com/chenglou/react-motion/blob/master/src/TransitionMotion.js#L368-L371
When I remove it, the problem goes away. I'm not too familiar with the RM code, so I can't really say if this is an essential piece. In any case, the 10 frames heuristic seems a bit too strict (I know that 6 FPS isn't really acceptable but you don't always know the performance of the user's machine). And shouldn't the animation just resume or skip to the end instead?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.