Game Development Reference
In-Depth Information
ctx.lineWidth = 5;
ctx.moveTo(0, 0);
ctx.lineTo(100, 100);
ctx.lineTo(canvas.width, 0);
// This call is also useless because the line
hasn't been drawn yet
ctx.strokeStyle = "#ca0";
ctx.moveTo(10, canvas.height - 10);
ctx.lineTo(canvas.width - 10, canvas.height *
0.5);
// This color is applied to every line drawn so
far
ctx.strokeStyle = "#f5a";
// The line is finally drawn here
ctx.stroke();
Search WWH ::




Custom Search