PageSourceSearch

https://communitytrust.com/wp-content/themes/ctc/src/vendor/bez/jquery.bez.js?ver=1576734717

js communitytrust.com collected 2026-10-05 23:45:17 UTC 2,002 bytes, 56 lines download raw bytes

vendor: 2,002 bytes, lines 1-56
1/*!
2 * Bez @VERSION
3 * http://github.com/rdallasgray/bez
4 *
5 * A plugin to convert CSS3 cubic-bezier co-ordinates to jQuery-compatible easing functions
6 *
7 * With thanks to Nikolay Nemshilov for clarification on the cubic-bezier maths
8 * See http://st-on-it.blogspot.com/2011/05/calculating-cubic-bezier-function.html
9 *
10 * Copyright @YEAR Robert Dallas Gray. All rights reserved.
11 * Provided under the FreeBSD license: https://github.com/rdallasgray/bez/blob/master/LICENSE.txt
12 */
13(function(factory) {
14  if (typeof exports === "object") {
15    factory(require("jquery"));
16  } else if (typeof define === "function" && define.amd) {
17    define(["jquery"], factory);
18  } else {
19    factory(jQuery);
20  }
21}(function($) {
22  $.extend({ bez: function(encodedFuncName, coOrdArray) {
23    if ($.isArray(encodedFuncName)) {
24      coOrdArray = encodedFuncName;
25      encodedFuncName = 'bez_' + coOrdArray.join('_').replace(/\./g, 'p');
26    }
27    if (typeof $.easing[encodedFuncName] !== "function") {
28      var polyBez = function(p1, p2) {
29        var A = [null, null], B = [null, null], C = [null, null],
30            bezCoOrd = function(t, ax) {
31              C[ax] = 3 * p1[ax], B[ax] = 3 * (p2[ax] - p1[ax]) - C[ax], A[ax] = 1 - C[ax] - B[ax];
32              return t * (C[ax] + t * (B[ax] + t * A[ax]));
33            },
34            xDeriv = function(t) {
35              return C[0] + t * (2 * B[0] + 3 * A[0] * t);
36            },
37            xForT = function(t) {
38              var x = t, i = 0, z;
39              while (++i < 14) {
40                z = bezCoOrd(x, 0) - t;
41                if (Math.abs(z) < 1e-3) break;
42                x -= z / xDeriv(x);
43              }
44              return x;
45            };
46        return function(t) {
47          return bezCoOrd(xForT(t), 1);
48        }
49      };
50      $.easing[encodedFuncName] = function(x, t, b, c, d) {
51        return c * polyBez([coOrdArray[0], coOrdArray[1]], [coOrdArray[2], coOrdArray[3]])(t/d) + b;
52      }
53    }
54    return encodedFuncName;
55  }});
56}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.