@linear_non/stellar-libs 1.2.9 → 1.3.1
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/package.json +1 -1
- package/src/CursorTracker/index.js +4 -1
- package/src/Marquee/index.js +4 -5
- package/src/ScrollBar/index.js +2 -2
- package/src/index.js +2 -2
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { lerp } from "@linear_non/stellar-kit/utils"
|
|
2
2
|
import { gsap } from "@linear_non/stellar-kit/gsap"
|
|
3
|
+
import { emitter, EVENTS } from "@linear_non/stellar-kit/events"
|
|
3
4
|
|
|
4
5
|
export default class CursorTracker {
|
|
5
6
|
constructor({ container, el, ease = 0.12, isCentered = true }) {
|
|
@@ -22,7 +23,7 @@ export default class CursorTracker {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
// GLOBAL TICK
|
|
25
|
-
tick({ mouse }) {
|
|
26
|
+
tick = ({ mouse }) => {
|
|
26
27
|
if (!this.isHovering) return
|
|
27
28
|
|
|
28
29
|
this.target.x = mouse.x
|
|
@@ -52,6 +53,7 @@ export default class CursorTracker {
|
|
|
52
53
|
|
|
53
54
|
this.container.addEventListener("mouseenter", this.hoverIn)
|
|
54
55
|
this.container.addEventListener("mouseleave", this.hoverOut)
|
|
56
|
+
emitter.on(EVENTS.APP_TICK, this.tick)
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
off() {
|
|
@@ -59,6 +61,7 @@ export default class CursorTracker {
|
|
|
59
61
|
|
|
60
62
|
this.container.removeEventListener("mouseenter", this.hoverIn)
|
|
61
63
|
this.container.removeEventListener("mouseleave", this.hoverOut)
|
|
64
|
+
emitter.off(EVENTS.APP_TICK, this.tick)
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
destroy() {
|
package/src/Marquee/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { gsap } from "@linear_non/stellar-kit/gsap"
|
|
2
|
+
import { emitter, EVENTS } from "@linear_non/stellar-kit/events"
|
|
2
3
|
|
|
3
4
|
export default class Marquee {
|
|
4
5
|
constructor({ container, el, speed = 50, gap = "1.6rem" }) {
|
|
@@ -10,7 +11,7 @@ export default class Marquee {
|
|
|
10
11
|
this.init()
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
setup() {
|
|
14
|
+
setup = () => {
|
|
14
15
|
if (this.tween) this.tween.kill()
|
|
15
16
|
|
|
16
17
|
gsap.set(this.container, {
|
|
@@ -69,13 +70,11 @@ export default class Marquee {
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
on() {
|
|
72
|
-
|
|
73
|
-
window.addEventListener("resize", this._onResize)
|
|
73
|
+
emitter.on(EVENTS.APP_RESIZE, this.setup)
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
off() {
|
|
77
|
-
|
|
78
|
-
this._onResize = null
|
|
77
|
+
emitter.off(EVENTS.APP_RESIZE, this.setup)
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
destroy() {
|
package/src/ScrollBar/index.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Sticky from "./Sticky"
|
|
2
2
|
import Smooth from "./Smooth"
|
|
3
|
-
import
|
|
3
|
+
import SplitOnScroll from "./SplitOnScroll"
|
|
4
4
|
import Noise from "./Noise"
|
|
5
5
|
import SpritePlayer from "./SpritePlayer"
|
|
6
6
|
import CursorTracker from "./CursorTracker"
|
|
7
7
|
import Marquee from "./Marquee"
|
|
8
8
|
|
|
9
|
-
export { Sticky, Smooth,
|
|
9
|
+
export { Sticky, Smooth, SplitOnScroll, Noise, SpritePlayer, CursorTracker, Marquee }
|