@tsparticles/interaction-external-trail 4.0.0-alpha.8 → 4.0.0-beta.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.
Files changed (56) hide show
  1. package/983.min.js +1 -0
  2. package/README.md +5 -0
  3. package/browser/Options/Classes/Trail.js +14 -4
  4. package/browser/Options/Classes/TrailColorComponent.js +21 -0
  5. package/browser/Options/Classes/TrailColorCoords.js +28 -0
  6. package/browser/Options/Classes/TrailColorWeight.js +19 -0
  7. package/browser/Options/Interfaces/ITrailColorComponent.js +1 -0
  8. package/browser/Options/Interfaces/ITrailColorCoords.js +1 -0
  9. package/browser/Options/Interfaces/ITrailColorWeight.js +1 -0
  10. package/browser/TrailMaker.js +44 -15
  11. package/browser/index.js +4 -4
  12. package/cjs/Options/Classes/Trail.js +14 -4
  13. package/cjs/Options/Classes/TrailColorComponent.js +21 -0
  14. package/cjs/Options/Classes/TrailColorCoords.js +28 -0
  15. package/cjs/Options/Classes/TrailColorWeight.js +19 -0
  16. package/cjs/Options/Interfaces/ITrailColorComponent.js +1 -0
  17. package/cjs/Options/Interfaces/ITrailColorCoords.js +1 -0
  18. package/cjs/Options/Interfaces/ITrailColorWeight.js +1 -0
  19. package/cjs/TrailMaker.js +44 -15
  20. package/cjs/index.js +4 -4
  21. package/dist_browser_TrailMaker_js.js +2 -2
  22. package/esm/Options/Classes/Trail.js +14 -4
  23. package/esm/Options/Classes/TrailColorComponent.js +21 -0
  24. package/esm/Options/Classes/TrailColorCoords.js +28 -0
  25. package/esm/Options/Classes/TrailColorWeight.js +19 -0
  26. package/esm/Options/Interfaces/ITrailColorComponent.js +1 -0
  27. package/esm/Options/Interfaces/ITrailColorCoords.js +1 -0
  28. package/esm/Options/Interfaces/ITrailColorWeight.js +1 -0
  29. package/esm/TrailMaker.js +44 -15
  30. package/esm/index.js +4 -4
  31. package/package.json +3 -3
  32. package/report.html +1 -1
  33. package/tsparticles.interaction.external.trail.js +69 -27
  34. package/tsparticles.interaction.external.trail.min.js +2 -2
  35. package/types/Options/Classes/Trail.d.ts +2 -0
  36. package/types/Options/Classes/TrailColorComponent.d.ts +9 -0
  37. package/types/Options/Classes/TrailColorCoords.d.ts +10 -0
  38. package/types/Options/Classes/TrailColorWeight.d.ts +8 -0
  39. package/types/Options/Interfaces/ITrail.d.ts +2 -0
  40. package/types/Options/Interfaces/ITrailColorComponent.d.ts +6 -0
  41. package/types/Options/Interfaces/ITrailColorCoords.d.ts +6 -0
  42. package/types/Options/Interfaces/ITrailColorWeight.d.ts +4 -0
  43. package/types/TrailMaker.d.ts +4 -2
  44. package/types/index.d.ts +3 -0
  45. package/umd/Options/Classes/Trail.js +15 -5
  46. package/umd/Options/Classes/TrailColorComponent.js +35 -0
  47. package/umd/Options/Classes/TrailColorCoords.js +42 -0
  48. package/umd/Options/Classes/TrailColorWeight.js +33 -0
  49. package/umd/Options/Interfaces/ITrailColorComponent.js +12 -0
  50. package/umd/Options/Interfaces/ITrailColorCoords.js +12 -0
  51. package/umd/Options/Interfaces/ITrailColorWeight.js +12 -0
  52. package/umd/TrailMaker.js +45 -16
  53. package/umd/index.js +4 -4
  54. package/323.min.js +0 -2
  55. package/323.min.js.LICENSE.txt +0 -1
  56. package/tsparticles.interaction.external.trail.min.js.LICENSE.txt +0 -1
package/esm/TrailMaker.js CHANGED
@@ -1,10 +1,15 @@
1
+ import { AnimatableColor, deepExtend, getRangeMax, getRangeMin, hMax, isInArray, itemFromSingleOrMultiple, lMax, millisecondsToSeconds, rangeColorToHsl, sMax, } from "@tsparticles/engine";
1
2
  import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
2
- import { isInArray, millisecondsToSeconds, } from "@tsparticles/engine";
3
3
  import { Trail } from "./Options/Classes/Trail.js";
4
- const trailMode = "trail";
4
+ const trailMode = "trail", defaultMin = 0, defaultWeight = 0;
5
5
  export class TrailMaker extends ExternalInteractorBase {
6
- constructor(container) {
6
+ maxDistance = 0;
7
+ _delay;
8
+ _engine;
9
+ _lastPosition;
10
+ constructor(engine, container) {
7
11
  super(container);
12
+ this._engine = engine;
8
13
  this._delay = 0;
9
14
  }
10
15
  clear() {
@@ -13,32 +18,56 @@ export class TrailMaker extends ExternalInteractorBase {
13
18
  }
14
19
  interact(interactivityData, delta) {
15
20
  const container = this.container;
16
- if (!container.retina.reduceFactor) {
21
+ if (!container.retina.reduceFactor)
17
22
  return;
18
- }
19
23
  const options = container.actualOptions, trailOptions = options.interactivity?.modes.trail;
20
- if (!trailOptions) {
24
+ if (!trailOptions)
21
25
  return;
22
- }
23
26
  const optDelay = (trailOptions.delay * millisecondsToSeconds) / this.container.retina.reduceFactor;
24
27
  if (this._delay < optDelay) {
25
28
  this._delay += delta.value;
26
29
  }
27
- if (this._delay < optDelay) {
30
+ if (this._delay < optDelay)
28
31
  return;
29
- }
30
- const canEmit = !(trailOptions.pauseOnStop &&
31
- (interactivityData.mouse.position === this._lastPosition ||
32
- (interactivityData.mouse.position?.x === this._lastPosition?.x &&
33
- interactivityData.mouse.position?.y === this._lastPosition?.y))), mousePos = interactivityData.mouse.position;
32
+ const mousePos = interactivityData.mouse.position, canEmit = !(trailOptions.pauseOnStop &&
33
+ (mousePos === this._lastPosition ||
34
+ (mousePos?.x === this._lastPosition?.x && mousePos?.y === this._lastPosition?.y)));
34
35
  if (mousePos) {
35
36
  this._lastPosition = { ...mousePos };
36
37
  }
37
38
  else {
38
39
  delete this._lastPosition;
39
40
  }
40
- if (canEmit) {
41
- container.particles.push(trailOptions.quantity, interactivityData.mouse.position, trailOptions.particles);
41
+ if (canEmit && mousePos) {
42
+ let particleOptions = trailOptions.particles;
43
+ const colorCoords = trailOptions.colorCoords;
44
+ if (colorCoords) {
45
+ const { width, height } = container.canvas.size, norm = {
46
+ x: mousePos.x / width,
47
+ y: mousePos.y / height,
48
+ }, hasWeights = (comp) => {
49
+ return !!(comp?.weights?.x ?? comp?.weights?.y);
50
+ }, calculateValue = (comp, originalValue, defaultMax) => {
51
+ if (!hasWeights(comp))
52
+ return undefined;
53
+ const w = comp?.weights, factor = norm.x * (w?.x ?? defaultWeight) + norm.y * (w?.y ?? defaultWeight), rangeSource = comp?.value ?? originalValue, min = getRangeMin(rangeSource ?? defaultMin), max = getRangeMax(rangeSource ?? defaultMax), result = min + factor * (max - min);
54
+ return Math.min(max, Math.max(min, result));
55
+ }, fillData = trailOptions.particles?.fill ? itemFromSingleOrMultiple(trailOptions.particles.fill) : undefined, baseHsl = fillData
56
+ ? rangeColorToHsl(this._engine, AnimatableColor.create(undefined, fillData.color))
57
+ : undefined, h = calculateValue(colorCoords.h, baseHsl?.h, hMax), s = calculateValue(colorCoords.s, baseHsl?.s, sMax), l = calculateValue(colorCoords.l, baseHsl?.l, lMax);
58
+ if (h !== undefined || s !== undefined || l !== undefined) {
59
+ particleOptions = deepExtend({}, trailOptions.particles, {
60
+ color: {
61
+ value: {
62
+ h: h ?? baseHsl?.h,
63
+ s: s ?? baseHsl?.s,
64
+ l: l ?? baseHsl?.l,
65
+ },
66
+ },
67
+ });
68
+ }
69
+ }
70
+ container.particles.push(trailOptions.quantity, mousePos, particleOptions);
42
71
  }
43
72
  this._delay -= optDelay;
44
73
  }
package/esm/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  export async function loadExternalTrailInteraction(engine) {
2
- engine.checkVersion("4.0.0-alpha.8");
2
+ engine.checkVersion("4.0.0-beta.0");
3
3
  await engine.register(async (e) => {
4
- const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
5
- await loadInteractivityPlugin(e);
4
+ const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
5
+ ensureInteractivityPluginLoaded(e);
6
6
  e.addInteractor?.("externalTrail", async (container) => {
7
7
  const { TrailMaker } = await import("./TrailMaker.js");
8
- return new TrailMaker(container);
8
+ return new TrailMaker(e, container);
9
9
  });
10
10
  });
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-external-trail",
3
- "version": "4.0.0-alpha.8",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "tsParticles trail external interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -87,8 +87,8 @@
87
87
  "./package.json": "./package.json"
88
88
  },
89
89
  "dependencies": {
90
- "@tsparticles/engine": "4.0.0-alpha.8",
91
- "@tsparticles/plugin-interactivity": "4.0.0-alpha.8"
90
+ "@tsparticles/engine": "4.0.0-beta.0",
91
+ "@tsparticles/plugin-interactivity": "4.0.0-beta.0"
92
92
  },
93
93
  "publishConfig": {
94
94
  "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-trail [23 Jan 2026 at 23:54]</title>
6
+ <title>@tsparticles/interaction-external-trail [19 Mar 2026 at 14:00]</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
- * v4.0.0-alpha.8
7
+ * v4.0.0-beta.0
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,43 +28,73 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
+ /***/ "@tsparticles/engine"
32
+ /*!*********************************************************************************************************************************!*\
33
+ !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
34
+ \*********************************************************************************************************************************/
35
+ (module) {
36
+
37
+ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
38
+
39
+ /***/ },
40
+
41
+ /***/ "@tsparticles/plugin-interactivity"
42
+ /*!***************************************************************************************************************************************************************************!*\
43
+ !*** external {"commonjs":"@tsparticles/plugin-interactivity","commonjs2":"@tsparticles/plugin-interactivity","amd":"@tsparticles/plugin-interactivity","root":"window"} ***!
44
+ \***************************************************************************************************************************************************************************/
45
+ (module) {
46
+
47
+ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
48
+
49
+ /***/ },
50
+
31
51
  /***/ "./dist/browser/Options/Classes/Trail.js"
32
52
  /*!***********************************************!*\
33
53
  !*** ./dist/browser/Options/Classes/Trail.js ***!
34
54
  \***********************************************/
35
55
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
36
56
 
37
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Trail: () => (/* binding */ Trail)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass Trail {\n constructor() {\n this.delay = 1;\n this.pauseOnStop = false;\n this.quantity = 1;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.delay !== undefined) {\n this.delay = data.delay;\n }\n if (data.quantity !== undefined) {\n this.quantity = data.quantity;\n }\n if (data.particles !== undefined) {\n this.particles = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, data.particles);\n }\n if (data.pauseOnStop !== undefined) {\n this.pauseOnStop = data.pauseOnStop;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-trail/./dist/browser/Options/Classes/Trail.js?\n}");
57
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Trail: () => (/* binding */ Trail)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _TrailColorCoords_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TrailColorCoords.js */ \"./dist/browser/Options/Classes/TrailColorCoords.js\");\n\n\nclass Trail {\n colorCoords;\n delay;\n particles;\n pauseOnStop;\n quantity;\n constructor(){\n this.delay = 1;\n this.pauseOnStop = false;\n this.quantity = 1;\n this.colorCoords = new _TrailColorCoords_js__WEBPACK_IMPORTED_MODULE_1__.TrailColorCoords();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) return;\n if (data.delay !== undefined) {\n this.delay = data.delay;\n }\n if (data.quantity !== undefined) {\n this.quantity = data.quantity;\n }\n if (data.pauseOnStop !== undefined) {\n this.pauseOnStop = data.pauseOnStop;\n }\n if (data.particles !== undefined) {\n this.particles = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, data.particles);\n }\n if (data.colorCoords) {\n this.colorCoords ??= new _TrailColorCoords_js__WEBPACK_IMPORTED_MODULE_1__.TrailColorCoords();\n this.colorCoords.load(data.colorCoords);\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-trail/./dist/browser/Options/Classes/Trail.js?\n}");
38
58
 
39
59
  /***/ },
40
60
 
41
- /***/ "./dist/browser/index.js"
42
- /*!*******************************!*\
43
- !*** ./dist/browser/index.js ***!
44
- \*******************************/
61
+ /***/ "./dist/browser/Options/Classes/TrailColorComponent.js"
62
+ /*!*************************************************************!*\
63
+ !*** ./dist/browser/Options/Classes/TrailColorComponent.js ***!
64
+ \*************************************************************/
45
65
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
46
66
 
47
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Trail: () => (/* reexport safe */ _Options_Classes_Trail_js__WEBPACK_IMPORTED_MODULE_0__.Trail),\n/* harmony export */ loadExternalTrailInteraction: () => (/* binding */ loadExternalTrailInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Trail_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Trail.js */ \"./dist/browser/Options/Classes/Trail.js\");\nasync function loadExternalTrailInteraction(engine) {\n engine.checkVersion(\"4.0.0-alpha.8\");\n await engine.register(async e => {\n const {\n loadInteractivityPlugin\n } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\", 19));\n await loadInteractivityPlugin(e);\n e.addInteractor?.(\"externalTrail\", async container => {\n const {\n TrailMaker\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_TrailMaker_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./TrailMaker.js */ \"./dist/browser/TrailMaker.js\"));\n return new TrailMaker(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-trail/./dist/browser/index.js?\n}");
67
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TrailColorComponent: () => (/* binding */ TrailColorComponent)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _TrailColorWeight_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TrailColorWeight.js */ \"./dist/browser/Options/Classes/TrailColorWeight.js\");\n\n\nclass TrailColorComponent {\n value;\n weights;\n constructor(){\n this.weights = new _TrailColorWeight_js__WEBPACK_IMPORTED_MODULE_1__.TrailColorWeight();\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.weights) {\n this.weights ??= new _TrailColorWeight_js__WEBPACK_IMPORTED_MODULE_1__.TrailColorWeight();\n this.weights.load(data.weights);\n }\n if (!(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data.value)) {\n this.value = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.value);\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-trail/./dist/browser/Options/Classes/TrailColorComponent.js?\n}");
48
68
 
49
69
  /***/ },
50
70
 
51
- /***/ "@tsparticles/engine"
52
- /*!*********************************************************************************************************************************!*\
53
- !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
54
- \*********************************************************************************************************************************/
55
- (module) {
71
+ /***/ "./dist/browser/Options/Classes/TrailColorCoords.js"
72
+ /*!**********************************************************!*\
73
+ !*** ./dist/browser/Options/Classes/TrailColorCoords.js ***!
74
+ \**********************************************************/
75
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
56
76
 
57
- module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
77
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TrailColorCoords: () => (/* binding */ TrailColorCoords)\n/* harmony export */ });\n/* harmony import */ var _TrailColorComponent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TrailColorComponent.js */ \"./dist/browser/Options/Classes/TrailColorComponent.js\");\n\nclass TrailColorCoords {\n h;\n l;\n s;\n constructor(){\n this.h = new _TrailColorComponent_js__WEBPACK_IMPORTED_MODULE_0__.TrailColorComponent();\n this.s = new _TrailColorComponent_js__WEBPACK_IMPORTED_MODULE_0__.TrailColorComponent();\n this.l = new _TrailColorComponent_js__WEBPACK_IMPORTED_MODULE_0__.TrailColorComponent();\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.h) {\n this.h ??= new _TrailColorComponent_js__WEBPACK_IMPORTED_MODULE_0__.TrailColorComponent();\n this.h.load(data.h);\n }\n if (data.s) {\n this.s ??= new _TrailColorComponent_js__WEBPACK_IMPORTED_MODULE_0__.TrailColorComponent();\n this.s.load(data.s);\n }\n if (data.l) {\n this.l ??= new _TrailColorComponent_js__WEBPACK_IMPORTED_MODULE_0__.TrailColorComponent();\n this.l.load(data.l);\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-trail/./dist/browser/Options/Classes/TrailColorCoords.js?\n}");
58
78
 
59
79
  /***/ },
60
80
 
61
- /***/ "@tsparticles/plugin-interactivity"
62
- /*!***************************************************************************************************************************************************************************!*\
63
- !*** external {"commonjs":"@tsparticles/plugin-interactivity","commonjs2":"@tsparticles/plugin-interactivity","amd":"@tsparticles/plugin-interactivity","root":"window"} ***!
64
- \***************************************************************************************************************************************************************************/
65
- (module) {
81
+ /***/ "./dist/browser/Options/Classes/TrailColorWeight.js"
82
+ /*!**********************************************************!*\
83
+ !*** ./dist/browser/Options/Classes/TrailColorWeight.js ***!
84
+ \**********************************************************/
85
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
66
86
 
67
- module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
87
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TrailColorWeight: () => (/* binding */ TrailColorWeight)\n/* harmony export */ });\nclass TrailColorWeight {\n x;\n y;\n constructor(){\n this.x = 0;\n this.y = 0;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.x !== undefined) {\n this.x = data.x;\n }\n if (data.y !== undefined) {\n this.y = data.y;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-trail/./dist/browser/Options/Classes/TrailColorWeight.js?\n}");
88
+
89
+ /***/ },
90
+
91
+ /***/ "./dist/browser/index.js"
92
+ /*!*******************************!*\
93
+ !*** ./dist/browser/index.js ***!
94
+ \*******************************/
95
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
96
+
97
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Trail: () => (/* reexport safe */ _Options_Classes_Trail_js__WEBPACK_IMPORTED_MODULE_0__.Trail),\n/* harmony export */ loadExternalTrailInteraction: () => (/* binding */ loadExternalTrailInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Trail_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Trail.js */ \"./dist/browser/Options/Classes/Trail.js\");\nasync function loadExternalTrailInteraction(engine) {\n engine.checkVersion(\"4.0.0-beta.0\");\n await engine.register(async (e)=>{\n const { ensureInteractivityPluginLoaded } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\", 19));\n ensureInteractivityPluginLoaded(e);\n e.addInteractor?.(\"externalTrail\", async (container)=>{\n const { TrailMaker } = await __webpack_require__.e(/*! import() */ \"dist_browser_TrailMaker_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./TrailMaker.js */ \"./dist/browser/TrailMaker.js\"));\n return new TrailMaker(e, container);\n });\n });\n}\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-trail/./dist/browser/index.js?\n}");
68
98
 
69
99
  /***/ }
70
100
 
@@ -80,12 +110,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
80
110
  /******/ if (cachedModule !== undefined) {
81
111
  /******/ return cachedModule.exports;
82
112
  /******/ }
83
- /******/ // Check if module exists (development only)
84
- /******/ if (__webpack_modules__[moduleId] === undefined) {
85
- /******/ var e = new Error("Cannot find module '" + moduleId + "'");
86
- /******/ e.code = 'MODULE_NOT_FOUND';
87
- /******/ throw e;
88
- /******/ }
89
113
  /******/ // Create a new module (and put it into the cache)
90
114
  /******/ var module = __webpack_module_cache__[moduleId] = {
91
115
  /******/ // no module.id needed
@@ -94,6 +118,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
94
118
  /******/ };
95
119
  /******/
96
120
  /******/ // Execute the module function
121
+ /******/ if (!(moduleId in __webpack_modules__)) {
122
+ /******/ delete __webpack_module_cache__[moduleId];
123
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
124
+ /******/ e.code = 'MODULE_NOT_FOUND';
125
+ /******/ throw e;
126
+ /******/ }
97
127
  /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
98
128
  /******/
99
129
  /******/ // Return the exports of the module
@@ -168,6 +198,18 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
168
198
  /******/ };
169
199
  /******/ })();
170
200
  /******/
201
+ /******/ /* webpack/runtime/global */
202
+ /******/ (() => {
203
+ /******/ __webpack_require__.g = (function() {
204
+ /******/ if (typeof globalThis === 'object') return globalThis;
205
+ /******/ try {
206
+ /******/ return this || new Function('return this')();
207
+ /******/ } catch (e) {
208
+ /******/ if (typeof window === 'object') return window;
209
+ /******/ }
210
+ /******/ })();
211
+ /******/ })();
212
+ /******/
171
213
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
172
214
  /******/ (() => {
173
215
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
@@ -232,8 +274,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
232
274
  /******/ /* webpack/runtime/publicPath */
233
275
  /******/ (() => {
234
276
  /******/ var scriptUrl;
235
- /******/ if (globalThis.importScripts) scriptUrl = globalThis.location + "";
236
- /******/ var document = globalThis.document;
277
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
278
+ /******/ var document = __webpack_require__.g.document;
237
279
  /******/ if (!scriptUrl && document) {
238
280
  /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
239
281
  /******/ scriptUrl = document.currentScript.src;
@@ -1,2 +1,2 @@
1
- /*! For license information please see tsparticles.interaction.external.trail.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/plugin-interactivity"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity")):t(e.window,e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,((e,t)=>(()=>{var r,i,a,n,o={303(t){t.exports=e},702(e){e.exports=t},913(e,t,r){r.d(t,{X:()=>a});var i=r(303);class a{constructor(){this.delay=1,this.pauseOnStop=!1,this.quantity=1}load(e){(0,i.isNull)(e)||(void 0!==e.delay&&(this.delay=e.delay),void 0!==e.quantity&&(this.quantity=e.quantity),void 0!==e.particles&&(this.particles=(0,i.deepExtend)({},e.particles)),void 0!==e.pauseOnStop&&(this.pauseOnStop=e.pauseOnStop))}}}},s={};function l(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return o[e](r,r.exports,l),r.exports}l.m=o,i=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,l.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var a=Object.create(null);l.r(a);var n={};r=r||[null,i({}),i([]),i(i)];for(var o=2&t&&e;("object"==typeof o||"function"==typeof o)&&!~r.indexOf(o);o=i(o))Object.getOwnPropertyNames(o).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,l.d(a,n),a},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce(((t,r)=>(l.f[r](e,t),t)),[])),l.u=e=>e+".min.js",l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a={},n="@tsparticles/interaction-external-trail:",l.l=(e,t,r,i)=>{if(a[e])a[e].push(t);else{var o,s;if(void 0!==r)for(var c=document.getElementsByTagName("script"),p=0;p<c.length;p++){var u=c[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+r){o=u;break}}o||(s=!0,(o=document.createElement("script")).charset="utf-8",l.nc&&o.setAttribute("nonce",l.nc),o.setAttribute("data-webpack",n+r),o.src=e),a[e]=[t];var d=(t,r)=>{o.onerror=o.onload=null,clearTimeout(f);var i=a[e];if(delete a[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach((e=>e(r))),t)return t(r)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=d.bind(null,o.onerror),o.onload=d.bind(null,o.onload),s&&document.head.appendChild(o)}},l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var t=globalThis.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l.p=e})(),(()=>{var e={54:0};l.f.j=(t,r)=>{var i=l.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var a=new Promise(((r,a)=>i=e[t]=[r,a]));r.push(i[2]=a);var n=l.p+l.u(t),o=new Error;l.l(n,(r=>{if(l.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var a=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;o.message="Loading chunk "+t+" failed.\n("+a+": "+n+")",o.name="ChunkLoadError",o.type=a,o.request=n,i[1](o)}}),"chunk-"+t,t)}};var t=(t,r)=>{var i,a,[n,o,s]=r,c=0;if(n.some((t=>0!==e[t]))){for(i in o)l.o(o,i)&&(l.m[i]=o[i]);if(s)s(l)}for(t&&t(r);c<n.length;c++)a=n[c],l.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=this.webpackChunk_tsparticles_interaction_external_trail=this.webpackChunk_tsparticles_interaction_external_trail||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var c={};l.r(c),l.d(c,{Trail:()=>p.X,loadExternalTrailInteraction:()=>u});var p=l(913);async function u(e){e.checkVersion("4.0.0-alpha.8"),await e.register((async e=>{const{loadInteractivityPlugin:t}=await Promise.resolve().then(l.t.bind(l,702,19));await t(e),e.addInteractor?.("externalTrail",(async e=>{const{TrailMaker:t}=await l.e(323).then(l.bind(l,323));return new t(e)}))}))}return c})()));
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/plugin-interactivity"],e);else{var r="object"==typeof exports?e(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity")):e(t.window,t.window);for(var i in r)("object"==typeof exports?exports:t)[i]=r[i]}}(this,(t,e)=>(()=>{"use strict";var r,i,o,n={303(e){e.exports=t},702(t){t.exports=e},170(t,e,r){r.d(e,{X:()=>s});var i=r(303);class o{x;y;constructor(){this.x=0,this.y=0}load(t){t&&(void 0!==t.x&&(this.x=t.x),void 0!==t.y&&(this.y=t.y))}}class n{value;weights;constructor(){this.weights=new o}load(t){t&&(t.weights&&(this.weights??=new o,this.weights.load(t.weights)),(0,i.isNull)(t.value)||(this.value=(0,i.setRangeValue)(t.value)))}}class a{h;l;s;constructor(){this.h=new n,this.s=new n,this.l=new n}load(t){t&&(t.h&&(this.h??=new n,this.h.load(t.h)),t.s&&(this.s??=new n,this.s.load(t.s)),t.l&&(this.l??=new n,this.l.load(t.l)))}}class s{colorCoords;delay;particles;pauseOnStop;quantity;constructor(){this.delay=1,this.pauseOnStop=!1,this.quantity=1,this.colorCoords=new a}load(t){!(0,i.isNull)(t)&&(void 0!==t.delay&&(this.delay=t.delay),void 0!==t.quantity&&(this.quantity=t.quantity),void 0!==t.pauseOnStop&&(this.pauseOnStop=t.pauseOnStop),void 0!==t.particles&&(this.particles=(0,i.deepExtend)({},t.particles)),t.colorCoords&&(this.colorCoords??=new a,this.colorCoords.load(t.colorCoords)))}}}},a={};function s(t){var e=a[t];if(void 0!==e)return e.exports;var r=a[t]={exports:{}};return n[t](r,r.exports,s),r.exports}s.m=n,c=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,s.t=function(t,e){if(1&e&&(t=this(t)),8&e||"object"==typeof t&&t&&(4&e&&t.__esModule||16&e&&"function"==typeof t.then))return t;var r=Object.create(null);s.r(r);var i={};l=l||[null,c({}),c([]),c(c)];for(var o=2&e&&t;("object"==typeof o||"function"==typeof o)&&!~l.indexOf(o);o=c(o))Object.getOwnPropertyNames(o).forEach(e=>i[e]=()=>t[e]);return i.default=()=>t,s.d(r,i),r},s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.f={},s.e=t=>Promise.all(Object.keys(s.f).reduce((e,r)=>(s.f[r](t,e),e),[])),s.u=t=>""+t+".min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),u={},s.l=(t,e,r,i)=>{if(u[t])return void u[t].push(e);if(void 0!==r)for(var o,n,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var c=a[l];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")=="@tsparticles/interaction-external-trail:"+r){o=c;break}}o||(n=!0,(o=document.createElement("script")).charset="utf-8",s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-webpack","@tsparticles/interaction-external-trail:"+r),o.src=t),u[t]=[e];var p=(e,r)=>{o.onerror=o.onload=null,clearTimeout(d);var i=u[t];if(delete u[t],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(t=>t(r)),e)return e(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=p.bind(null,o.onerror),o.onload=p.bind(null,o.onload),n&&document.head.appendChild(o)},s.r=t=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.g.importScripts&&(p=s.g.location+"");var l,c,u,p,d=s.g.document;if(!p&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(p=d.currentScript.src),!p)){var h=d.getElementsByTagName("script");if(h.length)for(var f=h.length-1;f>-1&&(!p||!/^http(s?):/.test(p));)p=h[f--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");s.p=p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={54:0},s.f.j=(t,e)=>{var i=s.o(r,t)?r[t]:void 0;if(0!==i)if(i)e.push(i[2]);else{var o=new Promise((e,o)=>i=r[t]=[e,o]);e.push(i[2]=o);var n=s.p+s.u(t),a=Error();s.l(n,e=>{if(s.o(r,t)&&(0!==(i=r[t])&&(r[t]=void 0),i)){var o=e&&("load"===e.type?"missing":e.type),n=e&&e.target&&e.target.src;a.message="Loading chunk "+t+` failed.
2
+ (`+o+": "+n+")",a.name="ChunkLoadError",a.type=o,a.request=n,i[1](a)}},"chunk-"+t,t)}},i=(t,e)=>{var i,o,[n,a,l]=e,c=0;if(n.some(t=>0!==r[t])){for(i in a)s.o(a,i)&&(s.m[i]=a[i]);l&&l(s)}for(t&&t(e);c<n.length;c++)o=n[c],s.o(r,o)&&r[o]&&r[o][0](),r[o]=0},(o=this.webpackChunk_tsparticles_interaction_external_trail=this.webpackChunk_tsparticles_interaction_external_trail||[]).forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var y={};s.r(y),s.d(y,{Trail:()=>v.X,loadExternalTrailInteraction:()=>b});var v=s(170);async function b(t){t.checkVersion("4.0.0-beta.0"),await t.register(async t=>{let{ensureInteractivityPluginLoaded:e}=await Promise.resolve().then(s.t.bind(s,702,19));e(t),t.addInteractor?.("externalTrail",async e=>{let{TrailMaker:r}=await s.e(983).then(s.bind(s,983));return new r(t,e)})})}return y})());
@@ -1,6 +1,8 @@
1
1
  import { type IOptionLoader, type IParticlesOptions, type RecursivePartial } from "@tsparticles/engine";
2
2
  import type { ITrail } from "../Interfaces/ITrail.js";
3
+ import { TrailColorCoords } from "./TrailColorCoords.js";
3
4
  export declare class Trail implements ITrail, IOptionLoader<ITrail> {
5
+ colorCoords?: TrailColorCoords;
4
6
  delay: number;
5
7
  particles?: RecursivePartial<IParticlesOptions>;
6
8
  pauseOnStop: boolean;
@@ -0,0 +1,9 @@
1
+ import { type IOptionLoader, type RangeValue, type RecursivePartial } from "@tsparticles/engine";
2
+ import type { ITrailColorComponent } from "../Interfaces/ITrailColorComponent.js";
3
+ import { TrailColorWeight } from "./TrailColorWeight.js";
4
+ export declare class TrailColorComponent implements ITrailColorComponent, IOptionLoader<ITrailColorComponent> {
5
+ value?: RangeValue;
6
+ weights?: TrailColorWeight;
7
+ constructor();
8
+ load(data?: RecursivePartial<ITrailColorComponent>): void;
9
+ }
@@ -0,0 +1,10 @@
1
+ import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
2
+ import type { ITrailColorCoords } from "../Interfaces/ITrailColorCoords.js";
3
+ import { TrailColorComponent } from "./TrailColorComponent.js";
4
+ export declare class TrailColorCoords implements ITrailColorCoords, IOptionLoader<ITrailColorCoords> {
5
+ h?: TrailColorComponent;
6
+ l?: TrailColorComponent;
7
+ s?: TrailColorComponent;
8
+ constructor();
9
+ load(data?: RecursivePartial<ITrailColorCoords>): void;
10
+ }
@@ -0,0 +1,8 @@
1
+ import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
2
+ import type { ITrailColorWeight } from "../Interfaces/ITrailColorWeight.js";
3
+ export declare class TrailColorWeight implements ITrailColorWeight, IOptionLoader<ITrailColorWeight> {
4
+ x: number;
5
+ y: number;
6
+ constructor();
7
+ load(data?: RecursivePartial<ITrailColorWeight>): void;
8
+ }
@@ -1,5 +1,7 @@
1
1
  import type { IParticlesOptions, RecursivePartial } from "@tsparticles/engine";
2
+ import type { ITrailColorCoords } from "./ITrailColorCoords.js";
2
3
  export interface ITrail {
4
+ colorCoords?: ITrailColorCoords;
3
5
  delay: number;
4
6
  particles?: RecursivePartial<IParticlesOptions>;
5
7
  pauseOnStop: boolean;
@@ -0,0 +1,6 @@
1
+ import type { ITrailColorWeight } from "./ITrailColorWeight.js";
2
+ import type { RangeValue } from "@tsparticles/engine";
3
+ export interface ITrailColorComponent {
4
+ value?: RangeValue;
5
+ weights?: ITrailColorWeight;
6
+ }
@@ -0,0 +1,6 @@
1
+ import type { ITrailColorComponent } from "./ITrailColorComponent.js";
2
+ export interface ITrailColorCoords {
3
+ h?: ITrailColorComponent;
4
+ l?: ITrailColorComponent;
5
+ s?: ITrailColorComponent;
6
+ }
@@ -0,0 +1,4 @@
1
+ export interface ITrailColorWeight {
2
+ x?: number;
3
+ y?: number;
4
+ }
@@ -1,10 +1,12 @@
1
- import { ExternalInteractorBase, type IInteractivityData, type IModes, type InteractivityParticle, type Modes } from "@tsparticles/plugin-interactivity";
2
1
  import { type IDelta, type RecursivePartial } from "@tsparticles/engine";
2
+ import { ExternalInteractorBase, type IInteractivityData, type IModes, type InteractivityEngine, type InteractivityParticle, type Modes } from "@tsparticles/plugin-interactivity";
3
3
  import type { ITrailMode, TrailContainer, TrailMode } from "./Types.js";
4
4
  export declare class TrailMaker extends ExternalInteractorBase<TrailContainer> {
5
+ readonly maxDistance = 0;
5
6
  private _delay;
7
+ private readonly _engine;
6
8
  private _lastPosition?;
7
- constructor(container: TrailContainer);
9
+ constructor(engine: InteractivityEngine, container: TrailContainer);
8
10
  clear(): void;
9
11
  init(): void;
10
12
  interact(interactivityData: IInteractivityData, delta: IDelta): void;
package/types/index.d.ts CHANGED
@@ -2,3 +2,6 @@ import { type Engine } from "@tsparticles/engine";
2
2
  export declare function loadExternalTrailInteraction(engine: Engine): Promise<void>;
3
3
  export * from "./Options/Classes/Trail.js";
4
4
  export type * from "./Options/Interfaces/ITrail.js";
5
+ export type { ITrailColorWeight } from "./Options/Interfaces/ITrailColorWeight.js";
6
+ export type { ITrailColorCoords } from "./Options/Interfaces/ITrailColorCoords.js";
7
+ export type { ITrailColorComponent } from "./Options/Interfaces/ITrailColorComponent.js";
@@ -4,34 +4,44 @@
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"], factory);
7
+ define(["require", "exports", "@tsparticles/engine", "./TrailColorCoords.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Trail = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
+ const TrailColorCoords_js_1 = require("./TrailColorCoords.js");
14
15
  class Trail {
16
+ colorCoords;
17
+ delay;
18
+ particles;
19
+ pauseOnStop;
20
+ quantity;
15
21
  constructor() {
16
22
  this.delay = 1;
17
23
  this.pauseOnStop = false;
18
24
  this.quantity = 1;
25
+ this.colorCoords = new TrailColorCoords_js_1.TrailColorCoords();
19
26
  }
20
27
  load(data) {
21
- if ((0, engine_1.isNull)(data)) {
28
+ if ((0, engine_1.isNull)(data))
22
29
  return;
23
- }
24
30
  if (data.delay !== undefined) {
25
31
  this.delay = data.delay;
26
32
  }
27
33
  if (data.quantity !== undefined) {
28
34
  this.quantity = data.quantity;
29
35
  }
36
+ if (data.pauseOnStop !== undefined) {
37
+ this.pauseOnStop = data.pauseOnStop;
38
+ }
30
39
  if (data.particles !== undefined) {
31
40
  this.particles = (0, engine_1.deepExtend)({}, data.particles);
32
41
  }
33
- if (data.pauseOnStop !== undefined) {
34
- this.pauseOnStop = data.pauseOnStop;
42
+ if (data.colorCoords) {
43
+ this.colorCoords ??= new TrailColorCoords_js_1.TrailColorCoords();
44
+ this.colorCoords.load(data.colorCoords);
35
45
  }
36
46
  }
37
47
  }
@@ -0,0 +1,35 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "@tsparticles/engine", "./TrailColorWeight.js"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TrailColorComponent = void 0;
13
+ const engine_1 = require("@tsparticles/engine");
14
+ const TrailColorWeight_js_1 = require("./TrailColorWeight.js");
15
+ class TrailColorComponent {
16
+ value;
17
+ weights;
18
+ constructor() {
19
+ this.weights = new TrailColorWeight_js_1.TrailColorWeight();
20
+ }
21
+ load(data) {
22
+ if (!data) {
23
+ return;
24
+ }
25
+ if (data.weights) {
26
+ this.weights ??= new TrailColorWeight_js_1.TrailColorWeight();
27
+ this.weights.load(data.weights);
28
+ }
29
+ if (!(0, engine_1.isNull)(data.value)) {
30
+ this.value = (0, engine_1.setRangeValue)(data.value);
31
+ }
32
+ }
33
+ }
34
+ exports.TrailColorComponent = TrailColorComponent;
35
+ });
@@ -0,0 +1,42 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "./TrailColorComponent.js"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TrailColorCoords = void 0;
13
+ const TrailColorComponent_js_1 = require("./TrailColorComponent.js");
14
+ class TrailColorCoords {
15
+ h;
16
+ l;
17
+ s;
18
+ constructor() {
19
+ this.h = new TrailColorComponent_js_1.TrailColorComponent();
20
+ this.s = new TrailColorComponent_js_1.TrailColorComponent();
21
+ this.l = new TrailColorComponent_js_1.TrailColorComponent();
22
+ }
23
+ load(data) {
24
+ if (!data) {
25
+ return;
26
+ }
27
+ if (data.h) {
28
+ this.h ??= new TrailColorComponent_js_1.TrailColorComponent();
29
+ this.h.load(data.h);
30
+ }
31
+ if (data.s) {
32
+ this.s ??= new TrailColorComponent_js_1.TrailColorComponent();
33
+ this.s.load(data.s);
34
+ }
35
+ if (data.l) {
36
+ this.l ??= new TrailColorComponent_js_1.TrailColorComponent();
37
+ this.l.load(data.l);
38
+ }
39
+ }
40
+ }
41
+ exports.TrailColorCoords = TrailColorCoords;
42
+ });
@@ -0,0 +1,33 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TrailColorWeight = void 0;
13
+ class TrailColorWeight {
14
+ x;
15
+ y;
16
+ constructor() {
17
+ this.x = 0;
18
+ this.y = 0;
19
+ }
20
+ load(data) {
21
+ if (!data) {
22
+ return;
23
+ }
24
+ if (data.x !== undefined) {
25
+ this.x = data.x;
26
+ }
27
+ if (data.y !== undefined) {
28
+ this.y = data.y;
29
+ }
30
+ }
31
+ }
32
+ exports.TrailColorWeight = TrailColorWeight;
33
+ });
@@ -0,0 +1,12 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ });