veasing
This is a pure V module that provides easing function calculations.
Install
Install using vpkg
vpkg get veasing
Install using vpm
v install jamestomasino.veasing
Install using git
cd path/to/your/project
git clone https://github.com/jamestomasino/veasing
Install using git submodule
cd path/to/your/project
git submodule add https://github.com/jamestomasino/veasing veasing && git submodule update --init --recursive
Importing the module
For vpkg or git installation
import veasing
For vpm installation
import jamestomasino.veasing as veasing
Usage
Use the
animate
fn main () {
println(veasing.animate(veasing.bounce_ease_out, 0, 100, 100))
// easing function ^
// lower bounds ^
// upper bounds ^
// number of frames/length of return array ^
}
The following easing methods are available:
veasing.linear_interpolation(p f64) f64
veasing.quadratic_ease_in(p f64) f64
veasing.quadratic_ease_out(p f64) f64
veasing.quadratic_ease_in_out(p f64) f64
veasing.cubic_ease_in(p f64) f64
veasing.cubic_ease_out(p f64) f64
veasing.cubic_ease_in_out(p f64) f64
veasing.quartic_ease_in(p f64) f64
veasing.quartic_ease_out(p f64) f64
veasing.quartic_ease_in_out(p f64) f64
veasing.quintic_ease_in(p f64) f64
veasing.quintic_ease_out(p f64) f64
veasing.quintic_ease_in_out(p f64) f64
veasing.sine_ease_in(p f64) f64
veasing.sine_ease_out(p f64) f64
veasing.sine_ease_in_out(p f64) f64
veasing.circular_ease_in(p f64) f64
veasing.circular_ease_out(p f64) f64
veasing.circular_ease_in_out(p f64) f64
veasing.exponential_ease_in(p f64) f64
veasing.exponential_ease_out(p f64) f64
veasing.exponential_ease_in_out(p f64) f64
veasing.elastic_ease_in(p f64) f64
veasing.elastic_ease_out(p f64) f64
veasing.elastic_ease_in_out(p f64) f64
veasing.back_ease_in(p f64) f64
veasing.back_ease_out(p f64) f64
veasing.back_ease_in_out(p f64) f64
veasing.bounce_ease_in(p f64) f64
veasing.bounce_ease_out(p f64) f64
veasing.bounce_ease_in_out(p f64) f64
Testing
To run the tests execute the following command from inside the cloned repo.
v -stats veasing_test.v
Credits
Based on the works of: