Perfect Circle Drawer

Draws a perfect circle

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला 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);