我试图改变画布上每一行消息的颜色,但迄今为止没有成功。我尝试为它们创建变量,但仍然没有运气。任何帮助都将不胜感激。
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);
}