strokeStyle ගුණය
strokeStyle ගුණය යනු canvas මත ඇඳීමේදී
රේඛාවේ වර්ණය සකසා දෙන්නකි. මෙම ගුණයේ අගය
ලෙස ඕනෑම CSS
වර්ණ ඒකක භාවිතා කළ හැකිය.
වාක්ය රචනය
context.strokeStyle = color;
උදාහරණය
rect භාවිතයෙන්
සම්මුඛයක් අඳින්න එය රතු පැහැයට වර්ණ කරමු:
<canvas id="canvas" width="200" height="200" style="background: #f4f4f4;"></canvas>
let canvas = document.querySelector('#canvas');
let ctx = canvas.getContext('2d');
ctx.rect(50, 50, 100, 100);
ctx.strokeStyle = 'red';
ctx.stroke();
:
මේවාද බලන්න
-
fillStyleක්රමය,
රූපයේ පසුබිම් වර්ණය සකසයි