exmorph v1.1.1 Exmorph.Easing

Summary

Functions

Takes and returns the time variable to be used within a tweening function. The returned value will be modified based on the second argument, an atom representing the easing function

Takes and string and returns whether that string exists within the @easings module attribute

Functions

ease(t, atom)

Takes and returns the time variable to be used within a tweening function. The returned value will be modified based on the second argument, an atom representing the easing function.

Examples

iex> Exmorph.Easing.ease(2, :linear)
2

iex> Exmorph.Easing.ease(2, :quad_in)
4

iex> Exmorph.Easing.ease(2, :quad_out)
0

iex> Exmorph.Easing.ease(2, :cubic_in)
8

iex> Exmorph.Easing.ease(2, :cubic_out)
2

iex> Exmorph.Easing.ease(2, :quart_in)
16

iex> Exmorph.Easing.ease(2, :quart_out)
0

iex> Exmorph.Easing.ease(2, :quint_in)
32

iex> Exmorph.Easing.ease(2, :quint_out)
2

iex> Exmorph.Easing.ease(2, :sine_in)
2.0

iex> Exmorph.Easing.ease(2, :sine_out)
1.2246467991473532e-16
valid?(easing)

Takes and string and returns whether that string exists within the @easings module attribute.

Examples

iex> Exmorph.Easing.valid?("linear")
true

iex> Exmorph.Easing.valid?("foo")
false