gsap-react-marquee 0.1.4 → 0.1.7
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/README.md +1 -1
- package/dist/components/gsap-reactmarquee.utils.d.ts +32 -2
- package/dist/index.cjs.css +1 -1
- package/dist/index.cjs.js +4553 -585
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +33 -3
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +4554 -587
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -107,6 +107,32 @@ declare const GSAPReactMarquee: react.ForwardRefExoticComponent<GSAPReactMarquee
|
|
|
107
107
|
* @returns Merged and deduplicated class string
|
|
108
108
|
*/
|
|
109
109
|
declare const cn: (...inputs: ClassValue[]) => string;
|
|
110
|
+
/**
|
|
111
|
+
* Traverses the DOM tree upward to find the first non-transparent background color
|
|
112
|
+
*
|
|
113
|
+
* This function walks up the element hierarchy starting from the given element,
|
|
114
|
+
* checking each parent's computed backgroundColor style until it finds a visible
|
|
115
|
+
* (non-transparent) background color. This is useful for automatically detecting
|
|
116
|
+
* the effective background behind an element for gradient overlays.
|
|
117
|
+
*
|
|
118
|
+
* The traversal stops at the first element with a visible background color,
|
|
119
|
+
* which could be the element itself or any of its ancestors up to the document root.
|
|
120
|
+
*
|
|
121
|
+
* @param el - The HTMLElement to start the background color search from
|
|
122
|
+
* @returns The first non-transparent background color found in the hierarchy,
|
|
123
|
+
* or "transparent" if no visible background is found
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* // Element with white parent background
|
|
127
|
+
* const color = getEffectiveBackgroundColor(marqueeElement);
|
|
128
|
+
* // Returns: "rgb(255, 255, 255)" or "#ffffff"
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* // Element with no background set anywhere in hierarchy
|
|
132
|
+
* const color = getEffectiveBackgroundColor(marqueeElement);
|
|
133
|
+
* // Returns: "transparent"
|
|
134
|
+
*/
|
|
135
|
+
declare const getEffectiveBackgroundColor: (el: HTMLElement) => string;
|
|
110
136
|
/**
|
|
111
137
|
* Sets up container styles and rotation handling for the marquee
|
|
112
138
|
*
|
|
@@ -161,7 +187,7 @@ declare const calculateDuplicates: (marqueeChildrenWidth: number, containerMarqu
|
|
|
161
187
|
*/
|
|
162
188
|
declare const getMinWidth: (marqueesChildren: HTMLElement[], totalWidth: number, containerMarqueeWidth: number, props: GSAPReactMarqueeProps) => string | number;
|
|
163
189
|
/**
|
|
164
|
-
* Creates a complex
|
|
190
|
+
* Creates a complex marquee animation with seamless looping and draggable support
|
|
165
191
|
*
|
|
166
192
|
* This is the core animation engine that creates smooth, continuous scrolling.
|
|
167
193
|
* It handles the complex math required for seamless looping by calculating
|
|
@@ -172,19 +198,23 @@ declare const getMinWidth: (marqueesChildren: HTMLElement[], totalWidth: number,
|
|
|
172
198
|
* 2. **Seamless Looping**: Calculate track length and loop points to prevent gaps
|
|
173
199
|
* 3. **Staggered Animation**: Each element starts at different times for smooth flow
|
|
174
200
|
* 4. **Direction Handling**: Support forward and reverse directions with proper timing
|
|
201
|
+
* 5. **Integrated Draggable**: Optional support for drag interaction with manual control
|
|
175
202
|
*
|
|
176
203
|
* Technical Details:
|
|
177
204
|
* - Uses xPercent for percentage-based positioning (responsive to element width changes)
|
|
178
205
|
* - Creates two-part animation: main movement + seamless loop reset
|
|
179
206
|
* - Calculates precise durations based on distance and speed for consistent motion
|
|
207
|
+
* - Implements draggable with intelligent pause/resume animation handling
|
|
180
208
|
*
|
|
181
209
|
* @param elementsToAnimate - Array of DOM elements to animate (content or containers)
|
|
182
210
|
* @param startX - Starting X position reference point
|
|
183
211
|
* @param tl - GSAP timeline to add animations to
|
|
184
212
|
* @param isReverse - Whether animation should play in reverse direction
|
|
213
|
+
* @param draggableTrigger - Element(s) that will trigger the draggable functionality
|
|
214
|
+
* @param isVertical - Whether the marquee scrolls vertically
|
|
185
215
|
* @param props - Configuration object with spacing, speed, delay, and other settings
|
|
186
216
|
*/
|
|
187
|
-
declare const coreAnimation: (elementsToAnimate: HTMLElement[], startX: number, tl: gsap.core.Timeline, isReverse: boolean, props: GSAPReactMarqueeProps) => void;
|
|
217
|
+
declare const coreAnimation: (elementsToAnimate: HTMLElement[], startX: number, tl: gsap.core.Timeline, isReverse: boolean, draggableTrigger: HTMLElement | HTMLElement[], isVertical: boolean, props: GSAPReactMarqueeProps) => void;
|
|
188
218
|
|
|
189
|
-
export { calculateDuplicates, cn, coreAnimation, GSAPReactMarquee as default, getMinWidth, setupContainerStyles };
|
|
219
|
+
export { calculateDuplicates, cn, coreAnimation, GSAPReactMarquee as default, getEffectiveBackgroundColor, getMinWidth, setupContainerStyles };
|
|
190
220
|
export type { GSAPReactMarqueeProps };
|
package/dist/index.esm.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gsap-react-marquee{flex:1;height:max-content;width:auto}.gsap-react-marquee,.gsap-react-marquee-content{display:flex;line-height:100%;white-space:preserve nowrap}.gsap-react-marquee-content{overflow:hidden;width:max-content}
|
|
1
|
+
.gsap-react-marquee-container:after{background:linear-gradient(270deg,hsla(0,0%,100%,0) 0,var(--gradient-color) 75%);left:0}.gsap-react-marquee-container:after,.gsap-react-marquee-container:before{content:"";height:100%;pointer-events:none;position:absolute;top:0;width:15%;z-index:10}.gsap-react-marquee-container:before{background:linear-gradient(90deg,hsla(0,0%,100%,0) 0,var(--gradient-color) 75%);right:0}.gsap-react-marquee{flex:1;height:max-content;width:auto}.gsap-react-marquee,.gsap-react-marquee-content{display:flex;line-height:100%;white-space:preserve nowrap}.gsap-react-marquee-content{overflow:hidden;width:max-content}
|