新建Javascript文件1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253var rAF = function () { return ( window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60); } );}();var frame = 0;var allFrameCount = 0;var lastTime = Date.now();var lastFameTime = Date.now();var loop = function () { var now = Date.now(); var fs = (now - lastFameTime); var fps = Math.round(1000 / fs); lastFameTime = now; // 不置 0,在动画的开头及结尾记录此值的差值算出 FPS allFrameCount++; frame++; if (now > 1000 + lastTime) { var fps = Math.round((frame * 1000) / (now - lastTime)); if(fps<=6){ var kd=`<span style="color:#bd0000">卡成ppt</span>` } else if(fps<=10){ var kd=`<span style="color:red">电竞级帧率</span>` } else if(fps<=14){ var kd=`<span style="color:yellow">难受</span>` } else if(fps<24){ var kd=`<span style="color:orange">卡</span>` } else if(fps<=40){ var kd=`<span style="color:green">...</span>` } else{ var kd=`<span style="color:#425aef">正常</span>` } document.getElementById("fps").innerHTML=`FPS:${fps} ${kd}`; frame = 0; lastTime = now; }; rAF(loop);}loop(); 新建Css文件1234567891011121314151617181920/* 帧率检测 */#fps { position: fixed; /* 指定位置 */ left: 10px; bottom: 10px; z-index: 1919810;}[data-theme="light"] #fps { background-color: rgba(255, 255, 255, 0.85); backdrop-filter: var(--backdrop-filter); padding: 4px; border-radius: 4px;}[data-theme="dark"] #fps { background-color: rgba(0, 0, 0, 0.72); backdrop-filter: var(--backdrop-filter); padding: 4px; border-radius: 4px;} 修改_config.butterfly.yml1234567891011# Inject# Insert the code to head (before '</head>' tag) and the bottom (before '</body>' tag)# 插入代码到头部 </head> 之前 和 底部 </body> 之前inject: head: # 零零散散的css - <link rel="stylesheet" href="/css/新建的fps的.css"> bottom: # 显示FPS - <script type="text/javascript" src="/js/新建的fps的.js"></script> - <div id="fps"></div>