我的加载屏幕上有画布上的文本,但它太小了。我以某种方式找不到任何关于更改它的正确语法的资源。
我试过:
// examples of what i've tried
canvasContext.font(40);
canvasContext.font(40 + 'px');
canvasContext.fontSize(40);
canvasContext.fontSize(40 + 'px');
canvasContext.font = 40;
canvasContext.font = 40 + 'px';
canvasContext.fontSize = 40;
canvasContext.fontSize = 40 + 'px';
——
//my actual code
window.onload = function () {
canvas = document.getElementById('gameCanvas');
canvasContext = canvas.getContext('2d');
}
function colorText(showWords, textX, textY, fillColor, fontSize) {
//this works -----
canvasContext.fillStyle = fillColor;
canvasContext.fillText(showWords, textX, textY);
//this doesn't ------
canvasContext.fontSize = 40 + 'px';
}
慕哥6287543
相关分类