HTML canvas clearRect() နည်းလမ်း
ဥပမာ
ပေးထားသည့် စတုဂံအတွင်း ထောင့်မှန်စတုဂံကို ရှင်းလင်းပါ။
JavaScript-
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);
Browser ပံ့ပိုးမှု
ဇယားရှိ နံပါတ်များသည် နည်းလမ်းကို အပြည့်အဝထောက်ခံသည့် ပထမဆုံးဘရောက်ဆာဗားရှင်းကို သတ်မှတ်ပေးသည်။
Method | |||||
---|---|---|---|---|---|
clearRect() | Yes | 9.0 | Yes | Yes | Yes |
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
clearRect() နည်းလမ်းသည် ပေးထားသည့် ထောင့်မှန်စတုဂံအတွင်း သတ်မှတ်ထားသော ပစ်ဆယ်များကို ရှင်းလင်းပေးသည်။
JavaScript syntax- | စကား စပ် .clearRect(x၊y၊width၊height ) ; |
---|
ကန့်သတ်တန်ဖိုးများ
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 Canvas အကိုးအကား