@tsparticles/interaction-external-trail 4.0.0-beta.11 → 4.0.0-beta.15
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/browser.js +5 -0
- package/browser/index.js +6 -6
- package/browser/index.lazy.js +12 -0
- package/cjs/browser.js +5 -0
- package/cjs/index.js +6 -6
- package/cjs/index.lazy.js +12 -0
- package/esm/browser.js +5 -0
- package/esm/index.js +6 -6
- package/esm/index.lazy.js +12 -0
- package/package.json +10 -3
- package/report.html +4949 -94
- package/tsparticles.interaction.external.trail.js +222 -397
- package/tsparticles.interaction.external.trail.min.js +1 -2
- package/types/browser.d.ts +1 -0
- package/types/index.lazy.d.ts +7 -0
- package/704.min.js +0 -1
- package/dist_browser_TrailMaker_js.js +0 -30
|
@@ -1,397 +1,222 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
224
|
-
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
225
|
-
/******/ var script, needAttach;
|
|
226
|
-
/******/ if(key !== undefined) {
|
|
227
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
228
|
-
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
229
|
-
/******/ var s = scripts[i];
|
|
230
|
-
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
231
|
-
/******/ }
|
|
232
|
-
/******/ }
|
|
233
|
-
/******/ if(!script) {
|
|
234
|
-
/******/ needAttach = true;
|
|
235
|
-
/******/ script = document.createElement('script');
|
|
236
|
-
/******/
|
|
237
|
-
/******/ script.charset = 'utf-8';
|
|
238
|
-
/******/ if (__webpack_require__.nc) {
|
|
239
|
-
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
240
|
-
/******/ }
|
|
241
|
-
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
242
|
-
/******/
|
|
243
|
-
/******/ script.src = url;
|
|
244
|
-
/******/ }
|
|
245
|
-
/******/ inProgress[url] = [done];
|
|
246
|
-
/******/ var onScriptComplete = (prev, event) => {
|
|
247
|
-
/******/ // avoid mem leaks in IE.
|
|
248
|
-
/******/ script.onerror = script.onload = null;
|
|
249
|
-
/******/ clearTimeout(timeout);
|
|
250
|
-
/******/ var doneFns = inProgress[url];
|
|
251
|
-
/******/ delete inProgress[url];
|
|
252
|
-
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
253
|
-
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
254
|
-
/******/ if(prev) return prev(event);
|
|
255
|
-
/******/ }
|
|
256
|
-
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
257
|
-
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
258
|
-
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
259
|
-
/******/ needAttach && document.head.appendChild(script);
|
|
260
|
-
/******/ };
|
|
261
|
-
/******/ })();
|
|
262
|
-
/******/
|
|
263
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
264
|
-
/******/ (() => {
|
|
265
|
-
/******/ // define __esModule on exports
|
|
266
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
267
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
268
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
269
|
-
/******/ }
|
|
270
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
271
|
-
/******/ };
|
|
272
|
-
/******/ })();
|
|
273
|
-
/******/
|
|
274
|
-
/******/ /* webpack/runtime/publicPath */
|
|
275
|
-
/******/ (() => {
|
|
276
|
-
/******/ var scriptUrl;
|
|
277
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
278
|
-
/******/ var document = __webpack_require__.g.document;
|
|
279
|
-
/******/ if (!scriptUrl && document) {
|
|
280
|
-
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
281
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
282
|
-
/******/ if (!scriptUrl) {
|
|
283
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
284
|
-
/******/ if(scripts.length) {
|
|
285
|
-
/******/ var i = scripts.length - 1;
|
|
286
|
-
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
287
|
-
/******/ }
|
|
288
|
-
/******/ }
|
|
289
|
-
/******/ }
|
|
290
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
291
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
292
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
293
|
-
/******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
294
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
295
|
-
/******/ })();
|
|
296
|
-
/******/
|
|
297
|
-
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
298
|
-
/******/ (() => {
|
|
299
|
-
/******/ // no baseURI
|
|
300
|
-
/******/
|
|
301
|
-
/******/ // object to store loaded and loading chunks
|
|
302
|
-
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
303
|
-
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
304
|
-
/******/ var installedChunks = {
|
|
305
|
-
/******/ "tsparticles.interaction.external.trail": 0
|
|
306
|
-
/******/ };
|
|
307
|
-
/******/
|
|
308
|
-
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
309
|
-
/******/ // JSONP chunk loading for javascript
|
|
310
|
-
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
311
|
-
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
312
|
-
/******/
|
|
313
|
-
/******/ // a Promise means "currently loading".
|
|
314
|
-
/******/ if(installedChunkData) {
|
|
315
|
-
/******/ promises.push(installedChunkData[2]);
|
|
316
|
-
/******/ } else {
|
|
317
|
-
/******/ if(true) { // all chunks have JS
|
|
318
|
-
/******/ // setup Promise in chunk cache
|
|
319
|
-
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
320
|
-
/******/ promises.push(installedChunkData[2] = promise);
|
|
321
|
-
/******/
|
|
322
|
-
/******/ // start chunk loading
|
|
323
|
-
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
324
|
-
/******/ // create error before stack unwound to get useful stacktrace later
|
|
325
|
-
/******/ var error = new Error();
|
|
326
|
-
/******/ var loadingEnded = (event) => {
|
|
327
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
328
|
-
/******/ installedChunkData = installedChunks[chunkId];
|
|
329
|
-
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
330
|
-
/******/ if(installedChunkData) {
|
|
331
|
-
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
332
|
-
/******/ var realSrc = event && event.target && event.target.src;
|
|
333
|
-
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
334
|
-
/******/ error.name = 'ChunkLoadError';
|
|
335
|
-
/******/ error.type = errorType;
|
|
336
|
-
/******/ error.request = realSrc;
|
|
337
|
-
/******/ installedChunkData[1](error);
|
|
338
|
-
/******/ }
|
|
339
|
-
/******/ }
|
|
340
|
-
/******/ };
|
|
341
|
-
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
342
|
-
/******/ }
|
|
343
|
-
/******/ }
|
|
344
|
-
/******/ }
|
|
345
|
-
/******/ };
|
|
346
|
-
/******/
|
|
347
|
-
/******/ // no prefetching
|
|
348
|
-
/******/
|
|
349
|
-
/******/ // no preloaded
|
|
350
|
-
/******/
|
|
351
|
-
/******/ // no HMR
|
|
352
|
-
/******/
|
|
353
|
-
/******/ // no HMR manifest
|
|
354
|
-
/******/
|
|
355
|
-
/******/ // no on chunks loaded
|
|
356
|
-
/******/
|
|
357
|
-
/******/ // install a JSONP callback for chunk loading
|
|
358
|
-
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
359
|
-
/******/ var [chunkIds, moreModules, runtime] = data;
|
|
360
|
-
/******/ // add "moreModules" to the modules object,
|
|
361
|
-
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
362
|
-
/******/ var moduleId, chunkId, i = 0;
|
|
363
|
-
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
364
|
-
/******/ for(moduleId in moreModules) {
|
|
365
|
-
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
366
|
-
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
367
|
-
/******/ }
|
|
368
|
-
/******/ }
|
|
369
|
-
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
370
|
-
/******/ }
|
|
371
|
-
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
372
|
-
/******/ for(;i < chunkIds.length; i++) {
|
|
373
|
-
/******/ chunkId = chunkIds[i];
|
|
374
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
375
|
-
/******/ installedChunks[chunkId][0]();
|
|
376
|
-
/******/ }
|
|
377
|
-
/******/ installedChunks[chunkId] = 0;
|
|
378
|
-
/******/ }
|
|
379
|
-
/******/
|
|
380
|
-
/******/ }
|
|
381
|
-
/******/
|
|
382
|
-
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_interaction_external_trail"] = this["webpackChunk_tsparticles_interaction_external_trail"] || [];
|
|
383
|
-
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
384
|
-
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
385
|
-
/******/ })();
|
|
386
|
-
/******/
|
|
387
|
-
/************************************************************************/
|
|
388
|
-
/******/
|
|
389
|
-
/******/ // startup
|
|
390
|
-
/******/ // Load entry module and return exports
|
|
391
|
-
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
392
|
-
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
393
|
-
/******/
|
|
394
|
-
/******/ return __webpack_exports__;
|
|
395
|
-
/******/ })()
|
|
396
|
-
;
|
|
397
|
-
});
|
|
1
|
+
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
+
/* External Interaction v4.0.0-beta.15 */
|
|
3
|
+
(function (global, factory) {
|
|
4
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/plugin-interactivity'), require('@tsparticles/engine')) :
|
|
5
|
+
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/plugin-interactivity', '@tsparticles/engine'], factory) :
|
|
6
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.interactions = global.__tsParticlesInternals.interactions || {}, global.__tsParticlesInternals.interactions.externalTrail = global.__tsParticlesInternals.interactions.externalTrail || {}), global.__tsParticlesInternals.plugins.interactivity, global.__tsParticlesInternals.engine));
|
|
7
|
+
})(this, (function (exports, pluginInteractivity, engine) { 'use strict';
|
|
8
|
+
|
|
9
|
+
class TrailColorWeight {
|
|
10
|
+
x;
|
|
11
|
+
y;
|
|
12
|
+
constructor() {
|
|
13
|
+
this.x = 0;
|
|
14
|
+
this.y = 0;
|
|
15
|
+
}
|
|
16
|
+
load(data) {
|
|
17
|
+
if (!data) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (data.x !== undefined) {
|
|
21
|
+
this.x = data.x;
|
|
22
|
+
}
|
|
23
|
+
if (data.y !== undefined) {
|
|
24
|
+
this.y = data.y;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class TrailColorComponent {
|
|
30
|
+
value;
|
|
31
|
+
weights;
|
|
32
|
+
constructor() {
|
|
33
|
+
this.weights = new TrailColorWeight();
|
|
34
|
+
}
|
|
35
|
+
load(data) {
|
|
36
|
+
if (!data) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (data.weights) {
|
|
40
|
+
this.weights ??= new TrailColorWeight();
|
|
41
|
+
this.weights.load(data.weights);
|
|
42
|
+
}
|
|
43
|
+
if (!engine.isNull(data.value)) {
|
|
44
|
+
this.value = engine.setRangeValue(data.value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class TrailColorCoords {
|
|
50
|
+
h;
|
|
51
|
+
l;
|
|
52
|
+
s;
|
|
53
|
+
constructor() {
|
|
54
|
+
this.h = new TrailColorComponent();
|
|
55
|
+
this.s = new TrailColorComponent();
|
|
56
|
+
this.l = new TrailColorComponent();
|
|
57
|
+
}
|
|
58
|
+
load(data) {
|
|
59
|
+
if (!data) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (data.h) {
|
|
63
|
+
this.h ??= new TrailColorComponent();
|
|
64
|
+
this.h.load(data.h);
|
|
65
|
+
}
|
|
66
|
+
if (data.s) {
|
|
67
|
+
this.s ??= new TrailColorComponent();
|
|
68
|
+
this.s.load(data.s);
|
|
69
|
+
}
|
|
70
|
+
if (data.l) {
|
|
71
|
+
this.l ??= new TrailColorComponent();
|
|
72
|
+
this.l.load(data.l);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
class Trail {
|
|
78
|
+
colorCoords;
|
|
79
|
+
delay;
|
|
80
|
+
particles;
|
|
81
|
+
pauseOnStop;
|
|
82
|
+
quantity;
|
|
83
|
+
constructor() {
|
|
84
|
+
this.delay = 1;
|
|
85
|
+
this.pauseOnStop = false;
|
|
86
|
+
this.quantity = 1;
|
|
87
|
+
this.colorCoords = new TrailColorCoords();
|
|
88
|
+
}
|
|
89
|
+
load(data) {
|
|
90
|
+
if (engine.isNull(data))
|
|
91
|
+
return;
|
|
92
|
+
if (data.delay !== undefined) {
|
|
93
|
+
this.delay = data.delay;
|
|
94
|
+
}
|
|
95
|
+
if (data.quantity !== undefined) {
|
|
96
|
+
this.quantity = data.quantity;
|
|
97
|
+
}
|
|
98
|
+
if (data.pauseOnStop !== undefined) {
|
|
99
|
+
this.pauseOnStop = data.pauseOnStop;
|
|
100
|
+
}
|
|
101
|
+
if (data.particles !== undefined) {
|
|
102
|
+
this.particles = engine.deepExtend({}, data.particles);
|
|
103
|
+
}
|
|
104
|
+
if (data.colorCoords) {
|
|
105
|
+
this.colorCoords ??= new TrailColorCoords();
|
|
106
|
+
this.colorCoords.load(data.colorCoords);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const trailMode = "trail", defaultMin = 0, defaultWeight = 0;
|
|
112
|
+
class TrailMaker extends pluginInteractivity.ExternalInteractorBase {
|
|
113
|
+
maxDistance = 0;
|
|
114
|
+
_delay;
|
|
115
|
+
_lastPosition;
|
|
116
|
+
_pluginManager;
|
|
117
|
+
constructor(pluginManager, container) {
|
|
118
|
+
super(container);
|
|
119
|
+
this._pluginManager = pluginManager;
|
|
120
|
+
this._delay = 0;
|
|
121
|
+
}
|
|
122
|
+
clear() {
|
|
123
|
+
}
|
|
124
|
+
init() {
|
|
125
|
+
}
|
|
126
|
+
interact(interactivityData, delta) {
|
|
127
|
+
const container = this.container;
|
|
128
|
+
if (!container.retina.reduceFactor)
|
|
129
|
+
return;
|
|
130
|
+
const options = container.actualOptions, trailOptions = options.interactivity?.modes.trail;
|
|
131
|
+
if (!trailOptions)
|
|
132
|
+
return;
|
|
133
|
+
const optDelay = (trailOptions.delay * engine.millisecondsToSeconds) / this.container.retina.reduceFactor;
|
|
134
|
+
if (this._delay < optDelay) {
|
|
135
|
+
this._delay += delta.value;
|
|
136
|
+
}
|
|
137
|
+
if (this._delay < optDelay)
|
|
138
|
+
return;
|
|
139
|
+
const mousePos = interactivityData.mouse.position, canEmit = !(trailOptions.pauseOnStop &&
|
|
140
|
+
(mousePos === this._lastPosition ||
|
|
141
|
+
(mousePos?.x === this._lastPosition?.x && mousePos?.y === this._lastPosition?.y)));
|
|
142
|
+
if (mousePos) {
|
|
143
|
+
this._lastPosition = { ...mousePos };
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
delete this._lastPosition;
|
|
147
|
+
}
|
|
148
|
+
if (canEmit && mousePos) {
|
|
149
|
+
let particleOptions = trailOptions.particles;
|
|
150
|
+
const colorCoords = trailOptions.colorCoords;
|
|
151
|
+
if (colorCoords) {
|
|
152
|
+
const { width, height } = container.canvas.size, norm = {
|
|
153
|
+
x: mousePos.x / width,
|
|
154
|
+
y: mousePos.y / height,
|
|
155
|
+
}, hasWeights = (comp) => {
|
|
156
|
+
return !!(comp?.weights?.x ?? comp?.weights?.y);
|
|
157
|
+
}, calculateValue = (comp, originalValue, defaultMax) => {
|
|
158
|
+
if (!hasWeights(comp))
|
|
159
|
+
return undefined;
|
|
160
|
+
const w = comp?.weights, factor = norm.x * (w?.x ?? defaultWeight) + norm.y * (w?.y ?? defaultWeight), rangeSource = comp?.value ?? originalValue, min = engine.getRangeMin(rangeSource ?? defaultMin), max = engine.getRangeMax(rangeSource ?? defaultMax), result = min + factor * (max - min);
|
|
161
|
+
return Math.min(max, Math.max(min, result));
|
|
162
|
+
}, trailPaintOptions = trailOptions.particles?.paint
|
|
163
|
+
? engine.itemFromSingleOrMultiple(trailOptions.particles.paint)
|
|
164
|
+
: undefined, fillData = trailPaintOptions?.fill, baseHsl = fillData
|
|
165
|
+
? engine.rangeColorToHsl(this._pluginManager, engine.AnimatableColor.create(undefined, fillData.color))
|
|
166
|
+
: undefined, h = calculateValue(colorCoords.h, baseHsl?.h, engine.hMax), s = calculateValue(colorCoords.s, baseHsl?.s, engine.sMax), l = calculateValue(colorCoords.l, baseHsl?.l, engine.lMax);
|
|
167
|
+
if (h !== undefined || s !== undefined || l !== undefined) {
|
|
168
|
+
particleOptions = engine.deepExtend({}, trailOptions.particles, {
|
|
169
|
+
paint: {
|
|
170
|
+
fill: {
|
|
171
|
+
color: {
|
|
172
|
+
value: {
|
|
173
|
+
h: h ?? baseHsl?.h,
|
|
174
|
+
s: s ?? baseHsl?.s,
|
|
175
|
+
l: l ?? baseHsl?.l,
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
container.particles.push(trailOptions.quantity, mousePos, particleOptions);
|
|
184
|
+
}
|
|
185
|
+
this._delay -= optDelay;
|
|
186
|
+
}
|
|
187
|
+
isEnabled(interactivityData, particle) {
|
|
188
|
+
const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity)?.events;
|
|
189
|
+
return (!!events &&
|
|
190
|
+
((mouse.clicking && mouse.inside && !!mouse.position && engine.isInArray(trailMode, events.onClick.mode)) ||
|
|
191
|
+
(mouse.inside && !!mouse.position && engine.isInArray(trailMode, events.onHover.mode))));
|
|
192
|
+
}
|
|
193
|
+
loadModeOptions(options, ...sources) {
|
|
194
|
+
options.trail ??= new Trail();
|
|
195
|
+
for (const source of sources) {
|
|
196
|
+
options.trail.load(source?.trail);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
reset() {
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
async function loadExternalTrailInteraction(engine) {
|
|
204
|
+
engine.checkVersion("4.0.0-beta.15");
|
|
205
|
+
await engine.pluginManager.register((e) => {
|
|
206
|
+
pluginInteractivity.ensureInteractivityPluginLoaded(e);
|
|
207
|
+
e.pluginManager.addInteractor?.("externalTrail", container => {
|
|
208
|
+
return Promise.resolve(new TrailMaker(e.pluginManager, container));
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const globalObject = globalThis;
|
|
214
|
+
globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
|
|
215
|
+
globalObject.loadExternalTrailInteraction = loadExternalTrailInteraction;
|
|
216
|
+
|
|
217
|
+
exports.Trail = Trail;
|
|
218
|
+
exports.loadExternalTrailInteraction = loadExternalTrailInteraction;
|
|
219
|
+
|
|
220
|
+
}));
|
|
221
|
+
Object.assign(globalThis.window || globalThis, { loadExternalTrailInteraction: (globalThis.__tsParticlesInternals.interactions.externalTrail || {}).loadExternalTrailInteraction });
|
|
222
|
+
delete (globalThis.window || globalThis).tsparticlesInternalExports;
|