Closed mikkelkai closed 8 years ago
Hi @mikkelkai, this is great! But this improvement is breaking some animations that I had done. I'm trying to find out why it is not working properly. Maybe I'll prepare a demo to show you the issue. Your pull request is very welcome anyway :) Looking forward to merge this!
That's unfortunate, but i would be happy to help you fix it :)
I've created 2 demos to show you how an animation work with and without the pull request. Seems to be a Firefox issue. It's working properly in Chrome (not tested in others browsers).
Demo original: http://jsfiddle.net/lmgonzalves/e2vbuaz6/1/ Demo with the pull request included: http://jsfiddle.net/lmgonzalves/ptzz2x4k/2/
Note the unwanted delay in the second demo (only Firefox).
The error seems to happen because of how firefox handles the callback (works fine in safari too). Demo with setInterval instead of callback: https://jsfiddle.net/s8qoeg6y/ I can't look at it anymore right now, but i'll likely look in to i later today :)
Good fix man!
But I need to get it working using callback
too.
I really appreciate your efforts to help :+1:
It seems that firefox was stopping the current animationFrame function when calling cancelAnimationFrame from it. Anyway the bug should be fixed now :)
@mikkelkai
I've experimenting a very strange behavior with requestAnimationFrame
. You can see the details in this StackOverflow question, and also you can check the demos:
Can you help me with this? I really have no idea what's going on, so any help is welcome :)
Solved! Here is the answer :)
Nice, sorry i didn't get around to look at it
Use requestAnimtionFrame for better performance in modern browsers and add polyfill for older.