Skip to content

Instantly share code, notes, and snippets.

@dennisschaaf
Created December 20, 2011 11:25
Show Gist options
  • Select an option

  • Save dennisschaaf/1501265 to your computer and use it in GitHub Desktop.

Select an option

Save dennisschaaf/1501265 to your computer and use it in GitHub Desktop.
Draw triangles using line commands
// Draw a Line
ctx.beginPath();
ctx.moveTo(10, 100);
ctx.lineTo(110,100);
ctx.lineTo(80, 0);
ctx.lineTo(10, 100);
ctx.stroke();
// Draw another Line
ctx.beginPath();
ctx.moveTo(210, 100);
ctx.lineTo(310,100);
ctx.lineTo(280, 0);
ctx.lineTo(210, 100);
ctx.fill();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment