baseframe-js
Version:
Baseframe JS is a comprehensive suite of modular plugins and utilities designed for front-end development
17 lines (16 loc) • 671 B
JavaScript
//from: https://gist.github.com/gre/1650294... inspired by: https://nicmulvaney.com/easing
export const easeInOutQuart = (t) => t < .5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t;
export const easeInOutCubic = (t) => t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
export const easeOutQuint = (t) => 1 + (--t) * t * t * t * t;
export const linear = (t) => t;
const Easing = {
// no easing, no acceleration
linear,
// acceleration until halfway, then deceleration
easeInOutCubic,
// acceleration until halfway, then deceleration
easeInOutQuart,
// decelerating to zero velocity
easeOutQuint
};
export default Easing;