marquee-content 4.0.0 → 4.2.0
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 +25 -6
- package/dist/index.js +19 -15
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +19 -15
- package/dist/index.module.js.map +1 -1
- package/package.json +1 -2
- package/src/index.js +27 -22
- package/src/demo.js +0 -10
package/README.md
CHANGED
|
@@ -25,23 +25,42 @@ yarn add marquee-content
|
|
|
25
25
|
|
|
26
26
|
➤ **Import**
|
|
27
27
|
```javascript
|
|
28
|
-
import
|
|
29
|
-
import
|
|
28
|
+
import gsap from 'gsap';
|
|
29
|
+
import ScrollTrigger from 'gsap/ScrollTrigger';
|
|
30
30
|
import MarqueeContent from 'marquee-content';
|
|
31
|
+
|
|
32
|
+
gsap.registerPlugin(ScrollTrigger);
|
|
33
|
+
MarqueeContent.registerGSAP(gsap, ScrollTrigger);
|
|
31
34
|
```
|
|
32
35
|
<br>
|
|
33
36
|
|
|
34
37
|
➤ **Usage**
|
|
35
38
|
```javascript
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
const marquee = new MarqueeContent({
|
|
40
|
+
element: '.marquee',
|
|
41
|
+
});
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
marquee.init();
|
|
44
|
+
```
|
|
45
|
+
or
|
|
46
|
+
```javascript
|
|
47
|
+
document.querySelectorAll('.marquee').forEach((element) => {
|
|
48
|
+
const marquee = new MarqueeContent({
|
|
49
|
+
element,
|
|
50
|
+
});
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
marquee.init();
|
|
53
|
+
});
|
|
42
54
|
```
|
|
43
55
|
<br>
|
|
44
56
|
|
|
57
|
+
➤ **Options**
|
|
58
|
+
|
|
59
|
+
| Option | Type | Default | Description |
|
|
60
|
+
|:----------|:-----------------------------:|:-----------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
61
|
+
| `element` | `string` | `HTMLElement` | `.marquee` | The option `element` defines the DOM element to which the animation will be applied. This option offers two ways to specify the target element:<br>**1.** As a string with a CSS selector. If `element` is given as a string, it is used to find the element in the DOM through the `document.querySelector` method. This allows for easy identification of elements by their id, class, or other selector.<br>**2.** As an HTMLElement object. If `element` is already an HTMLElement object, it is used directly, without the need for additional searching in the DOM. |
|
|
62
|
+
<br>
|
|
63
|
+
|
|
45
64
|
➤ **Settings**
|
|
46
65
|
|
|
47
66
|
| Option | Default | Description |
|
package/dist/index.js
CHANGED
|
@@ -82,37 +82,40 @@ const $4559ecf940edc78d$export$3484d11c6bb42ecc = function(element) {
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
class $4fa36e821943b400$
|
|
85
|
+
class $4fa36e821943b400$var$MarqueeContent {
|
|
86
86
|
#gsap;
|
|
87
87
|
#MM;
|
|
88
88
|
#timeline;
|
|
89
89
|
#element;
|
|
90
90
|
#resizeObserver;
|
|
91
91
|
#animationFrame;
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
static gsap;
|
|
93
|
+
static ScrollTrigger;
|
|
94
|
+
constructor({ element: element = ".marquee" } = {}){
|
|
95
|
+
this.#gsap = $4fa36e821943b400$var$MarqueeContent.gsap ?? window.gsap;
|
|
94
96
|
this.#MM = this.#gsap.matchMedia();
|
|
95
97
|
this.#timeline = null;
|
|
96
|
-
this.#element =
|
|
97
|
-
if (!this.#element)
|
|
98
|
-
this.#resizeObserver = new ResizeObserver(
|
|
98
|
+
this.#element = element instanceof HTMLElement ? element : document.querySelector(element);
|
|
99
|
+
if (!this.#element) return;
|
|
100
|
+
this.#resizeObserver = new ResizeObserver($4559ecf940edc78d$export$61fc7d43ac8f84b0(()=>this.#update()));
|
|
99
101
|
this.#resizeObserver.observe(this.#element);
|
|
100
102
|
}
|
|
101
|
-
static registerGSAP(gsap) {
|
|
102
|
-
$4fa36e821943b400$
|
|
103
|
+
static registerGSAP(gsap, ScrollTrigger) {
|
|
104
|
+
$4fa36e821943b400$var$MarqueeContent.gsap = gsap;
|
|
105
|
+
$4fa36e821943b400$var$MarqueeContent.ScrollTrigger = ScrollTrigger;
|
|
103
106
|
}
|
|
104
107
|
#commonInit = ()=>{
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.#timeline =
|
|
108
|
+
$4559ecf940edc78d$export$6a732ac1b1fdc86b(this.#timeline, this.#element, this.#gsap);
|
|
109
|
+
$4559ecf940edc78d$export$7c4d14cd3c92bf0b(this.#element, this.#gsap, this.#MM);
|
|
110
|
+
$4559ecf940edc78d$export$d07517a676ce386f(this.#element);
|
|
111
|
+
$4559ecf940edc78d$export$3484d11c6bb42ecc(this.#element);
|
|
112
|
+
this.#timeline = $4559ecf940edc78d$export$ecad260a8a5fef4f(this.#element, this.#gsap, this.#MM, this.#timeline, this);
|
|
110
113
|
};
|
|
111
114
|
#update = ()=>{
|
|
112
115
|
cancelAnimationFrame(this.#animationFrame);
|
|
113
116
|
this.#animationFrame = requestAnimationFrame(()=>{
|
|
114
117
|
this.#commonInit();
|
|
115
|
-
ScrollTrigger.refresh();
|
|
118
|
+
$4fa36e821943b400$var$MarqueeContent.ScrollTrigger.refresh();
|
|
116
119
|
});
|
|
117
120
|
};
|
|
118
121
|
init = ()=>{
|
|
@@ -120,10 +123,11 @@ class $4fa36e821943b400$export$2e2bcd8739ae039 {
|
|
|
120
123
|
};
|
|
121
124
|
destroy = ()=>{
|
|
122
125
|
cancelAnimationFrame(this.#animationFrame);
|
|
123
|
-
|
|
126
|
+
$4559ecf940edc78d$export$6a732ac1b1fdc86b(this.#timeline, this.#element, this.#gsap);
|
|
124
127
|
this.#resizeObserver?.disconnect();
|
|
125
128
|
};
|
|
126
129
|
}
|
|
130
|
+
var $4fa36e821943b400$export$2e2bcd8739ae039 = $4fa36e821943b400$var$MarqueeContent;
|
|
127
131
|
|
|
128
132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CAAoB,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI;QAE7D,IAAI,CAAC,CAAC,cAAc,EAAE;IACxB,EAAC;AACH;IAEA,2CAAe","sources":["src/index.js","src/utils.js"],"sourcesContent":["import * as Utils from './utils.js';\n\nclass MarqueeContent {\n #gsap;\n\n #MM;\n\n #timeline;\n\n #element;\n\n #resizeObserver;\n\n #animationFrame;\n\n static gsap;\n\n static ScrollTrigger;\n\n constructor({element = '.marquee'} = {}) {\n this.#gsap = MarqueeContent.gsap ?? window.gsap;\n this.#MM = this.#gsap.matchMedia();\n this.#timeline = null;\n this.#element = element instanceof HTMLElement ? element : document.querySelector(element);\n\n if (!this.#element) return;\n\n this.#resizeObserver = new ResizeObserver(Utils.debounce(() => this.#update()));\n this.#resizeObserver.observe(this.#element);\n }\n\n static registerGSAP(gsap, ScrollTrigger) {\n MarqueeContent.gsap = gsap;\n MarqueeContent.ScrollTrigger = ScrollTrigger;\n }\n\n #commonInit = () => {\n Utils.clearTimeline(this.#timeline, this.#element, this.#gsap);\n Utils.cloning(this.#element, this.#gsap, this.#MM);\n Utils.breakpoints(this.#element);\n Utils.skewed(this.#element);\n\n this.#timeline = Utils.animation(this.#element, this.#gsap, this.#MM, this.#timeline, this);\n };\n\n #update = () => {\n cancelAnimationFrame(this.#animationFrame);\n this.#animationFrame = requestAnimationFrame(() => {\n this.#commonInit();\n\n MarqueeContent.ScrollTrigger.refresh();\n });\n };\n\n init = () => {\n this.#commonInit();\n }\n\n destroy = () => {\n cancelAnimationFrame(this.#animationFrame);\n\n Utils.clearTimeline(this.#timeline, this.#element, this.#gsap);\n\n this.#resizeObserver?.disconnect();\n }\n}\n\nexport default MarqueeContent;\n","export const debounce = function(func) {\n let timer;\n\n return (...args) => {\n cancelAnimationFrame(timer);\n\n timer = requestAnimationFrame(() => func(...args));\n };\n};\n\nexport const animation = function(element, gsap, MM, timeline, update) {\n timeline?.kill();\n\n timeline = gsap.timeline({\n scrollTrigger: {\n trigger: element,\n start: 'top bottom',\n end: 'bottom top',\n toggleActions: 'resume pause resume pause',\n onUpdate: (self) => {\n if (element.dataset.mcDirection === 'ltr') {\n timeline.timeScale(-1);\n } else if (element.dataset.mcDirection === 'auto') {\n timeline.timeScale(self.direction);\n }\n },\n }\n });\n\n MM.add(element.dataset.mcBreakpoint, () => {\n timeline.to(element.children, {\n duration: element.dataset.mcDuration ?? 20,\n x: '-100%',\n repeat: -1,\n ease: 'none',\n });\n\n timeline.totalProgress(0.5);\n\n return () => timeline?.kill();\n });\n\n update.timeline = timeline;\n\n return timeline;\n};\n\nexport const breakpoints = function(element) {\n element.dataset.mcBreakpoint = element.dataset.mcMax\n ? `(max-width: ${element.dataset.mcMax - 0.02}px)`\n : element.dataset.mcMin ? `(min-width: ${element.dataset.mcMin}px)` : '';\n};\n\nexport const clearTimeline = function(timeline, element, gsap) {\n timeline?.kill();\n timeline = null;\n\n gsap.set(element.children, { clearProps: 'all' });\n};\n\nexport const cloning = function(element, gsap, MM) {\n const removingClones = () => {\n while (element.childElementCount > 1) {\n element.removeChild(element.lastChild);\n }\n };\n\n removingClones();\n\n MM.add(element.dataset.mcBreakpoint, () => {\n const requiredQuantity = Math.ceil(element.scrollWidth / element.firstElementChild.clientWidth + 2);\n\n if (element.childElementCount < requiredQuantity) {\n const fragment = document.createDocumentFragment();\n const clones = Array.from({ length: requiredQuantity - 1 }, () => element.firstElementChild.cloneNode(true));\n\n clones.forEach(clone => fragment.appendChild(clone));\n\n element.appendChild(fragment);\n }\n\n return removingClones;\n });\n};\n\nexport const skewed = function(element) {\n if (!element.dataset.mcSkew) return;\n\n const abs = Math.abs(parseInt(element.dataset.mcSkew, 10));\n const { style } = element;\n\n style.transformOrigin = 'center center';\n style.transform = `skew(0deg, ${element.dataset.mcSkew}deg)`;\n style.minHeight = `calc(${abs * 1.25}vh + ${abs * 1.25}vw)`;\n};\n"],"names":[],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -70,37 +70,40 @@ const $f3ad94c9f84f4d57$export$3484d11c6bb42ecc = function(element) {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
class $cf838c15c8b009ba$
|
|
73
|
+
class $cf838c15c8b009ba$var$MarqueeContent {
|
|
74
74
|
#gsap;
|
|
75
75
|
#MM;
|
|
76
76
|
#timeline;
|
|
77
77
|
#element;
|
|
78
78
|
#resizeObserver;
|
|
79
79
|
#animationFrame;
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
static gsap;
|
|
81
|
+
static ScrollTrigger;
|
|
82
|
+
constructor({ element: element = ".marquee" } = {}){
|
|
83
|
+
this.#gsap = $cf838c15c8b009ba$var$MarqueeContent.gsap ?? window.gsap;
|
|
82
84
|
this.#MM = this.#gsap.matchMedia();
|
|
83
85
|
this.#timeline = null;
|
|
84
|
-
this.#element =
|
|
85
|
-
if (!this.#element)
|
|
86
|
-
this.#resizeObserver = new ResizeObserver(
|
|
86
|
+
this.#element = element instanceof HTMLElement ? element : document.querySelector(element);
|
|
87
|
+
if (!this.#element) return;
|
|
88
|
+
this.#resizeObserver = new ResizeObserver($f3ad94c9f84f4d57$export$61fc7d43ac8f84b0(()=>this.#update()));
|
|
87
89
|
this.#resizeObserver.observe(this.#element);
|
|
88
90
|
}
|
|
89
|
-
static registerGSAP(gsap) {
|
|
90
|
-
$cf838c15c8b009ba$
|
|
91
|
+
static registerGSAP(gsap, ScrollTrigger) {
|
|
92
|
+
$cf838c15c8b009ba$var$MarqueeContent.gsap = gsap;
|
|
93
|
+
$cf838c15c8b009ba$var$MarqueeContent.ScrollTrigger = ScrollTrigger;
|
|
91
94
|
}
|
|
92
95
|
#commonInit = ()=>{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.#timeline =
|
|
96
|
+
$f3ad94c9f84f4d57$export$6a732ac1b1fdc86b(this.#timeline, this.#element, this.#gsap);
|
|
97
|
+
$f3ad94c9f84f4d57$export$7c4d14cd3c92bf0b(this.#element, this.#gsap, this.#MM);
|
|
98
|
+
$f3ad94c9f84f4d57$export$d07517a676ce386f(this.#element);
|
|
99
|
+
$f3ad94c9f84f4d57$export$3484d11c6bb42ecc(this.#element);
|
|
100
|
+
this.#timeline = $f3ad94c9f84f4d57$export$ecad260a8a5fef4f(this.#element, this.#gsap, this.#MM, this.#timeline, this);
|
|
98
101
|
};
|
|
99
102
|
#update = ()=>{
|
|
100
103
|
cancelAnimationFrame(this.#animationFrame);
|
|
101
104
|
this.#animationFrame = requestAnimationFrame(()=>{
|
|
102
105
|
this.#commonInit();
|
|
103
|
-
ScrollTrigger.refresh();
|
|
106
|
+
$cf838c15c8b009ba$var$MarqueeContent.ScrollTrigger.refresh();
|
|
104
107
|
});
|
|
105
108
|
};
|
|
106
109
|
init = ()=>{
|
|
@@ -108,10 +111,11 @@ class $cf838c15c8b009ba$export$2e2bcd8739ae039 {
|
|
|
108
111
|
};
|
|
109
112
|
destroy = ()=>{
|
|
110
113
|
cancelAnimationFrame(this.#animationFrame);
|
|
111
|
-
|
|
114
|
+
$f3ad94c9f84f4d57$export$6a732ac1b1fdc86b(this.#timeline, this.#element, this.#gsap);
|
|
112
115
|
this.#resizeObserver?.disconnect();
|
|
113
116
|
};
|
|
114
117
|
}
|
|
118
|
+
var $cf838c15c8b009ba$export$2e2bcd8739ae039 = $cf838c15c8b009ba$var$MarqueeContent;
|
|
115
119
|
|
|
116
120
|
|
|
117
121
|
export {$cf838c15c8b009ba$export$2e2bcd8739ae039 as default};
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACAO,MAAM,4CAAW,SAAS,IAAI;IACnC,IAAI;IAEJ,OAAO,CAAC,GAAG;QACT,qBAAqB;QAErB,QAAQ,sBAAsB,IAAM,QAAQ;IAC9C;AACF;AAEO,MAAM,4CAAY,SAAS,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,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AC,IAAI,CAAC,CAAC,OAAO;IAC5C;IAEA,OAAO,aAAa,IAAI,EAAE,aAAa,EAAE;QACvC,qCAAe,IAAI,GAAG;QACtB,qCAAe,aAAa,GAAG;IACjC;IAEA,CAAC,UAAU,GAAG;QACZ,0CAAoB,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI;QAC7D,0CAAc,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE;QACjD,0CAAkB,IAAI,CAAC,CAAC,OAAO;QAC/B,0CAAa,IAAI,CAAC,CAAC,OAAO;QAE1B,IAAI,CAAC,CAAC,QAAQ,GAAG,0CAAgB,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI;IAC5F,EAAE;IAEF,CAAC,MAAM,GAAG;QACR,qBAAqB,IAAI,CAAC,CAAC,cAAc;QACzC,IAAI,CAAC,CAAC,cAAc,GAAG,sBAAsB;YAC3C,IAAI,CAAC,CAAC,UAAU;YAEhB,qCAAe,aAAa,CAAC,OAAO;QACtC;IACF,EAAE;IAEF,OAAO;QACL,IAAI,CAAC,CAAC,UAAU;IAClB,EAAC;IAED,UAAU;QACR,qBAAqB,IAAI,CAAC,CAAC,cAAc;QAEzC,0CAAoB,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI;QAE7D,IAAI,CAAC,CAAC,cAAc,EAAE;IACxB,EAAC;AACH;IAEA,2CAAe","sources":["src/index.js","src/utils.js"],"sourcesContent":["import * as Utils from './utils.js';\n\nclass MarqueeContent {\n #gsap;\n\n #MM;\n\n #timeline;\n\n #element;\n\n #resizeObserver;\n\n #animationFrame;\n\n static gsap;\n\n static ScrollTrigger;\n\n constructor({element = '.marquee'} = {}) {\n this.#gsap = MarqueeContent.gsap ?? window.gsap;\n this.#MM = this.#gsap.matchMedia();\n this.#timeline = null;\n this.#element = element instanceof HTMLElement ? element : document.querySelector(element);\n\n if (!this.#element) return;\n\n this.#resizeObserver = new ResizeObserver(Utils.debounce(() => this.#update()));\n this.#resizeObserver.observe(this.#element);\n }\n\n static registerGSAP(gsap, ScrollTrigger) {\n MarqueeContent.gsap = gsap;\n MarqueeContent.ScrollTrigger = ScrollTrigger;\n }\n\n #commonInit = () => {\n Utils.clearTimeline(this.#timeline, this.#element, this.#gsap);\n Utils.cloning(this.#element, this.#gsap, this.#MM);\n Utils.breakpoints(this.#element);\n Utils.skewed(this.#element);\n\n this.#timeline = Utils.animation(this.#element, this.#gsap, this.#MM, this.#timeline, this);\n };\n\n #update = () => {\n cancelAnimationFrame(this.#animationFrame);\n this.#animationFrame = requestAnimationFrame(() => {\n this.#commonInit();\n\n MarqueeContent.ScrollTrigger.refresh();\n });\n };\n\n init = () => {\n this.#commonInit();\n }\n\n destroy = () => {\n cancelAnimationFrame(this.#animationFrame);\n\n Utils.clearTimeline(this.#timeline, this.#element, this.#gsap);\n\n this.#resizeObserver?.disconnect();\n }\n}\n\nexport default MarqueeContent;\n","export const debounce = function(func) {\n let timer;\n\n return (...args) => {\n cancelAnimationFrame(timer);\n\n timer = requestAnimationFrame(() => func(...args));\n };\n};\n\nexport const animation = function(element, gsap, MM, timeline, update) {\n timeline?.kill();\n\n timeline = gsap.timeline({\n scrollTrigger: {\n trigger: element,\n start: 'top bottom',\n end: 'bottom top',\n toggleActions: 'resume pause resume pause',\n onUpdate: (self) => {\n if (element.dataset.mcDirection === 'ltr') {\n timeline.timeScale(-1);\n } else if (element.dataset.mcDirection === 'auto') {\n timeline.timeScale(self.direction);\n }\n },\n }\n });\n\n MM.add(element.dataset.mcBreakpoint, () => {\n timeline.to(element.children, {\n duration: element.dataset.mcDuration ?? 20,\n x: '-100%',\n repeat: -1,\n ease: 'none',\n });\n\n timeline.totalProgress(0.5);\n\n return () => timeline?.kill();\n });\n\n update.timeline = timeline;\n\n return timeline;\n};\n\nexport const breakpoints = function(element) {\n element.dataset.mcBreakpoint = element.dataset.mcMax\n ? `(max-width: ${element.dataset.mcMax - 0.02}px)`\n : element.dataset.mcMin ? `(min-width: ${element.dataset.mcMin}px)` : '';\n};\n\nexport const clearTimeline = function(timeline, element, gsap) {\n timeline?.kill();\n timeline = null;\n\n gsap.set(element.children, { clearProps: 'all' });\n};\n\nexport const cloning = function(element, gsap, MM) {\n const removingClones = () => {\n while (element.childElementCount > 1) {\n element.removeChild(element.lastChild);\n }\n };\n\n removingClones();\n\n MM.add(element.dataset.mcBreakpoint, () => {\n const requiredQuantity = Math.ceil(element.scrollWidth / element.firstElementChild.clientWidth + 2);\n\n if (element.childElementCount < requiredQuantity) {\n const fragment = document.createDocumentFragment();\n const clones = Array.from({ length: requiredQuantity - 1 }, () => element.firstElementChild.cloneNode(true));\n\n clones.forEach(clone => fragment.appendChild(clone));\n\n element.appendChild(fragment);\n }\n\n return removingClones;\n });\n};\n\nexport const skewed = function(element) {\n if (!element.dataset.mcSkew) return;\n\n const abs = Math.abs(parseInt(element.dataset.mcSkew, 10));\n const { style } = element;\n\n style.transformOrigin = 'center center';\n style.transform = `skew(0deg, ${element.dataset.mcSkew}deg)`;\n style.minHeight = `calc(${abs * 1.25}vh + ${abs * 1.25}vw)`;\n};\n"],"names":[],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marquee-content",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Class for creating the running content effect, also known as a marquee or ticker.",
|
|
5
5
|
"author": "ux-ui.pro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"url": "https://github.com/ux-ui-pro/marquee-content/issues"
|
|
13
13
|
},
|
|
14
14
|
"main": "dist/index.js",
|
|
15
|
-
"source": "dist/index.html",
|
|
16
15
|
"module": "dist/index.module.js",
|
|
17
16
|
"targets": {
|
|
18
17
|
"main": {
|
package/src/index.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
cloning,
|
|
5
|
-
skewed,
|
|
6
|
-
animation,
|
|
7
|
-
clearTimeline,
|
|
8
|
-
} from './utils.js';
|
|
9
|
-
|
|
10
|
-
export default class MarqueeContent {
|
|
1
|
+
import * as Utils from './utils.js';
|
|
2
|
+
|
|
3
|
+
class MarqueeContent {
|
|
11
4
|
#gsap;
|
|
12
5
|
|
|
13
6
|
#MM;
|
|
@@ -20,34 +13,42 @@ export default class MarqueeContent {
|
|
|
20
13
|
|
|
21
14
|
#animationFrame;
|
|
22
15
|
|
|
23
|
-
|
|
16
|
+
static gsap;
|
|
17
|
+
|
|
18
|
+
static ScrollTrigger;
|
|
19
|
+
|
|
20
|
+
constructor({element = '.marquee'} = {}) {
|
|
24
21
|
this.#gsap = MarqueeContent.gsap ?? window.gsap;
|
|
25
22
|
this.#MM = this.#gsap.matchMedia();
|
|
26
23
|
this.#timeline = null;
|
|
27
|
-
this.#element =
|
|
28
|
-
if (!this.#element) throw new Error('Element not found');
|
|
24
|
+
this.#element = element instanceof HTMLElement ? element : document.querySelector(element);
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
if (!this.#element) return;
|
|
27
|
+
|
|
28
|
+
this.#resizeObserver = new ResizeObserver(Utils.debounce(() => this.#update()));
|
|
31
29
|
this.#resizeObserver.observe(this.#element);
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
static registerGSAP(gsap) {
|
|
32
|
+
static registerGSAP(gsap, ScrollTrigger) {
|
|
35
33
|
MarqueeContent.gsap = gsap;
|
|
34
|
+
MarqueeContent.ScrollTrigger = ScrollTrigger;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
#commonInit = () => {
|
|
39
|
-
clearTimeline(this.#timeline, this.#element, this.#gsap);
|
|
40
|
-
cloning(this.#element, this.#gsap, this.#MM);
|
|
41
|
-
breakpoints(this.#element);
|
|
42
|
-
skewed(this.#element);
|
|
43
|
-
|
|
38
|
+
Utils.clearTimeline(this.#timeline, this.#element, this.#gsap);
|
|
39
|
+
Utils.cloning(this.#element, this.#gsap, this.#MM);
|
|
40
|
+
Utils.breakpoints(this.#element);
|
|
41
|
+
Utils.skewed(this.#element);
|
|
42
|
+
|
|
43
|
+
this.#timeline = Utils.animation(this.#element, this.#gsap, this.#MM, this.#timeline, this);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
#update = () => {
|
|
47
47
|
cancelAnimationFrame(this.#animationFrame);
|
|
48
48
|
this.#animationFrame = requestAnimationFrame(() => {
|
|
49
49
|
this.#commonInit();
|
|
50
|
-
|
|
50
|
+
|
|
51
|
+
MarqueeContent.ScrollTrigger.refresh();
|
|
51
52
|
});
|
|
52
53
|
};
|
|
53
54
|
|
|
@@ -57,7 +58,11 @@ export default class MarqueeContent {
|
|
|
57
58
|
|
|
58
59
|
destroy = () => {
|
|
59
60
|
cancelAnimationFrame(this.#animationFrame);
|
|
60
|
-
|
|
61
|
+
|
|
62
|
+
Utils.clearTimeline(this.#timeline, this.#element, this.#gsap);
|
|
63
|
+
|
|
61
64
|
this.#resizeObserver?.disconnect();
|
|
62
65
|
}
|
|
63
66
|
}
|
|
67
|
+
|
|
68
|
+
export default MarqueeContent;
|
package/src/demo.js
DELETED