Reference triangle()

triangle()

Draws a triangle.

A triangle is a three-sided shape defined by three points. The first two parameters specify the triangle's first point (x1, y1). The middle two parameters specify its second point (x2, y2). And the last two parameters specify its third point (x3, y3).

Examples

Syntax

triangle(x1, y1, x2, y2, x3, y3)

Parameters

x1
Number:

x-coordinate of the first point.

y1
Number:

y-coordinate of the first point.

x2
Number:

x-coordinate of the second point.

y2
Number:

y-coordinate of the second point.

x3
Number:

x-coordinate of the third point.

y3
Number:

y-coordinate of the third point.

Notice any errors or typos? Please let us know. Please feel free to edit src/core/shape/2d_primitives.js and open a pull request!

Related References