Search documentation of Plushie

# Plushie.Canvas.Circle (Plushie v0.7.2)

Copy Markdown View Source

Canvas circle element with center, radius, and optional styling.

## Summary

### Types

option()
t()

### Functions

build(widget)

Converts this widget struct to a `ui_node()` map.

fill(widget, descriptor)

Fill color or gradient.

fill_rule(widget, descriptor)

Fill rule: "non_zero" or "even_odd".

new(x, y, r)
new(id, x, y, r)

Creates a new element without an explicit ID (auto-assigned by parent container).

new(id, x, y, r, opts)

Creates a new element with the given ID, positional args, and keyword options.

opacity(widget, descriptor)

Opacity from 0.0 to 1.0.

r(widget, descriptor)

Radius in pixels.

stroke(widget, descriptor)

Stroke descriptor.

type_name()

Returns the element type string for the wire protocol.

with_options(widget, opts)

Applies keyword options to an existing widget struct.

x(widget, descriptor)

Center X in pixels.

y(widget, descriptor)

Center Y in pixels.

## Types

# option()

    @type option() ::
      ((((({:x, number()} | {:y, number()}) | {:r, number()}) | {:fill, term()})
        | {:stroke,
           %Plushie.Canvas.Stroke{
             cap: term(),
             color: term(),
             dash: term(),
             join: term(),
             width: term()
           }
           | keyword()
           | map()})
       | {:opacity, number()})
      | {:fill_rule, String.t() | atom()}

# t()

    @type t() :: %Plushie.Canvas.Circle{
      fill:
        term()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      fill_rule:
        (String.t() | atom())
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      id: String.t() | nil,
      opacity:
        number()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      r:
        number()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      stroke:
        %Plushie.Canvas.Stroke{
          cap: term(),
          color: term(),
          dash: term(),
          join: term(),
          width: term()
        }
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      x:
        number()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil,
      y:
        number()
        | Plushie.Animation.Transition.t()
        | Plushie.Animation.Spring.t()
        | Plushie.Animation.Sequence.t()
        | nil
    }

## Functions

# build(widget)

    @spec build(widget :: t()) :: Plushie.Widget.ui_node()

Converts this widget struct to a `ui_node()` map.

# fill(widget, descriptor)

    @spec fill(widget :: t(), value :: term() | nil) :: t()

Fill color or gradient.

Accepts `term()`.

# fill_rule(widget, descriptor)

    @spec fill_rule(widget :: t(), value :: (String.t() | atom()) | nil) :: t()

Fill rule: "non_zero" or "even_odd".

Accepts `String.t() | atom()`.

# new(x, y, r)

# new(id, x, y, r)

Creates a new element without an explicit ID (auto-assigned by parent container).

# new(id, x, y, r, opts)

Creates a new element with the given ID, positional args, and keyword options.

# opacity(widget, descriptor)

    @spec opacity(widget :: t(), value :: number() | nil) :: t()

Opacity from 0.0 to 1.0.

Accepts `number()`.

# r(widget, descriptor)

    @spec r(widget :: t(), value :: number() | nil) :: t()

Radius in pixels.

Accepts `number()`.

# stroke(widget, descriptor)

    @spec stroke(
      widget :: t(),
      value ::
        (%Plushie.Canvas.Stroke{
           cap: term(),
           color: term(),
           dash: term(),
           join: term(),
           width: term()
         }
         | keyword()
         | map())
        | nil
    ) :: t()

Stroke descriptor.

Accepts `%Plushie.Canvas.Stroke{}`.

# type_name()

    @spec type_name() :: String.t()

Returns the element type string for the wire protocol.

# with_options(widget, opts)

    @spec with_options(widget :: t(), opts :: [option()]) :: t()

Applies keyword options to an existing widget struct.

# x(widget, descriptor)

    @spec x(widget :: t(), value :: number() | nil) :: t()

Center X in pixels.

Accepts `number()`.

# y(widget, descriptor)

    @spec y(widget :: t(), value :: number() | nil) :: t()

Center Y in pixels.

Accepts `number()`.