PageSourceSearch

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

js babblehove.com collected 2026-10-09 21:27:24 UTC 5,319 bytes, 212 lines download raw bytes

vendor: 4,692 bytes, lines 1-189
1/*!
2 * EasePack 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    _registerEase,
15    _getGSAP = function _getGSAP() {
16  return gsap || typeof window !== "undefined" && (gsap = window.gsap) && gsap.registerPlugin && gsap;
17},
18    _boolean = function _boolean(value, defaultValue) {
19  return !!(typeof value === "undefined" ? defaultValue : value && !~(value + "").indexOf("false"));
20},
21    _initCore = function _initCore(core) {
22  gsap = core || _getGSAP();
23
24  if (gsap) {
25    _registerEase = gsap.registerEase; //add weighted ease capabilities to standard eases so users can do "power2.inOut(0.8)" for example to push everything toward the "out", or (-0.8) to push it toward the "in" (0 is neutral)
26
27    var eases = gsap.parseEase(),
28        createConfig = function createConfig(ease) {
29      return function (ratio) {
30        var y = 0.5 + ratio / 2;
31
32        ease.config = function (p) {
33          return ease(2 * (1 - p) * p * y + p * p);
34        };
35      };
36    },
37        p;
38
39    for (p in eases) {
40      if (!eases[p].config) {
41        createConfig(eases[p]);
42      }
43    }
44
45    _registerEase("slow", SlowMo);
46
47    _registerEase("expoScale", ExpoScaleEase);
48
49    _registerEase("rough", RoughEase);
50
51    for (p in EasePack) {
52      p !== "version" && gsap.core.globals(p, EasePack[p]);
53    }
54
55    _coreInitted = 1;
56  }
57},
58    _createSlowMo = function _createSlowMo(linearRatio, power, yoyoMode) {
59  linearRatio = Math.min(1, linearRatio || 0.7);
60
61  var pow = linearRatio < 1 ? power || power === 0 ? power : 0.7 : 0,
62      p1 = (1 - linearRatio) / 2,
63      p3 = p1 + linearRatio,
64      calcEnd = _boolean(yoyoMode);
65
66  return function (p) {
67    var r = p + (0.5 - p) * pow;
68    return p < p1 ? calcEnd ? 1 - (p = 1 - p / p1) * p : r - (p = 1 - p / p1) * p * p * p * r : p > p3 ? calcEnd ? p === 1 ? 0 : 1 - (p = (p - p3) / p1) * p : r + (p - r) * (p = (p - p3) / p1) * p * p * p : calcEnd ? 1 : r;
69  };
70},
71    _createExpoScale = function _createExpoScale(start, end, ease) {
72  var p1 = Math.log(end / start),
73      p2 = end - start;
74  ease && (ease = gsap.parseEase(ease));
75  return function (p) {
76    return (start * Math.exp(p1 * (ease ? ease(p) : p)) - start) / p2;
77  };
78},
79    EasePoint = function EasePoint(time, value, next) {
80  this.t = time;
81  this.v = value;
82
83  if (next) {
84    this.next = next;
85    next.prev = this;
86    this.c = next.v - value;
87    this.gap = next.t - time;
88  }
89},
90    _createRoughEase = function _createRoughEase(vars) {
91  if (typeof vars !== "object") {
92    //users may pass in via a string, like "rough(30)"
93    vars = {
94      points: +vars || 20
95    };
96  }
97
98  var taper = vars.taper || "none",
99      a = [],
100      cnt = 0,
101      points = (+vars.points || 20) | 0,
102      i = points,
103      randomize = _boolean(vars.randomize, true),
104      clamp = _boolean(vars.clamp),
105      template = gsap ? gsap.parseEase(vars.template) : 0,
106      strength = (+vars.strength || 1) * 0.4,
107      x,
108      y,
109      bump,
110      invX,
111      obj,
112      pnt,
113      recent;
114
115  while (--i > -1) {
116    x = randomize ? Math.random() : 1 / points * i;
117    y = template ? template(x) : x;
118
119    if (taper === "none") {
120      bump = strength;
121    } else if (taper === "out") {
122      invX = 1 - x;
123      bump = invX * invX * strength;
124    } else if (taper === "in") {
125      bump = x * x * strength;
126    } else if (x < 0.5) {
127      //"both" (start)
128      invX = x * 2;
129      bump = invX * invX * 0.5 * strength;
130    } else {
131      //"both" (end)
132      invX = (1 - x) * 2;
133      bump = invX * invX * 0.5 * strength;
134    }
135
136    if (randomize) {
137      y += Math.random() * bump - bump * 0.5;
138    } else if (i % 2) {
139      y += bump * 0.5;
140    } else {
141      y -= bump * 0.5;
142    }
143
144    if (clamp) {
145      if (y > 1) {
146        y = 1;
147      } else if (y < 0) {
148        y = 0;
149      }
150    }
151
152    a[cnt++] = {
153      x: x,
154      y: y
155    };
156  }
157
158  a.sort(function (a, b) {
159    return a.x - b.x;
160  });
161  pnt = new EasePoint(1, 1, null);
162  i = points;
163
164  while (i--) {
165    obj = a[i];
166    pnt = new EasePoint(obj.x, obj.y, pnt);
167  }
168
169  recent = new EasePoint(0, 0, pnt.t ? pnt : pnt.next);
170  return function (p) {
171    var pnt = recent;
172
173    if (p > pnt.t) {
174      while (pnt.next && p >= pnt.t) {
175        pnt = pnt.next;
176      }
177
178      pnt = pnt.prev;
179    } else {
180      while (pnt.prev && p <= pnt.t) {
181        pnt = pnt.prev;
182      }
183    }
184
185    recent = pnt;
186    return pnt.v + (p - pnt.t) / pnt.gap * pnt.c;
187  };
188};
189
190export var SlowMo = _createSlowMo(0.7);
191SlowMo.ease = SlowMo; //for backward compatibility
192
193SlowMo.config = _createSlowMo;
194export var ExpoScaleEase = _createExpoScale(1, 2);
195ExpoScaleEase.config = _createExpoScale;
196export var RoughEase = _createRoughEase();
197RoughEase.ease = RoughEase; //for backward compatibility
198
199RoughEase.config = _createRoughEase;
200export var EasePack = {
201  SlowMo: SlowMo,
202  RoughEase: RoughEase,
203  ExpoScaleEase: ExpoScaleEase
204};
205
206for (var p in EasePack) {
207  EasePack[p].register = _initCore;
208  EasePack[p].version = "3.12.7";
209}
210
211_getGSAP() && gsap.registerPlugin(SlowMo);
212export { EasePack 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.