Skip to content

Commit

Permalink
Update requestAnimationFrame兼容.js
Browse files Browse the repository at this point in the history
修改兼容requestAnimationFrame时间
1000 ms / 60fps
  • Loading branch information
Rain120 authored May 13, 2019
1 parent 3e949a1 commit c655bc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion requestAnimationFrame兼容.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (!Date.now)
var lastTime = 0;
window.requestAnimationFrame = function(callback) {
var now = Date.now();
var nextTime = Math.max(lastTime + 16, now);
var nextTime = Math.max(lastTime + (1000 / 60), now);
return setTimeout(function() { callback(lastTime = nextTime); },
nextTime - now);
};
Expand Down

0 comments on commit c655bc3

Please sign in to comment.