Skip to content

Commit

Permalink
GSAP self-install to get vite build working
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunomiac committed Feb 29, 2024
1 parent fc1ba81 commit f4f61b7
Show file tree
Hide file tree
Showing 108 changed files with 70,725 additions and 23,130 deletions.
24,953 changes: 16,063 additions & 8,890 deletions dist/blades.js

Large diffs are not rendered by default.

1,532 changes: 1,532 additions & 0 deletions dist/lib/greensock/CSSPlugin.js

Large diffs are not rendered by default.

134 changes: 134 additions & 0 deletions dist/lib/greensock/CSSRulePlugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*!
* CSSRulePlugin 3.11.0
* https://greensock.com
*
* @license Copyright 2008-2022, GreenSock. All rights reserved.
* Subject to the terms at https://greensock.com/standard-license or for
* Club GreenSock members, the agreement issued with that membership.
* @author: Jack Doyle, [email protected]
*/

/* eslint-disable */
var gsap,
_coreInitted,
_win,
_doc,
CSSPlugin,
_windowExists = function _windowExists() {
return typeof window !== "undefined";
},
_getGSAP = function _getGSAP() {
return gsap || _windowExists() && (gsap = window.gsap) && gsap.registerPlugin && gsap;
},
_checkRegister = function _checkRegister() {
if (!_coreInitted) {
_initCore();

if (!CSSPlugin) {
console.warn("Please gsap.registerPlugin(CSSPlugin, CSSRulePlugin)");
}
}

return _coreInitted;
},
_initCore = function _initCore(core) {
gsap = core || _getGSAP();

if (_windowExists()) {
_win = window;
_doc = document;
}

if (gsap) {
CSSPlugin = gsap.plugins.css;

if (CSSPlugin) {
_coreInitted = 1;
}
}
};

export var CSSRulePlugin = {
version: "3.11.0",
name: "cssRule",
init: function init(target, value, tween, index, targets) {
if (!_checkRegister() || typeof target.cssText === "undefined") {
return false;
}

var div = target._gsProxy = target._gsProxy || _doc.createElement("div");

this.ss = target;
this.style = div.style;
div.style.cssText = target.cssText;
CSSPlugin.prototype.init.call(this, div, value, tween, index, targets); //we just offload all the work to the regular CSSPlugin and then copy the cssText back over to the rule in the render() method. This allows us to have all of the updates to CSSPlugin automatically flow through to CSSRulePlugin instead of having to maintain both
},
render: function render(ratio, data) {
var pt = data._pt,
style = data.style,
ss = data.ss,
i;

while (pt) {
pt.r(ratio, pt.d);
pt = pt._next;
}

i = style.length;

while (--i > -1) {
ss[style[i]] = style[style[i]];
}
},
getRule: function getRule(selector) {
_checkRegister();

var ruleProp = _doc.all ? "rules" : "cssRules",
styleSheets = _doc.styleSheets,
i = styleSheets.length,
pseudo = selector.charAt(0) === ":",
j,
curSS,
cs,
a;
selector = (pseudo ? "" : ",") + selector.split("::").join(":").toLowerCase() + ","; //note: old versions of IE report tag name selectors as upper case, so we just change everything to lowercase.

if (pseudo) {
a = [];
}

while (i--) {
//Firefox may throw insecure operation errors when css is loaded from other domains, so try/catch.
try {
curSS = styleSheets[i][ruleProp];

if (!curSS) {
continue;
}

j = curSS.length;
} catch (e) {
console.warn(e);
continue;
}

while (--j > -1) {
cs = curSS[j];

if (cs.selectorText && ("," + cs.selectorText.split("::").join(":").toLowerCase() + ",").indexOf(selector) !== -1) {
//note: IE adds an extra ":" to pseudo selectors, so .myClass:after becomes .myClass::after, so we need to strip the extra one out.
if (pseudo) {
a.push(cs.style);
} else {
return cs.style;
}
}
}
}

return a;
},
register: _initCore
};
_getGSAP() && gsap.registerPlugin(CSSRulePlugin);
export { CSSRulePlugin as default };
166 changes: 166 additions & 0 deletions dist/lib/greensock/CustomBounce.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
/*!
* CustomBounce 3.11.0
* https://greensock.com
*
* @license Copyright 2008-2022, GreenSock. All rights reserved.
* Subject to the terms at https://greensock.com/standard-license or for
* Club GreenSock members, the agreement issued with that membership.
* @author: Jack Doyle, [email protected]
*/

/* eslint-disable */
var gsap,
_coreInitted,
createCustomEase,
_getGSAP = function _getGSAP() {
return gsap || typeof window !== "undefined" && (gsap = window.gsap) && gsap.registerPlugin && gsap;
},
_initCore = function _initCore(required) {
gsap = _getGSAP();
createCustomEase = gsap && gsap.parseEase("_CE");

if (createCustomEase) {
_coreInitted = 1;

gsap.parseEase("bounce").config = function (vars) {
return typeof vars === "object" ? _create("", vars) : _create("bounce(" + vars + ")", {
strength: +vars
});
};
} else {
required && console.warn("Please gsap.registerPlugin(CustomEase, CustomBounce)");
}
},
_normalizeX = function _normalizeX(a) {
//scales all the x values in an array [x, y, x, y...] AND rounds them to the closest hundredth (decimal)
var l = a.length,
s = 1 / a[l - 2],
rnd = 1000,
i;

for (i = 2; i < l; i += 2) {
a[i] = ~~(a[i] * s * rnd) / rnd;
}

a[l - 2] = 1; //in case there are any rounding errors. x should always end at 1.
},
_bonusValidated = 1,
//<name>CustomBounce</name>
_create = function _create(id, vars) {
if (!_coreInitted) {
_initCore(1);
}

vars = vars || {};

if (_bonusValidated) {
var max = 0.999,
decay = Math.min(max, vars.strength || 0.7),
// Math.min(0.999, 1 - 0.3 / (vars.strength || 1)),
decayX = decay,
gap = (vars.squash || 0) / 100,
originalGap = gap,
slope = 1 / 0.03,
w = 0.2,
h = 1,
prevX = 0.1,
path = [0, 0, 0.07, 0, 0.1, 1, 0.1, 1],
squashPath = [0, 0, 0, 0, 0.1, 0, 0.1, 0],
cp1,
cp2,
x,
y,
i,
nextX,
squishMagnitude;

for (i = 0; i < 200; i++) {
w *= decayX * ((decayX + 1) / 2);
h *= decay * decay;
nextX = prevX + w;
x = prevX + w * 0.49;
y = 1 - h;
cp1 = prevX + h / slope;
cp2 = x + (x - cp1) * 0.8;

if (gap) {
prevX += gap;
cp1 += gap;
x += gap;
cp2 += gap;
nextX += gap;
squishMagnitude = gap / originalGap;
squashPath.push(prevX - gap, 0, prevX - gap, squishMagnitude, prevX - gap / 2, squishMagnitude, //center peak anchor
prevX, squishMagnitude, prevX, 0, prevX, 0, //base anchor
prevX, squishMagnitude * -0.6, prevX + (nextX - prevX) / 6, 0, nextX, 0);
path.push(prevX - gap, 1, prevX, 1, prevX, 1);
gap *= decay * decay;
}

path.push(prevX, 1, cp1, y, x, y, cp2, y, nextX, 1, nextX, 1);
decay *= 0.95;
slope = h / (nextX - cp2);
prevX = nextX;

if (y > max) {
break;
}
}

if (vars.endAtStart && vars.endAtStart !== "false") {
x = -0.1;
path.unshift(x, 1, x, 1, -0.07, 0);

if (originalGap) {
gap = originalGap * 2.5; //make the initial anticipation squash longer (more realistic)

x -= gap;
path.unshift(x, 1, x, 1, x, 1);
squashPath.splice(0, 6);
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);

for (i = 0; i < squashPath.length; i += 2) {
squashPath[i] -= x;
}
}

for (i = 0; i < path.length; i += 2) {
path[i] -= x;
path[i + 1] = 1 - path[i + 1];
}
}

if (gap) {
_normalizeX(squashPath);

squashPath[2] = "C" + squashPath[2];
createCustomEase(vars.squashID || id + "-squash", "M" + squashPath.join(","));
}

_normalizeX(path);

path[2] = "C" + path[2];
return createCustomEase(id, "M" + path.join(","));
}
};

export var CustomBounce = /*#__PURE__*/function () {
function CustomBounce(id, vars) {
this.ease = _create(id, vars);
}

CustomBounce.create = function create(id, vars) {
return _create(id, vars);
};

CustomBounce.register = function register(core) {
gsap = core;

_initCore();
};

return CustomBounce;
}();
_getGSAP() && gsap.registerPlugin(CustomBounce);
CustomBounce.version = "3.11.0";
export { CustomBounce as default };
Loading

0 comments on commit f4f61b7

Please sign in to comment.