FPS Display Overlay

Shows a real-time FPS counter in the corner of any site

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         FPS Display Overlay
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Shows a real-time FPS counter in the corner of any site
// @author       Skibidi555
// @match        *://*/*
// @grant        none
// @license      No Copying
// ==/UserScript==

(function () {
    'use strict';

    // Create FPS display box
    const fpsBox = document.createElement("div");
    fpsBox.style.position = "fixed";
    fpsBox.style.top = "20px";
    fpsBox.style.right = "20px";
    fpsBox.style.background = "#28a745";
    fpsBox.style.color = "white";
    fpsBox.style.padding = "10px 15px";
    fpsBox.style.borderRadius = "8px";
    fpsBox.style.fontFamily = "Arial, sans-serif";
    fpsBox.style.fontSize = "16px";
    fpsBox.style.zIndex = "999999";
    fpsBox.style.boxShadow = "0px 0px 10px rgba(0,0,0,0.3)";
    fpsBox.textContent = "FPS: …";
    document.body.appendChild(fpsBox);

    // FPS logic
    let lastFrame = performance.now();
    let frameCount = 0;
    let lastSecond = performance.now();

    function loop() {
        const now = performance.now();
        frameCount++;

        // Every 1 second, update FPS
        if (now - lastSecond >= 1000) {
            fpsBox.textContent = "FPS: " + frameCount;
            frameCount = 0;
            lastSecond = now;
        }

        lastFrame = now;
        requestAnimationFrame(loop);
    }

    requestAnimationFrame(loop);

})();