View Source Easing.AnimationRange (easing v0.1.3)
Animation 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.AnimationRange
struct from a desires animation duration and target fps
Convenience function for creating a new Easing.AnimationRange
struct
Returns the size of the Easing.AnimationRange
Link to this section Types
Specs
Link to this section Functions
Specs
calculate(integer(), integer()) :: animation_range()
Creates a new Easing.AnimationRange
struct from a desires animation 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.AnimationRange.calculate(1000, 1)
%Easing.AnimationRange{first: 0, last: 1, step: 1.0}
Specs
new(number(), number(), number()) :: animation_range()
Convenience function for creating a new Easing.AnimationRange
struct
- first: represents the starting % of the animation range. Value should be:
value >= 0 and < 1
- last: represents the ending % of the animation range. Value should be:
value > 0 and <= 1
- step: value representing what the incremental value is between
first
andlast
. Can represent
Specs
size(animation_range()) :: integer()
Returns the size of the Easing.AnimationRange
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.AnimationRange.calculate(1000, 60) |> Easing.AnimationRange.size()
61