Scenic.Primitives.triangle

You're seeing just the function triangle, go back to Scenic.Primitives module for more information.
Link to this function

triangle(graph_or_primitive, triangle, opts \\ [])

View Source

Specs

triangle(
  source :: Scenic.Graph.t() | Scenic.Primitive.t(),
  triangle :: Scenic.Math.triangle(),
  options :: list()
) :: Scenic.Graph.t() | Scenic.Primitive.t()

Add a Triangle to a graph.

Triangles are defined by three points on the screen.

Data:

{ {x0,y0}, {x1,y1}, {x2,y2} }

The following example will draw a triangle.

graph
|> triangle( {{10,20}, {100,20}, {50, 120}} )

Styles

Triangles honor the following styles

  • :hidden - If true, the outline is rendered. If false, it is skipped. Default: false.
  • :fill - Fills in the interior with the specified paint. If not set, the default is to not draw anything in the interior. This is similar to specifying fill: :clear, but optimized.
  • :stroke - The width and paint to draw the outline with. If the stroke is not specified, the default stroke is {1, :white}.
  • :join - Specifies how the lines are joined together where they meet. Can be one of :miter, :round, or :bevel. If join is not specified, then the default is :miter.
  • :miter_limit - Apply an optional miter limit to the joints. If the angle is very shallow, the pointy bit might extend out far beyond the joint. Specifying :miter_limit puts a limit on the joint and bevels it if it goes out too far.

Example:

graph
|> triangle( {{10,20}, {100,20}, {50, 120}}, fill: :red,
  stroke: {3, :blue}, join: :round )