canvas文字描边
您可以使用Canvas的strokeText方法来描边文字。以下是一个示例代码:
<canvas id="myCanvas"></canvas>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.font = "30px Arial";
ctx.strokeStyle = "red";
ctx.lineWidth = 2;
ctx.strokeText("Hello World", 50, 50);
在上面的代码中,我们设置了文字的字体大小,描边的颜色和宽度,并使用strokeText方法将“Hello World”文本描边绘制到画布上。
原文地址: https://www.cveoy.top/t/topic/cVm9 著作权归作者所有。请勿转载和采集!