A Ruby implementation of the well-known Robert Penner's easing functions
A port of known Robert Penner's easing functions for Ruby, implemented both in pure-Ruby and with FFI.
Check out easings.net to help you easily visualize each of the easing functions.
All functions are defined in the Easing
module, and they always receive the same 4 parameters:
t
: current timeb
: beginning or start valuec
: change in value (or destination - b
)d
: duration(0..10).map { |t| Easing.ease_in_out_expo(t, 0, 10, 10) }
# => [0.0, 0.01953125, 0.078125, 0.3125, 1.2500000000000002, 5.0, 8.75, 9.6875, 9.921875, 9.98046875, 10.0]
Add this line to your application's Gemfile:
gem 'easing'
And then execute:
$ bundle
Or install it yourself as:
$ gem install easing
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)