HTML canvas strokeStyle ပိုင်ဆိုင်မှု
ဥပမာ
စတုဂံပုံဆွဲပါ။ အနီရောင်၏ လေဖြတ်ခြင်းအရောင်ကို သုံးပါ
JavaScript-
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.strokeStyle = "#FF0000";
ctx.strokeRect(20, 20, 150, 100);
Browser ပံ့ပိုးမှု
ဇယားရှိ နံပါတ်များသည် ပိုင်ဆိုင်မှုကို အပြည့်အဝထောက်ခံသည့် ပထမဆုံးဘရောက်ဆာဗားရှင်းကို သတ်မှတ်ပေးသည်။
Property | |||||
---|---|---|---|---|---|
strokeStyle | Yes | 9.0 | Yes | Yes | Yes |
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
StrokeStyle ပိုင်ဆိုင်မှုသည် လေဖြတ်ခြင်းအတွက် အသုံးပြုသည့် အရောင်၊ gradient သို့မဟုတ် ပုံစံကို သတ်မှတ်ပေးသည် သို့မဟုတ် ပြန်ပေးသည်။
မူလတန်ဖိုး: | #၀၀၀၀၀၀ |
---|---|
JavaScript syntax- | context .strokeStyle= အရောင် | gradient | ပုံစံ ; |
အိမ်ခြံမြေတန်ဖိုးများ
Value | Description | Play it |
---|---|---|
color | A CSS color value that indicates the stroke color of the drawing. Default value is #000000 | |
gradient | A gradient object (linear or radial) used to create a gradient stroke | |
pattern | A pattern object used to create a pattern stroke |
နောက်ထပ် ဥပမာများ
ဥပမာ
စတုဂံပုံဆွဲပါ။ gradient လေဖြတ်ခြင်းကို သုံးပါ-
JavaScript-
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var gradient = ctx.createLinearGradient(0, 0, 170, 0);
gradient.addColorStop("0", "magenta");
gradient.addColorStop("0.5" ,"blue");
gradient.addColorStop("1.0", "red");
// Fill with gradient
ctx.strokeStyle = gradient;
ctx.lineWidth = 5;
ctx.strokeRect(20, 20, 150, 100);
ဥပမာ
ဖျော့ဖျော့ဖျော့ဖျော့ဖြင့် "ပြုံးကြီး!" ဟူသော စာသားကို ရေးပါ။
JavaScript-
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.font = "30px Verdana";
// Create gradient
var gradient = ctx.createLinearGradient(0, 0, c.width, 0);
gradient.addColorStop("0", "magenta");
gradient.addColorStop("0.5", "blue");
gradient.addColorStop("1.0", "red");
// Fill with gradient
ctx.strokeStyle = gradient;
ctx.strokeText("Big smile!", 10, 50);
❮ HTML Canvas အကိုးအကား