forked from gre/easing.js
Simple Easing Functions in Javascript - see http://greweb.me/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
npm install gist:542f17b35344f211da49 --save
var easing = require('easing.js');forked from gre/easing.js
Simple Easing Functions in Javascript - see http://greweb.me/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
npm install gist:542f17b35344f211da49 --save
var easing = require('easing.js');| /* | |
| * Easing Functions - inspired from http://gizma.com/easing/ | |
| * only considering the t value for the range [0, 1] => [0, 1] | |
| */ | |
| module.exports = { | |
| // no easing, no acceleration | |
| linear: function (t) { return t }, | |
| // accelerating from zero velocity | |
| easeInQuad: function (t) { return t*t }, | |
| // decelerating to zero velocity | |
| easeOutQuad: function (t) { return t*(2-t) }, | |
| // acceleration until halfway, then deceleration | |
| easeInOutQuad: function (t) { return t<.5 ? 2*t*t : -1+(4-2*t)*t }, | |
| // accelerating from zero velocity | |
| easeInCubic: function (t) { return t*t*t }, | |
| // decelerating to zero velocity | |
| easeOutCubic: function (t) { return (--t)*t*t+1 }, | |
| // acceleration until halfway, then deceleration | |
| easeInOutCubic: function (t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 }, | |
| // accelerating from zero velocity | |
| easeInQuart: function (t) { return t*t*t*t }, | |
| // decelerating to zero velocity | |
| easeOutQuart: function (t) { return 1-(--t)*t*t*t }, | |
| // acceleration until halfway, then deceleration | |
| easeInOutQuart: function (t) { return t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t }, | |
| // accelerating from zero velocity | |
| easeInQuint: function (t) { return t*t*t*t*t }, | |
| // decelerating to zero velocity | |
| easeOutQuint: function (t) { return 1+(--t)*t*t*t*t }, | |
| // acceleration until halfway, then deceleration | |
| easeInOutQuint: function (t) { return t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t } | |
| } |
| { | |
| "name": "easing.js", | |
| "version": "1.0.0", | |
| "description": "Simple Easing Functions in Javascript - see http://greweb.me/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/", | |
| "main": "easing.js" | |
| } |