我正在尝试更改画布上每行消息的颜色,但到目前为止还没有成功。我已经尝试为它们中的每一个创建变量,但仍然没有运气。任何帮助,将不胜感激。
function initiate(){
var elem = document.getElementById("canvas");
canvas = elem.getContext("2d");
addEventListener("mousemove", animation);
canvas.shadowColor = "rgba(0, 0, 0, 0.5)";
canvas.shadowOffsetX = 4;
canvas.shadowOffsetY = 4;
canvas.shadowBlur = 5;
canvas.font = "bold 24px verdana, sans-serif ";
var welcomeMessage ="Welcome to the store!";
canvas.textAlign = "start";
canvas.textBaseline = "bottom";
canvas.fillText(welcomeMessage, 400, 50);
canvas.font = "bold 14px verdana, sans-serif";
var message2 = "Your favorite store for videos games and latest DVDs!";
canvas.textAlign = "start";
canvas.textBaseline = "bottom";
canvas.fillText(message2, 400, 100);
canvas.font = "bold 12px verdana, sans-serif";
canvas.textAlign = "start";
canvas.textBaseline = "bottom";
// Create gradient
//var gradient=canvas.createLinearGradient(0,0,c.width,0);
//gradient.addColorStop("0","magenta");
//gradient.addColorStop("0.5","blue");
//gradient.addColorStop("1.0","red");
//canvas.fillStyle = gradient;
canvas.fillText(" <-- Move your mouse aroud to interact with Macroplay smily!", 400, 250);
}