看:
https://github.com/mrdoob/three.js/issues/642
想要控制动画的 FPS 是否是继续使用 setTimeout 而不是 requestAnimationFrame 的好理由?
requestAnimationFrame 以有限的帧速率
您基本上是在考虑必须覆盖内置的 requestAnimationFrame 功能(旨在尽可能快地制作动画),并改为创建计时器,但目前 kineticjs 中没有内置功能来设置动画的帧速率。
您可以进入从 kineticjs 网站下载的 .js 文件,并弄乱以下代码:
Kinetic.Animation._animationLoop = function() {
var that = this;
if(this.animations.length > 0) {
this._runFrames();
Kinetic.Animation.requestAnimFrame(function() {
that._animationLoop();
});
}
else {
this.animRunning = false;
}
};
Kinetic.Animation._handleAnimation = function() {
var that = this;
if(!this.animRunning) {
this.animRunning = true;
that._animationLoop();
}
};
RAF = (function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || Kinetic.Animation.fixedRequestAnimFrame;
})();
Kinetic.Animation.requestAnimFrame = function(callback) {
var raf = Kinetic.DD && Kinetic.DD.moving ? this.fixedRequestAnimFrame : RAF;
raf(callback);
};
}