I am currently coding a game in HTML5 canvas and finding it difficult to change the background gradient of the canvas to a background image for the main menu.
Here is my code for the gradient background:
Any help would be appreciated, I have tried everything.
Here is my code for the gradient background:
Code:
if (MainMenu)
{
var gradient = ctx.createLinearGradient(0, 0, 0, 0);
gradient.addColorStop (0, "black");
ctx.fillStyle = gradient;
ctx.fillRect (0, 0, 1024, 660);
}
Any help would be appreciated, I have tried everything.