Curves.Bezier.Predefined (curves v0.2.3)

Copy Markdown View Source

Shortcuts for quickly getting a list of points that can be passed into Curves.define_bezier/1

Usage

    iex> alias Curves.Bezier.Predefined
    iex> Predefined.get_coords(:linear_up_right)
    [{0, 0}, {1, 1}]
    iex> [:ease | _] = Predefined.list()
    iex> Predefined.get_coords(:ease_in_out_cubic)
    [{0.0, 0.0}, {0.65, 0.0}, {0.35, 1.0}, {1.0, 1.0}]

Summary

Types

The type of curve

A list of curve keys

A map of useful info about a predefined curve.

A list of curve type info

Functions

Return a map with details about a specific curve.

Return a tensor of points for a given key. Mainly for internal use.

Return coordinates list for a given key

Return a list of all keys that can be used with get/2

Return a list of all keys, within a given curve order, that can be used with get/2 (linear = 1, quadratic = 2, cubic = 3)

Return list of all details for all predefined curves

Types

curve_key()

@type curve_key() :: atom()

The type of curve

curve_keys()

@type curve_keys() :: [curve_key()]

A list of curve keys

curve_type_info()

@type curve_type_info() :: %{
  order: Curves.Utils.Types.order(),
  key: curve_key(),
  points: Curves.Utils.Types.point_list()
}

A map of useful info about a predefined curve.

curve_type_infos()

@type curve_type_infos() :: [curve_type_info()]

A list of curve type info

Functions

details(k)

@spec details(curve_key()) :: curve_type_info()

Return a map with details about a specific curve.

Examples

iex> Curves.Bezier.Predefined.details(:linear_up_right)
%{k: :linear_up_right, points: , order: 1}

get(k, opts \\ [])

Return a tensor of points for a given key. Mainly for internal use.

get_coords(k)

@spec get_coords(curve_key()) :: Curves.Utils.Types.point_list()

Return coordinates list for a given key

list()

@spec list() :: curve_keys()

Return a list of all keys that can be used with get/2

Examples

iex> [:ease | _] = Curves.Bezier.Predefined.list()

list(order)

Return a list of all keys, within a given curve order, that can be used with get/2 (linear = 1, quadratic = 2, cubic = 3)

Examples

iex> [:linear | _] = Curves.Bezier.Predefined.list(1)
iex> [:quadratic_down | _] = Curves.Bezier.Predefined.list(2)

list_details()

@spec list_details() :: curve_type_info()

Return list of all details for all predefined curves