The 25 easing curves (spec/07 §18), copied from visualize's Visualize.Ease: functions
from t in [0, 1] to a float, nominally in [0, 1] (the elastic_* and back_*
families overshoot).
iex> Macaw.Draw.Ease.quad_in(0.5)
0.25
iex> {:ok, ease} = Macaw.Draw.Ease.by_name("cubic_in_out")
iex> ease.(0.5)
0.5The exact-endpoint clauses match the integer literals 0 and 1 only; the floats
0.0 and 1.0 take the formula (exp_in(0.0) is 2^−10). by_name/1 reads a name by
spelling and refuses an unknown one as {[], {:unknown, :ease, spelling}}, where
visualize raised; frames/2 samples a curve at evenly spaced t.
Every easing answers a value for any number: a t that is no number is
{[], {:type, :number}}, and one outside [0, 1] where the curve is undefined or past a
float's range (a circle's square root of a negative, an exponential's overflow) is
{[], {:domain, t}}.
Summary
Functions
The back_in easing of t (spec/07 §18).
back_in with the overshoot s in place of 1.70158.
The back_in_out easing of t (spec/07 §18).
The back_out easing of t (spec/07 §18).
back_out with the overshoot s in place of 1.70158.
The bounce_in easing of t (spec/07 §18).
The bounce_in_out easing of t (spec/07 §18).
The bounce_out easing of t (spec/07 §18).
The easing of a name, an atom or its string read by spelling: {:ok, fun}, or
{:error, [{[], {:unknown, :ease, spelling}}]}.
The circle_in easing of t (spec/07 §18).
The circle_in_out easing of t (spec/07 §18).
The circle_out easing of t (spec/07 §18).
The cubic_in easing of t (spec/07 §18).
The cubic_in_out easing of t (spec/07 §18).
The cubic_out easing of t (spec/07 §18).
The elastic_in easing of t (spec/07 §18).
The elastic_in_out easing of t (spec/07 §18).
The elastic_out easing of t (spec/07 §18).
The exp_in easing of t (spec/07 §18).
The exp_in_out easing of t (spec/07 §18).
The exp_out easing of t (spec/07 §18).
count values of an easing, named or a 1-arity function, at t = i / (count − 1) for
i in 0..count − 1 when count > 1, and [1.0] for a count of 1 or less;
{:error, faults} for an unknown name.
The linear easing of t (spec/07 §18).
The 25 names, in spec/07 §18's order.
t^e, exponent 3 by default.
2^(e−1)·t^e below one half, else 1 − (−2t + 2)^e / 2; exponent 3 by default.
1 − (1 − t)^e, exponent 3 by default.
The quad_in easing of t (spec/07 §18).
The quad_in_out easing of t (spec/07 §18).
The quad_out easing of t (spec/07 §18).
The sin_in easing of t (spec/07 §18).
The sin_in_out easing of t (spec/07 §18).
The sin_out easing of t (spec/07 §18).
Types
@type error() :: {:error, [Macaw.Base.Fault.t()]}
A refusal: faults with their paths.
Functions
The back_in easing of t (spec/07 §18).
back_in with the overshoot s in place of 1.70158.
The back_in_out easing of t (spec/07 §18).
The back_out easing of t (spec/07 §18).
back_out with the overshoot s in place of 1.70158.
The bounce_in easing of t (spec/07 §18).
The bounce_in_out easing of t (spec/07 §18).
The bounce_out easing of t (spec/07 §18).
The easing of a name, an atom or its string read by spelling: {:ok, fun}, or
{:error, [{[], {:unknown, :ease, spelling}}]}.
The circle_in easing of t (spec/07 §18).
The circle_in_out easing of t (spec/07 §18).
The circle_out easing of t (spec/07 §18).
The cubic_in easing of t (spec/07 §18).
The cubic_in_out easing of t (spec/07 §18).
The cubic_out easing of t (spec/07 §18).
The elastic_in easing of t (spec/07 §18).
The elastic_in_out easing of t (spec/07 §18).
The elastic_out easing of t (spec/07 §18).
The exp_in easing of t (spec/07 §18).
The exp_in_out easing of t (spec/07 §18).
The exp_out easing of t (spec/07 §18).
count values of an easing, named or a 1-arity function, at t = i / (count − 1) for
i in 0..count − 1 when count > 1, and [1.0] for a count of 1 or less;
{:error, faults} for an unknown name.
The linear easing of t (spec/07 §18).
@spec names() :: [atom()]
The 25 names, in spec/07 §18's order.
t^e, exponent 3 by default.
2^(e−1)·t^e below one half, else 1 − (−2t + 2)^e / 2; exponent 3 by default.
1 − (1 − t)^e, exponent 3 by default.
The quad_in easing of t (spec/07 §18).
The quad_in_out easing of t (spec/07 §18).
The quad_out easing of t (spec/07 §18).
The sin_in easing of t (spec/07 §18).
The sin_in_out easing of t (spec/07 §18).
The sin_out easing of t (spec/07 §18).