Created
September 30, 2014 13:23
-
-
Save lidocaine/99e1e4705a4b2a17982b to your computer and use it in GitHub Desktop.
Easing Functions (js)
This file contains 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
// These take t as (t/d) | |
// From: https://github.com/Prinzhorn/skrollr/issues/341 | |
EasingFunctions = { | |
linear: function (t) { return t }, | |
easeInQuad: function (t) { return t*t }, | |
easeOutQuad: function (t) { return t*(2-t) }, | |
easeInOutQuad: function (t) { return t<.5 ? 2*t*t : -1+(4-2*t)*t }, | |
easeInCubic: function (t) { return t*t*t }, | |
easeOutCubic: function (t) { return (--t)*t*t+1 }, | |
easeInOutCubic: function (t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 }, | |
easeInQuart: function (t) { return t*t*t*t }, | |
easeOutQuart: function (t) { return 1-(--t)*t*t*t }, | |
easeInOutQuart: function (t) { return t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t }, | |
easeInQuint: function (t) { return t*t*t*t*t }, | |
easeOutQuint: function (t) { return 1+(--t)*t*t*t*t }, | |
easeInOutQuint: function (t) { return t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment