Rel*_*lla 1 html javascript statistics jquery
所以有很棒的stats.js,我需要它给我它当前的 FPS 值。这样的事情怎么办?
所以我尝试
stats.domElement.style.position = 'absolute';
stats.domElement.style.left = '0px';
stats.domElement.style.top = '0px';
$('body').append(stats.domElement );
setInterval( function () { stats.update();}, 1000 / 60 );
setInterval(function () { if(stats._fps <= 50){
// Do stuff for slow guys
}}, 1000 );
Run Code Online (Sandbox Code Playgroud)
该统计对象只有两个公共属性:domElement和update()。
要检索 FPS,您必须向getFPSStatus 构造函数返回的对象添加一个函数,如下所示:
return {
domElement: _container,
getFPS: function () {
return _fps;
},
update: function () {
// ...
}
};
Run Code Online (Sandbox Code Playgroud)
这样,您可以使用 检索 FPS 值stats.getFPS()。
| 归档时间: |
|
| 查看次数: |
2856 次 |
| 最近记录: |