项目作者: jamestomasino

项目描述 :
easing module for v
高级语言: V
项目地址: git://github.com/jamestomasino/veasing.git
创建时间: 2019-10-19T13:43:57Z
项目社区:https://github.com/jamestomasino/veasing

开源协议:GNU General Public License v3.0

下载


veasing

This is a pure V module that provides easing function calculations.

Install

Install using vpkg

  1. vpkg get veasing

Install using vpm

  1. v install jamestomasino.veasing

Install using git

  1. cd path/to/your/project
  2. git clone https://github.com/jamestomasino/veasing

Install using git submodule

  1. cd path/to/your/project
  2. git submodule add https://github.com/jamestomasino/veasing veasing && git submodule update --init --recursive

Importing the module

For vpkg or git installation

  1. import veasing

For vpm installation

  1. import jamestomasino.veasing as veasing

Usage

Use the animate function to apply an easing function over a range of numbers

  1. fn main () {
  2. println(veasing.animate(veasing.bounce_ease_out, 0, 100, 100))
  3. // easing function ^
  4. // lower bounds ^
  5. // upper bounds ^
  6. // number of frames/length of return array ^
  7. }

The following easing methods are available:

  1. veasing.linear_interpolation(p f64) f64
  2. veasing.quadratic_ease_in(p f64) f64
  3. veasing.quadratic_ease_out(p f64) f64
  4. veasing.quadratic_ease_in_out(p f64) f64
  5. veasing.cubic_ease_in(p f64) f64
  6. veasing.cubic_ease_out(p f64) f64
  7. veasing.cubic_ease_in_out(p f64) f64
  8. veasing.quartic_ease_in(p f64) f64
  9. veasing.quartic_ease_out(p f64) f64
  10. veasing.quartic_ease_in_out(p f64) f64
  11. veasing.quintic_ease_in(p f64) f64
  12. veasing.quintic_ease_out(p f64) f64
  13. veasing.quintic_ease_in_out(p f64) f64
  14. veasing.sine_ease_in(p f64) f64
  15. veasing.sine_ease_out(p f64) f64
  16. veasing.sine_ease_in_out(p f64) f64
  17. veasing.circular_ease_in(p f64) f64
  18. veasing.circular_ease_out(p f64) f64
  19. veasing.circular_ease_in_out(p f64) f64
  20. veasing.exponential_ease_in(p f64) f64
  21. veasing.exponential_ease_out(p f64) f64
  22. veasing.exponential_ease_in_out(p f64) f64
  23. veasing.elastic_ease_in(p f64) f64
  24. veasing.elastic_ease_out(p f64) f64
  25. veasing.elastic_ease_in_out(p f64) f64
  26. veasing.back_ease_in(p f64) f64
  27. veasing.back_ease_out(p f64) f64
  28. veasing.back_ease_in_out(p f64) f64
  29. veasing.bounce_ease_in(p f64) f64
  30. veasing.bounce_ease_out(p f64) f64
  31. veasing.bounce_ease_in_out(p f64) f64

Testing

To run the tests execute the following command from inside the cloned repo.

  1. v -stats veasing_test.v

Credits

Based on the works of:

License

GPL-3.0