Perfect Circle Drawer

Draws a perfect circle

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

    // ==UserScript==
    // @name         Perfect Circle Drawer
    // @namespace    example.com
    // @version      1.0
    // @description  Draws a perfect circle
    // @author       You
    // @match        *://*/*  # Change this to match the desired website
    // @grant        GM_addStyle
    // @grant        none
    // ==/UserScript==

    function drawCircle(x, y, radius, color) {
        // Get the canvas element or create one dynamically
        let canvas = document.getElementById('myCanvas');
        if (!canvas) {
            canvas = document.createElement('canvas');
            canvas.id = 'myCanvas';
            canvas.width = 400; // Adjust as needed
            canvas.height = 400; // Adjust as needed
            document.body.appendChild(canvas); // Add to the page
        }

        let ctx = canvas.getContext('2d');

        ctx.beginPath();
        ctx.arc(x, y, radius, 0, 2 * Math.PI);
        ctx.fillStyle = color;
        ctx.fill();
    }

    // Add a button or use a keyboard shortcut
    const button = document.createElement('button');
    button.textContent = 'Draw Circle';
    button.addEventListener('click', function() {
        // Example: Draw a circle at (100, 100) with radius 50 and red color
        drawCircle(100, 100, 50, 'red');
    });

    document.body.appendChild(button);