HTML कैनवास clearRect () विधि
उदाहरण
किसी दिए गए आयत के भीतर एक आयत साफ़ करें:
जावास्क्रिप्ट:
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(0, 0, 300, 150);
ctx.clearRect(20, 20, 100, 50);
ब्राउज़र समर्थन
तालिका में संख्याएं पहले ब्राउज़र संस्करण को निर्दिष्ट करती हैं जो पूरी तरह से विधि का समर्थन करता है।
Method | |||||
---|---|---|---|---|---|
clearRect() | Yes | 9.0 | Yes | Yes | Yes |
परिभाषा और उपयोग
ClearRect () विधि किसी दिए गए आयत के भीतर निर्दिष्ट पिक्सेल को साफ़ करती है।
जावास्क्रिप्ट सिंटैक्स: | संदर्भ .clearRect ( एक्स, वाई, चौड़ाई, ऊंचाई ); |
---|
पैरामीटर मान
Parameter | Description | Play it |
---|---|---|
x | The x-coordinate of the upper-left corner of the rectangle to clear | |
y | The y-coordinate of the upper-left corner of the rectangle to clear | |
width | The width of the rectangle to clear, in pixels | |
height | The height of the rectangle to clear, in pixels |
❮ HTML कैनवास संदर्भ