ctx_fillText(ctx, text, x, y, fontSize = 18, fillStyle = "#ff0", fontWeight = "normal") {
// 设置字体
ctx.font = `normal normal ${fontWeight} ${fontSize}px 黑体`;
// 设置颜色
ctx.fillStyle = fillStyle;
// 设置水平对齐方式
ctx.textAlign = "left";
// 设置垂直对齐方式
ctx.textBaseline = "middle";
// 绘制文字(参数:要写的字,x坐标,y坐标)
ctx.fillText(text, x, y);
},
canvas 绘制文字
最新推荐文章于 2024-06-08 22:16:13 发布