Triangle

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

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

_triangle is used to draw a triangle.

Info This function may only be called within a canvas draw callback

Return value

This function won't return any value.

Arguments

# Argument Type Description
1 x1 Number Left point of the first corner of the triangle
2 y1 Number Top point of the first corner of the triangle
3 x2 Number Left point of the second corner of the triangle
4 y2 Number Top point of the second corner of the triangle
5 x3 Number Left point of the third corner of the triangle
6 y3 Number Top point of the third corner of the triangle

Example

canvas_id = canvas_add(0, 0, 200, 200, function()
  -- Create a triangle
  _triangle(100, 0, 0, 200, 200, 200)

  _fill("red")
end)
Output of code above