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