Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 7.81 KB | None | 0 0
  1.  * Redistribution and use in source and binary forms, with or without modification,
  2.  * are permitted provided that the following conditions are met:
  3.  *
  4.  * Redistributions of source code must retain the above copyright notice, this list of
  5.  * conditions and the following disclaimer.
  6.  * Redistributions in binary form must reproduce the above copyright notice, this list
  7.  * of conditions and the following disclaimer in the documentation and/or other materials
  8.  * provided with the distribution.
  9.  *
  10.  * Neither the name of the author nor the names of contributors may be used to endorse
  11.  * or promote products derived from this software without specific prior written permission.
  12.  *
  13.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  14.  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  16.  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  17.  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  18.  *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  19.  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  20.  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  21.  * OF THE POSSIBILITY OF SUCH DAMAGE.
  22.  *
  23. */
  24.  
  25. // t: current time, b: begInnIng value, c: change In value, d: duration
  26. (function($, undefined) {
  27.  
  28. jQuery.easing['jswing'] = jQuery.easing['swing'];
  29. jQuery.extend( jQuery.easing,
  30. {
  31.     def: 'easeOutQuad',
  32.     swing: function (x, t, b, c, d) {
  33.         //alert(jQuery.easing.default);
  34.     return $.easing[jQuery.easing.def](x, t, b, c, d);
  35.  
  36.     },
  37.     easeInQuad: function (x, t, b, c, d) {
  38.         return c*(t/=d)*t + b;
  39.     },
  40.     easeOutQuad: function (x, t, b, c, d) {
  41.         return -c *(t/=d)*(t-2) + b;
  42.     },
  43.     easeInOutQuad: function (x, t, b, c, d) {
  44.         if ((t/=d/2) < 1) return c/2*t*t + b;
  45.         return -c/2 * ((--t)*(t-2) - 1) + b;
  46.     },
  47.     easeInCubic: function (x, t, b, c, d) {
  48.         return c*(t/=d)*t*t + b;
  49.     },
  50.     easeOutCubic: function (x, t, b, c, d) {
  51.         return c*((t=t/d-1)*t*t + 1) + b;
  52.     },
  53.     easeInOutCubic: function (x, t, b, c, d) {
  54.         if ((t/=d/2) < 1) return c/2*t*t*t + b;
  55.         return c/2*((t-=2)*t*t + 2) + b;
  56.     },
  57.     easeInQuart: function (x, t, b, c, d) {
  58.         return c*(t/=d)*t*t*t + b;
  59.     },
  60.     easeOutQuart: function (x, t, b, c, d) {
  61.         return -c * ((t=t/d-1)*t*t*t - 1) + b;
  62.     },
  63.     easeInOutQuart: function (x, t, b, c, d) {
  64.         if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  65.         return -c/2 * ((t-=2)*t*t*t - 2) + b;
  66.     },
  67.     easeInQuint: function (x, t, b, c, d) {
  68.         return c*(t/=d)*t*t*t*t + b;
  69.     },
  70.     easeOutQuint: function (x, t, b, c, d) {
  71.         return c*((t=t/d-1)*t*t*t*t + 1) + b;
  72.     },
  73.     easeInOutQuint: function (x, t, b, c, d) {
  74.         if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  75.         return c/2*((t-=2)*t*t*t*t + 2) + b;
  76.     },
  77.     easeInSine: function (x, t, b, c, d) {
  78.         return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  79.     },
  80.     easeOutSine: function (x, t, b, c, d) {
  81.         return c * Math.sin(t/d * (Math.PI/2)) + b;
  82.     },
  83.     easeInOutSine: function (x, t, b, c, d) {
  84.         return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  85.     },
  86.     easeInExpo: function (x, t, b, c, d) {
  87.         return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  88.     },
  89.     easeOutExpo: function (x, t, b, c, d) {
  90.         return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  91.     },
  92.     easeInOutExpo: function (x, t, b, c, d) {
  93.         if (t==0) return b;
  94.         if (t==d) return b+c;
  95.         if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  96.         return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  97.     },
  98.     easeInCirc: function (x, t, b, c, d) {
  99.         return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  100.     },
  101.     easeOutCirc: function (x, t, b, c, d) {
  102.         return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  103.     },
  104.     easeInOutCirc: function (x, t, b, c, d) {
  105.         if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  106.         return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  107.     },
  108.     easeInElastic: function (x, t, b, c, d) {
  109.         var s=1.70158;var p=0;var a=c;
  110.         if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
  111.         if (a < Math.abs(c)) { a=c; var s=p/4; }
  112.         else var s = p/(2*Math.PI) * Math.asin (c/a);
  113.         return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  114.     },
  115.     easeOutElastic: function (x, t, b, c, d) {
  116.         var s=1.70158;var p=0;var a=c;
  117.         if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
  118.         if (a < Math.abs(c)) { a=c; var s=p/4; }
  119.         else var s = p/(2*Math.PI) * Math.asin (c/a);
  120.         return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  121.     },
  122.     easeInOutElastic: function (x, t, b, c, d) {
  123.         var s=1.70158;var p=0;var a=c;
  124.         if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
  125.         if (a < Math.abs(c)) { a=c; var s=p/4; }
  126.         else var s = p/(2*Math.PI) * Math.asin (c/a);
  127.         if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  128.         return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  129.     },
  130.     easeInBack: function (x, t, b, c, d, s) {
  131.         if (s == undefined) s = 1.70158;
  132.         return c*(t/=d)*t*((s+1)*t - s) + b;
  133.     },
  134.     easeOutBack: function (x, t, b, c, d, s) {
  135.         if (s == undefined) s = 1.70158;
  136.         return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  137.     },
  138.     easeInOutBack: function (x, t, b, c, d, s) {
  139.         if (s == undefined) s = 1.70158;
  140.         if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  141.         return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  142.     },
  143.     easeInBounce: function (x, t, b, c, d) {
  144.         return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  145.     },
  146.     easeOutBounce: function (x, t, b, c, d) {
  147.         if ((t/=d) < (1/2.75)) {
  148.             return c*(7.5625*t*t) + b;
  149.         } else if (t < (2/2.75)) {
  150.             return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  151.         } else if (t < (2.5/2.75)) {
  152.             return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  153.         } else {
  154.             return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  155.         }
  156.     },
  157.     easeInOutBounce: function (x, t, b, c, d) {
  158.         if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  159.         return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  160.     }
  161. }) (jQuery);
  162. /*
  163.  *
  164.  * TERMS OF USE - EASING EQUATIONS
  165.  *
  166.  * Open source under the BSD License.
  167.  *
  168.  * Copyright © 2001 Robert Penner
  169.  * All rights reserved.
  170.  *
  171.  * Redistribution and use in source and binary forms, with or without modification,
  172.  * are permitted provided that the following conditions are met:
  173.  *
  174.  * Redistributions of source code must retain the above copyright notice, this list of
  175.  * conditions and the following disclaimer.
  176.  * Redistributions in binary form must reproduce the above copyright notice, this list
  177.  * of conditions and the following disclaimer in the documentation and/or other materials
  178.  * provided with the distribution.
  179.  *
  180.  * Neither the name of the author nor the names of contributors may be used to endorse
  181.  * or promote products derived from this software without specific prior written permission.
  182.  *
  183.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  184.  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  185.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  186.  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  187.  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  188.  *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  189.  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  190.  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  191.  * OF THE POSSIBILITY OF SUCH DAMAGE.
  192.  *
  193.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement