gsap-react-marquee 0.1.5 → 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 +6 -2
- package/dist/index.cjs.css +1 -1
- package/dist/index.cjs.js +3957 -46
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +3957 -46
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,4 +45,4 @@ function App() {
|
|
|
45
45
|
| `spacing` | `number` | `16` | Spacing between repeated elements in px |
|
|
46
46
|
| `draggable` | `boolean` | `false` | Enable dragging to scroll manually |
|
|
47
47
|
| `followScrollDir` | `boolean` | `false` | Sync marquee with page scroll direction |
|
|
48
|
-
| `scrollSpeed` | `number` |
|
|
48
|
+
| `scrollSpeed` | `number` | `2.5` | Speed factor when syncing with page scroll |
|
|
@@ -91,7 +91,7 @@ export declare const calculateDuplicates: (marqueeChildrenWidth: number, contain
|
|
|
91
91
|
*/
|
|
92
92
|
export declare const getMinWidth: (marqueesChildren: HTMLElement[], totalWidth: number, containerMarqueeWidth: number, props: GSAPReactMarqueeProps) => string | number;
|
|
93
93
|
/**
|
|
94
|
-
* Creates a complex
|
|
94
|
+
* Creates a complex marquee animation with seamless looping and draggable support
|
|
95
95
|
*
|
|
96
96
|
* This is the core animation engine that creates smooth, continuous scrolling.
|
|
97
97
|
* It handles the complex math required for seamless looping by calculating
|
|
@@ -102,16 +102,20 @@ export declare const getMinWidth: (marqueesChildren: HTMLElement[], totalWidth:
|
|
|
102
102
|
* 2. **Seamless Looping**: Calculate track length and loop points to prevent gaps
|
|
103
103
|
* 3. **Staggered Animation**: Each element starts at different times for smooth flow
|
|
104
104
|
* 4. **Direction Handling**: Support forward and reverse directions with proper timing
|
|
105
|
+
* 5. **Integrated Draggable**: Optional support for drag interaction with manual control
|
|
105
106
|
*
|
|
106
107
|
* Technical Details:
|
|
107
108
|
* - Uses xPercent for percentage-based positioning (responsive to element width changes)
|
|
108
109
|
* - Creates two-part animation: main movement + seamless loop reset
|
|
109
110
|
* - Calculates precise durations based on distance and speed for consistent motion
|
|
111
|
+
* - Implements draggable with intelligent pause/resume animation handling
|
|
110
112
|
*
|
|
111
113
|
* @param elementsToAnimate - Array of DOM elements to animate (content or containers)
|
|
112
114
|
* @param startX - Starting X position reference point
|
|
113
115
|
* @param tl - GSAP timeline to add animations to
|
|
114
116
|
* @param isReverse - Whether animation should play in reverse direction
|
|
117
|
+
* @param draggableTrigger - Element(s) that will trigger the draggable functionality
|
|
118
|
+
* @param isVertical - Whether the marquee scrolls vertically
|
|
115
119
|
* @param props - Configuration object with spacing, speed, delay, and other settings
|
|
116
120
|
*/
|
|
117
|
-
export declare const coreAnimation: (elementsToAnimate: HTMLElement[], startX: number, tl: gsap.core.Timeline, isReverse: boolean, props: GSAPReactMarqueeProps) => void;
|
|
121
|
+
export declare const coreAnimation: (elementsToAnimate: HTMLElement[], startX: number, tl: gsap.core.Timeline, isReverse: boolean, draggableTrigger: HTMLElement | HTMLElement[], isVertical: boolean, props: GSAPReactMarqueeProps) => void;
|
package/dist/index.cjs.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gsap-react-marquee-container:after{background:linear-gradient(270deg,hsla(0,0%,100%,0) 0,var(--gradient-color) 75%);content:"";height:100%;
|
|
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}
|