updated 屏幕高刷频率限制
This commit is contained in:
parent
29a2728b94
commit
589e348662
7
game.js
7
game.js
@ -323,7 +323,14 @@ function Game(id,params){
|
||||
//动画开始
|
||||
this.start = function() {
|
||||
var f = 0; //帧数计算
|
||||
var timestamp = (new Date()).getTime();
|
||||
var fn = function(){
|
||||
var now = (new Date()).getTime();
|
||||
if(now-timestamp<16){ // 限频,防止高刷屏幕动画过快
|
||||
_hander = requestAnimationFrame(fn);
|
||||
return false;
|
||||
}
|
||||
timestamp = now;
|
||||
var stage = _stages[_index];
|
||||
_context.clearRect(0,0,_.width,_.height); //清除画布
|
||||
_context.fillStyle = '#000000';
|
||||
|
Loading…
x
Reference in New Issue
Block a user