PageSourceSearch

https://babblehove.com/wp-content/themes/bricks-child/assets/libs/gsap/CustomBounce.js

js babblehove.com collected 2026-10-09 21:27:14 UTC 4,444 bytes, 166 lines download raw bytes

vendor: 4,444 bytes, lines 1-166
1/*!
2 * CustomBounce 3.12.7
3 * https://gsap.com
4 *
5 * @license Copyright 2008-2025, GreenSock. All rights reserved.
6 * Subject to the terms at https://gsap.com/standard-license or for
7 * Club GSAP members, the agreement issued with that membership.
8 * @author: Jack Doyle, [email protected]
9*/
10
11/* eslint-disable */
12var gsap,
13    _coreInitted,
14    createCustomEase,
15    _getGSAP = function _getGSAP() {
16  return gsap || typeof window !== "undefined" && (gsap = window.gsap) && gsap.registerPlugin && gsap;
17},
18    _initCore = function _initCore(required) {
19  gsap = _getGSAP();
20  createCustomEase = gsap && gsap.parseEase("_CE");
21
22  if (createCustomEase) {
23    _coreInitted = 1;
24
25    gsap.parseEase("bounce").config = function (vars) {
26      return typeof vars === "object" ? _create("", vars) : _create("bounce(" + vars + ")", {
27        strength: +vars
28      });
29    };
30  } else {
31    required && console.warn("Please gsap.registerPlugin(CustomEase, CustomBounce)");
32  }
33},
34    _normalizeX = function _normalizeX(a) {
35  //scales all the x values in an array [x, y, x, y...] AND rounds them to the closest hundredth (decimal)
36  var l = a.length,
37      s = 1 / a[l - 2],
38      rnd = 1000,
39      i;
40
41  for (i = 2; i < l; i += 2) {
42    a[i] = ~~(a[i] * s * rnd) / rnd;
43  }
44
45  a[l - 2] = 1; //in case there are any rounding errors. x should always end at 1.
46},
47    _bonusValidated = 1,
48    //<name>CustomBounce</name>
49_create = function _create(id, vars) {
50  if (!_coreInitted) {
51    _initCore(1);
52  }
53
54  vars = vars || {};
55
56  if (_bonusValidated) {
57    var max = 0.999,
58        decay = Math.min(max, vars.strength || 0.7),
59        // Math.min(0.999, 1 - 0.3 / (vars.strength || 1)),
60    decayX = decay,
61        gap = (vars.squash || 0) / 100,
62        originalGap = gap,
63        slope = 1 / 0.03,
64        w = 0.2,
65        h = 1,
66        prevX = 0.1,
67        path = [0, 0, 0.07, 0, 0.1, 1, 0.1, 1],
68        squashPath = [0, 0, 0, 0, 0.1, 0, 0.1, 0],
69        cp1,
70        cp2,
71        x,
72        y,
73        i,
74        nextX,
75        squishMagnitude;
76
77    for (i = 0; i < 200; i++) {
78      w *= decayX * ((decayX + 1) / 2);
79      h *= decay * decay;
80      nextX = prevX + w;
81      x = prevX + w * 0.49;
82      y = 1 - h;
83      cp1 = prevX + h / slope;
84      cp2 = x + (x - cp1) * 0.8;
85
86      if (gap) {
87        prevX += gap;
88        cp1 += gap;
89        x += gap;
90        cp2 += gap;
91        nextX += gap;
92        squishMagnitude = gap / originalGap;
93        squashPath.push(prevX - gap, 0, prevX - gap, squishMagnitude, prevX - gap / 2, squishMagnitude, //center peak anchor
94        prevX, squishMagnitude, prevX, 0, prevX, 0, //base anchor
95        prevX, squishMagnitude * -0.6, prevX + (nextX - prevX) / 6, 0, nextX, 0);
96        path.push(prevX - gap, 1, prevX, 1, prevX, 1);
97        gap *= decay * decay;
98      }
99
100      path.push(prevX, 1, cp1, y, x, y, cp2, y, nextX, 1, nextX, 1);
101      decay *= 0.95;
102      slope = h / (nextX - cp2);
103      prevX = nextX;
104
105      if (y > max) {
106        break;
107      }
108    }
109
110    if (vars.endAtStart && vars.endAtStart !== "false") {
111      x = -0.1;
112      path.unshift(x, 1, x, 1, -0.07, 0);
113
114      if (originalGap) {
115        gap = originalGap * 2.5; //make the initial anticipation squash longer (more realistic)
116
117        x -= gap;
118        path.unshift(x, 1, x, 1, x, 1);
119        squashPath.splice(0, 6);
120        squashPath.unshift(x, 0, x, 0, x, 1, x + gap / 2, 1, x + gap, 1, x + gap, 0, x + gap, 0, x + gap, -0.6, x + gap + 0.033, 0);
121
122        for (i = 0; i < squashPath.length; i += 2) {
123          squashPath[i] -= x;
124        }
125      }
126
127      for (i = 0; i < path.length; i += 2) {
128        path[i] -= x;
129        path[i + 1] = 1 - path[i + 1];
130      }
131    }
132
133    if (gap) {
134      _normalizeX(squashPath);
135
136      squashPath[2] = "C" + squashPath[2];
137      createCustomEase(vars.squashID || id + "-squash", "M" + squashPath.join(","));
138    }
139
140    _normalizeX(path);
141
142    path[2] = "C" + path[2];
143    return createCustomEase(id, "M" + path.join(","));
144  }
145};
146
147export var CustomBounce = /*#__PURE__*/function () {
148  function CustomBounce(id, vars) {
149    this.ease = _create(id, vars);
150  }
151
152  CustomBounce.create = function create(id, vars) {
153    return _create(id, vars);
154  };
155
156  CustomBounce.register = function register(core) {
157    gsap = core;
158
159    _initCore();
160  };
161
162  return CustomBounce;
163}();
164_getGSAP() && gsap.registerPlugin(CustomBounce);
165CustomBounce.version = "3.12.7";
166export { CustomBounce as default };

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.