HTML canvas fillRect() နည်းလမ်း
ဥပမာ
150*100 pixels အပြည့်ရှိသော စတုဂံကိုဆွဲပါ-
JavaScript-
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.fillRect(20, 20, 150, 100);
Browser ပံ့ပိုးမှု
ဇယားရှိ နံပါတ်များသည် နည်းလမ်းကို အပြည့်အဝထောက်ခံသည့် ပထမဆုံးဘရောက်ဆာဗားရှင်းကို သတ်မှတ်ပေးသည်။
Method | |||||
---|---|---|---|---|---|
fillRect() | Yes | 9.0 | Yes | Yes | Yes |
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
fillRect() method သည် "filled" စတုဂံပုံဆွဲသည်။ ဖြည့်စွက်မှု၏ မူရင်းအရောင်မှာ အနက်ရောင်ဖြစ်သည်။
အကြံပြုချက်- ပုံဆွဲခြင်းအားဖြည့်ရန် အသုံးပြုသော အရောင်၊ gradient သို့မဟုတ် ပုံစံတစ်ခုကို သတ်မှတ်ရန် fillStyle ပိုင်ဆိုင်မှုကို အသုံးပြု ပါ။
JavaScript syntax- | အကြောင်းအရာ .fillRect( x၊y၊width၊height ) ; |
---|
ကန့်သတ်တန်ဖိုးများ
Parameter | Description | Play it |
---|---|---|
x | The x-coordinate of the upper-left corner of the rectangle | |
y | The y-coordinate of the upper-left corner of the rectangle | |
width | The width of the rectangle, in pixels | |
height | The height of the rectangle, in pixels |
❮ HTML Canvas အကိုးအကား