Search documentation of Plushie

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

Copy Markdown View Source

Angle type for canvas rotation and arc parameters.

Accepts degrees by default. Use `{value, :rad}` for explicit radians or `{value, :deg}` for explicit degrees.

    rotate(45)              # 45 degrees
    rotate({45, :deg})      # same
    rotate({0.785, :rad})   # explicit radians

The renderer receives degrees on the wire. Bare numbers are treated as degrees (matching the Rust SDK convention). Values are normalized to degrees at cast time.

When used as a field type, values are normalized to degrees at cast time. The `to_radians/1` function is available for contexts that need radian values.

## Summary

### Types

t()

### Functions

to_degrees(v)

Converts an angle value to degrees.

to_radians(v)

Converts an angle value to radians.

## Types

# t()

    @type t() :: number() | {number(), :deg} | {number(), :rad}

## Functions

# to_degrees(v)

    @spec to_degrees(t()) :: float()

Converts an angle value to degrees.

Accepts bare numbers (already degrees), `{value, :deg}`, or `{value, :rad}`.

# to_radians(v)

    @spec to_radians(t()) :: float()

Converts an angle value to radians.

Accepts bare numbers (degrees), `{value, :deg}`, or `{value, :rad}`.