-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select correct ticker function during initialization, not only when document visibility changes #725
Conversation
ugh, it didn't work. I'm pretty sure it did when I tested it year ago |
Was finishing up getting the pause in and eyeing this up next, any idea why it doesn't fix it? |
I'm not sure yet. Animation starts playing in the background as it supposed to, but instead of stopping at the end it plays it backwards to initial state with the same speed, then forward again and so on. I was thinking it might be because of I'll take another look this evening (in like 6 hours) |
I run a D&D game on Thursday evenings, so won't be able to look till tomorrow anyway - and trying to update QUnit to v2 to improve the testing right now ;-) |
Hi. Diidn't had time to take a look into this yesterday, so I'm just getting started. Something has changed indeed. I tried to roll back to ce90611 (year ago), apply the patch and it did the thing. Also works with 1.3.1, but breaks on 1.3.2 release. I also noticed another new behavior with 1.3.2, which is not mentioned in release notes: all running animations are getting fast-forwarded to the end with the next tick after tab is moved to background. Here's JSFiddle: 1.3.1 and 1.3.2. I don't know if it's intended or not. I can definitely see how this could be a desired behavior, but personally I would consider this a breaking change. Thought, I would let you know asap. Will keep you updated. |
I forgot what kind of value rAF callback receives. This comment has been updated to tell the truth. Caused by 130d2e6. It mixes together I dropped console log there and this is what happens:
And if animation is started while page was in the background and used setTimeout() instead of rAF - we go from bigger to smaller numbers, so animation thinks it should play for the next ~47 years. I'm going to do few things:
Expect another pull request landing in few minutes. I'm too lazy to create an issue for this bug though, so if you use them for tracking various problems - you might want to create one yourself. |
Not going to roll that back - but definitely needs fixing - if it's in the background then it should use the "normal" time, and not the high resolution time. |
…ow() if it doesn't exist. Reference #725
Hopefully this fixes it - can't have a "perfect" timer as the start time isn't known, but looks to be within a couple of ms of the expected time to me - which should hopefully let this PR work properly again :-) |
Here was my take on this. Instead of creating local polifyll for When With this var timeCurrent = Velocity.timestamp && timestamp !== true ? timestamp : performance.now(); could be simplified to var timeCurrent = timestamp; .... Now thinking of what I did with timestamps when performance API is not available, that might lead to problems in environments where With all this in mind, I think you should update that line to simply var timeCurrent = performance.now(); Only this way we know for sure returned values will be count from the same origin in every situation. |
Can confirm - it works properly as is with current master. It's up to you now |
Checking on MDN, If you look at #684 (specifically the graphs in it) you can see that Saying that, it might be worth improving the new polyfill code to try and detect broken API access - maybe check for decimal places, and if none then assume broken? Not quite sure how we can make this part of the test suite either... |
…ow() if it doesn't exist. Reference #725
Fixes #611