-
-
Save chinghanho/fb0117a49a7525a1a1011fd4a243e5b4 to your computer and use it in GitHub Desktop.
add `easeOutBounce` to velocity.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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