View Source Scenic.Primitive.Triangle (Scenic v0.12.0-rc.0)
Draw a triangle on the screen.
Data
{point_a, point_b, point_c}
The data for a line is a tuple containing three points.
point_a
- position to start drawing frompoint_b
- position to draw topoint_c
- position to draw to
Styles
This primitive recognizes the following styles
hidden
- show or hide the primitivescissor
- "scissor rectangle" that drawing will be clipped to.fill
- fill in the area of the primitivestroke
- stroke the outline of the primitive. In this case, only the curvy part.join
- control how segments are joined.miter_limit
- control how segments are joined.
Usage
You should add/modify primitives via the helper functions in
Scenic.Primitives
graph
|> triangle(
{{10, 0}, {20, 40}, 0, 20}},
stroke: {1, :yellow}
)
Summary
Functions
Returns the centroid of the triangle. This is used as the default pin when applying rotate or scale transforms.
Compile the data for this primitive into a mini script. This can be combined with others to generate a larger script and is called when a graph is compiled.
Returns a list of styles recognized by this primitive.
Types
@type styles_t() :: [
:hidden
| :scissor
| :fill
| :stroke_width
| :stroke_fill
| :join
| :miter_limit
]
Functions
Returns the centroid of the triangle. This is used as the default pin when applying rotate or scale transforms.
@spec compile(primitive :: Scenic.Primitive.t(), styles :: Scenic.Primitive.Style.t()) :: Scenic.Script.t()
Compile the data for this primitive into a mini script. This can be combined with others to generate a larger script and is called when a graph is compiled.
@spec valid_styles() :: styles_t()
Returns a list of styles recognized by this primitive.