Scenic.Primitives.rectangle

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

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

View Source

Specs

rectangle(
  source :: Scenic.Graph.t() | Scenic.Primitive.t(),
  rectangle :: {width :: number(), height :: number()},
  options :: list()
) :: Scenic.Graph.t() | Scenic.Primitive.t()

Add a rectangle to a graph.

Rectangles are defined by a width and height.

Data:

{ width, height }

The following example will draw a rectangle.

graph
|> rectangle( {100, 200} )

Styles

Rectangles 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, except optimized out to do nothing.
  • :stroke - The width and paint to draw the outline with. If the stroke is not specified then 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
|> rectangle( {100, 200},
  fill: :red, stroke: {3, :blue}, join: :round )