Skip to content

Instantly share code, notes, and snippets.

@yuheiy
Created February 5, 2016 09:57
Show Gist options
  • Save yuheiy/3e7a9165e791890cc0af to your computer and use it in GitHub Desktop.
Save yuheiy/3e7a9165e791890cc0af to your computer and use it in GitHub Desktop.
add `easeOutBounce` to velocity.js
'use strict';
import Velocity from 'velocity-animate';
let baseEasings = {};
baseEasings.Bounce = p => {
let pow2;
let bounce = 4;
while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) {}
return 1 / Math.pow(4, 3 - bounce) - 7.5625 *
Math.pow((pow2 * 3 - 2) / 22 - p, 2);
};
Velocity.Easings.easeOutBounce = p => 1 - baseEasings.Bounce(1 - p);
export default Velocity;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment