mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-16 07:53:43 +03:00
1a8fe4dd43
We moved off to our own fork of velocity many moons ago to fix a memory leak bug when velocity was being barely maintained. They have now merged the bugfix, so go back to mainline.
17 lines
522 B
JavaScript
17 lines
522 B
JavaScript
const Velocity = require('velocity-animate');
|
|
|
|
// courtesy of https://github.com/julianshapiro/velocity/issues/283
|
|
// We only use easeOutBounce (easeInBounce is just sort of nonsensical)
|
|
function bounce( p ) {
|
|
let pow2;
|
|
let bounce = 4;
|
|
|
|
while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {
|
|
// just sets pow2
|
|
}
|
|
return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
|
|
}
|
|
|
|
Velocity.Easings.easeOutBounce = function(p) {
|
|
return 1 - bounce(1 - p);
|
|
};
|