@tsparticles/interaction-external-bubble 3.0.0-alpha.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/LICENSE +21 -0
- package/README.md +70 -0
- package/browser/Bubbler.js +294 -0
- package/browser/IBubblerProcessParam.js +1 -0
- package/browser/Options/Classes/Bubble.js +16 -0
- package/browser/Options/Classes/BubbleBase.js +34 -0
- package/browser/Options/Classes/BubbleDiv.js +26 -0
- package/browser/Options/Classes/BubbleOptions.js +1 -0
- package/browser/Options/Interfaces/IBubble.js +1 -0
- package/browser/Options/Interfaces/IBubbleBase.js +1 -0
- package/browser/Options/Interfaces/IBubbleDiv.js +1 -0
- package/browser/ProcessBubbleType.js +1 -0
- package/browser/Types.js +1 -0
- package/browser/index.js +10 -0
- package/cjs/Bubbler.js +309 -0
- package/cjs/IBubblerProcessParam.js +2 -0
- package/cjs/Options/Classes/Bubble.js +20 -0
- package/cjs/Options/Classes/BubbleBase.js +38 -0
- package/cjs/Options/Classes/BubbleDiv.js +30 -0
- package/cjs/Options/Classes/BubbleOptions.js +2 -0
- package/cjs/Options/Interfaces/IBubble.js +2 -0
- package/cjs/Options/Interfaces/IBubbleBase.js +2 -0
- package/cjs/Options/Interfaces/IBubbleDiv.js +2 -0
- package/cjs/ProcessBubbleType.js +2 -0
- package/cjs/Types.js +2 -0
- package/cjs/index.js +39 -0
- package/esm/Bubbler.js +294 -0
- package/esm/IBubblerProcessParam.js +1 -0
- package/esm/Options/Classes/Bubble.js +16 -0
- package/esm/Options/Classes/BubbleBase.js +34 -0
- package/esm/Options/Classes/BubbleDiv.js +26 -0
- package/esm/Options/Classes/BubbleOptions.js +1 -0
- package/esm/Options/Interfaces/IBubble.js +1 -0
- package/esm/Options/Interfaces/IBubbleBase.js +1 -0
- package/esm/Options/Interfaces/IBubbleDiv.js +1 -0
- package/esm/ProcessBubbleType.js +1 -0
- package/esm/Types.js +1 -0
- package/esm/index.js +10 -0
- package/package.json +82 -0
- package/report.html +39 -0
- package/tsparticles.interaction.external.bubble.js +520 -0
- package/tsparticles.interaction.external.bubble.min.js +2 -0
- package/tsparticles.interaction.external.bubble.min.js.LICENSE.txt +8 -0
- package/types/Bubbler.d.ts +20 -0
- package/types/IBubblerProcessParam.d.ts +10 -0
- package/types/Options/Classes/Bubble.d.ts +8 -0
- package/types/Options/Classes/BubbleBase.d.ts +13 -0
- package/types/Options/Classes/BubbleDiv.d.ts +10 -0
- package/types/Options/Classes/BubbleOptions.d.ts +7 -0
- package/types/Options/Interfaces/IBubble.d.ts +6 -0
- package/types/Options/Interfaces/IBubbleBase.d.ts +9 -0
- package/types/Options/Interfaces/IBubbleDiv.d.ts +4 -0
- package/types/ProcessBubbleType.d.ts +5 -0
- package/types/Types.d.ts +23 -0
- package/types/index.d.ts +8 -0
- package/umd/Bubbler.js +308 -0
- package/umd/IBubblerProcessParam.js +12 -0
- package/umd/Options/Classes/Bubble.js +30 -0
- package/umd/Options/Classes/BubbleBase.js +48 -0
- package/umd/Options/Classes/BubbleDiv.js +40 -0
- package/umd/Options/Classes/BubbleOptions.js +12 -0
- package/umd/Options/Interfaces/IBubble.js +12 -0
- package/umd/Options/Interfaces/IBubbleBase.js +12 -0
- package/umd/Options/Interfaces/IBubbleDiv.js +12 -0
- package/umd/ProcessBubbleType.js +12 -0
- package/umd/Types.js +12 -0
- package/umd/index.js +38 -0
package/esm/Bubbler.js
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { Circle, ExternalInteractorBase, Rectangle, clamp, colorMix, divMode, divModeExecute, getDistance, getRangeMax, isDivModeEnabled, isInArray, itemFromSingleOrMultiple, mouseLeaveEvent, mouseMoveEvent, rangeColorToHsl, rgbToHsl, } from "@tsparticles/engine";
|
|
2
|
+
import { Bubble } from "./Options/Classes/Bubble";
|
|
3
|
+
function calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) {
|
|
4
|
+
if (modeValue >= optionsValue) {
|
|
5
|
+
const value = particleValue + (modeValue - optionsValue) * ratio;
|
|
6
|
+
return clamp(value, particleValue, modeValue);
|
|
7
|
+
}
|
|
8
|
+
else if (modeValue < optionsValue) {
|
|
9
|
+
const value = particleValue - (optionsValue - modeValue) * ratio;
|
|
10
|
+
return clamp(value, modeValue, particleValue);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export class Bubbler extends ExternalInteractorBase {
|
|
14
|
+
constructor(container) {
|
|
15
|
+
super(container);
|
|
16
|
+
if (!container.bubble) {
|
|
17
|
+
container.bubble = {};
|
|
18
|
+
}
|
|
19
|
+
this.handleClickMode = (mode) => {
|
|
20
|
+
if (mode !== "bubble") {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (!container.bubble) {
|
|
24
|
+
container.bubble = {};
|
|
25
|
+
}
|
|
26
|
+
container.bubble.clicking = true;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
clear(particle, delta, force) {
|
|
30
|
+
if (particle.bubble.inRange && !force) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
delete particle.bubble.div;
|
|
34
|
+
delete particle.bubble.opacity;
|
|
35
|
+
delete particle.bubble.radius;
|
|
36
|
+
delete particle.bubble.color;
|
|
37
|
+
}
|
|
38
|
+
init() {
|
|
39
|
+
const container = this.container, bubble = container.actualOptions.interactivity.modes.bubble;
|
|
40
|
+
if (!bubble) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
container.retina.bubbleModeDistance = bubble.distance * container.retina.pixelRatio;
|
|
44
|
+
if (bubble.size !== undefined) {
|
|
45
|
+
container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async interact(delta) {
|
|
49
|
+
const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
|
|
50
|
+
if (hoverEnabled && isInArray("bubble", hoverMode)) {
|
|
51
|
+
this.hoverBubble(delta);
|
|
52
|
+
}
|
|
53
|
+
else if (clickEnabled && isInArray("bubble", clickMode)) {
|
|
54
|
+
this.clickBubble(delta);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
divModeExecute("bubble", divs, (selector, div) => this.singleSelectorHover(delta, selector, div));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
isEnabled(particle) {
|
|
61
|
+
var _a;
|
|
62
|
+
const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = ((_a = particle === null || particle === void 0 ? void 0 : particle.interactivity) !== null && _a !== void 0 ? _a : options.interactivity).events, divs = events.onDiv, divBubble = isDivModeEnabled("bubble", divs);
|
|
63
|
+
if (!(divBubble || (events.onHover.enable && mouse.position) || (events.onClick.enable && mouse.clickPosition))) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
const hoverMode = events.onHover.mode;
|
|
67
|
+
const clickMode = events.onClick.mode;
|
|
68
|
+
return isInArray("bubble", hoverMode) || isInArray("bubble", clickMode) || divBubble;
|
|
69
|
+
}
|
|
70
|
+
loadModeOptions(options, ...sources) {
|
|
71
|
+
if (!options.bubble) {
|
|
72
|
+
options.bubble = new Bubble();
|
|
73
|
+
}
|
|
74
|
+
for (const source of sources) {
|
|
75
|
+
options.bubble.load(source === null || source === void 0 ? void 0 : source.bubble);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
reset(particle) {
|
|
79
|
+
particle.bubble.inRange = false;
|
|
80
|
+
}
|
|
81
|
+
clickBubble(delta) {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
const container = this.container, options = container.actualOptions, mouseClickPos = container.interactivity.mouse.clickPosition, bubble = options.interactivity.modes.bubble;
|
|
84
|
+
if (!bubble || !mouseClickPos) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (!container.bubble) {
|
|
88
|
+
container.bubble = {};
|
|
89
|
+
}
|
|
90
|
+
const distance = container.retina.bubbleModeDistance;
|
|
91
|
+
if (!distance || distance < 0) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, (p) => this.isEnabled(p));
|
|
95
|
+
for (const particle of query) {
|
|
96
|
+
if (!container.bubble.clicking) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
particle.bubble.inRange = !container.bubble.durationEnd;
|
|
100
|
+
const pos = particle.getPosition(), distMouse = getDistance(pos, mouseClickPos), timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime || 0)) / 1000;
|
|
101
|
+
if (timeSpent > bubble.duration) {
|
|
102
|
+
container.bubble.durationEnd = true;
|
|
103
|
+
}
|
|
104
|
+
if (timeSpent > bubble.duration * 2) {
|
|
105
|
+
container.bubble.clicking = false;
|
|
106
|
+
container.bubble.durationEnd = false;
|
|
107
|
+
}
|
|
108
|
+
const sizeData = {
|
|
109
|
+
bubbleObj: {
|
|
110
|
+
optValue: container.retina.bubbleModeSize,
|
|
111
|
+
value: particle.bubble.radius,
|
|
112
|
+
},
|
|
113
|
+
particlesObj: {
|
|
114
|
+
optValue: getRangeMax(particle.options.size.value) * container.retina.pixelRatio,
|
|
115
|
+
value: particle.size.value,
|
|
116
|
+
},
|
|
117
|
+
type: "size",
|
|
118
|
+
};
|
|
119
|
+
this.process(particle, distMouse, timeSpent, sizeData);
|
|
120
|
+
const opacityData = {
|
|
121
|
+
bubbleObj: {
|
|
122
|
+
optValue: bubble.opacity,
|
|
123
|
+
value: particle.bubble.opacity,
|
|
124
|
+
},
|
|
125
|
+
particlesObj: {
|
|
126
|
+
optValue: getRangeMax(particle.options.opacity.value),
|
|
127
|
+
value: (_b = (_a = particle.opacity) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 1,
|
|
128
|
+
},
|
|
129
|
+
type: "opacity",
|
|
130
|
+
};
|
|
131
|
+
this.process(particle, distMouse, timeSpent, opacityData);
|
|
132
|
+
if (!container.bubble.durationEnd) {
|
|
133
|
+
if (distMouse <= distance) {
|
|
134
|
+
this.hoverBubbleColor(particle, distMouse);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
delete particle.bubble.color;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
delete particle.bubble.color;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
hoverBubble(delta) {
|
|
146
|
+
const container = this.container, mousePos = container.interactivity.mouse.position, distance = container.retina.bubbleModeDistance;
|
|
147
|
+
if (!distance || distance < 0 || mousePos === undefined) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const query = container.particles.quadTree.queryCircle(mousePos, distance, (p) => this.isEnabled(p));
|
|
151
|
+
for (const particle of query) {
|
|
152
|
+
particle.bubble.inRange = true;
|
|
153
|
+
const pos = particle.getPosition(), pointDistance = getDistance(pos, mousePos), ratio = 1 - pointDistance / distance;
|
|
154
|
+
if (pointDistance <= distance) {
|
|
155
|
+
if (ratio >= 0 && container.interactivity.status === mouseMoveEvent) {
|
|
156
|
+
this.hoverBubbleSize(particle, ratio);
|
|
157
|
+
this.hoverBubbleOpacity(particle, ratio);
|
|
158
|
+
this.hoverBubbleColor(particle, ratio);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.reset(particle);
|
|
163
|
+
}
|
|
164
|
+
if (container.interactivity.status === mouseLeaveEvent) {
|
|
165
|
+
this.reset(particle);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
hoverBubbleColor(particle, ratio, divBubble) {
|
|
170
|
+
const options = this.container.actualOptions;
|
|
171
|
+
const bubbleOptions = divBubble !== null && divBubble !== void 0 ? divBubble : options.interactivity.modes.bubble;
|
|
172
|
+
if (!bubbleOptions) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (!particle.bubble.finalColor) {
|
|
176
|
+
const modeColor = bubbleOptions.color;
|
|
177
|
+
if (!modeColor) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const bubbleColor = itemFromSingleOrMultiple(modeColor);
|
|
181
|
+
particle.bubble.finalColor = rangeColorToHsl(bubbleColor);
|
|
182
|
+
}
|
|
183
|
+
if (!particle.bubble.finalColor) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (bubbleOptions.mix) {
|
|
187
|
+
particle.bubble.color = undefined;
|
|
188
|
+
const pColor = particle.getFillColor();
|
|
189
|
+
particle.bubble.color = pColor
|
|
190
|
+
? rgbToHsl(colorMix(pColor, particle.bubble.finalColor, 1 - ratio, ratio))
|
|
191
|
+
: particle.bubble.finalColor;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
particle.bubble.color = particle.bubble.finalColor;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
hoverBubbleOpacity(particle, ratio, divBubble) {
|
|
198
|
+
var _a, _b, _c, _d;
|
|
199
|
+
const container = this.container, options = container.actualOptions, modeOpacity = (_a = divBubble === null || divBubble === void 0 ? void 0 : divBubble.opacity) !== null && _a !== void 0 ? _a : (_b = options.interactivity.modes.bubble) === null || _b === void 0 ? void 0 : _b.opacity;
|
|
200
|
+
if (!modeOpacity) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const optOpacity = particle.options.opacity.value;
|
|
204
|
+
const pOpacity = (_d = (_c = particle.opacity) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 1;
|
|
205
|
+
const opacity = calculateBubbleValue(pOpacity, modeOpacity, getRangeMax(optOpacity), ratio);
|
|
206
|
+
if (opacity !== undefined) {
|
|
207
|
+
particle.bubble.opacity = opacity;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
hoverBubbleSize(particle, ratio, divBubble) {
|
|
211
|
+
const container = this.container, modeSize = (divBubble === null || divBubble === void 0 ? void 0 : divBubble.size) ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;
|
|
212
|
+
if (modeSize === undefined) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const optSize = getRangeMax(particle.options.size.value) * container.retina.pixelRatio;
|
|
216
|
+
const pSize = particle.size.value;
|
|
217
|
+
const size = calculateBubbleValue(pSize, modeSize, optSize, ratio);
|
|
218
|
+
if (size !== undefined) {
|
|
219
|
+
particle.bubble.radius = size;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
process(particle, distMouse, timeSpent, data) {
|
|
223
|
+
const container = this.container, bubbleParam = data.bubbleObj.optValue, options = container.actualOptions, bubble = options.interactivity.modes.bubble;
|
|
224
|
+
if (!bubble || bubbleParam === undefined) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const bubbleDuration = bubble.duration, bubbleDistance = container.retina.bubbleModeDistance, particlesParam = data.particlesObj.optValue, pObjBubble = data.bubbleObj.value, pObj = data.particlesObj.value || 0, type = data.type;
|
|
228
|
+
if (!bubbleDistance || bubbleDistance < 0 || bubbleParam === particlesParam) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (!container.bubble) {
|
|
232
|
+
container.bubble = {};
|
|
233
|
+
}
|
|
234
|
+
if (!container.bubble.durationEnd) {
|
|
235
|
+
if (distMouse <= bubbleDistance) {
|
|
236
|
+
const obj = pObjBubble !== null && pObjBubble !== void 0 ? pObjBubble : pObj;
|
|
237
|
+
if (obj !== bubbleParam) {
|
|
238
|
+
const value = pObj - (timeSpent * (pObj - bubbleParam)) / bubbleDuration;
|
|
239
|
+
if (type === "size") {
|
|
240
|
+
particle.bubble.radius = value;
|
|
241
|
+
}
|
|
242
|
+
if (type === "opacity") {
|
|
243
|
+
particle.bubble.opacity = value;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
if (type === "size") {
|
|
249
|
+
delete particle.bubble.radius;
|
|
250
|
+
}
|
|
251
|
+
if (type === "opacity") {
|
|
252
|
+
delete particle.bubble.opacity;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else if (pObjBubble) {
|
|
257
|
+
if (type === "size") {
|
|
258
|
+
delete particle.bubble.radius;
|
|
259
|
+
}
|
|
260
|
+
if (type === "opacity") {
|
|
261
|
+
delete particle.bubble.opacity;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
singleSelectorHover(delta, selector, div) {
|
|
266
|
+
const container = this.container, selectors = document.querySelectorAll(selector), bubble = container.actualOptions.interactivity.modes.bubble;
|
|
267
|
+
if (!bubble || !selectors.length) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
selectors.forEach((item) => {
|
|
271
|
+
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
272
|
+
x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
|
|
273
|
+
y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio,
|
|
274
|
+
}, repulseRadius = (elem.offsetWidth / 2) * pxRatio, area = div.type === "circle"
|
|
275
|
+
? new Circle(pos.x, pos.y, repulseRadius)
|
|
276
|
+
: new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area, (p) => this.isEnabled(p));
|
|
277
|
+
for (const particle of query) {
|
|
278
|
+
if (!area.contains(particle.getPosition())) {
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
particle.bubble.inRange = true;
|
|
282
|
+
const divs = bubble.divs;
|
|
283
|
+
const divBubble = divMode(divs, elem);
|
|
284
|
+
if (!particle.bubble.div || particle.bubble.div !== elem) {
|
|
285
|
+
this.clear(particle, delta, true);
|
|
286
|
+
particle.bubble.div = elem;
|
|
287
|
+
}
|
|
288
|
+
this.hoverBubbleSize(particle, 1, divBubble);
|
|
289
|
+
this.hoverBubbleOpacity(particle, 1, divBubble);
|
|
290
|
+
this.hoverBubbleColor(particle, 1, divBubble);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BubbleBase } from "./BubbleBase";
|
|
2
|
+
import { BubbleDiv } from "./BubbleDiv";
|
|
3
|
+
import { executeOnSingleOrMultiple } from "@tsparticles/engine";
|
|
4
|
+
export class Bubble extends BubbleBase {
|
|
5
|
+
load(data) {
|
|
6
|
+
super.load(data);
|
|
7
|
+
if (!data) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
this.divs = executeOnSingleOrMultiple(data.divs, (div) => {
|
|
11
|
+
const tmp = new BubbleDiv();
|
|
12
|
+
tmp.load(div);
|
|
13
|
+
return tmp;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OptionsColor, executeOnSingleOrMultiple } from "@tsparticles/engine";
|
|
2
|
+
export class BubbleBase {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.distance = 200;
|
|
5
|
+
this.duration = 0.4;
|
|
6
|
+
this.mix = false;
|
|
7
|
+
}
|
|
8
|
+
load(data) {
|
|
9
|
+
if (!data) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (data.distance !== undefined) {
|
|
13
|
+
this.distance = data.distance;
|
|
14
|
+
}
|
|
15
|
+
if (data.duration !== undefined) {
|
|
16
|
+
this.duration = data.duration;
|
|
17
|
+
}
|
|
18
|
+
if (data.mix !== undefined) {
|
|
19
|
+
this.mix = data.mix;
|
|
20
|
+
}
|
|
21
|
+
if (data.opacity !== undefined) {
|
|
22
|
+
this.opacity = data.opacity;
|
|
23
|
+
}
|
|
24
|
+
if (data.color !== undefined) {
|
|
25
|
+
const sourceColor = this.color instanceof Array ? undefined : this.color;
|
|
26
|
+
this.color = executeOnSingleOrMultiple(data.color, (color) => {
|
|
27
|
+
return OptionsColor.create(sourceColor, color);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (data.size !== undefined) {
|
|
31
|
+
this.size = data.size;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BubbleBase } from "./BubbleBase";
|
|
2
|
+
import { executeOnSingleOrMultiple } from "@tsparticles/engine";
|
|
3
|
+
export class BubbleDiv extends BubbleBase {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.selectors = [];
|
|
7
|
+
}
|
|
8
|
+
get ids() {
|
|
9
|
+
return executeOnSingleOrMultiple(this.selectors, (t) => t.replace("#", ""));
|
|
10
|
+
}
|
|
11
|
+
set ids(value) {
|
|
12
|
+
this.selectors = executeOnSingleOrMultiple(value, (t) => `#${t}`);
|
|
13
|
+
}
|
|
14
|
+
load(data) {
|
|
15
|
+
super.load(data);
|
|
16
|
+
if (!data) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (data.ids !== undefined) {
|
|
20
|
+
this.ids = data.ids;
|
|
21
|
+
}
|
|
22
|
+
if (data.selectors !== undefined) {
|
|
23
|
+
this.selectors = data.selectors;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/Types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Bubbler } from "./Bubbler";
|
|
2
|
+
export async function loadExternalBubbleInteraction(engine) {
|
|
3
|
+
await engine.addInteractor("externalBubble", (container) => new Bubbler(container));
|
|
4
|
+
}
|
|
5
|
+
export * from "./Options/Classes/BubbleBase";
|
|
6
|
+
export * from "./Options/Classes/BubbleDiv";
|
|
7
|
+
export * from "./Options/Classes/Bubble";
|
|
8
|
+
export * from "./Options/Interfaces/IBubbleBase";
|
|
9
|
+
export * from "./Options/Interfaces/IBubbleDiv";
|
|
10
|
+
export * from "./Options/Interfaces/IBubble";
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tsparticles/interaction-external-bubble",
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
|
+
"description": "tsParticles bubble external interaction",
|
|
5
|
+
"homepage": "https://particles.js.org",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/matteobruni/tsparticles.git",
|
|
9
|
+
"directory": "interactions/external/bubble"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"front-end",
|
|
13
|
+
"frontend",
|
|
14
|
+
"tsparticles",
|
|
15
|
+
"particles.js",
|
|
16
|
+
"particlesjs",
|
|
17
|
+
"particles",
|
|
18
|
+
"particle",
|
|
19
|
+
"canvas",
|
|
20
|
+
"jsparticles",
|
|
21
|
+
"xparticles",
|
|
22
|
+
"particles-js",
|
|
23
|
+
"particles-bg",
|
|
24
|
+
"particles-bg-vue",
|
|
25
|
+
"particles-ts",
|
|
26
|
+
"particles.ts",
|
|
27
|
+
"react-particles-js",
|
|
28
|
+
"react-particles.js",
|
|
29
|
+
"react-particles",
|
|
30
|
+
"react",
|
|
31
|
+
"reactjs",
|
|
32
|
+
"vue-particles",
|
|
33
|
+
"ngx-particles",
|
|
34
|
+
"angular-particles",
|
|
35
|
+
"particleground",
|
|
36
|
+
"vue",
|
|
37
|
+
"vuejs",
|
|
38
|
+
"preact",
|
|
39
|
+
"preactjs",
|
|
40
|
+
"jquery",
|
|
41
|
+
"angularjs",
|
|
42
|
+
"angular",
|
|
43
|
+
"typescript",
|
|
44
|
+
"javascript",
|
|
45
|
+
"animation",
|
|
46
|
+
"web",
|
|
47
|
+
"html5",
|
|
48
|
+
"web-design",
|
|
49
|
+
"webdesign",
|
|
50
|
+
"css",
|
|
51
|
+
"html",
|
|
52
|
+
"css3",
|
|
53
|
+
"animated",
|
|
54
|
+
"background",
|
|
55
|
+
"confetti",
|
|
56
|
+
"canvas",
|
|
57
|
+
"fireworks",
|
|
58
|
+
"fireworks-js",
|
|
59
|
+
"confetti-js",
|
|
60
|
+
"confettijs",
|
|
61
|
+
"fireworksjs",
|
|
62
|
+
"canvas-confetti",
|
|
63
|
+
"@tsparticles/plugin",
|
|
64
|
+
"@tsparticles/interaction"
|
|
65
|
+
],
|
|
66
|
+
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
|
67
|
+
"license": "MIT",
|
|
68
|
+
"bugs": {
|
|
69
|
+
"url": "https://github.com/matteobruni/tsparticles/issues"
|
|
70
|
+
},
|
|
71
|
+
"main": "cjs/index.js",
|
|
72
|
+
"jsdelivr": "tsparticles.interaction.external.bubble.min.js",
|
|
73
|
+
"unpkg": "tsparticles.interaction.external.bubble.min.js",
|
|
74
|
+
"module": "esm/index.js",
|
|
75
|
+
"types": "types/index.d.ts",
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@tsparticles/engine": "^3.0.0-alpha.0"
|
|
81
|
+
}
|
|
82
|
+
}
|