@drivexstudio/animations 1.0.1 → 1.0.3
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 +25 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -54,7 +54,7 @@ __export(packages_exports, {
|
|
|
54
54
|
easingDefinitionToFunction: () => easingDefinitionToFunction,
|
|
55
55
|
getCssScrollLocked: () => getCssScrollLocked,
|
|
56
56
|
getLenis: () => getLenis,
|
|
57
|
-
gsap: () => import_gsap.
|
|
57
|
+
gsap: () => import_gsap.gsap,
|
|
58
58
|
scrollToTop: () => scrollToTop,
|
|
59
59
|
setCssScrollLocked: () => setCssScrollLocked,
|
|
60
60
|
stagger: () => stagger,
|
|
@@ -76,17 +76,23 @@ module.exports = __toCommonJS(packages_exports);
|
|
|
76
76
|
var import_react9 = __toESM(require("react"), 1);
|
|
77
77
|
|
|
78
78
|
// libs/vendor.js
|
|
79
|
-
var import_gsap =
|
|
79
|
+
var import_gsap = require("gsap");
|
|
80
80
|
var import_react = require("@gsap/react");
|
|
81
81
|
var import_ScrollTrigger = require("gsap/ScrollTrigger");
|
|
82
|
+
var import_Flip = require("gsap/Flip");
|
|
82
83
|
var import_SplitText = require("gsap/SplitText");
|
|
83
84
|
var import_ScrambleTextPlugin = require("gsap/ScrambleTextPlugin");
|
|
85
|
+
var import_InertiaPlugin = require("gsap/InertiaPlugin");
|
|
86
|
+
var import_Draggable = require("gsap/Draggable");
|
|
84
87
|
var import_class_variance_authority = require("class-variance-authority");
|
|
85
88
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
86
|
-
import_gsap.
|
|
89
|
+
import_gsap.gsap.registerPlugin(
|
|
87
90
|
import_ScrollTrigger.ScrollTrigger,
|
|
88
91
|
import_ScrambleTextPlugin.ScrambleTextPlugin,
|
|
89
|
-
import_SplitText.SplitText
|
|
92
|
+
import_SplitText.SplitText,
|
|
93
|
+
import_Flip.Flip,
|
|
94
|
+
import_Draggable.Draggable,
|
|
95
|
+
import_InertiaPlugin.InertiaPlugin
|
|
90
96
|
);
|
|
91
97
|
var cx = import_class_variance_authority.cx;
|
|
92
98
|
|
|
@@ -355,7 +361,7 @@ function ScrambleGroup({
|
|
|
355
361
|
const callbacks = Array.from(childrenMapRef.current.values());
|
|
356
362
|
const staggerValue = customStagger ?? stagger2;
|
|
357
363
|
callbacks.forEach((callbackFn, index) => {
|
|
358
|
-
import_gsap.
|
|
364
|
+
import_gsap.gsap.delayedCall(index * staggerValue, () => {
|
|
359
365
|
callbackFn();
|
|
360
366
|
});
|
|
361
367
|
});
|
|
@@ -364,7 +370,7 @@ function ScrambleGroup({
|
|
|
364
370
|
const setupScrollTrigger = (0, import_react8.useCallback)(() => {
|
|
365
371
|
if (manual || !containerRef.current) return;
|
|
366
372
|
isTriggering.current = false;
|
|
367
|
-
const tween = import_gsap.
|
|
373
|
+
const tween = import_gsap.gsap.to(containerRef.current, {
|
|
368
374
|
scrollTrigger: {
|
|
369
375
|
trigger: containerRef.current,
|
|
370
376
|
start,
|
|
@@ -458,7 +464,7 @@ function ScrambleText({
|
|
|
458
464
|
return null;
|
|
459
465
|
}
|
|
460
466
|
killTimeline();
|
|
461
|
-
timelineRef.current = import_gsap.
|
|
467
|
+
timelineRef.current = import_gsap.gsap.timeline({
|
|
462
468
|
onComplete: () => {
|
|
463
469
|
timelineRef.current = null;
|
|
464
470
|
isCompleteRef.current = true;
|
|
@@ -645,8 +651,8 @@ var AnimatedHeadline = (0, import_react10.forwardRef)(({
|
|
|
645
651
|
(0, import_react.useGSAP)(() => {
|
|
646
652
|
if (shouldSkip || !containerRef.current || !lines) return;
|
|
647
653
|
const container = containerRef.current;
|
|
648
|
-
import_gsap.
|
|
649
|
-
import_gsap.
|
|
654
|
+
import_gsap.gsap.set(container.querySelectorAll("[data-line-inner]"), { opacity: 0 });
|
|
655
|
+
import_gsap.gsap.set(container.querySelectorAll("[data-brand-rect], [data-fg-rect]"), { scaleX: 0, transformOrigin: "left" });
|
|
650
656
|
}, { dependencies: [shouldSkip, lines] });
|
|
651
657
|
useIdleGSAP(() => {
|
|
652
658
|
if (trigger !== "scroll" || shouldSkip || !lines) return;
|
|
@@ -673,7 +679,7 @@ var AnimatedHeadline = (0, import_react10.forwardRef)(({
|
|
|
673
679
|
const fgRect = lineNode.querySelector("[data-fg-rect]");
|
|
674
680
|
if (!lineInner || !brandRect || !fgRect) continue;
|
|
675
681
|
const rects = [brandRect, fgRect];
|
|
676
|
-
const tl = import_gsap.
|
|
682
|
+
const tl = import_gsap.gsap.timeline({ delay });
|
|
677
683
|
tl.to(brandRect, { scaleX: 1, duration: 0.45, ease: "power3.inOut" }, 0);
|
|
678
684
|
tl.to(fgRect, { scaleX: 1, duration: 0.45, ease: "power3.inOut" }, 0.1);
|
|
679
685
|
tl.set(lineInner, { opacity: 1 }, 0.5);
|
|
@@ -686,8 +692,8 @@ var AnimatedHeadline = (0, import_react10.forwardRef)(({
|
|
|
686
692
|
hasRevealedRef.current = false;
|
|
687
693
|
if (!containerRef.current) return;
|
|
688
694
|
const container = containerRef.current;
|
|
689
|
-
import_gsap.
|
|
690
|
-
import_gsap.
|
|
695
|
+
import_gsap.gsap.set(container.querySelectorAll("[data-line-inner]"), { opacity: 0 });
|
|
696
|
+
import_gsap.gsap.set(container.querySelectorAll("[data-brand-rect], [data-fg-rect]"), { scaleX: 0, transformOrigin: "left" });
|
|
691
697
|
}, []);
|
|
692
698
|
(0, import_react10.useImperativeHandle)(ref, () => ({ reveal, reset }), [reveal, reset]);
|
|
693
699
|
const resolvedClassName = cx(typographyClasses[displayAs ?? Component], className);
|
|
@@ -809,7 +815,7 @@ function useDualLayerScramble(options) {
|
|
|
809
815
|
const finalWidth = Math.max(((_a = dimensionsRef.current) == null ? void 0 : _a.width) ?? 0, maxWidth);
|
|
810
816
|
const finalHeight = Math.max(((_b = dimensionsRef.current) == null ? void 0 : _b.height) ?? 0, totalHeight);
|
|
811
817
|
isPreparedRef.current = true;
|
|
812
|
-
import_gsap.
|
|
818
|
+
import_gsap.gsap.set(el, { width: finalWidth, height: finalHeight, display: "inline-block", overflow: "hidden" });
|
|
813
819
|
el.innerHTML = "";
|
|
814
820
|
spansRef.current = [];
|
|
815
821
|
linesDataRef.current.forEach((lineData) => {
|
|
@@ -826,7 +832,7 @@ function useDualLayerScramble(options) {
|
|
|
826
832
|
el.appendChild(span);
|
|
827
833
|
spansRef.current.push(span);
|
|
828
834
|
});
|
|
829
|
-
import_gsap.
|
|
835
|
+
import_gsap.gsap.set(el, { opacity: 1 });
|
|
830
836
|
}, []);
|
|
831
837
|
const playScramble = (0, import_react11.useCallback)((overrides) => {
|
|
832
838
|
var _a;
|
|
@@ -857,7 +863,7 @@ function useDualLayerScramble(options) {
|
|
|
857
863
|
}
|
|
858
864
|
killTimeline();
|
|
859
865
|
isAnimatingRef.current = true;
|
|
860
|
-
timelineRef.current = import_gsap.
|
|
866
|
+
timelineRef.current = import_gsap.gsap.timeline({
|
|
861
867
|
onComplete: () => {
|
|
862
868
|
var _a2;
|
|
863
869
|
isAnimatingRef.current = false;
|
|
@@ -887,7 +893,7 @@ function useDualLayerScramble(options) {
|
|
|
887
893
|
const nonSpaceCount = originalText.replace(/\s/g, "").length;
|
|
888
894
|
const spacesOnly = originalText.replace(/[^\s]/g, " ");
|
|
889
895
|
(_a2 = timelineRef.current) == null ? void 0 : _a2.add(() => {
|
|
890
|
-
import_gsap.
|
|
896
|
+
import_gsap.gsap.set(span, { opacity: 1 });
|
|
891
897
|
span.innerText = spacesOnly;
|
|
892
898
|
}, delay);
|
|
893
899
|
(_b = timelineRef.current) == null ? void 0 : _b.to(span, {
|
|
@@ -921,7 +927,7 @@ function useDualLayerScramble(options) {
|
|
|
921
927
|
killTimeline();
|
|
922
928
|
if (elementRef.current && isPreparedRef.current) {
|
|
923
929
|
elementRef.current.innerHTML = originalHTMLRef.current || originalTextRef.current;
|
|
924
|
-
import_gsap.
|
|
930
|
+
import_gsap.gsap.set(elementRef.current, {
|
|
925
931
|
opacity: 0,
|
|
926
932
|
width: "auto",
|
|
927
933
|
height: "auto",
|
|
@@ -1425,7 +1431,7 @@ var AnimatedSubtext = (0, import_react15.forwardRef)(({
|
|
|
1425
1431
|
const lines = splitTextRef.current.lines ?? [];
|
|
1426
1432
|
if (lines.length !== 0) {
|
|
1427
1433
|
elementRef.current.style.visibility = "visible";
|
|
1428
|
-
import_gsap.
|
|
1434
|
+
import_gsap.gsap.fromTo(
|
|
1429
1435
|
lines,
|
|
1430
1436
|
{ y: "100%" },
|
|
1431
1437
|
{
|
|
@@ -1626,7 +1632,7 @@ function Preloader() {
|
|
|
1626
1632
|
requestAnimationFrame(runAnimation);
|
|
1627
1633
|
return;
|
|
1628
1634
|
}
|
|
1629
|
-
timelineRef.current = import_gsap.
|
|
1635
|
+
timelineRef.current = import_gsap.gsap.timeline();
|
|
1630
1636
|
onReadyRef.current();
|
|
1631
1637
|
squares.forEach((square, index) => {
|
|
1632
1638
|
var _a2;
|