HTML canvas quadraticCurveTo() နည်းလမ်း
ဥပမာ
လေးထောင့်ပုံ Bézier မျဉ်းကွေးကို ဆွဲပါ-
JavaScript-
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(20, 20);
ctx.quadraticCurveTo(20, 100, 200, 20);
ctx.stroke();
Browser ပံ့ပိုးမှု
ဇယားရှိ နံပါတ်များသည် နည်းလမ်းကို အပြည့်အဝထောက်ခံသည့် ပထမဆုံးဘရောက်ဆာဗားရှင်းကို သတ်မှတ်ပေးသည်။
Method | |||||
---|---|---|---|---|---|
quadraticCurveTo() | Yes | 9.0 | Yes | Yes | Yes |
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
quadraticCurveTo() နည်းလမ်းသည် quadratic Bézier မျဉ်းကွေးကို ကိုယ်စားပြုသည့် သတ်မှတ်ထားသော ထိန်းချုပ်အမှတ်များကို အသုံးပြုခြင်းဖြင့် လက်ရှိလမ်းကြောင်းသို့ အမှတ်တစ်ခု ထပ်လောင်းသည်။
လေးထောင့်ပုံ Bézier မျဉ်းကွေးသည် အမှတ်နှစ်မှတ် လိုအပ်သည်။ ပထမအချက်သည် လေးထောင့်ပုံစံ Bézier တွက်ချက်မှုတွင် အသုံးပြုသည့် ထိန်းချုပ်ရေးအမှတ်ဖြစ်ပြီး ဒုတိယအချက်မှာ မျဉ်းကွေးအတွက် အဆုံးမှတ်ဖြစ်သည်။ မျဉ်းကွေးအတွက် စမှတ်သည် လက်ရှိလမ်းကြောင်း၏ နောက်ဆုံးအမှတ်ဖြစ်သည်။ လမ်းကြောင်းတစ်ခုမရှိပါက၊ အစမှတ်ကိုသတ်မှတ်ရန် startPath() နှင့် moveTo() နည်းလမ်းများကို အသုံးပြုပါ။
အကြံပြုချက်- bezierCurveTo() နည်းလမ်းကို စစ်ဆေးကြည့်ပါ ။ တစ်ခုအစား ထိန်းချုပ်ရန်အချက်နှစ်ချက်ရှိသည်။
JavaScript syntax- | စကား စပ် .quadraticCurveTo( cpx,cpy,x,y ); |
---|
ကန့်သတ်တန်ဖိုးများ
Parameter | Description | Play it |
---|---|---|
cpx | The x-coordinate of the Bézier control point | |
cpy | The y-coordinate of the Bézier control point | |
x | The x-coordinate of the ending point | |
y | The y-coordinate of the ending point |
❮ HTML Canvas အကိုးအကား