@drivexstudio/animations 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +22 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// packages/index.js
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
AnimatedButton: () => AnimatedButton,
|
|
34
34
|
AnimatedHeadline: () => AnimatedHeadline_default,
|
|
35
35
|
AnimatedLink: () => AnimatedLink_default,
|
|
@@ -54,7 +54,7 @@ __export(packages_exports, {
|
|
|
54
54
|
easingDefinitionToFunction: () => easingDefinitionToFunction,
|
|
55
55
|
getCssScrollLocked: () => getCssScrollLocked,
|
|
56
56
|
getLenis: () => getLenis,
|
|
57
|
-
gsap: () =>
|
|
57
|
+
gsap: () => gsap2,
|
|
58
58
|
scrollToTop: () => scrollToTop,
|
|
59
59
|
setCssScrollLocked: () => setCssScrollLocked,
|
|
60
60
|
stagger: () => stagger,
|
|
@@ -70,13 +70,13 @@ __export(packages_exports, {
|
|
|
70
70
|
usePreloader: () => usePreloader,
|
|
71
71
|
useScrambleGroup: () => useScrambleGroup
|
|
72
72
|
});
|
|
73
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(index_exports);
|
|
74
74
|
|
|
75
75
|
// packages/animations/ScrambleText.jsx
|
|
76
76
|
var import_react9 = __toESM(require("react"), 1);
|
|
77
77
|
|
|
78
78
|
// libs/vendor.js
|
|
79
|
-
var
|
|
79
|
+
var gsapModule = __toESM(require("gsap"), 1);
|
|
80
80
|
var import_react = require("@gsap/react");
|
|
81
81
|
var import_ScrollTrigger = require("gsap/ScrollTrigger");
|
|
82
82
|
var import_Flip = require("gsap/Flip");
|
|
@@ -86,7 +86,8 @@ var import_InertiaPlugin = require("gsap/InertiaPlugin");
|
|
|
86
86
|
var import_Draggable = require("gsap/Draggable");
|
|
87
87
|
var import_class_variance_authority = require("class-variance-authority");
|
|
88
88
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
89
|
-
|
|
89
|
+
var gsap2 = gsapModule.gsap || gsapModule.default || gsapModule;
|
|
90
|
+
gsap2.registerPlugin(
|
|
90
91
|
import_ScrollTrigger.ScrollTrigger,
|
|
91
92
|
import_ScrambleTextPlugin.ScrambleTextPlugin,
|
|
92
93
|
import_SplitText.SplitText,
|
|
@@ -361,7 +362,7 @@ function ScrambleGroup({
|
|
|
361
362
|
const callbacks = Array.from(childrenMapRef.current.values());
|
|
362
363
|
const staggerValue = customStagger ?? stagger2;
|
|
363
364
|
callbacks.forEach((callbackFn, index) => {
|
|
364
|
-
|
|
365
|
+
gsap2.delayedCall(index * staggerValue, () => {
|
|
365
366
|
callbackFn();
|
|
366
367
|
});
|
|
367
368
|
});
|
|
@@ -370,7 +371,7 @@ function ScrambleGroup({
|
|
|
370
371
|
const setupScrollTrigger = (0, import_react8.useCallback)(() => {
|
|
371
372
|
if (manual || !containerRef.current) return;
|
|
372
373
|
isTriggering.current = false;
|
|
373
|
-
const tween =
|
|
374
|
+
const tween = gsap2.to(containerRef.current, {
|
|
374
375
|
scrollTrigger: {
|
|
375
376
|
trigger: containerRef.current,
|
|
376
377
|
start,
|
|
@@ -464,7 +465,7 @@ function ScrambleText({
|
|
|
464
465
|
return null;
|
|
465
466
|
}
|
|
466
467
|
killTimeline();
|
|
467
|
-
timelineRef.current =
|
|
468
|
+
timelineRef.current = gsap2.timeline({
|
|
468
469
|
onComplete: () => {
|
|
469
470
|
timelineRef.current = null;
|
|
470
471
|
isCompleteRef.current = true;
|
|
@@ -651,8 +652,8 @@ var AnimatedHeadline = (0, import_react10.forwardRef)(({
|
|
|
651
652
|
(0, import_react.useGSAP)(() => {
|
|
652
653
|
if (shouldSkip || !containerRef.current || !lines) return;
|
|
653
654
|
const container = containerRef.current;
|
|
654
|
-
|
|
655
|
-
|
|
655
|
+
gsap2.set(container.querySelectorAll("[data-line-inner]"), { opacity: 0 });
|
|
656
|
+
gsap2.set(container.querySelectorAll("[data-brand-rect], [data-fg-rect]"), { scaleX: 0, transformOrigin: "left" });
|
|
656
657
|
}, { dependencies: [shouldSkip, lines] });
|
|
657
658
|
useIdleGSAP(() => {
|
|
658
659
|
if (trigger !== "scroll" || shouldSkip || !lines) return;
|
|
@@ -679,7 +680,7 @@ var AnimatedHeadline = (0, import_react10.forwardRef)(({
|
|
|
679
680
|
const fgRect = lineNode.querySelector("[data-fg-rect]");
|
|
680
681
|
if (!lineInner || !brandRect || !fgRect) continue;
|
|
681
682
|
const rects = [brandRect, fgRect];
|
|
682
|
-
const tl =
|
|
683
|
+
const tl = gsap2.timeline({ delay });
|
|
683
684
|
tl.to(brandRect, { scaleX: 1, duration: 0.45, ease: "power3.inOut" }, 0);
|
|
684
685
|
tl.to(fgRect, { scaleX: 1, duration: 0.45, ease: "power3.inOut" }, 0.1);
|
|
685
686
|
tl.set(lineInner, { opacity: 1 }, 0.5);
|
|
@@ -692,8 +693,8 @@ var AnimatedHeadline = (0, import_react10.forwardRef)(({
|
|
|
692
693
|
hasRevealedRef.current = false;
|
|
693
694
|
if (!containerRef.current) return;
|
|
694
695
|
const container = containerRef.current;
|
|
695
|
-
|
|
696
|
-
|
|
696
|
+
gsap2.set(container.querySelectorAll("[data-line-inner]"), { opacity: 0 });
|
|
697
|
+
gsap2.set(container.querySelectorAll("[data-brand-rect], [data-fg-rect]"), { scaleX: 0, transformOrigin: "left" });
|
|
697
698
|
}, []);
|
|
698
699
|
(0, import_react10.useImperativeHandle)(ref, () => ({ reveal, reset }), [reveal, reset]);
|
|
699
700
|
const resolvedClassName = cx(typographyClasses[displayAs ?? Component], className);
|
|
@@ -815,7 +816,7 @@ function useDualLayerScramble(options) {
|
|
|
815
816
|
const finalWidth = Math.max(((_a = dimensionsRef.current) == null ? void 0 : _a.width) ?? 0, maxWidth);
|
|
816
817
|
const finalHeight = Math.max(((_b = dimensionsRef.current) == null ? void 0 : _b.height) ?? 0, totalHeight);
|
|
817
818
|
isPreparedRef.current = true;
|
|
818
|
-
|
|
819
|
+
gsap2.set(el, { width: finalWidth, height: finalHeight, display: "inline-block", overflow: "hidden" });
|
|
819
820
|
el.innerHTML = "";
|
|
820
821
|
spansRef.current = [];
|
|
821
822
|
linesDataRef.current.forEach((lineData) => {
|
|
@@ -832,7 +833,7 @@ function useDualLayerScramble(options) {
|
|
|
832
833
|
el.appendChild(span);
|
|
833
834
|
spansRef.current.push(span);
|
|
834
835
|
});
|
|
835
|
-
|
|
836
|
+
gsap2.set(el, { opacity: 1 });
|
|
836
837
|
}, []);
|
|
837
838
|
const playScramble = (0, import_react11.useCallback)((overrides) => {
|
|
838
839
|
var _a;
|
|
@@ -863,7 +864,7 @@ function useDualLayerScramble(options) {
|
|
|
863
864
|
}
|
|
864
865
|
killTimeline();
|
|
865
866
|
isAnimatingRef.current = true;
|
|
866
|
-
timelineRef.current =
|
|
867
|
+
timelineRef.current = gsap2.timeline({
|
|
867
868
|
onComplete: () => {
|
|
868
869
|
var _a2;
|
|
869
870
|
isAnimatingRef.current = false;
|
|
@@ -893,7 +894,7 @@ function useDualLayerScramble(options) {
|
|
|
893
894
|
const nonSpaceCount = originalText.replace(/\s/g, "").length;
|
|
894
895
|
const spacesOnly = originalText.replace(/[^\s]/g, " ");
|
|
895
896
|
(_a2 = timelineRef.current) == null ? void 0 : _a2.add(() => {
|
|
896
|
-
|
|
897
|
+
gsap2.set(span, { opacity: 1 });
|
|
897
898
|
span.innerText = spacesOnly;
|
|
898
899
|
}, delay);
|
|
899
900
|
(_b = timelineRef.current) == null ? void 0 : _b.to(span, {
|
|
@@ -927,7 +928,7 @@ function useDualLayerScramble(options) {
|
|
|
927
928
|
killTimeline();
|
|
928
929
|
if (elementRef.current && isPreparedRef.current) {
|
|
929
930
|
elementRef.current.innerHTML = originalHTMLRef.current || originalTextRef.current;
|
|
930
|
-
|
|
931
|
+
gsap2.set(elementRef.current, {
|
|
931
932
|
opacity: 0,
|
|
932
933
|
width: "auto",
|
|
933
934
|
height: "auto",
|
|
@@ -1431,7 +1432,7 @@ var AnimatedSubtext = (0, import_react15.forwardRef)(({
|
|
|
1431
1432
|
const lines = splitTextRef.current.lines ?? [];
|
|
1432
1433
|
if (lines.length !== 0) {
|
|
1433
1434
|
elementRef.current.style.visibility = "visible";
|
|
1434
|
-
|
|
1435
|
+
gsap2.fromTo(
|
|
1435
1436
|
lines,
|
|
1436
1437
|
{ y: "100%" },
|
|
1437
1438
|
{
|
|
@@ -1632,7 +1633,7 @@ function Preloader() {
|
|
|
1632
1633
|
requestAnimationFrame(runAnimation);
|
|
1633
1634
|
return;
|
|
1634
1635
|
}
|
|
1635
|
-
timelineRef.current =
|
|
1636
|
+
timelineRef.current = gsap2.timeline();
|
|
1636
1637
|
onReadyRef.current();
|
|
1637
1638
|
squares.forEach((square, index) => {
|
|
1638
1639
|
var _a2;
|