Human Vision Mask Overlay

Adds an adjustable overlay that mimics the field of vision of the human eye

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Human Vision Mask Overlay
// @description  Adds an adjustable overlay that mimics the field of vision of the human eye
// @match        *://*/*
// @version 0.0.1.20250614212221
// @namespace https://greasyfork.org/users/1435046
// ==/UserScript==

(function () {
    'use strict';

    // Create the vision mask
    const visionMask = document.createElement('div');
    visionMask.id = 'vision-mask-overlay';
    Object.assign(visionMask.style, {
        position: 'fixed',
        top: '0',
        left: '0',
        width: '100vw',
        height: '100vh',
        pointerEvents: 'none',
        zIndex: '999999',
        background: 'radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.4) 60%, rgba(0,0,0,0.8) 85%, rgba(0,0,0,1) 100%)',
        transition: 'background 0.2s ease-out'
    });
    document.body.appendChild(visionMask);

    // Create control panel
    const controlPanel = document.createElement('div');
    Object.assign(controlPanel.style, {
        position: 'fixed',
        bottom: '10px',
        right: '10px',
        backgroundColor: 'white',
        color: 'black',
        padding: '10px',
        fontSize: '14px',
        border: '1px solid black',
        borderRadius: '6px',
        zIndex: '1000000',
        fontFamily: 'monospace',
        userSelect: 'none'
    });

    controlPanel.innerHTML = `
        <label>Inner Radius (%): <input id="inner-radius" type="range" min="10" max="90" value="40"></label><br>
        <label>Mid Radius (%): <input id="mid-radius" type="range" min="10" max="95" value="60"></label><br>
        <label>Outer Radius (%): <input id="outer-radius" type="range" min="10" max="100" value="85"></label>
    `;
    document.body.appendChild(controlPanel);

    // Get references to inputs
    const innerInput = controlPanel.querySelector('#inner-radius');
    const midInput = controlPanel.querySelector('#mid-radius');
    const outerInput = controlPanel.querySelector('#outer-radius');

    function updateGradient() {
        const inner = innerInput.value;
        const mid = midInput.value;
        const outer = outerInput.value;

        visionMask.style.background = `radial-gradient(ellipse at center, rgba(0,0,0,0) ${inner}%, rgba(0,0,0,0.4) ${mid}%, rgba(0,0,0,0.8) ${outer}%, rgba(0,0,0,1) 100%)`;
    }

    innerInput.addEventListener('input', updateGradient);
    midInput.addEventListener('input', updateGradient);
    outerInput.addEventListener('input', updateGradient);
})();