@tsparticles/interaction-external-bubble 3.3.0 → 3.4.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/browser/Bubbler.js +15 -14
- package/browser/Enums.js +6 -1
- package/browser/Options/Classes/Bubble.js +1 -1
- package/browser/Options/Classes/BubbleBase.js +1 -1
- package/browser/index.js +3 -3
- package/cjs/Bubbler.js +14 -13
- package/cjs/Enums.js +7 -0
- package/cjs/Options/Classes/Bubble.js +1 -1
- package/cjs/Options/Classes/BubbleBase.js +1 -1
- package/cjs/index.js +3 -3
- package/esm/Bubbler.js +15 -14
- package/esm/Enums.js +6 -1
- package/esm/Options/Classes/Bubble.js +1 -1
- package/esm/Options/Classes/BubbleBase.js +1 -1
- package/esm/index.js +3 -3
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.interaction.external.bubble.js +32 -200
- package/tsparticles.interaction.external.bubble.min.js +1 -1
- package/tsparticles.interaction.external.bubble.min.js.LICENSE.txt +1 -1
- package/types/Enums.d.ts +1 -1
- package/umd/Bubbler.js +15 -14
- package/umd/Enums.js +7 -0
- package/umd/Options/Classes/Bubble.js +1 -1
- package/umd/Options/Classes/BubbleBase.js +1 -1
- package/umd/index.js +4 -17
- package/201.min.js +0 -2
- package/201.min.js.LICENSE.txt +0 -1
- package/dist_browser_Bubbler_js.js +0 -40
package/browser/Bubbler.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Circle, ExternalInteractorBase, Rectangle, colorMix, divMode, divModeExecute, getDistance, getRangeMax, isDivModeEnabled, isInArray, itemFromSingleOrMultiple, millisecondsToSeconds, mouseLeaveEvent, mouseMoveEvent, rangeColorToHsl, rgbToHsl, } from "@tsparticles/engine";
|
|
1
|
+
import { Circle, DivType, ExternalInteractorBase, Rectangle, colorMix, divMode, divModeExecute, getDistance, getRangeMax, isDivModeEnabled, isInArray, itemFromSingleOrMultiple, millisecondsToSeconds, mouseLeaveEvent, mouseMoveEvent, rangeColorToHsl, rgbToHsl, } from "@tsparticles/engine";
|
|
2
2
|
import { Bubble } from "./Options/Classes/Bubble.js";
|
|
3
|
+
import { ProcessBubbleType } from "./Enums.js";
|
|
3
4
|
import { calculateBubbleValue } from "./Utils.js";
|
|
4
5
|
const bubbleMode = "bubble", minDistance = 0, defaultClickTime = 0, double = 2, defaultOpacity = 1, ratioOffset = 1, defaultBubbleValue = 0, minRatio = 0, half = 0.5, defaultRatio = 1;
|
|
5
6
|
export class Bubbler extends ExternalInteractorBase {
|
|
@@ -17,7 +18,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
17
18
|
if (!distance || distance < minDistance) {
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
|
-
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance,
|
|
21
|
+
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)), { bubble } = container;
|
|
21
22
|
for (const particle of query) {
|
|
22
23
|
if (!bubble.clicking) {
|
|
23
24
|
continue;
|
|
@@ -41,7 +42,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
41
42
|
optValue: getRangeMax(particle.options.size.value) * container.retina.pixelRatio,
|
|
42
43
|
value: particle.size.value,
|
|
43
44
|
},
|
|
44
|
-
type:
|
|
45
|
+
type: ProcessBubbleType.size,
|
|
45
46
|
};
|
|
46
47
|
this._process(particle, distMouse, timeSpent, sizeData);
|
|
47
48
|
const opacityData = {
|
|
@@ -53,7 +54,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
53
54
|
optValue: getRangeMax(particle.options.opacity.value),
|
|
54
55
|
value: particle.opacity?.value ?? defaultOpacity,
|
|
55
56
|
},
|
|
56
|
-
type:
|
|
57
|
+
type: ProcessBubbleType.opacity,
|
|
57
58
|
};
|
|
58
59
|
this._process(particle, distMouse, timeSpent, opacityData);
|
|
59
60
|
if (!bubble.durationEnd && distMouse <= distance) {
|
|
@@ -69,7 +70,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
69
70
|
if (!distance || distance < minDistance || !mousePos) {
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
72
|
-
const query = container.particles.quadTree.queryCircle(mousePos, distance,
|
|
73
|
+
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
73
74
|
for (const particle of query) {
|
|
74
75
|
particle.bubble.inRange = true;
|
|
75
76
|
const pos = particle.getPosition(), pointDistance = getDistance(pos, mousePos), ratio = ratioOffset - pointDistance / distance;
|
|
@@ -149,10 +150,10 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
149
150
|
}
|
|
150
151
|
if (container.bubble.durationEnd) {
|
|
151
152
|
if (pObjBubble) {
|
|
152
|
-
if (type ===
|
|
153
|
+
if (type === ProcessBubbleType.size) {
|
|
153
154
|
delete particle.bubble.radius;
|
|
154
155
|
}
|
|
155
|
-
if (type ===
|
|
156
|
+
if (type === ProcessBubbleType.opacity) {
|
|
156
157
|
delete particle.bubble.opacity;
|
|
157
158
|
}
|
|
158
159
|
}
|
|
@@ -162,19 +163,19 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
162
163
|
const obj = pObjBubble ?? pObj;
|
|
163
164
|
if (obj !== bubbleParam) {
|
|
164
165
|
const value = pObj - (timeSpent * (pObj - bubbleParam)) / bubbleDuration;
|
|
165
|
-
if (type ===
|
|
166
|
+
if (type === ProcessBubbleType.size) {
|
|
166
167
|
particle.bubble.radius = value;
|
|
167
168
|
}
|
|
168
|
-
if (type ===
|
|
169
|
+
if (type === ProcessBubbleType.opacity) {
|
|
169
170
|
particle.bubble.opacity = value;
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
174
|
else {
|
|
174
|
-
if (type ===
|
|
175
|
+
if (type === ProcessBubbleType.size) {
|
|
175
176
|
delete particle.bubble.radius;
|
|
176
177
|
}
|
|
177
|
-
if (type ===
|
|
178
|
+
if (type === ProcessBubbleType.opacity) {
|
|
178
179
|
delete particle.bubble.opacity;
|
|
179
180
|
}
|
|
180
181
|
}
|
|
@@ -185,13 +186,13 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
185
186
|
if (!bubble || !selectors.length) {
|
|
186
187
|
return;
|
|
187
188
|
}
|
|
188
|
-
selectors.forEach(
|
|
189
|
+
selectors.forEach(item => {
|
|
189
190
|
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
190
191
|
x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,
|
|
191
192
|
y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio,
|
|
192
|
-
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type ===
|
|
193
|
+
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type === DivType.circle
|
|
193
194
|
? new Circle(pos.x, pos.y, repulseRadius)
|
|
194
|
-
: new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area,
|
|
195
|
+
: new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area, p => this.isEnabled(p));
|
|
195
196
|
for (const particle of query) {
|
|
196
197
|
if (!area.contains(particle.getPosition())) {
|
|
197
198
|
continue;
|
package/browser/Enums.js
CHANGED
|
@@ -23,7 +23,7 @@ export class BubbleBase {
|
|
|
23
23
|
}
|
|
24
24
|
if (data.color !== undefined) {
|
|
25
25
|
const sourceColor = isArray(this.color) ? undefined : this.color;
|
|
26
|
-
this.color = executeOnSingleOrMultiple(data.color,
|
|
26
|
+
this.color = executeOnSingleOrMultiple(data.color, color => {
|
|
27
27
|
return OptionsColor.create(sourceColor, color);
|
|
28
28
|
});
|
|
29
29
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Bubbler } from "./Bubbler.js";
|
|
1
2
|
export async function loadExternalBubbleInteraction(engine, refresh = true) {
|
|
2
|
-
await engine.addInteractor("externalBubble",
|
|
3
|
-
|
|
4
|
-
return new Bubbler(container);
|
|
3
|
+
await engine.addInteractor("externalBubble", container => {
|
|
4
|
+
return Promise.resolve(new Bubbler(container));
|
|
5
5
|
}, refresh);
|
|
6
6
|
}
|
|
7
7
|
export * from "./Options/Classes/BubbleBase.js";
|
package/cjs/Bubbler.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Bubbler = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
5
|
const Bubble_js_1 = require("./Options/Classes/Bubble.js");
|
|
6
|
+
const Enums_js_1 = require("./Enums.js");
|
|
6
7
|
const Utils_js_1 = require("./Utils.js");
|
|
7
8
|
const bubbleMode = "bubble", minDistance = 0, defaultClickTime = 0, double = 2, defaultOpacity = 1, ratioOffset = 1, defaultBubbleValue = 0, minRatio = 0, half = 0.5, defaultRatio = 1;
|
|
8
9
|
class Bubbler extends engine_1.ExternalInteractorBase {
|
|
@@ -20,7 +21,7 @@ class Bubbler extends engine_1.ExternalInteractorBase {
|
|
|
20
21
|
if (!distance || distance < minDistance) {
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
|
-
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance,
|
|
24
|
+
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)), { bubble } = container;
|
|
24
25
|
for (const particle of query) {
|
|
25
26
|
if (!bubble.clicking) {
|
|
26
27
|
continue;
|
|
@@ -44,7 +45,7 @@ class Bubbler extends engine_1.ExternalInteractorBase {
|
|
|
44
45
|
optValue: (0, engine_1.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,
|
|
45
46
|
value: particle.size.value,
|
|
46
47
|
},
|
|
47
|
-
type:
|
|
48
|
+
type: Enums_js_1.ProcessBubbleType.size,
|
|
48
49
|
};
|
|
49
50
|
this._process(particle, distMouse, timeSpent, sizeData);
|
|
50
51
|
const opacityData = {
|
|
@@ -56,7 +57,7 @@ class Bubbler extends engine_1.ExternalInteractorBase {
|
|
|
56
57
|
optValue: (0, engine_1.getRangeMax)(particle.options.opacity.value),
|
|
57
58
|
value: particle.opacity?.value ?? defaultOpacity,
|
|
58
59
|
},
|
|
59
|
-
type:
|
|
60
|
+
type: Enums_js_1.ProcessBubbleType.opacity,
|
|
60
61
|
};
|
|
61
62
|
this._process(particle, distMouse, timeSpent, opacityData);
|
|
62
63
|
if (!bubble.durationEnd && distMouse <= distance) {
|
|
@@ -72,7 +73,7 @@ class Bubbler extends engine_1.ExternalInteractorBase {
|
|
|
72
73
|
if (!distance || distance < minDistance || !mousePos) {
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
|
-
const query = container.particles.quadTree.queryCircle(mousePos, distance,
|
|
76
|
+
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
76
77
|
for (const particle of query) {
|
|
77
78
|
particle.bubble.inRange = true;
|
|
78
79
|
const pos = particle.getPosition(), pointDistance = (0, engine_1.getDistance)(pos, mousePos), ratio = ratioOffset - pointDistance / distance;
|
|
@@ -152,10 +153,10 @@ class Bubbler extends engine_1.ExternalInteractorBase {
|
|
|
152
153
|
}
|
|
153
154
|
if (container.bubble.durationEnd) {
|
|
154
155
|
if (pObjBubble) {
|
|
155
|
-
if (type ===
|
|
156
|
+
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
156
157
|
delete particle.bubble.radius;
|
|
157
158
|
}
|
|
158
|
-
if (type ===
|
|
159
|
+
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
159
160
|
delete particle.bubble.opacity;
|
|
160
161
|
}
|
|
161
162
|
}
|
|
@@ -165,19 +166,19 @@ class Bubbler extends engine_1.ExternalInteractorBase {
|
|
|
165
166
|
const obj = pObjBubble ?? pObj;
|
|
166
167
|
if (obj !== bubbleParam) {
|
|
167
168
|
const value = pObj - (timeSpent * (pObj - bubbleParam)) / bubbleDuration;
|
|
168
|
-
if (type ===
|
|
169
|
+
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
169
170
|
particle.bubble.radius = value;
|
|
170
171
|
}
|
|
171
|
-
if (type ===
|
|
172
|
+
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
172
173
|
particle.bubble.opacity = value;
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
else {
|
|
177
|
-
if (type ===
|
|
178
|
+
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
178
179
|
delete particle.bubble.radius;
|
|
179
180
|
}
|
|
180
|
-
if (type ===
|
|
181
|
+
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
181
182
|
delete particle.bubble.opacity;
|
|
182
183
|
}
|
|
183
184
|
}
|
|
@@ -188,13 +189,13 @@ class Bubbler extends engine_1.ExternalInteractorBase {
|
|
|
188
189
|
if (!bubble || !selectors.length) {
|
|
189
190
|
return;
|
|
190
191
|
}
|
|
191
|
-
selectors.forEach(
|
|
192
|
+
selectors.forEach(item => {
|
|
192
193
|
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
193
194
|
x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,
|
|
194
195
|
y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio,
|
|
195
|
-
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type ===
|
|
196
|
+
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type === engine_1.DivType.circle
|
|
196
197
|
? new engine_1.Circle(pos.x, pos.y, repulseRadius)
|
|
197
|
-
: new engine_1.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area,
|
|
198
|
+
: new engine_1.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area, p => this.isEnabled(p));
|
|
198
199
|
for (const particle of query) {
|
|
199
200
|
if (!area.contains(particle.getPosition())) {
|
|
200
201
|
continue;
|
package/cjs/Enums.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProcessBubbleType = void 0;
|
|
4
|
+
var ProcessBubbleType;
|
|
5
|
+
(function (ProcessBubbleType) {
|
|
6
|
+
ProcessBubbleType["color"] = "color";
|
|
7
|
+
ProcessBubbleType["opacity"] = "opacity";
|
|
8
|
+
ProcessBubbleType["size"] = "size";
|
|
9
|
+
})(ProcessBubbleType || (exports.ProcessBubbleType = ProcessBubbleType = {}));
|
|
@@ -10,7 +10,7 @@ class Bubble extends BubbleBase_js_1.BubbleBase {
|
|
|
10
10
|
if (!data) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
this.divs = (0, engine_1.executeOnSingleOrMultiple)(data.divs,
|
|
13
|
+
this.divs = (0, engine_1.executeOnSingleOrMultiple)(data.divs, div => {
|
|
14
14
|
const tmp = new BubbleDiv_js_1.BubbleDiv();
|
|
15
15
|
tmp.load(div);
|
|
16
16
|
return tmp;
|
|
@@ -26,7 +26,7 @@ class BubbleBase {
|
|
|
26
26
|
}
|
|
27
27
|
if (data.color !== undefined) {
|
|
28
28
|
const sourceColor = (0, engine_1.isArray)(this.color) ? undefined : this.color;
|
|
29
|
-
this.color = (0, engine_1.executeOnSingleOrMultiple)(data.color,
|
|
29
|
+
this.color = (0, engine_1.executeOnSingleOrMultiple)(data.color, color => {
|
|
30
30
|
return engine_1.OptionsColor.create(sourceColor, color);
|
|
31
31
|
});
|
|
32
32
|
}
|
package/cjs/index.js
CHANGED
|
@@ -15,10 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.loadExternalBubbleInteraction = void 0;
|
|
18
|
+
const Bubbler_js_1 = require("./Bubbler.js");
|
|
18
19
|
async function loadExternalBubbleInteraction(engine, refresh = true) {
|
|
19
|
-
await engine.addInteractor("externalBubble",
|
|
20
|
-
|
|
21
|
-
return new Bubbler(container);
|
|
20
|
+
await engine.addInteractor("externalBubble", container => {
|
|
21
|
+
return Promise.resolve(new Bubbler_js_1.Bubbler(container));
|
|
22
22
|
}, refresh);
|
|
23
23
|
}
|
|
24
24
|
exports.loadExternalBubbleInteraction = loadExternalBubbleInteraction;
|
package/esm/Bubbler.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Circle, ExternalInteractorBase, Rectangle, colorMix, divMode, divModeExecute, getDistance, getRangeMax, isDivModeEnabled, isInArray, itemFromSingleOrMultiple, millisecondsToSeconds, mouseLeaveEvent, mouseMoveEvent, rangeColorToHsl, rgbToHsl, } from "@tsparticles/engine";
|
|
1
|
+
import { Circle, DivType, ExternalInteractorBase, Rectangle, colorMix, divMode, divModeExecute, getDistance, getRangeMax, isDivModeEnabled, isInArray, itemFromSingleOrMultiple, millisecondsToSeconds, mouseLeaveEvent, mouseMoveEvent, rangeColorToHsl, rgbToHsl, } from "@tsparticles/engine";
|
|
2
2
|
import { Bubble } from "./Options/Classes/Bubble.js";
|
|
3
|
+
import { ProcessBubbleType } from "./Enums.js";
|
|
3
4
|
import { calculateBubbleValue } from "./Utils.js";
|
|
4
5
|
const bubbleMode = "bubble", minDistance = 0, defaultClickTime = 0, double = 2, defaultOpacity = 1, ratioOffset = 1, defaultBubbleValue = 0, minRatio = 0, half = 0.5, defaultRatio = 1;
|
|
5
6
|
export class Bubbler extends ExternalInteractorBase {
|
|
@@ -17,7 +18,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
17
18
|
if (!distance || distance < minDistance) {
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
|
-
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance,
|
|
21
|
+
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)), { bubble } = container;
|
|
21
22
|
for (const particle of query) {
|
|
22
23
|
if (!bubble.clicking) {
|
|
23
24
|
continue;
|
|
@@ -41,7 +42,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
41
42
|
optValue: getRangeMax(particle.options.size.value) * container.retina.pixelRatio,
|
|
42
43
|
value: particle.size.value,
|
|
43
44
|
},
|
|
44
|
-
type:
|
|
45
|
+
type: ProcessBubbleType.size,
|
|
45
46
|
};
|
|
46
47
|
this._process(particle, distMouse, timeSpent, sizeData);
|
|
47
48
|
const opacityData = {
|
|
@@ -53,7 +54,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
53
54
|
optValue: getRangeMax(particle.options.opacity.value),
|
|
54
55
|
value: particle.opacity?.value ?? defaultOpacity,
|
|
55
56
|
},
|
|
56
|
-
type:
|
|
57
|
+
type: ProcessBubbleType.opacity,
|
|
57
58
|
};
|
|
58
59
|
this._process(particle, distMouse, timeSpent, opacityData);
|
|
59
60
|
if (!bubble.durationEnd && distMouse <= distance) {
|
|
@@ -69,7 +70,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
69
70
|
if (!distance || distance < minDistance || !mousePos) {
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
72
|
-
const query = container.particles.quadTree.queryCircle(mousePos, distance,
|
|
73
|
+
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
73
74
|
for (const particle of query) {
|
|
74
75
|
particle.bubble.inRange = true;
|
|
75
76
|
const pos = particle.getPosition(), pointDistance = getDistance(pos, mousePos), ratio = ratioOffset - pointDistance / distance;
|
|
@@ -149,10 +150,10 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
149
150
|
}
|
|
150
151
|
if (container.bubble.durationEnd) {
|
|
151
152
|
if (pObjBubble) {
|
|
152
|
-
if (type ===
|
|
153
|
+
if (type === ProcessBubbleType.size) {
|
|
153
154
|
delete particle.bubble.radius;
|
|
154
155
|
}
|
|
155
|
-
if (type ===
|
|
156
|
+
if (type === ProcessBubbleType.opacity) {
|
|
156
157
|
delete particle.bubble.opacity;
|
|
157
158
|
}
|
|
158
159
|
}
|
|
@@ -162,19 +163,19 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
162
163
|
const obj = pObjBubble ?? pObj;
|
|
163
164
|
if (obj !== bubbleParam) {
|
|
164
165
|
const value = pObj - (timeSpent * (pObj - bubbleParam)) / bubbleDuration;
|
|
165
|
-
if (type ===
|
|
166
|
+
if (type === ProcessBubbleType.size) {
|
|
166
167
|
particle.bubble.radius = value;
|
|
167
168
|
}
|
|
168
|
-
if (type ===
|
|
169
|
+
if (type === ProcessBubbleType.opacity) {
|
|
169
170
|
particle.bubble.opacity = value;
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
174
|
else {
|
|
174
|
-
if (type ===
|
|
175
|
+
if (type === ProcessBubbleType.size) {
|
|
175
176
|
delete particle.bubble.radius;
|
|
176
177
|
}
|
|
177
|
-
if (type ===
|
|
178
|
+
if (type === ProcessBubbleType.opacity) {
|
|
178
179
|
delete particle.bubble.opacity;
|
|
179
180
|
}
|
|
180
181
|
}
|
|
@@ -185,13 +186,13 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
185
186
|
if (!bubble || !selectors.length) {
|
|
186
187
|
return;
|
|
187
188
|
}
|
|
188
|
-
selectors.forEach(
|
|
189
|
+
selectors.forEach(item => {
|
|
189
190
|
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
190
191
|
x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,
|
|
191
192
|
y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio,
|
|
192
|
-
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type ===
|
|
193
|
+
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type === DivType.circle
|
|
193
194
|
? new Circle(pos.x, pos.y, repulseRadius)
|
|
194
|
-
: new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area,
|
|
195
|
+
: new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area, p => this.isEnabled(p));
|
|
195
196
|
for (const particle of query) {
|
|
196
197
|
if (!area.contains(particle.getPosition())) {
|
|
197
198
|
continue;
|
package/esm/Enums.js
CHANGED
|
@@ -23,7 +23,7 @@ export class BubbleBase {
|
|
|
23
23
|
}
|
|
24
24
|
if (data.color !== undefined) {
|
|
25
25
|
const sourceColor = isArray(this.color) ? undefined : this.color;
|
|
26
|
-
this.color = executeOnSingleOrMultiple(data.color,
|
|
26
|
+
this.color = executeOnSingleOrMultiple(data.color, color => {
|
|
27
27
|
return OptionsColor.create(sourceColor, color);
|
|
28
28
|
});
|
|
29
29
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Bubbler } from "./Bubbler.js";
|
|
1
2
|
export async function loadExternalBubbleInteraction(engine, refresh = true) {
|
|
2
|
-
await engine.addInteractor("externalBubble",
|
|
3
|
-
|
|
4
|
-
return new Bubbler(container);
|
|
3
|
+
await engine.addInteractor("externalBubble", container => {
|
|
4
|
+
return Promise.resolve(new Bubbler(container));
|
|
5
5
|
}, refresh);
|
|
6
6
|
}
|
|
7
7
|
export * from "./Options/Classes/BubbleBase.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-bubble",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "tsParticles bubble external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "^3.
|
|
90
|
+
"@tsparticles/engine": "^3.4.0"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/interaction-external-bubble [
|
|
6
|
+
<title>@tsparticles/interaction-external-bubble [13 May 2024 at 00:06]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.
|
|
7
|
+
* v3.4.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,6 +28,26 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
+
/***/ "./dist/browser/Bubbler.js":
|
|
32
|
+
/*!*********************************!*\
|
|
33
|
+
!*** ./dist/browser/Bubbler.js ***!
|
|
34
|
+
\*********************************/
|
|
35
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
+
|
|
37
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubbler: () => (/* binding */ Bubbler)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Options/Classes/Bubble.js */ \"./dist/browser/Options/Classes/Bubble.js\");\n/* harmony import */ var _Enums_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Enums.js */ \"./dist/browser/Enums.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\n\nconst bubbleMode = \"bubble\",\n minDistance = 0,\n defaultClickTime = 0,\n double = 2,\n defaultOpacity = 1,\n ratioOffset = 1,\n defaultBubbleValue = 0,\n minRatio = 0,\n half = 0.5,\n defaultRatio = 1;\nclass Bubbler extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container) {\n super(container);\n this._clickBubble = () => {\n const container = this.container,\n options = container.actualOptions,\n mouseClickPos = container.interactivity.mouse.clickPosition,\n bubbleOptions = options.interactivity.modes.bubble;\n if (!bubbleOptions || !mouseClickPos) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n const distance = container.retina.bubbleModeDistance;\n if (!distance || distance < minDistance) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)),\n {\n bubble\n } = container;\n for (const particle of query) {\n if (!bubble.clicking) {\n continue;\n }\n particle.bubble.inRange = !bubble.durationEnd;\n const pos = particle.getPosition(),\n distMouse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mouseClickPos),\n timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime ?? defaultClickTime)) / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds;\n if (timeSpent > bubbleOptions.duration) {\n bubble.durationEnd = true;\n }\n if (timeSpent > bubbleOptions.duration * double) {\n bubble.clicking = false;\n bubble.durationEnd = false;\n }\n const sizeData = {\n bubbleObj: {\n optValue: container.retina.bubbleModeSize,\n value: particle.bubble.radius\n },\n particlesObj: {\n optValue: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,\n value: particle.size.value\n },\n type: _Enums_js__WEBPACK_IMPORTED_MODULE_1__.ProcessBubbleType.size\n };\n this._process(particle, distMouse, timeSpent, sizeData);\n const opacityData = {\n bubbleObj: {\n optValue: bubbleOptions.opacity,\n value: particle.bubble.opacity\n },\n particlesObj: {\n optValue: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.opacity.value),\n value: particle.opacity?.value ?? defaultOpacity\n },\n type: _Enums_js__WEBPACK_IMPORTED_MODULE_1__.ProcessBubbleType.opacity\n };\n this._process(particle, distMouse, timeSpent, opacityData);\n if (!bubble.durationEnd && distMouse <= distance) {\n this._hoverBubbleColor(particle, distMouse);\n } else {\n delete particle.bubble.color;\n }\n }\n };\n this._hoverBubble = () => {\n const container = this.container,\n mousePos = container.interactivity.mouse.position,\n distance = container.retina.bubbleModeDistance;\n if (!distance || distance < minDistance || !mousePos) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));\n for (const particle of query) {\n particle.bubble.inRange = true;\n const pos = particle.getPosition(),\n pointDistance = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mousePos),\n ratio = ratioOffset - pointDistance / distance;\n if (pointDistance <= distance) {\n if (ratio >= minRatio && container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent) {\n this._hoverBubbleSize(particle, ratio);\n this._hoverBubbleOpacity(particle, ratio);\n this._hoverBubbleColor(particle, ratio);\n }\n } else {\n this.reset(particle);\n }\n if (container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseLeaveEvent) {\n this.reset(particle);\n }\n }\n };\n this._hoverBubbleColor = (particle, ratio, divBubble) => {\n const options = this.container.actualOptions,\n bubbleOptions = divBubble ?? options.interactivity.modes.bubble;\n if (!bubbleOptions) {\n return;\n }\n if (!particle.bubble.finalColor) {\n const modeColor = bubbleOptions.color;\n if (!modeColor) {\n return;\n }\n const bubbleColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(modeColor);\n particle.bubble.finalColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(bubbleColor);\n }\n if (!particle.bubble.finalColor) {\n return;\n }\n if (bubbleOptions.mix) {\n particle.bubble.color = undefined;\n const pColor = particle.getFillColor();\n particle.bubble.color = pColor ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rgbToHsl)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.colorMix)(pColor, particle.bubble.finalColor, ratioOffset - ratio, ratio)) : particle.bubble.finalColor;\n } else {\n particle.bubble.color = particle.bubble.finalColor;\n }\n };\n this._hoverBubbleOpacity = (particle, ratio, divBubble) => {\n const container = this.container,\n options = container.actualOptions,\n modeOpacity = divBubble?.opacity ?? options.interactivity.modes.bubble?.opacity;\n if (!modeOpacity) {\n return;\n }\n const optOpacity = particle.options.opacity.value,\n pOpacity = particle.opacity?.value ?? defaultOpacity,\n opacity = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.calculateBubbleValue)(pOpacity, modeOpacity, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(optOpacity), ratio);\n if (opacity !== undefined) {\n particle.bubble.opacity = opacity;\n }\n };\n this._hoverBubbleSize = (particle, ratio, divBubble) => {\n const container = this.container,\n modeSize = divBubble?.size ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;\n if (modeSize === undefined) {\n return;\n }\n const optSize = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,\n pSize = particle.size.value,\n size = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.calculateBubbleValue)(pSize, modeSize, optSize, ratio);\n if (size !== undefined) {\n particle.bubble.radius = size;\n }\n };\n this._process = (particle, distMouse, timeSpent, data) => {\n const container = this.container,\n bubbleParam = data.bubbleObj.optValue,\n options = container.actualOptions,\n bubbleOptions = options.interactivity.modes.bubble;\n if (!bubbleOptions || bubbleParam === undefined) {\n return;\n }\n const bubbleDuration = bubbleOptions.duration,\n bubbleDistance = container.retina.bubbleModeDistance,\n particlesParam = data.particlesObj.optValue,\n pObjBubble = data.bubbleObj.value,\n pObj = data.particlesObj.value ?? defaultBubbleValue,\n type = data.type;\n if (!bubbleDistance || bubbleDistance < minDistance || bubbleParam === particlesParam) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n if (container.bubble.durationEnd) {\n if (pObjBubble) {\n if (type === _Enums_js__WEBPACK_IMPORTED_MODULE_1__.ProcessBubbleType.size) {\n delete particle.bubble.radius;\n }\n if (type === _Enums_js__WEBPACK_IMPORTED_MODULE_1__.ProcessBubbleType.opacity) {\n delete particle.bubble.opacity;\n }\n }\n } else {\n if (distMouse <= bubbleDistance) {\n const obj = pObjBubble ?? pObj;\n if (obj !== bubbleParam) {\n const value = pObj - timeSpent * (pObj - bubbleParam) / bubbleDuration;\n if (type === _Enums_js__WEBPACK_IMPORTED_MODULE_1__.ProcessBubbleType.size) {\n particle.bubble.radius = value;\n }\n if (type === _Enums_js__WEBPACK_IMPORTED_MODULE_1__.ProcessBubbleType.opacity) {\n particle.bubble.opacity = value;\n }\n }\n } else {\n if (type === _Enums_js__WEBPACK_IMPORTED_MODULE_1__.ProcessBubbleType.size) {\n delete particle.bubble.radius;\n }\n if (type === _Enums_js__WEBPACK_IMPORTED_MODULE_1__.ProcessBubbleType.opacity) {\n delete particle.bubble.opacity;\n }\n }\n }\n };\n this._singleSelectorHover = (delta, selector, div) => {\n const container = this.container,\n selectors = document.querySelectorAll(selector),\n bubble = container.actualOptions.interactivity.modes.bubble;\n if (!bubble || !selectors.length) {\n return;\n }\n selectors.forEach(item => {\n const elem = item,\n pxRatio = container.retina.pixelRatio,\n pos = {\n x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,\n y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio\n },\n repulseRadius = elem.offsetWidth * half * pxRatio,\n area = div.type === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DivType.circle ? new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(pos.x, pos.y, repulseRadius) : new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),\n query = container.particles.quadTree.query(area, p => this.isEnabled(p));\n for (const particle of query) {\n if (!area.contains(particle.getPosition())) {\n continue;\n }\n particle.bubble.inRange = true;\n const divs = bubble.divs,\n divBubble = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divMode)(divs, elem);\n if (!particle.bubble.div || particle.bubble.div !== elem) {\n this.clear(particle, delta, true);\n particle.bubble.div = elem;\n }\n this._hoverBubbleSize(particle, defaultRatio, divBubble);\n this._hoverBubbleOpacity(particle, defaultRatio, divBubble);\n this._hoverBubbleColor(particle, defaultRatio, divBubble);\n }\n });\n };\n if (!container.bubble) {\n container.bubble = {};\n }\n this.handleClickMode = mode => {\n if (mode !== bubbleMode) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n container.bubble.clicking = true;\n };\n }\n clear(particle, delta, force) {\n if (particle.bubble.inRange && !force) {\n return;\n }\n delete particle.bubble.div;\n delete particle.bubble.opacity;\n delete particle.bubble.radius;\n delete particle.bubble.color;\n }\n init() {\n const container = this.container,\n bubble = container.actualOptions.interactivity.modes.bubble;\n if (!bubble) {\n return;\n }\n container.retina.bubbleModeDistance = bubble.distance * container.retina.pixelRatio;\n if (bubble.size !== undefined) {\n container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;\n }\n }\n interact(delta) {\n const options = this.container.actualOptions,\n events = options.interactivity.events,\n onHover = events.onHover,\n onClick = events.onClick,\n hoverEnabled = onHover.enable,\n hoverMode = onHover.mode,\n clickEnabled = onClick.enable,\n clickMode = onClick.mode,\n divs = events.onDiv;\n if (hoverEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, hoverMode)) {\n this._hoverBubble();\n } else if (clickEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, clickMode)) {\n this._clickBubble();\n } else {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divModeExecute)(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));\n }\n }\n isEnabled(particle) {\n const container = this.container,\n options = container.actualOptions,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? options.interactivity).events,\n {\n onClick,\n onDiv,\n onHover\n } = events,\n divBubble = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isDivModeEnabled)(bubbleMode, onDiv);\n if (!(divBubble || onHover.enable && !!mouse.position || onClick.enable && mouse.clickPosition)) {\n return false;\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, onHover.mode) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, onClick.mode) || divBubble;\n }\n loadModeOptions(options, ...sources) {\n if (!options.bubble) {\n options.bubble = new _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_3__.Bubble();\n }\n for (const source of sources) {\n options.bubble.load(source?.bubble);\n }\n }\n reset(particle) {\n particle.bubble.inRange = false;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Bubbler.js?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ "./dist/browser/Enums.js":
|
|
42
|
+
/*!*******************************!*\
|
|
43
|
+
!*** ./dist/browser/Enums.js ***!
|
|
44
|
+
\*******************************/
|
|
45
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
46
|
+
|
|
47
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ProcessBubbleType: () => (/* binding */ ProcessBubbleType)\n/* harmony export */ });\nvar ProcessBubbleType;\n(function (ProcessBubbleType) {\n ProcessBubbleType[\"color\"] = \"color\";\n ProcessBubbleType[\"opacity\"] = \"opacity\";\n ProcessBubbleType[\"size\"] = \"size\";\n})(ProcessBubbleType || (ProcessBubbleType = {}));\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Enums.js?");
|
|
48
|
+
|
|
49
|
+
/***/ }),
|
|
50
|
+
|
|
31
51
|
/***/ "./dist/browser/Options/Classes/Bubble.js":
|
|
32
52
|
/*!************************************************!*\
|
|
33
53
|
!*** ./dist/browser/Options/Classes/Bubble.js ***!
|
|
@@ -58,13 +78,23 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
58
78
|
|
|
59
79
|
/***/ }),
|
|
60
80
|
|
|
81
|
+
/***/ "./dist/browser/Utils.js":
|
|
82
|
+
/*!*******************************!*\
|
|
83
|
+
!*** ./dist/browser/Utils.js ***!
|
|
84
|
+
\*******************************/
|
|
85
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
86
|
+
|
|
87
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ calculateBubbleValue: () => (/* binding */ calculateBubbleValue)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) {\n if (modeValue >= optionsValue) {\n const value = particleValue + (modeValue - optionsValue) * ratio;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(value, particleValue, modeValue);\n } else if (modeValue < optionsValue) {\n const value = particleValue - (optionsValue - modeValue) * ratio;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(value, modeValue, particleValue);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Utils.js?");
|
|
88
|
+
|
|
89
|
+
/***/ }),
|
|
90
|
+
|
|
61
91
|
/***/ "./dist/browser/index.js":
|
|
62
92
|
/*!*******************************!*\
|
|
63
93
|
!*** ./dist/browser/index.js ***!
|
|
64
94
|
\*******************************/
|
|
65
95
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66
96
|
|
|
67
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubble: () => (/* reexport safe */
|
|
97
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubble: () => (/* reexport safe */ _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_3__.Bubble),\n/* harmony export */ BubbleBase: () => (/* reexport safe */ _Options_Classes_BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__.BubbleBase),\n/* harmony export */ BubbleDiv: () => (/* reexport safe */ _Options_Classes_BubbleDiv_js__WEBPACK_IMPORTED_MODULE_2__.BubbleDiv),\n/* harmony export */ loadExternalBubbleInteraction: () => (/* binding */ loadExternalBubbleInteraction)\n/* harmony export */ });\n/* harmony import */ var _Bubbler_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Bubbler.js */ \"./dist/browser/Bubbler.js\");\n/* harmony import */ var _Options_Classes_BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n/* harmony import */ var _Options_Classes_BubbleDiv_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/BubbleDiv.js */ \"./dist/browser/Options/Classes/BubbleDiv.js\");\n/* harmony import */ var _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Options/Classes/Bubble.js */ \"./dist/browser/Options/Classes/Bubble.js\");\n\nasync function loadExternalBubbleInteraction(engine, refresh = true) {\n await engine.addInteractor(\"externalBubble\", container => {\n return Promise.resolve(new _Bubbler_js__WEBPACK_IMPORTED_MODULE_0__.Bubbler(container));\n }, refresh);\n}\n\n\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/index.js?");
|
|
68
98
|
|
|
69
99
|
/***/ }),
|
|
70
100
|
|
|
@@ -104,9 +134,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
104
134
|
/******/ return module.exports;
|
|
105
135
|
/******/ }
|
|
106
136
|
/******/
|
|
107
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
108
|
-
/******/ __webpack_require__.m = __webpack_modules__;
|
|
109
|
-
/******/
|
|
110
137
|
/************************************************************************/
|
|
111
138
|
/******/ /* webpack/runtime/compat get default export */
|
|
112
139
|
/******/ (() => {
|
|
@@ -132,91 +159,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
132
159
|
/******/ };
|
|
133
160
|
/******/ })();
|
|
134
161
|
/******/
|
|
135
|
-
/******/ /* webpack/runtime/ensure chunk */
|
|
136
|
-
/******/ (() => {
|
|
137
|
-
/******/ __webpack_require__.f = {};
|
|
138
|
-
/******/ // This file contains only the entry chunk.
|
|
139
|
-
/******/ // The chunk loading function for additional chunks
|
|
140
|
-
/******/ __webpack_require__.e = (chunkId) => {
|
|
141
|
-
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
142
|
-
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
143
|
-
/******/ return promises;
|
|
144
|
-
/******/ }, []));
|
|
145
|
-
/******/ };
|
|
146
|
-
/******/ })();
|
|
147
|
-
/******/
|
|
148
|
-
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
149
|
-
/******/ (() => {
|
|
150
|
-
/******/ // This function allow to reference async chunks
|
|
151
|
-
/******/ __webpack_require__.u = (chunkId) => {
|
|
152
|
-
/******/ // return url for filenames based on template
|
|
153
|
-
/******/ return "" + chunkId + ".js";
|
|
154
|
-
/******/ };
|
|
155
|
-
/******/ })();
|
|
156
|
-
/******/
|
|
157
|
-
/******/ /* webpack/runtime/global */
|
|
158
|
-
/******/ (() => {
|
|
159
|
-
/******/ __webpack_require__.g = (function() {
|
|
160
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
161
|
-
/******/ try {
|
|
162
|
-
/******/ return this || new Function('return this')();
|
|
163
|
-
/******/ } catch (e) {
|
|
164
|
-
/******/ if (typeof window === 'object') return window;
|
|
165
|
-
/******/ }
|
|
166
|
-
/******/ })();
|
|
167
|
-
/******/ })();
|
|
168
|
-
/******/
|
|
169
162
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
170
163
|
/******/ (() => {
|
|
171
164
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
172
165
|
/******/ })();
|
|
173
166
|
/******/
|
|
174
|
-
/******/ /* webpack/runtime/load script */
|
|
175
|
-
/******/ (() => {
|
|
176
|
-
/******/ var inProgress = {};
|
|
177
|
-
/******/ var dataWebpackPrefix = "@tsparticles/interaction-external-bubble:";
|
|
178
|
-
/******/ // loadScript function to load a script via script tag
|
|
179
|
-
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
180
|
-
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
181
|
-
/******/ var script, needAttach;
|
|
182
|
-
/******/ if(key !== undefined) {
|
|
183
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
184
|
-
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
185
|
-
/******/ var s = scripts[i];
|
|
186
|
-
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
187
|
-
/******/ }
|
|
188
|
-
/******/ }
|
|
189
|
-
/******/ if(!script) {
|
|
190
|
-
/******/ needAttach = true;
|
|
191
|
-
/******/ script = document.createElement('script');
|
|
192
|
-
/******/
|
|
193
|
-
/******/ script.charset = 'utf-8';
|
|
194
|
-
/******/ script.timeout = 120;
|
|
195
|
-
/******/ if (__webpack_require__.nc) {
|
|
196
|
-
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
197
|
-
/******/ }
|
|
198
|
-
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
199
|
-
/******/
|
|
200
|
-
/******/ script.src = url;
|
|
201
|
-
/******/ }
|
|
202
|
-
/******/ inProgress[url] = [done];
|
|
203
|
-
/******/ var onScriptComplete = (prev, event) => {
|
|
204
|
-
/******/ // avoid mem leaks in IE.
|
|
205
|
-
/******/ script.onerror = script.onload = null;
|
|
206
|
-
/******/ clearTimeout(timeout);
|
|
207
|
-
/******/ var doneFns = inProgress[url];
|
|
208
|
-
/******/ delete inProgress[url];
|
|
209
|
-
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
210
|
-
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
211
|
-
/******/ if(prev) return prev(event);
|
|
212
|
-
/******/ }
|
|
213
|
-
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
214
|
-
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
215
|
-
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
216
|
-
/******/ needAttach && document.head.appendChild(script);
|
|
217
|
-
/******/ };
|
|
218
|
-
/******/ })();
|
|
219
|
-
/******/
|
|
220
167
|
/******/ /* webpack/runtime/make namespace object */
|
|
221
168
|
/******/ (() => {
|
|
222
169
|
/******/ // define __esModule on exports
|
|
@@ -228,121 +175,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
228
175
|
/******/ };
|
|
229
176
|
/******/ })();
|
|
230
177
|
/******/
|
|
231
|
-
/******/ /* webpack/runtime/publicPath */
|
|
232
|
-
/******/ (() => {
|
|
233
|
-
/******/ var scriptUrl;
|
|
234
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
235
|
-
/******/ var document = __webpack_require__.g.document;
|
|
236
|
-
/******/ if (!scriptUrl && document) {
|
|
237
|
-
/******/ if (document.currentScript)
|
|
238
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
239
|
-
/******/ if (!scriptUrl) {
|
|
240
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
241
|
-
/******/ if(scripts.length) {
|
|
242
|
-
/******/ var i = scripts.length - 1;
|
|
243
|
-
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
244
|
-
/******/ }
|
|
245
|
-
/******/ }
|
|
246
|
-
/******/ }
|
|
247
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
248
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
249
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
250
|
-
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
251
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
252
|
-
/******/ })();
|
|
253
|
-
/******/
|
|
254
|
-
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
255
|
-
/******/ (() => {
|
|
256
|
-
/******/ // no baseURI
|
|
257
|
-
/******/
|
|
258
|
-
/******/ // object to store loaded and loading chunks
|
|
259
|
-
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
260
|
-
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
261
|
-
/******/ var installedChunks = {
|
|
262
|
-
/******/ "tsparticles.interaction.external.bubble": 0
|
|
263
|
-
/******/ };
|
|
264
|
-
/******/
|
|
265
|
-
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
266
|
-
/******/ // JSONP chunk loading for javascript
|
|
267
|
-
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
268
|
-
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
269
|
-
/******/
|
|
270
|
-
/******/ // a Promise means "currently loading".
|
|
271
|
-
/******/ if(installedChunkData) {
|
|
272
|
-
/******/ promises.push(installedChunkData[2]);
|
|
273
|
-
/******/ } else {
|
|
274
|
-
/******/ if(true) { // all chunks have JS
|
|
275
|
-
/******/ // setup Promise in chunk cache
|
|
276
|
-
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
277
|
-
/******/ promises.push(installedChunkData[2] = promise);
|
|
278
|
-
/******/
|
|
279
|
-
/******/ // start chunk loading
|
|
280
|
-
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
281
|
-
/******/ // create error before stack unwound to get useful stacktrace later
|
|
282
|
-
/******/ var error = new Error();
|
|
283
|
-
/******/ var loadingEnded = (event) => {
|
|
284
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
285
|
-
/******/ installedChunkData = installedChunks[chunkId];
|
|
286
|
-
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
287
|
-
/******/ if(installedChunkData) {
|
|
288
|
-
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
289
|
-
/******/ var realSrc = event && event.target && event.target.src;
|
|
290
|
-
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
291
|
-
/******/ error.name = 'ChunkLoadError';
|
|
292
|
-
/******/ error.type = errorType;
|
|
293
|
-
/******/ error.request = realSrc;
|
|
294
|
-
/******/ installedChunkData[1](error);
|
|
295
|
-
/******/ }
|
|
296
|
-
/******/ }
|
|
297
|
-
/******/ };
|
|
298
|
-
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
299
|
-
/******/ }
|
|
300
|
-
/******/ }
|
|
301
|
-
/******/ }
|
|
302
|
-
/******/ };
|
|
303
|
-
/******/
|
|
304
|
-
/******/ // no prefetching
|
|
305
|
-
/******/
|
|
306
|
-
/******/ // no preloaded
|
|
307
|
-
/******/
|
|
308
|
-
/******/ // no HMR
|
|
309
|
-
/******/
|
|
310
|
-
/******/ // no HMR manifest
|
|
311
|
-
/******/
|
|
312
|
-
/******/ // no on chunks loaded
|
|
313
|
-
/******/
|
|
314
|
-
/******/ // install a JSONP callback for chunk loading
|
|
315
|
-
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
316
|
-
/******/ var chunkIds = data[0];
|
|
317
|
-
/******/ var moreModules = data[1];
|
|
318
|
-
/******/ var runtime = data[2];
|
|
319
|
-
/******/ // add "moreModules" to the modules object,
|
|
320
|
-
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
321
|
-
/******/ var moduleId, chunkId, i = 0;
|
|
322
|
-
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
323
|
-
/******/ for(moduleId in moreModules) {
|
|
324
|
-
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
325
|
-
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
326
|
-
/******/ }
|
|
327
|
-
/******/ }
|
|
328
|
-
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
329
|
-
/******/ }
|
|
330
|
-
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
331
|
-
/******/ for(;i < chunkIds.length; i++) {
|
|
332
|
-
/******/ chunkId = chunkIds[i];
|
|
333
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
334
|
-
/******/ installedChunks[chunkId][0]();
|
|
335
|
-
/******/ }
|
|
336
|
-
/******/ installedChunks[chunkId] = 0;
|
|
337
|
-
/******/ }
|
|
338
|
-
/******/
|
|
339
|
-
/******/ }
|
|
340
|
-
/******/
|
|
341
|
-
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_interaction_external_bubble"] = this["webpackChunk_tsparticles_interaction_external_bubble"] || [];
|
|
342
|
-
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
343
|
-
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
344
|
-
/******/ })();
|
|
345
|
-
/******/
|
|
346
178
|
/************************************************************************/
|
|
347
179
|
/******/
|
|
348
180
|
/******/ // startup
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.bubble.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},i={};function o(e){var n=i[e];if(void 0!==n)return n.exports;var b=i[e]={exports:{}};return t[e](b,b.exports,o),b.exports}o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{Bubble:()=>l,BubbleBase:()=>i,BubbleDiv:()=>b,loadExternalBubbleInteraction:()=>c});var e,t=o(303);class i{constructor(){this.distance=200,this.duration=.4,this.mix=!1}load(e){if(e){if(void 0!==e.distance&&(this.distance=e.distance),void 0!==e.duration&&(this.duration=e.duration),void 0!==e.mix&&(this.mix=e.mix),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.color){const i=(0,t.isArray)(this.color)?void 0:this.color;this.color=(0,t.executeOnSingleOrMultiple)(e.color,(e=>t.OptionsColor.create(i,e)))}void 0!==e.size&&(this.size=e.size)}}}class b extends i{constructor(){super(),this.selectors=[]}load(e){super.load(e),e&&void 0!==e.selectors&&(this.selectors=e.selectors)}}class l extends i{load(e){super.load(e),e&&(this.divs=(0,t.executeOnSingleOrMultiple)(e.divs,(e=>{const t=new b;return t.load(e),t})))}}function s(e,i,o,n){if(i>=o){const b=e+(i-o)*n;return(0,t.clamp)(b,e,i)}if(i<o){const b=e-(o-i)*n;return(0,t.clamp)(b,i,e)}}!function(e){e.color="color",e.opacity="opacity",e.size="size"}(e||(e={}));const r="bubble";class a extends t.ExternalInteractorBase{constructor(i){super(i),this._clickBubble=()=>{const i=this.container,o=i.actualOptions,n=i.interactivity.mouse.clickPosition,b=o.interactivity.modes.bubble;if(!b||!n)return;i.bubble||(i.bubble={});const l=i.retina.bubbleModeDistance;if(!l||l<0)return;const s=i.particles.quadTree.queryCircle(n,l,(e=>this.isEnabled(e))),{bubble:r}=i;for(const o of s){if(!r.clicking)continue;o.bubble.inRange=!r.durationEnd;const s=o.getPosition(),a=(0,t.getDistance)(s,n),c=((new Date).getTime()-(i.interactivity.mouse.clickTime??0))/t.millisecondsToSeconds;c>b.duration&&(r.durationEnd=!0),c>2*b.duration&&(r.clicking=!1,r.durationEnd=!1);const u={bubbleObj:{optValue:i.retina.bubbleModeSize,value:o.bubble.radius},particlesObj:{optValue:(0,t.getRangeMax)(o.options.size.value)*i.retina.pixelRatio,value:o.size.value},type:e.size};this._process(o,a,c,u);const d={bubbleObj:{optValue:b.opacity,value:o.bubble.opacity},particlesObj:{optValue:(0,t.getRangeMax)(o.options.opacity.value),value:o.opacity?.value??1},type:e.opacity};this._process(o,a,c,d),!r.durationEnd&&a<=l?this._hoverBubbleColor(o,a):delete o.bubble.color}},this._hoverBubble=()=>{const e=this.container,i=e.interactivity.mouse.position,o=e.retina.bubbleModeDistance;if(!o||o<0||!i)return;const n=e.particles.quadTree.queryCircle(i,o,(e=>this.isEnabled(e)));for(const b of n){b.bubble.inRange=!0;const n=b.getPosition(),l=(0,t.getDistance)(n,i),s=1-l/o;l<=o?s>=0&&e.interactivity.status===t.mouseMoveEvent&&(this._hoverBubbleSize(b,s),this._hoverBubbleOpacity(b,s),this._hoverBubbleColor(b,s)):this.reset(b),e.interactivity.status===t.mouseLeaveEvent&&this.reset(b)}},this._hoverBubbleColor=(e,i,o)=>{const n=this.container.actualOptions,b=o??n.interactivity.modes.bubble;if(b){if(!e.bubble.finalColor){const i=b.color;if(!i)return;const o=(0,t.itemFromSingleOrMultiple)(i);e.bubble.finalColor=(0,t.rangeColorToHsl)(o)}if(e.bubble.finalColor)if(b.mix){e.bubble.color=void 0;const o=e.getFillColor();e.bubble.color=o?(0,t.rgbToHsl)((0,t.colorMix)(o,e.bubble.finalColor,1-i,i)):e.bubble.finalColor}else e.bubble.color=e.bubble.finalColor}},this._hoverBubbleOpacity=(e,i,o)=>{const n=this.container.actualOptions,b=o?.opacity??n.interactivity.modes.bubble?.opacity;if(!b)return;const l=e.options.opacity.value,r=s(e.opacity?.value??1,b,(0,t.getRangeMax)(l),i);void 0!==r&&(e.bubble.opacity=r)},this._hoverBubbleSize=(e,i,o)=>{const n=this.container,b=o?.size?o.size*n.retina.pixelRatio:n.retina.bubbleModeSize;if(void 0===b)return;const l=(0,t.getRangeMax)(e.options.size.value)*n.retina.pixelRatio,r=s(e.size.value,b,l,i);void 0!==r&&(e.bubble.radius=r)},this._process=(t,i,o,n)=>{const b=this.container,l=n.bubbleObj.optValue,s=b.actualOptions.interactivity.modes.bubble;if(!s||void 0===l)return;const r=s.duration,a=b.retina.bubbleModeDistance,c=n.particlesObj.optValue,u=n.bubbleObj.value,d=n.particlesObj.value??0,p=n.type;if(a&&!(a<0)&&l!==c)if(b.bubble||(b.bubble={}),b.bubble.durationEnd)u&&(p===e.size&&delete t.bubble.radius,p===e.opacity&&delete t.bubble.opacity);else if(i<=a){if((u??d)!==l){const i=d-o*(d-l)/r;p===e.size&&(t.bubble.radius=i),p===e.opacity&&(t.bubble.opacity=i)}}else p===e.size&&delete t.bubble.radius,p===e.opacity&&delete t.bubble.opacity},this._singleSelectorHover=(e,i,o)=>{const n=this.container,b=document.querySelectorAll(i),l=n.actualOptions.interactivity.modes.bubble;l&&b.length&&b.forEach((i=>{const b=i,s=n.retina.pixelRatio,r={x:(b.offsetLeft+.5*b.offsetWidth)*s,y:(b.offsetTop+.5*b.offsetHeight)*s},a=.5*b.offsetWidth*s,c=o.type===t.DivType.circle?new t.Circle(r.x,r.y,a):new t.Rectangle(b.offsetLeft*s,b.offsetTop*s,b.offsetWidth*s,b.offsetHeight*s),u=n.particles.quadTree.query(c,(e=>this.isEnabled(e)));for(const i of u){if(!c.contains(i.getPosition()))continue;i.bubble.inRange=!0;const o=l.divs,n=(0,t.divMode)(o,b);i.bubble.div&&i.bubble.div===b||(this.clear(i,e,!0),i.bubble.div=b),this._hoverBubbleSize(i,1,n),this._hoverBubbleOpacity(i,1,n),this._hoverBubbleColor(i,1,n)}}))},i.bubble||(i.bubble={}),this.handleClickMode=e=>{e===r&&(i.bubble||(i.bubble={}),i.bubble.clicking=!0)}}clear(e,t,i){e.bubble.inRange&&!i||(delete e.bubble.div,delete e.bubble.opacity,delete e.bubble.radius,delete e.bubble.color)}init(){const e=this.container,t=e.actualOptions.interactivity.modes.bubble;t&&(e.retina.bubbleModeDistance=t.distance*e.retina.pixelRatio,void 0!==t.size&&(e.retina.bubbleModeSize=t.size*e.retina.pixelRatio))}interact(e){const i=this.container.actualOptions.interactivity.events,o=i.onHover,n=i.onClick,b=o.enable,l=o.mode,s=n.enable,a=n.mode,c=i.onDiv;b&&(0,t.isInArray)(r,l)?this._hoverBubble():s&&(0,t.isInArray)(r,a)?this._clickBubble():(0,t.divModeExecute)(r,c,((t,i)=>this._singleSelectorHover(e,t,i)))}isEnabled(e){const i=this.container,o=i.actualOptions,n=i.interactivity.mouse,b=(e?.interactivity??o.interactivity).events,{onClick:l,onDiv:s,onHover:a}=b,c=(0,t.isDivModeEnabled)(r,s);return!!(c||a.enable&&n.position||l.enable&&n.clickPosition)&&((0,t.isInArray)(r,a.mode)||(0,t.isInArray)(r,l.mode)||c)}loadModeOptions(e,...t){e.bubble||(e.bubble=new l);for(const i of t)e.bubble.load(i?.bubble)}reset(e){e.bubble.inRange=!1}}async function c(e,t=!0){await e.addInteractor("externalBubble",(e=>Promise.resolve(new a(e))),t)}})(),n})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Bubble External Interaction v3.
|
|
1
|
+
/*! tsParticles Bubble External Interaction v3.4.0 by Matteo Bruni */
|
package/types/Enums.d.ts
CHANGED
package/umd/Bubbler.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Bubble.js", "./Utils.js"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Bubble.js", "./Enums.js", "./Utils.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
exports.Bubbler = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Bubble_js_1 = require("./Options/Classes/Bubble.js");
|
|
15
|
+
const Enums_js_1 = require("./Enums.js");
|
|
15
16
|
const Utils_js_1 = require("./Utils.js");
|
|
16
17
|
const bubbleMode = "bubble", minDistance = 0, defaultClickTime = 0, double = 2, defaultOpacity = 1, ratioOffset = 1, defaultBubbleValue = 0, minRatio = 0, half = 0.5, defaultRatio = 1;
|
|
17
18
|
class Bubbler extends engine_1.ExternalInteractorBase {
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
if (!distance || distance < minDistance) {
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
|
-
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance,
|
|
33
|
+
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)), { bubble } = container;
|
|
33
34
|
for (const particle of query) {
|
|
34
35
|
if (!bubble.clicking) {
|
|
35
36
|
continue;
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
optValue: (0, engine_1.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,
|
|
54
55
|
value: particle.size.value,
|
|
55
56
|
},
|
|
56
|
-
type:
|
|
57
|
+
type: Enums_js_1.ProcessBubbleType.size,
|
|
57
58
|
};
|
|
58
59
|
this._process(particle, distMouse, timeSpent, sizeData);
|
|
59
60
|
const opacityData = {
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
optValue: (0, engine_1.getRangeMax)(particle.options.opacity.value),
|
|
66
67
|
value: particle.opacity?.value ?? defaultOpacity,
|
|
67
68
|
},
|
|
68
|
-
type:
|
|
69
|
+
type: Enums_js_1.ProcessBubbleType.opacity,
|
|
69
70
|
};
|
|
70
71
|
this._process(particle, distMouse, timeSpent, opacityData);
|
|
71
72
|
if (!bubble.durationEnd && distMouse <= distance) {
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
if (!distance || distance < minDistance || !mousePos) {
|
|
82
83
|
return;
|
|
83
84
|
}
|
|
84
|
-
const query = container.particles.quadTree.queryCircle(mousePos, distance,
|
|
85
|
+
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
85
86
|
for (const particle of query) {
|
|
86
87
|
particle.bubble.inRange = true;
|
|
87
88
|
const pos = particle.getPosition(), pointDistance = (0, engine_1.getDistance)(pos, mousePos), ratio = ratioOffset - pointDistance / distance;
|
|
@@ -161,10 +162,10 @@
|
|
|
161
162
|
}
|
|
162
163
|
if (container.bubble.durationEnd) {
|
|
163
164
|
if (pObjBubble) {
|
|
164
|
-
if (type ===
|
|
165
|
+
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
165
166
|
delete particle.bubble.radius;
|
|
166
167
|
}
|
|
167
|
-
if (type ===
|
|
168
|
+
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
168
169
|
delete particle.bubble.opacity;
|
|
169
170
|
}
|
|
170
171
|
}
|
|
@@ -174,19 +175,19 @@
|
|
|
174
175
|
const obj = pObjBubble ?? pObj;
|
|
175
176
|
if (obj !== bubbleParam) {
|
|
176
177
|
const value = pObj - (timeSpent * (pObj - bubbleParam)) / bubbleDuration;
|
|
177
|
-
if (type ===
|
|
178
|
+
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
178
179
|
particle.bubble.radius = value;
|
|
179
180
|
}
|
|
180
|
-
if (type ===
|
|
181
|
+
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
181
182
|
particle.bubble.opacity = value;
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
else {
|
|
186
|
-
if (type ===
|
|
187
|
+
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
187
188
|
delete particle.bubble.radius;
|
|
188
189
|
}
|
|
189
|
-
if (type ===
|
|
190
|
+
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
190
191
|
delete particle.bubble.opacity;
|
|
191
192
|
}
|
|
192
193
|
}
|
|
@@ -197,13 +198,13 @@
|
|
|
197
198
|
if (!bubble || !selectors.length) {
|
|
198
199
|
return;
|
|
199
200
|
}
|
|
200
|
-
selectors.forEach(
|
|
201
|
+
selectors.forEach(item => {
|
|
201
202
|
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
202
203
|
x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,
|
|
203
204
|
y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio,
|
|
204
|
-
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type ===
|
|
205
|
+
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type === engine_1.DivType.circle
|
|
205
206
|
? new engine_1.Circle(pos.x, pos.y, repulseRadius)
|
|
206
|
-
: new engine_1.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area,
|
|
207
|
+
: new engine_1.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area, p => this.isEnabled(p));
|
|
207
208
|
for (const particle of query) {
|
|
208
209
|
if (!area.contains(particle.getPosition())) {
|
|
209
210
|
continue;
|
package/umd/Enums.js
CHANGED
|
@@ -9,4 +9,11 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ProcessBubbleType = void 0;
|
|
13
|
+
var ProcessBubbleType;
|
|
14
|
+
(function (ProcessBubbleType) {
|
|
15
|
+
ProcessBubbleType["color"] = "color";
|
|
16
|
+
ProcessBubbleType["opacity"] = "opacity";
|
|
17
|
+
ProcessBubbleType["size"] = "size";
|
|
18
|
+
})(ProcessBubbleType || (exports.ProcessBubbleType = ProcessBubbleType = {}));
|
|
12
19
|
});
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
if (!data) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
this.divs = (0, engine_1.executeOnSingleOrMultiple)(data.divs,
|
|
22
|
+
this.divs = (0, engine_1.executeOnSingleOrMultiple)(data.divs, div => {
|
|
23
23
|
const tmp = new BubbleDiv_js_1.BubbleDiv();
|
|
24
24
|
tmp.load(div);
|
|
25
25
|
return tmp;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
if (data.color !== undefined) {
|
|
37
37
|
const sourceColor = (0, engine_1.isArray)(this.color) ? undefined : this.color;
|
|
38
|
-
this.color = (0, engine_1.executeOnSingleOrMultiple)(data.color,
|
|
38
|
+
this.color = (0, engine_1.executeOnSingleOrMultiple)(data.color, color => {
|
|
39
39
|
return engine_1.OptionsColor.create(sourceColor, color);
|
|
40
40
|
});
|
|
41
41
|
}
|
package/umd/index.js
CHANGED
|
@@ -9,18 +9,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
9
9
|
if (k2 === undefined) k2 = k;
|
|
10
10
|
o[k2] = m[k];
|
|
11
11
|
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
12
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
13
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
14
|
};
|
|
@@ -30,17 +18,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
30
18
|
if (v !== undefined) module.exports = v;
|
|
31
19
|
}
|
|
32
20
|
else if (typeof define === "function" && define.amd) {
|
|
33
|
-
define(["require", "exports", "./Options/Classes/BubbleBase.js", "./Options/Classes/BubbleDiv.js", "./Options/Classes/Bubble.js", "./Options/Interfaces/IBubbleBase.js", "./Options/Interfaces/IBubbleDiv.js", "./Options/Interfaces/IBubble.js"], factory);
|
|
21
|
+
define(["require", "exports", "./Bubbler.js", "./Options/Classes/BubbleBase.js", "./Options/Classes/BubbleDiv.js", "./Options/Classes/Bubble.js", "./Options/Interfaces/IBubbleBase.js", "./Options/Interfaces/IBubbleDiv.js", "./Options/Interfaces/IBubble.js"], factory);
|
|
34
22
|
}
|
|
35
23
|
})(function (require, exports) {
|
|
36
24
|
"use strict";
|
|
37
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
38
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
26
|
exports.loadExternalBubbleInteraction = void 0;
|
|
27
|
+
const Bubbler_js_1 = require("./Bubbler.js");
|
|
40
28
|
async function loadExternalBubbleInteraction(engine, refresh = true) {
|
|
41
|
-
await engine.addInteractor("externalBubble",
|
|
42
|
-
|
|
43
|
-
return new Bubbler(container);
|
|
29
|
+
await engine.addInteractor("externalBubble", container => {
|
|
30
|
+
return Promise.resolve(new Bubbler_js_1.Bubbler(container));
|
|
44
31
|
}, refresh);
|
|
45
32
|
}
|
|
46
33
|
exports.loadExternalBubbleInteraction = loadExternalBubbleInteraction;
|
package/201.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 201.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_interaction_external_bubble=this.webpackChunk_tsparticles_interaction_external_bubble||[]).push([[201],{201:(e,t,i)=>{i.d(t,{Bubbler:()=>a});var b=i(303),o=i(510);function l(e,t,i,o){if(t>=i){const l=e+(t-i)*o;return(0,b.clamp)(l,e,t)}if(t<i){const l=e-(i-t)*o;return(0,b.clamp)(l,t,e)}}const n="bubble";class a extends b.ExternalInteractorBase{constructor(e){super(e),this._clickBubble=()=>{const e=this.container,t=e.actualOptions,i=e.interactivity.mouse.clickPosition,o=t.interactivity.modes.bubble;if(!o||!i)return;e.bubble||(e.bubble={});const l=e.retina.bubbleModeDistance;if(!l||l<0)return;const n=e.particles.quadTree.queryCircle(i,l,(e=>this.isEnabled(e))),{bubble:a}=e;for(const t of n){if(!a.clicking)continue;t.bubble.inRange=!a.durationEnd;const n=t.getPosition(),s=(0,b.getDistance)(n,i),r=((new Date).getTime()-(e.interactivity.mouse.clickTime??0))/b.millisecondsToSeconds;r>o.duration&&(a.durationEnd=!0),r>2*o.duration&&(a.clicking=!1,a.durationEnd=!1);const c={bubbleObj:{optValue:e.retina.bubbleModeSize,value:t.bubble.radius},particlesObj:{optValue:(0,b.getRangeMax)(t.options.size.value)*e.retina.pixelRatio,value:t.size.value},type:"size"};this._process(t,s,r,c);const u={bubbleObj:{optValue:o.opacity,value:t.bubble.opacity},particlesObj:{optValue:(0,b.getRangeMax)(t.options.opacity.value),value:t.opacity?.value??1},type:"opacity"};this._process(t,s,r,u),!a.durationEnd&&s<=l?this._hoverBubbleColor(t,s):delete t.bubble.color}},this._hoverBubble=()=>{const e=this.container,t=e.interactivity.mouse.position,i=e.retina.bubbleModeDistance;if(!i||i<0||!t)return;const o=e.particles.quadTree.queryCircle(t,i,(e=>this.isEnabled(e)));for(const l of o){l.bubble.inRange=!0;const o=l.getPosition(),n=(0,b.getDistance)(o,t),a=1-n/i;n<=i?a>=0&&e.interactivity.status===b.mouseMoveEvent&&(this._hoverBubbleSize(l,a),this._hoverBubbleOpacity(l,a),this._hoverBubbleColor(l,a)):this.reset(l),e.interactivity.status===b.mouseLeaveEvent&&this.reset(l)}},this._hoverBubbleColor=(e,t,i)=>{const o=this.container.actualOptions,l=i??o.interactivity.modes.bubble;if(l){if(!e.bubble.finalColor){const t=l.color;if(!t)return;const i=(0,b.itemFromSingleOrMultiple)(t);e.bubble.finalColor=(0,b.rangeColorToHsl)(i)}if(e.bubble.finalColor)if(l.mix){e.bubble.color=void 0;const i=e.getFillColor();e.bubble.color=i?(0,b.rgbToHsl)((0,b.colorMix)(i,e.bubble.finalColor,1-t,t)):e.bubble.finalColor}else e.bubble.color=e.bubble.finalColor}},this._hoverBubbleOpacity=(e,t,i)=>{const o=this.container.actualOptions,n=i?.opacity??o.interactivity.modes.bubble?.opacity;if(!n)return;const a=e.options.opacity.value,s=l(e.opacity?.value??1,n,(0,b.getRangeMax)(a),t);void 0!==s&&(e.bubble.opacity=s)},this._hoverBubbleSize=(e,t,i)=>{const o=this.container,n=i?.size?i.size*o.retina.pixelRatio:o.retina.bubbleModeSize;if(void 0===n)return;const a=(0,b.getRangeMax)(e.options.size.value)*o.retina.pixelRatio,s=l(e.size.value,n,a,t);void 0!==s&&(e.bubble.radius=s)},this._process=(e,t,i,b)=>{const o=this.container,l=b.bubbleObj.optValue,n=o.actualOptions.interactivity.modes.bubble;if(!n||void 0===l)return;const a=n.duration,s=o.retina.bubbleModeDistance,r=b.particlesObj.optValue,c=b.bubbleObj.value,u=b.particlesObj.value??0,d=b.type;if(s&&!(s<0)&&l!==r)if(o.bubble||(o.bubble={}),o.bubble.durationEnd)c&&("size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity);else if(t<=s){if((c??u)!==l){const t=u-i*(u-l)/a;"size"===d&&(e.bubble.radius=t),"opacity"===d&&(e.bubble.opacity=t)}}else"size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity},this._singleSelectorHover=(e,t,i)=>{const o=this.container,l=document.querySelectorAll(t),n=o.actualOptions.interactivity.modes.bubble;n&&l.length&&l.forEach((t=>{const l=t,a=o.retina.pixelRatio,s={x:(l.offsetLeft+.5*l.offsetWidth)*a,y:(l.offsetTop+.5*l.offsetHeight)*a},r=.5*l.offsetWidth*a,c="circle"===i.type?new b.Circle(s.x,s.y,r):new b.Rectangle(l.offsetLeft*a,l.offsetTop*a,l.offsetWidth*a,l.offsetHeight*a),u=o.particles.quadTree.query(c,(e=>this.isEnabled(e)));for(const t of u){if(!c.contains(t.getPosition()))continue;t.bubble.inRange=!0;const i=n.divs,o=(0,b.divMode)(i,l);t.bubble.div&&t.bubble.div===l||(this.clear(t,e,!0),t.bubble.div=l),this._hoverBubbleSize(t,1,o),this._hoverBubbleOpacity(t,1,o),this._hoverBubbleColor(t,1,o)}}))},e.bubble||(e.bubble={}),this.handleClickMode=t=>{t===n&&(e.bubble||(e.bubble={}),e.bubble.clicking=!0)}}clear(e,t,i){e.bubble.inRange&&!i||(delete e.bubble.div,delete e.bubble.opacity,delete e.bubble.radius,delete e.bubble.color)}init(){const e=this.container,t=e.actualOptions.interactivity.modes.bubble;t&&(e.retina.bubbleModeDistance=t.distance*e.retina.pixelRatio,void 0!==t.size&&(e.retina.bubbleModeSize=t.size*e.retina.pixelRatio))}interact(e){const t=this.container.actualOptions.interactivity.events,i=t.onHover,o=t.onClick,l=i.enable,a=i.mode,s=o.enable,r=o.mode,c=t.onDiv;l&&(0,b.isInArray)(n,a)?this._hoverBubble():s&&(0,b.isInArray)(n,r)?this._clickBubble():(0,b.divModeExecute)(n,c,((t,i)=>this._singleSelectorHover(e,t,i)))}isEnabled(e){const t=this.container,i=t.actualOptions,o=t.interactivity.mouse,l=(e?.interactivity??i.interactivity).events,{onClick:a,onDiv:s,onHover:r}=l,c=(0,b.isDivModeEnabled)(n,s);return!!(c||r.enable&&o.position||a.enable&&o.clickPosition)&&((0,b.isInArray)(n,r.mode)||(0,b.isInArray)(n,a.mode)||c)}loadModeOptions(e,...t){e.bubble||(e.bubble=new o.Z);for(const i of t)e.bubble.load(i?.bubble)}reset(e){e.bubble.inRange=!1}}}}]);
|
package/201.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Bubble External Interaction v3.3.0 by Matteo Bruni */
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Author : Matteo Bruni
|
|
3
|
-
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
-
* Demo / Generator : https://particles.js.org/
|
|
5
|
-
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
-
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.3.0
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_interaction_external_bubble"] = this["webpackChunk_tsparticles_interaction_external_bubble"] || []).push([["dist_browser_Bubbler_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/Bubbler.js":
|
|
21
|
-
/*!*********************************!*\
|
|
22
|
-
!*** ./dist/browser/Bubbler.js ***!
|
|
23
|
-
\*********************************/
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubbler: () => (/* binding */ Bubbler)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Bubble.js */ \"./dist/browser/Options/Classes/Bubble.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nconst bubbleMode = \"bubble\",\n minDistance = 0,\n defaultClickTime = 0,\n double = 2,\n defaultOpacity = 1,\n ratioOffset = 1,\n defaultBubbleValue = 0,\n minRatio = 0,\n half = 0.5,\n defaultRatio = 1;\nclass Bubbler extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container) {\n super(container);\n this._clickBubble = () => {\n const container = this.container,\n options = container.actualOptions,\n mouseClickPos = container.interactivity.mouse.clickPosition,\n bubbleOptions = options.interactivity.modes.bubble;\n if (!bubbleOptions || !mouseClickPos) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n const distance = container.retina.bubbleModeDistance;\n if (!distance || distance < minDistance) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)),\n {\n bubble\n } = container;\n for (const particle of query) {\n if (!bubble.clicking) {\n continue;\n }\n particle.bubble.inRange = !bubble.durationEnd;\n const pos = particle.getPosition(),\n distMouse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mouseClickPos),\n timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime ?? defaultClickTime)) / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds;\n if (timeSpent > bubbleOptions.duration) {\n bubble.durationEnd = true;\n }\n if (timeSpent > bubbleOptions.duration * double) {\n bubble.clicking = false;\n bubble.durationEnd = false;\n }\n const sizeData = {\n bubbleObj: {\n optValue: container.retina.bubbleModeSize,\n value: particle.bubble.radius\n },\n particlesObj: {\n optValue: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,\n value: particle.size.value\n },\n type: \"size\"\n };\n this._process(particle, distMouse, timeSpent, sizeData);\n const opacityData = {\n bubbleObj: {\n optValue: bubbleOptions.opacity,\n value: particle.bubble.opacity\n },\n particlesObj: {\n optValue: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.opacity.value),\n value: particle.opacity?.value ?? defaultOpacity\n },\n type: \"opacity\"\n };\n this._process(particle, distMouse, timeSpent, opacityData);\n if (!bubble.durationEnd && distMouse <= distance) {\n this._hoverBubbleColor(particle, distMouse);\n } else {\n delete particle.bubble.color;\n }\n }\n };\n this._hoverBubble = () => {\n const container = this.container,\n mousePos = container.interactivity.mouse.position,\n distance = container.retina.bubbleModeDistance;\n if (!distance || distance < minDistance || !mousePos) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));\n for (const particle of query) {\n particle.bubble.inRange = true;\n const pos = particle.getPosition(),\n pointDistance = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mousePos),\n ratio = ratioOffset - pointDistance / distance;\n if (pointDistance <= distance) {\n if (ratio >= minRatio && container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent) {\n this._hoverBubbleSize(particle, ratio);\n this._hoverBubbleOpacity(particle, ratio);\n this._hoverBubbleColor(particle, ratio);\n }\n } else {\n this.reset(particle);\n }\n if (container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseLeaveEvent) {\n this.reset(particle);\n }\n }\n };\n this._hoverBubbleColor = (particle, ratio, divBubble) => {\n const options = this.container.actualOptions,\n bubbleOptions = divBubble ?? options.interactivity.modes.bubble;\n if (!bubbleOptions) {\n return;\n }\n if (!particle.bubble.finalColor) {\n const modeColor = bubbleOptions.color;\n if (!modeColor) {\n return;\n }\n const bubbleColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(modeColor);\n particle.bubble.finalColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(bubbleColor);\n }\n if (!particle.bubble.finalColor) {\n return;\n }\n if (bubbleOptions.mix) {\n particle.bubble.color = undefined;\n const pColor = particle.getFillColor();\n particle.bubble.color = pColor ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rgbToHsl)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.colorMix)(pColor, particle.bubble.finalColor, ratioOffset - ratio, ratio)) : particle.bubble.finalColor;\n } else {\n particle.bubble.color = particle.bubble.finalColor;\n }\n };\n this._hoverBubbleOpacity = (particle, ratio, divBubble) => {\n const container = this.container,\n options = container.actualOptions,\n modeOpacity = divBubble?.opacity ?? options.interactivity.modes.bubble?.opacity;\n if (!modeOpacity) {\n return;\n }\n const optOpacity = particle.options.opacity.value,\n pOpacity = particle.opacity?.value ?? defaultOpacity,\n opacity = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.calculateBubbleValue)(pOpacity, modeOpacity, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(optOpacity), ratio);\n if (opacity !== undefined) {\n particle.bubble.opacity = opacity;\n }\n };\n this._hoverBubbleSize = (particle, ratio, divBubble) => {\n const container = this.container,\n modeSize = divBubble?.size ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;\n if (modeSize === undefined) {\n return;\n }\n const optSize = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,\n pSize = particle.size.value,\n size = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.calculateBubbleValue)(pSize, modeSize, optSize, ratio);\n if (size !== undefined) {\n particle.bubble.radius = size;\n }\n };\n this._process = (particle, distMouse, timeSpent, data) => {\n const container = this.container,\n bubbleParam = data.bubbleObj.optValue,\n options = container.actualOptions,\n bubbleOptions = options.interactivity.modes.bubble;\n if (!bubbleOptions || bubbleParam === undefined) {\n return;\n }\n const bubbleDuration = bubbleOptions.duration,\n bubbleDistance = container.retina.bubbleModeDistance,\n particlesParam = data.particlesObj.optValue,\n pObjBubble = data.bubbleObj.value,\n pObj = data.particlesObj.value ?? defaultBubbleValue,\n type = data.type;\n if (!bubbleDistance || bubbleDistance < minDistance || bubbleParam === particlesParam) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n if (container.bubble.durationEnd) {\n if (pObjBubble) {\n if (type === \"size\") {\n delete particle.bubble.radius;\n }\n if (type === \"opacity\") {\n delete particle.bubble.opacity;\n }\n }\n } else {\n if (distMouse <= bubbleDistance) {\n const obj = pObjBubble ?? pObj;\n if (obj !== bubbleParam) {\n const value = pObj - timeSpent * (pObj - bubbleParam) / bubbleDuration;\n if (type === \"size\") {\n particle.bubble.radius = value;\n }\n if (type === \"opacity\") {\n particle.bubble.opacity = value;\n }\n }\n } else {\n if (type === \"size\") {\n delete particle.bubble.radius;\n }\n if (type === \"opacity\") {\n delete particle.bubble.opacity;\n }\n }\n }\n };\n this._singleSelectorHover = (delta, selector, div) => {\n const container = this.container,\n selectors = document.querySelectorAll(selector),\n bubble = container.actualOptions.interactivity.modes.bubble;\n if (!bubble || !selectors.length) {\n return;\n }\n selectors.forEach(item => {\n const elem = item,\n pxRatio = container.retina.pixelRatio,\n pos = {\n x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,\n y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio\n },\n repulseRadius = elem.offsetWidth * half * pxRatio,\n area = div.type === \"circle\" ? new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(pos.x, pos.y, repulseRadius) : new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),\n query = container.particles.quadTree.query(area, p => this.isEnabled(p));\n for (const particle of query) {\n if (!area.contains(particle.getPosition())) {\n continue;\n }\n particle.bubble.inRange = true;\n const divs = bubble.divs,\n divBubble = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divMode)(divs, elem);\n if (!particle.bubble.div || particle.bubble.div !== elem) {\n this.clear(particle, delta, true);\n particle.bubble.div = elem;\n }\n this._hoverBubbleSize(particle, defaultRatio, divBubble);\n this._hoverBubbleOpacity(particle, defaultRatio, divBubble);\n this._hoverBubbleColor(particle, defaultRatio, divBubble);\n }\n });\n };\n if (!container.bubble) {\n container.bubble = {};\n }\n this.handleClickMode = mode => {\n if (mode !== bubbleMode) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n container.bubble.clicking = true;\n };\n }\n clear(particle, delta, force) {\n if (particle.bubble.inRange && !force) {\n return;\n }\n delete particle.bubble.div;\n delete particle.bubble.opacity;\n delete particle.bubble.radius;\n delete particle.bubble.color;\n }\n init() {\n const container = this.container,\n bubble = container.actualOptions.interactivity.modes.bubble;\n if (!bubble) {\n return;\n }\n container.retina.bubbleModeDistance = bubble.distance * container.retina.pixelRatio;\n if (bubble.size !== undefined) {\n container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;\n }\n }\n interact(delta) {\n const options = this.container.actualOptions,\n events = options.interactivity.events,\n onHover = events.onHover,\n onClick = events.onClick,\n hoverEnabled = onHover.enable,\n hoverMode = onHover.mode,\n clickEnabled = onClick.enable,\n clickMode = onClick.mode,\n divs = events.onDiv;\n if (hoverEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, hoverMode)) {\n this._hoverBubble();\n } else if (clickEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, clickMode)) {\n this._clickBubble();\n } else {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divModeExecute)(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));\n }\n }\n isEnabled(particle) {\n const container = this.container,\n options = container.actualOptions,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? options.interactivity).events,\n {\n onClick,\n onDiv,\n onHover\n } = events,\n divBubble = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isDivModeEnabled)(bubbleMode, onDiv);\n if (!(divBubble || onHover.enable && !!mouse.position || onClick.enable && mouse.clickPosition)) {\n return false;\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, onHover.mode) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, onClick.mode) || divBubble;\n }\n loadModeOptions(options, ...sources) {\n if (!options.bubble) {\n options.bubble = new _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__.Bubble();\n }\n for (const source of sources) {\n options.bubble.load(source?.bubble);\n }\n }\n reset(particle) {\n particle.bubble.inRange = false;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Bubbler.js?");
|
|
27
|
-
|
|
28
|
-
/***/ }),
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/Utils.js":
|
|
31
|
-
/*!*******************************!*\
|
|
32
|
-
!*** ./dist/browser/Utils.js ***!
|
|
33
|
-
\*******************************/
|
|
34
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
35
|
-
|
|
36
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ calculateBubbleValue: () => (/* binding */ calculateBubbleValue)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) {\n if (modeValue >= optionsValue) {\n const value = particleValue + (modeValue - optionsValue) * ratio;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(value, particleValue, modeValue);\n } else if (modeValue < optionsValue) {\n const value = particleValue - (optionsValue - modeValue) * ratio;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(value, modeValue, particleValue);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Utils.js?");
|
|
37
|
-
|
|
38
|
-
/***/ })
|
|
39
|
-
|
|
40
|
-
}]);
|