-
Notifications
You must be signed in to change notification settings - Fork 0
/
jeasing.min.js
15 lines (15 loc) · 3.9 KB
/
jeasing.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*! ****************************************************************************
* JEasing v0.0.1
*
* A simple library that implements Robert Penner's easing equations.
* (you can download it from npm or github repositories)
* Copyright (c) 2019 jclo <jclo@mobilabs.fr> (http://www.mobilabs.fr/).
* Released under the MIT license. You may obtain a copy of the License
* at: http://www.opensource.org/licenses/mit-license.php).
*
* EASING EQUATIONS
* Open source under the BSD License.
* Copyright © 2001 Robert Penner
* All rights reserved.
* ************************************************************************** */
!function(n,t){"use strict";"function"==typeof define&&define.amd?define([""],t):"object"==typeof exports?module.exports=t(n):n.JEasing=t(n)}(this,function(n){"use strict";var t,e;return t={linear:function(n,t,e,u){return e*n/u+t},swing:function(n,t,e,u){return e*(.5-Math.cos(n/u*Math.PI)/2)+t},easeInSine:function(n,t,e,u){return-e*Math.cos(n/u*(Math.PI/2))+e+t},easeOutSine:function(n,t,e,u){return e*Math.sin(n/u*(Math.PI/2))+t},easeInOutSine:function(n,t,e,u){return-e/2*(Math.cos(Math.PI*n/u)-1)+t},easeInQuad:function(n,t,e,u){return e*(n/=u)*n+t},easeOutQuad:function(n,t,e,u){return-e*(n/=u)*(n-2)+t},easeInOutQuad:function(n,t,e,u){return(n/=u/2)<1?e/2*n*n+t:-e/2*(--n*(n-2)-1)+t},easeInCubic:function(n,t,e,u){return e*(n/=u)*n*n+t},easeOutCubic:function(n,t,e,u){return e*((n=n/u-1)*n*n+1)+t},easeInOutCubic:function(n,t,e,u){return(n/=u/2)<1?e/2*n*n*n+t:e/2*((n-=2)*n*n+2)+t},easeInQuart:function(n,t,e,u){return e*(n/=u)*n*n*n+t},easeOutQuart:function(n,t,e,u){return-e*((n=n/u-1)*n*n*n-1)+t},easeInOutQuart:function(n,t,e,u){return(n/=u/2)<1?e/2*n*n*n*n+t:-e/2*((n-=2)*n*n*n-2)+t},easeInQuint:function(n,t,e,u){return e*(n/=u)*n*n*n*n+t},easeOutQuint:function(n,t,e,u){return e*((n=n/u-1)*n*n*n*n+1)+t},easeInOutQuint:function(n,t,e,u){return(n/=u/2)<1?e/2*n*n*n*n*n+t:e/2*((n-=2)*n*n*n*n+2)+t},easeInExpo:function(n,t,e,u){return 0===n?t:e*Math.pow(2,10*(n/u-1))+t},easeOutExpo:function(n,t,e,u){return n===u?t+e:e*(1-Math.pow(2,-10*n/u))+t},easeInOutExpo:function(n,t,e,u){return 0===n?t:n===u?t+e:(n/=u/2)<1?e/2*Math.pow(2,10*(n-1))+t:e/2*(2-Math.pow(2,-10*--n))+t},easeInCirc:function(n,t,e,u){return-e*(Math.sqrt(1-(n/=u)*n)-1)+t},easeOutCirc:function(n,t,e,u){return e*Math.sqrt(1-(n=n/u-1)*n)+t},easeInOutCirc:function(n,t,e,u){return(n/=u/2)<1?-e/2*(Math.sqrt(1-n*n)-1)+t:e/2*(Math.sqrt(1-(n-=2)*n)+1)+t},easeInBack:function(n,t,e,u,a){return void 0===a&&(a=1.70158),e*(n/=u)*n*((a+1)*n-a)+t},easeOutBack:function(n,t,e,u,a){return void 0===a&&(a=1.70158),e*((n=n/u-1)*n*((a+1)*n+a)+1)+t},easeInOutBack:function(n,t,e,u,a){return void 0===a&&(a=1.70158),(n/=u/2)<1?e/2*(n*n*((1+(a*=1.525))*n-a))+t:e/2*((n-=2)*n*((1+(a*=1.525))*n+a)+2)+t},easeInElastic:function(n,t,e,u){var a=1.70158,r=0,i=e;return 0===n?t:1==(n/=u)?t+e:(r||(r=.3*u),a=i<Math.abs(e)?(i=e,r/4):r/(2*Math.PI)*Math.asin(e/i),-i*Math.pow(2,10*(n-=1))*Math.sin((n*u-a)*(2*Math.PI)/r)+t)},easeOutElastic:function(n,t,e,u){var a=1.70158,r=0,i=e;return 0===n?t:1==(n/=u)?t+e:(r||(r=.3*u),a=i<Math.abs(e)?(i=e,r/4):r/(2*Math.PI)*Math.asin(e/i),i*Math.pow(2,-10*n)*Math.sin((n*u-a)*(2*Math.PI)/r)+e+t)},easeInOutElastic:function(n,t,e,u){var a=1.70158,r=0,i=e;return 0===n?t:2==(n/=u/2)?t+e:(r||(r=u*(.3*1.5)),a=i<Math.abs(e)?(i=e,r/4):r/(2*Math.PI)*Math.asin(e/i),n<1?i*Math.pow(2,10*(n-=1))*Math.sin((n*u-a)*(2*Math.PI)/r)*-.5+t:i*Math.pow(2,-10*(n-=1))*Math.sin((n*u-a)*(2*Math.PI)/r)*.5+e+t)},easeInBounce:function(n,t,e,u){return e-this.easeOutBounce(u-n,0,e,u)+t},easeOutBounce:function(n,t,e,u){return(n/=u)<1/2.75?e*(7.5625*n*n)+t:n<2/2.75?e*(7.5625*(n-=1.5/2.75)*n+.75)+t:n<2.5/2.75?e*(7.5625*(n-=2.25/2.75)*n+.9375)+t:e*(7.5625*(n-=2.625/2.75)*n+.984375)+t},easeInOutBounce:function(n,t,e,u){return n<u/2?.5*this.easeInBounce(2*n,0,e,u)+t:.5*this.easeOutBounce(2*n-u,0,e,u)+.5*e+t}},e=n.JEasing,t.noConflict=function(){return n.JEasing=e,this},t.VERSION="0.0.1",t});