Game Development Reference
In-Depth Information
// Short hand hex colors are fine
ctx.fillStyle = "#c00";
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Keyword colors are fine, though not as
precise
ctx.strokeStyle = "white";
ctx.lineWidth = 10;
ctx.strokeRect(25, 25, 100, 100);
ctx.strokeRect(175, 25, 100, 100);
// Alpha transparency is also allowed
ctx.fillStyle = "rgba(100, 255, 100, 0.8)";
ctx.fillRect(5, 50, canvas.width - 10, 50);
Search WWH ::




Custom Search