WordPress添加FPS帧率显示-子比主题论坛-WordPress-轻论坛

WordPress添加FPS帧率显示

预览图

27637339e1f0

使用方法

将下方代码放入后台网站管理后台—》主题设置—》自定义代码—》自定义javascript代码,把下面的js代码复制粘贴到里面即可。

js代码

// FPS帧 $(‘body’).before(‘‘); var showFPS = (function(){ var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000/60); }; var e,pe,pid,fps,last,offset,step,appendFps; fps = 0; last = Date.now(); step = function(){ offset = Date.now() – last; fps += 1; if( offset >= 1000 ){ last += offset; appendFps(fps); fps = 0; } requestAnimationFrame( step ); }; appendFps = function(fps){ console.log(fps+’FPS’); $(‘#fps’).html(fps+’FPS’); }; step(); })();

 

请登录后发表评论

    没有回复内容