Skip to content
mohayonao edited this page Aug 11, 2014 · 1 revision

triangle

Draws a triangle to the canvas.

Examples

canvas.stroke(12).noFill()
  .triangle(40, 30, 10, 80, 70, 80);

canvas.noStroke().fill([ 5, 13, 6 ])
  .triangle(110, 60, 160, 80, 180, 20);

canvas.stroke(14).fill(6)
  .triangle(220, 20, 220, 80, 280, 20);

Syntax

canvas.triangle(x1, y1, x2, y2, x3, y3);

Parameters

  • x1: int
    • x-coordinate of the first point
  • y1: int
    • y-coordinate of the first point
  • x2: int
    • x-coordinate of the second point
  • y2: int
    • y-coordinate of the second point
  • x3: int
    • x-coordinate of the third point
  • y3: int
    • y-coordinate of the third point

Returns

Canvas: self for method chaining

Related

Clone this wiki locally