View Source Easing.Range (easing v0.3.1)
Range struct for Easing
This struct is basically a reimplementation of Elixir's Range struct
but removing the limitations on only working with Integer constraints and steps
Link to this section Summary
Functions
Creates a new Easing.Range struct from a desired duration and target fps
Convenience function for creating a new Easing.Range struct
Returns the size of the Easing.Range
Link to this section Types
Specs
Link to this section Functions
Specs
Creates a new Easing.Range struct from a desired duration and target fps
- duration_in_ms - total duration of the animation, only accepts
Integer - fps - target frames per second of the animation, only accepts
Integer
Examples:
iex> Easing.Range.calculate(1000, 1)
%Easing.Range{first: 0, last: 1, step: 1.0}
Specs
Convenience function for creating a new Easing.Range struct
- first: represents the starting % of the range. Value should be:
value >= 0 and < 1 - last: represents the ending % of the range. Value should be:
value > 0 and <= 1 - step: value representing what the incremental value is between
firstandlast. Can represent
Specs
Returns the size of the Easing.Range
Sizes are inclusive across a range. So a range from 0 - 1 with a step of 0.1 will have
11 values, not 10 because the 0 value is included in that result.
Examples:
iex> Easing.Range.calculate(1000, 60) |> Easing.Range.size()
61