View Source Scenic.Primitive.Arc (Scenic v0.11.2)

Draw an arc on the screen.

An arc is a segment that traces part of the outline of a circle. If you are looking for something shaped like a piece of pie, then you want a segment.

Arcs are often drawn on top of a segment to get an affect where a piece of pie is filled in, but only the curvy edge is stroked.

Note that you can fill an arc, but that will result in a shape that looks like a potato wedge.

data

Data

{radius, angle}

The data for an arc is a tuple.

  • radius - the radius of the arc
  • angle - the angle the arc is swept through in radians

note

Note

The format for Arc has changed since v0.10. It used to be {radius, start_angle, end_angle}. You can achieve the same effect in the new, simpler format by using the same radius and the new angle is the difference between the old end_angle and start_angle. Then you can apply a rotation transform to get it in the right position.

styles

Styles

This primitive recognizes the following styles

  • hidden - show or hide the primitive
  • scissor - "scissor rectangle" that drawing will be clipped to.
  • fill - fill in the area of the primitive
  • cap - says how to draw the ends of the arc.
  • stroke - stroke the outline of the primitive. In this case, only the curvy part.

usage

Usage

You should add/modify primitives via the helper functions in Scenic.Primitives

graph
  |> arc( {100, 1.5}, stroke: {1, :yellow} )

Link to this section Summary

Functions

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.

Link to this section Types

@type styles_t() :: [:hidden | :scissor | :fill | :stroke_width | :stroke_fill | :cap]
@type t() :: {radius :: number(), angle :: number()}

Link to this section Functions

Link to this function

compile(primitive, styles)

View Source
@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.