fillStyle বৈশিষ্ট্য
fillStyle বৈশিষ্ট্য ক্যানভাসে আঁকার সময়
আকৃতি পূরণ করার রঙ নির্ধারণ করে। বৈশিষ্ট্যের মান
হল যেকোনো CSS
রঙের একক।
সিনট্যাক্স
প্রসঙ্গ.fillStyle = রঙ;
উদাহরণ
আসুন 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.fillStyle = 'red';
ctx.fill();
:
আরও দেখুন
-
strokeStyleপদ্ধতি,
যা লাইনের রঙ সেট করে