@tsparticles/preset-fireworks 3.1.0 → 4.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.
Files changed (144) hide show
  1. package/125.min.js +2 -0
  2. package/125.min.js.LICENSE.txt +1 -0
  3. package/171.min.js +2 -0
  4. package/171.min.js.LICENSE.txt +1 -0
  5. package/213.min.js +2 -0
  6. package/213.min.js.LICENSE.txt +1 -0
  7. package/22.min.js +2 -0
  8. package/22.min.js.LICENSE.txt +1 -0
  9. package/226.min.js +2 -0
  10. package/226.min.js.LICENSE.txt +1 -0
  11. package/237.min.js +2 -0
  12. package/237.min.js.LICENSE.txt +1 -0
  13. package/264.min.js +2 -0
  14. package/264.min.js.LICENSE.txt +1 -0
  15. package/267.min.js +2 -0
  16. package/267.min.js.LICENSE.txt +1 -0
  17. package/280.min.js +2 -0
  18. package/280.min.js.LICENSE.txt +1 -0
  19. package/283.min.js +2 -0
  20. package/283.min.js.LICENSE.txt +1 -0
  21. package/301.min.js +2 -0
  22. package/301.min.js.LICENSE.txt +1 -0
  23. package/313.min.js +2 -0
  24. package/313.min.js.LICENSE.txt +1 -0
  25. package/319.min.js +2 -0
  26. package/319.min.js.LICENSE.txt +1 -0
  27. package/349.min.js +2 -0
  28. package/349.min.js.LICENSE.txt +1 -0
  29. package/389.min.js +2 -0
  30. package/389.min.js.LICENSE.txt +1 -0
  31. package/397.min.js +2 -0
  32. package/397.min.js.LICENSE.txt +1 -0
  33. package/418.min.js +2 -0
  34. package/418.min.js.LICENSE.txt +1 -0
  35. package/453.min.js +2 -0
  36. package/453.min.js.LICENSE.txt +1 -0
  37. package/455.min.js +2 -0
  38. package/455.min.js.LICENSE.txt +1 -0
  39. package/459.min.js +2 -0
  40. package/459.min.js.LICENSE.txt +1 -0
  41. package/477.min.js +2 -0
  42. package/477.min.js.LICENSE.txt +1 -0
  43. package/481.min.js +2 -0
  44. package/481.min.js.LICENSE.txt +1 -0
  45. package/488.min.js +2 -0
  46. package/488.min.js.LICENSE.txt +1 -0
  47. package/49.min.js +2 -0
  48. package/49.min.js.LICENSE.txt +1 -0
  49. package/509.min.js +2 -0
  50. package/509.min.js.LICENSE.txt +1 -0
  51. package/527.min.js +2 -0
  52. package/527.min.js.LICENSE.txt +1 -0
  53. package/541.min.js +2 -0
  54. package/541.min.js.LICENSE.txt +1 -0
  55. package/597.min.js +2 -0
  56. package/597.min.js.LICENSE.txt +1 -0
  57. package/633.min.js +2 -0
  58. package/633.min.js.LICENSE.txt +1 -0
  59. package/637.min.js +2 -0
  60. package/637.min.js.LICENSE.txt +1 -0
  61. package/669.min.js +2 -0
  62. package/669.min.js.LICENSE.txt +1 -0
  63. package/751.min.js +2 -0
  64. package/751.min.js.LICENSE.txt +1 -0
  65. package/802.min.js +2 -0
  66. package/802.min.js.LICENSE.txt +1 -0
  67. package/803.min.js +2 -0
  68. package/803.min.js.LICENSE.txt +1 -0
  69. package/819.min.js +2 -0
  70. package/819.min.js.LICENSE.txt +1 -0
  71. package/829.min.js +2 -0
  72. package/829.min.js.LICENSE.txt +1 -0
  73. package/890.min.js +2 -0
  74. package/890.min.js.LICENSE.txt +1 -0
  75. package/908.min.js +2 -0
  76. package/908.min.js.LICENSE.txt +1 -0
  77. package/926.min.js +2 -0
  78. package/926.min.js.LICENSE.txt +1 -0
  79. package/98.min.js +2 -0
  80. package/98.min.js.LICENSE.txt +1 -0
  81. package/README.md +1 -1
  82. package/browser/bundle.js +2 -3
  83. package/browser/index.js +18 -22
  84. package/browser/options.js +254 -187
  85. package/cjs/bundle.js +2 -7
  86. package/cjs/index.js +18 -26
  87. package/cjs/options.js +254 -190
  88. package/dist_browser_options_js.js +30 -0
  89. package/esm/bundle.js +2 -3
  90. package/esm/index.js +18 -22
  91. package/esm/options.js +254 -187
  92. package/node_modules_pnpm_tsparticles_basic_4_0_0-alpha_2_node_modules_tsparticles_basic_browser_index_js.js +30 -0
  93. package/node_modules_pnpm_tsparticles_effect-trail_4_0_0-alpha_2_node_modules_tsparticles_effect-trai-3395e5.js +30 -0
  94. package/node_modules_pnpm_tsparticles_effect-trail_4_0_0-alpha_2_node_modules_tsparticles_effect-trai-8c7216.js +30 -0
  95. package/node_modules_pnpm_tsparticles_move-base_4_0_0-alpha_2_node_modules_tsparticles_move-base_brow-7d79eb.js +40 -0
  96. package/node_modules_pnpm_tsparticles_move-base_4_0_0-alpha_2_node_modules_tsparticles_move-base_brow-fb148a.js +30 -0
  97. package/node_modules_pnpm_tsparticles_plugin-emitters-shape-square_4_0_0-alpha_2_node_modules_tsparti-cafd8c.js +30 -0
  98. package/node_modules_pnpm_tsparticles_plugin-emitters-shape-square_4_0_0-alpha_2_node_modules_tsparti-cf2f58.js +70 -0
  99. package/node_modules_pnpm_tsparticles_plugin-emitters_4_0_0-alpha_2_node_modules_tsparticles_plugin-e-122a51.js +30 -0
  100. package/node_modules_pnpm_tsparticles_plugin-emitters_4_0_0-alpha_2_node_modules_tsparticles_plugin-e-6bd6f8.js +50 -0
  101. package/node_modules_pnpm_tsparticles_plugin-hex-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--91288b.js +30 -0
  102. package/node_modules_pnpm_tsparticles_plugin-hex-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--d06b2a.js +30 -0
  103. package/node_modules_pnpm_tsparticles_plugin-hsl-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--70976c.js +30 -0
  104. package/node_modules_pnpm_tsparticles_plugin-hsl-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--e141e9.js +30 -0
  105. package/node_modules_pnpm_tsparticles_plugin-rgb-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--60c9df.js +30 -0
  106. package/node_modules_pnpm_tsparticles_plugin-rgb-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--732407.js +30 -0
  107. package/node_modules_pnpm_tsparticles_plugin-sounds_4_0_0-alpha_2_node_modules_tsparticles_plugin-sou-6e6a34.js +30 -0
  108. package/node_modules_pnpm_tsparticles_shape-circle_4_0_0-alpha_2_node_modules_tsparticles_shape-circl-c98489.js +40 -0
  109. package/node_modules_pnpm_tsparticles_shape-circle_4_0_0-alpha_2_node_modules_tsparticles_shape-circl-ce96e8.js +30 -0
  110. package/node_modules_pnpm_tsparticles_shape-line_4_0_0-alpha_2_node_modules_tsparticles_shape-line_br-01d607.js +30 -0
  111. package/node_modules_pnpm_tsparticles_shape-line_4_0_0-alpha_2_node_modules_tsparticles_shape-line_br-eb7b65.js +40 -0
  112. package/node_modules_pnpm_tsparticles_updater-color_4_0_0-alpha_2_node_modules_tsparticles_updater-co-210bd6.js +30 -0
  113. package/node_modules_pnpm_tsparticles_updater-color_4_0_0-alpha_2_node_modules_tsparticles_updater-co-6ff909.js +30 -0
  114. package/node_modules_pnpm_tsparticles_updater-destroy_4_0_0-alpha_2_node_modules_tsparticles_updater--cef2d9.js +100 -0
  115. package/node_modules_pnpm_tsparticles_updater-destroy_4_0_0-alpha_2_node_modules_tsparticles_updater--f71d4c.js +30 -0
  116. package/node_modules_pnpm_tsparticles_updater-life_4_0_0-alpha_2_node_modules_tsparticles_updater-lif-50f821.js +30 -0
  117. package/node_modules_pnpm_tsparticles_updater-life_4_0_0-alpha_2_node_modules_tsparticles_updater-lif-dbf90f.js +70 -0
  118. package/node_modules_pnpm_tsparticles_updater-opacity_4_0_0-alpha_2_node_modules_tsparticles_updater--4e8c57.js +30 -0
  119. package/node_modules_pnpm_tsparticles_updater-opacity_4_0_0-alpha_2_node_modules_tsparticles_updater--ac14ff.js +30 -0
  120. package/node_modules_pnpm_tsparticles_updater-out-modes_4_0_0-alpha_2_node_modules_tsparticles_update-cd317f.js +30 -0
  121. package/node_modules_pnpm_tsparticles_updater-rotate_4_0_0-alpha_2_node_modules_tsparticles_updater-r-0de212.js +30 -0
  122. package/node_modules_pnpm_tsparticles_updater-rotate_4_0_0-alpha_2_node_modules_tsparticles_updater-r-e97427.js +50 -0
  123. package/node_modules_pnpm_tsparticles_updater-size_4_0_0-alpha_2_node_modules_tsparticles_updater-siz-53e0fe.js +30 -0
  124. package/node_modules_pnpm_tsparticles_updater-size_4_0_0-alpha_2_node_modules_tsparticles_updater-siz-aaa117.js +30 -0
  125. package/node_modules_pnpm_tsparticles_updater-stroke-color_4_0_0-alpha_2_node_modules_tsparticles_upd-74b323.js +30 -0
  126. package/node_modules_pnpm_tsparticles_updater-stroke-color_4_0_0-alpha_2_node_modules_tsparticles_upd-ca004c.js +30 -0
  127. package/package.json +30 -13
  128. package/report.html +5 -4
  129. package/tsparticles.preset.fireworks.bundle.js +770 -2539
  130. package/tsparticles.preset.fireworks.bundle.min.js +1 -1
  131. package/tsparticles.preset.fireworks.bundle.min.js.LICENSE.txt +1 -1
  132. package/tsparticles.preset.fireworks.js +306 -57
  133. package/tsparticles.preset.fireworks.min.js +1 -1
  134. package/tsparticles.preset.fireworks.min.js.LICENSE.txt +1 -1
  135. package/types/bundle.d.ts +2 -3
  136. package/types/index.d.ts +1 -1
  137. package/types/options.d.ts +2 -1
  138. package/umd/bundle.js +2 -2
  139. package/umd/index.js +54 -25
  140. package/umd/options.js +255 -187
  141. package/vendors-node_modules_pnpm_tsparticles_engine_4_0_0-alpha_2_node_modules_tsparticles_engine_br-9c0a0f.js +100 -0
  142. package/vendors-node_modules_pnpm_tsparticles_plugin-emitters_4_0_0-alpha_2_node_modules_tsparticles_-1e60b5.js +110 -0
  143. package/vendors-node_modules_pnpm_tsparticles_plugin-sounds_4_0_0-alpha_2_node_modules_tsparticles_pl-a36589.js +140 -0
  144. package/vendors-node_modules_pnpm_tsparticles_updater-out-modes_4_0_0-alpha_2_node_modules_tsparticle-124574.js +80 -0
package/umd/bundle.js CHANGED
@@ -10,8 +10,8 @@
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.tsParticles = exports.loadFireworksPreset = void 0;
13
- const index_js_1 = require("./index.js");
13
+ var index_js_1 = require("./index.js");
14
14
  Object.defineProperty(exports, "loadFireworksPreset", { enumerable: true, get: function () { return index_js_1.loadFireworksPreset; } });
15
- const engine_1 = require("@tsparticles/engine");
15
+ var engine_1 = require("@tsparticles/engine");
16
16
  Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
17
17
  });
package/umd/index.js CHANGED
@@ -1,37 +1,66 @@
1
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
+ if (k2 === undefined) k2 = k;
3
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
+ desc = { enumerable: true, get: function() { return m[k]; } };
6
+ }
7
+ Object.defineProperty(o, k2, desc);
8
+ }) : (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ o[k2] = m[k];
11
+ }));
12
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
14
+ }) : function(o, v) {
15
+ o["default"] = v;
16
+ });
17
+ var __importStar = (this && this.__importStar) || (function () {
18
+ var ownKeys = function(o) {
19
+ ownKeys = Object.getOwnPropertyNames || function (o) {
20
+ var ar = [];
21
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
22
+ return ar;
23
+ };
24
+ return ownKeys(o);
25
+ };
26
+ return function (mod) {
27
+ if (mod && mod.__esModule) return mod;
28
+ var result = {};
29
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
30
+ __setModuleDefault(result, mod);
31
+ return result;
32
+ };
33
+ })();
1
34
  (function (factory) {
2
35
  if (typeof module === "object" && typeof module.exports === "object") {
3
36
  var v = factory(require, exports);
4
37
  if (v !== undefined) module.exports = v;
5
38
  }
6
39
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/basic", "@tsparticles/updater-destroy", "@tsparticles/plugin-emitters", "@tsparticles/plugin-emitters-shape-square", "@tsparticles/updater-life", "@tsparticles/shape-line", "@tsparticles/updater-rotate", "@tsparticles/plugin-sounds", "@tsparticles/updater-stroke-color", "./options.js"], factory);
40
+ define(["require", "exports"], factory);
8
41
  }
9
42
  })(function (require, exports) {
10
43
  "use strict";
44
+ var __syncRequire = typeof module === "object" && typeof module.exports === "object";
11
45
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.loadFireworksPreset = void 0;
13
- const basic_1 = require("@tsparticles/basic");
14
- const updater_destroy_1 = require("@tsparticles/updater-destroy");
15
- const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
16
- const plugin_emitters_shape_square_1 = require("@tsparticles/plugin-emitters-shape-square");
17
- const updater_life_1 = require("@tsparticles/updater-life");
18
- const shape_line_1 = require("@tsparticles/shape-line");
19
- const updater_rotate_1 = require("@tsparticles/updater-rotate");
20
- const plugin_sounds_1 = require("@tsparticles/plugin-sounds");
21
- const updater_stroke_color_1 = require("@tsparticles/updater-stroke-color");
22
- const options_js_1 = require("./options.js");
23
- async function loadFireworksPreset(engine, refresh = true) {
24
- await (0, basic_1.loadBasic)(engine, false);
25
- await (0, plugin_emitters_1.loadEmittersPlugin)(engine, false);
26
- await (0, plugin_emitters_shape_square_1.loadEmittersShapeSquare)(engine, false);
27
- await (0, plugin_sounds_1.loadSoundsPlugin)(engine, false);
28
- await (0, shape_line_1.loadLineShape)(engine, false);
29
- await (0, updater_rotate_1.loadRotateUpdater)(engine, false);
30
- await (0, updater_destroy_1.loadDestroyUpdater)(engine, false);
31
- await (0, updater_life_1.loadLifeUpdater)(engine, false);
32
- await (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine, false);
33
- await engine.addPreset("fireworks", options_js_1.options, false);
34
- await engine.refresh(refresh);
35
- }
36
46
  exports.loadFireworksPreset = loadFireworksPreset;
47
+ function loadFireworksPreset(engine) {
48
+ engine.register(async (e) => {
49
+ const { loadBasic } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/basic"))) : new Promise((resolve_1, reject_1) => { require(["@tsparticles/basic"], resolve_1, reject_1); }).then(__importStar)), { loadEmittersPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-emitters"))) : new Promise((resolve_2, reject_2) => { require(["@tsparticles/plugin-emitters"], resolve_2, reject_2); }).then(__importStar)), { loadTrailEffect } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/effect-trail"))) : new Promise((resolve_3, reject_3) => { require(["@tsparticles/effect-trail"], resolve_3, reject_3); }).then(__importStar)), { loadEmittersShapeSquare } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-emitters-shape-square"))) : new Promise((resolve_4, reject_4) => { require(["@tsparticles/plugin-emitters-shape-square"], resolve_4, reject_4); }).then(__importStar)), { loadHexColorPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-hex-color"))) : new Promise((resolve_5, reject_5) => { require(["@tsparticles/plugin-hex-color"], resolve_5, reject_5); }).then(__importStar)), { loadHslColorPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-hsl-color"))) : new Promise((resolve_6, reject_6) => { require(["@tsparticles/plugin-hsl-color"], resolve_6, reject_6); }).then(__importStar)), { loadRgbColorPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-rgb-color"))) : new Promise((resolve_7, reject_7) => { require(["@tsparticles/plugin-rgb-color"], resolve_7, reject_7); }).then(__importStar)), { loadSoundsPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-sounds"))) : new Promise((resolve_8, reject_8) => { require(["@tsparticles/plugin-sounds"], resolve_8, reject_8); }).then(__importStar)), { loadLineShape } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/shape-line"))) : new Promise((resolve_9, reject_9) => { require(["@tsparticles/shape-line"], resolve_9, reject_9); }).then(__importStar)), { loadRotateUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/updater-rotate"))) : new Promise((resolve_10, reject_10) => { require(["@tsparticles/updater-rotate"], resolve_10, reject_10); }).then(__importStar)), { loadDestroyUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/updater-destroy"))) : new Promise((resolve_11, reject_11) => { require(["@tsparticles/updater-destroy"], resolve_11, reject_11); }).then(__importStar)), { loadLifeUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/updater-life"))) : new Promise((resolve_12, reject_12) => { require(["@tsparticles/updater-life"], resolve_12, reject_12); }).then(__importStar)), { loadStrokeColorUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/updater-stroke-color"))) : new Promise((resolve_13, reject_13) => { require(["@tsparticles/updater-stroke-color"], resolve_13, reject_13); }).then(__importStar)), { initOptions, presetName } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./options.js"))) : new Promise((resolve_14, reject_14) => { require(["./options.js"], resolve_14, reject_14); }).then(__importStar));
50
+ loadBasic(e);
51
+ loadHexColorPlugin(e);
52
+ loadHslColorPlugin(e);
53
+ loadRgbColorPlugin(e);
54
+ loadEmittersPlugin(e);
55
+ loadTrailEffect(e);
56
+ loadEmittersShapeSquare(e);
57
+ loadSoundsPlugin(e);
58
+ loadLineShape(e);
59
+ loadRotateUpdater(e);
60
+ loadDestroyUpdater(e);
61
+ loadLifeUpdater(e);
62
+ loadStrokeColorUpdater(e);
63
+ e.addPreset(presetName, initOptions(), false);
64
+ });
65
+ }
37
66
  });
package/umd/options.js CHANGED
@@ -9,216 +9,284 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.options = void 0;
12
+ exports.presetName = void 0;
13
+ exports.initOptions = initOptions;
13
14
  const engine_1 = require("@tsparticles/engine");
14
- const explodeSoundCheck = (args) => {
15
- const data = args.data;
16
- return data.particle.shape === "line";
17
- };
18
- const fixRange = (value, min, max) => {
19
- const minValue = 0, diffSMax = value.max > max ? value.max - max : minValue;
20
- let res = (0, engine_1.setRangeValue)(value);
21
- if (diffSMax) {
22
- res = (0, engine_1.setRangeValue)(value.min - diffSMax, max);
23
- }
24
- const diffSMin = value.min < min ? value.min : minValue;
25
- if (diffSMin) {
26
- res = (0, engine_1.setRangeValue)(minValue, value.max + diffSMin);
27
- }
28
- return res;
29
- };
30
- const fireworksOptions = ["#ff595e", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"]
31
- .map(color => {
32
- const rgb = (0, engine_1.stringToRgb)(color);
33
- if (!rgb) {
34
- return undefined;
35
- }
36
- const hsl = (0, engine_1.rgbToHsl)(rgb), sOffset = 30, lOffset = 30, sBounds = {
37
- min: 0,
38
- max: 100,
39
- }, lBounds = {
40
- min: 0,
41
- max: 100,
42
- }, sRange = fixRange({ min: hsl.s - sOffset, max: hsl.s + sOffset }, sBounds.min, sBounds.max), lRange = fixRange({ min: hsl.l - lOffset, max: hsl.l + lOffset }, lBounds.min, lBounds.max);
43
- return {
44
- color: {
45
- value: {
46
- h: hsl.h,
47
- s: sRange,
48
- l: lRange,
49
- },
50
- },
51
- stroke: {
52
- width: 0,
53
- },
54
- number: {
55
- value: 0,
56
- },
57
- opacity: {
58
- value: {
59
- min: 0.1,
60
- max: 1,
15
+ exports.presetName = "fireworks";
16
+ function initOptions() {
17
+ const explodeSoundCheck = (args) => {
18
+ const data = args.data;
19
+ return data.particle.options.move.gravity.inverse;
20
+ }, fixRange = (value, min, max) => {
21
+ const minValue = 0, diffSMax = value.max > max ? value.max - max : minValue;
22
+ let res = (0, engine_1.setRangeValue)(value);
23
+ if (diffSMax) {
24
+ res = (0, engine_1.setRangeValue)(value.min - diffSMax, max);
25
+ }
26
+ const diffSMin = value.min < min ? value.min : minValue;
27
+ if (diffSMin) {
28
+ res = (0, engine_1.setRangeValue)(minValue, value.max + diffSMin);
29
+ }
30
+ return res;
31
+ }, hexToRgba = (hex) => {
32
+ let hexValue = hex;
33
+ const shortRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
34
+ if (shortRegex.test(hexValue)) {
35
+ hexValue = hexValue.replace(shortRegex, (_m, r, g, b, a) => r + r + g + g + b + b + (a ? a + a : ""));
36
+ }
37
+ const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i, result = regex.exec(hexValue);
38
+ if (!result) {
39
+ return undefined;
40
+ }
41
+ result.shift();
42
+ const indexes = {
43
+ a: 3,
44
+ b: 2,
45
+ g: 1,
46
+ r: 0,
47
+ }, values = {
48
+ a: result[indexes.a],
49
+ b: result[indexes.b],
50
+ g: result[indexes.g],
51
+ r: result[indexes.r],
52
+ }, hexRadix = 16;
53
+ return {
54
+ r: values.r ? Number.parseInt(values.r, hexRadix) : engine_1.none,
55
+ g: values.g ? Number.parseInt(values.g, hexRadix) : engine_1.none,
56
+ b: values.b ? Number.parseInt(values.b, hexRadix) : engine_1.none,
57
+ a: values.a ? Number.parseInt(values.a, hexRadix) : engine_1.defaultAlpha,
58
+ };
59
+ }, fireworksOptions = [
60
+ "#FF0000",
61
+ "#FF2A00",
62
+ "#FF5500",
63
+ "#FF8000",
64
+ "#FFAA00",
65
+ "#FFD400",
66
+ "#FFFF00",
67
+ "#D4FF00",
68
+ "#AAFF00",
69
+ "#80FF00",
70
+ "#55FF00",
71
+ "#2AFF00",
72
+ "#00FF00",
73
+ "#00FF2A",
74
+ "#00FF55",
75
+ "#00FF80",
76
+ "#00FFAA",
77
+ "#00FFD4",
78
+ "#00FFFF",
79
+ "#00D4FF",
80
+ "#00AAFF",
81
+ "#0080FF",
82
+ "#0055FF",
83
+ "#002AFF",
84
+ "#0000FF",
85
+ "#2A00FF",
86
+ "#5500FF",
87
+ "#8000FF",
88
+ "#AA00FF",
89
+ "#D400FF",
90
+ "#FF00FF",
91
+ "#FF00D4",
92
+ "#FF00AA",
93
+ "#FF0080",
94
+ "#FF0055",
95
+ "#FF002A",
96
+ ]
97
+ .map(color => {
98
+ const rgb = hexToRgba(color);
99
+ if (!rgb) {
100
+ (0, engine_1.getLogger)().log("color not found", color);
101
+ return undefined;
102
+ }
103
+ const hsl = (0, engine_1.rgbToHsl)(rgb), sOffset = 30, lOffset = 30, sBounds = {
104
+ min: 0,
105
+ max: 100,
106
+ }, lBounds = {
107
+ min: 0,
108
+ max: 100,
109
+ }, sRange = fixRange({ min: hsl.s - sOffset, max: hsl.s + sOffset }, sBounds.min, sBounds.max), lRange = fixRange({ min: hsl.l - lOffset, max: hsl.l + lOffset }, lBounds.min, lBounds.max);
110
+ (0, engine_1.getLogger)().log(hsl.h, sRange, lRange);
111
+ return {
112
+ color: {
113
+ value: {
114
+ h: hsl.h,
115
+ s: sRange,
116
+ l: lRange,
117
+ },
61
118
  },
62
- animation: {
63
- enable: true,
64
- speed: 0.7,
65
- sync: false,
66
- startValue: engine_1.StartValueType.max,
67
- destroy: engine_1.DestroyType.min,
119
+ stroke: {
120
+ width: 0,
68
121
  },
69
- },
70
- shape: {
71
- type: "circle",
72
- },
73
- size: {
74
- value: { min: 1, max: 2 },
75
- animation: {
76
- enable: true,
77
- speed: 5,
78
- count: 1,
79
- sync: false,
80
- startValue: engine_1.StartValueType.min,
81
- destroy: engine_1.DestroyType.none,
122
+ number: {
123
+ value: 0,
82
124
  },
83
- },
84
- life: {
85
- count: 1,
86
- duration: {
125
+ opacity: {
87
126
  value: {
88
- min: 1,
89
- max: 2,
127
+ min: 0.1,
128
+ max: 1,
129
+ },
130
+ animation: {
131
+ enable: true,
132
+ speed: 0.7,
133
+ sync: false,
134
+ startValue: engine_1.StartValueType.max,
135
+ destroy: engine_1.DestroyType.min,
90
136
  },
91
137
  },
92
- },
93
- move: {
94
- decay: { min: 0.075, max: 0.1 },
95
- enable: true,
96
- gravity: {
97
- enable: true,
98
- inverse: false,
99
- acceleration: 5,
138
+ shape: {
139
+ type: "circle",
100
140
  },
101
- speed: { min: 5, max: 15 },
102
- direction: "none",
103
- outModes: engine_1.OutMode.destroy,
104
- },
105
- };
106
- })
107
- .filter(t => t !== undefined);
108
- exports.options = {
109
- detectRetina: true,
110
- background: {
111
- color: "#000",
112
- },
113
- fpsLimit: 120,
114
- emitters: {
115
- direction: engine_1.MoveDirection.top,
116
- life: {
117
- count: 0,
118
- duration: 0.1,
119
- delay: 0.1,
120
- },
121
- rate: {
122
- delay: 0.05,
123
- quantity: 1,
124
- },
125
- size: {
126
- width: 100,
127
- height: 0,
128
- },
129
- position: {
130
- y: 100,
131
- x: 50,
132
- },
133
- },
134
- particles: {
135
- number: {
136
- value: 0,
137
- },
138
- destroy: {
139
- mode: "split",
140
- bounds: {
141
- top: { min: 10, max: 30 },
141
+ effect: {
142
+ type: "trail",
143
+ options: {
144
+ trail: {
145
+ length: {
146
+ min: 5,
147
+ max: 10,
148
+ },
149
+ },
150
+ },
151
+ },
152
+ size: {
153
+ value: { min: 1, max: 2 },
154
+ animation: {
155
+ enable: true,
156
+ speed: 5,
157
+ count: 1,
158
+ sync: false,
159
+ startValue: engine_1.StartValueType.min,
160
+ destroy: engine_1.DestroyType.none,
161
+ },
142
162
  },
143
- split: {
144
- sizeOffset: false,
163
+ life: {
145
164
  count: 1,
146
- factor: {
147
- value: 0.333333,
165
+ duration: {
166
+ value: {
167
+ min: 1,
168
+ max: 2,
169
+ },
148
170
  },
149
- rate: {
150
- value: { min: 75, max: 150 },
171
+ },
172
+ move: {
173
+ decay: { min: 0.075, max: 0.1 },
174
+ enable: true,
175
+ gravity: {
176
+ enable: true,
177
+ inverse: false,
178
+ acceleration: 5,
151
179
  },
152
- particles: fireworksOptions,
180
+ speed: { min: 5, max: 15 },
181
+ direction: "none",
182
+ outModes: engine_1.OutMode.destroy,
153
183
  },
184
+ };
185
+ })
186
+ .filter(t => t !== undefined);
187
+ return {
188
+ detectRetina: true,
189
+ background: {
190
+ color: "#000",
154
191
  },
155
- life: {
156
- count: 1,
157
- },
158
- shape: {
159
- type: "line",
160
- },
161
- size: {
162
- value: {
163
- min: 0.1,
164
- max: 50,
192
+ fpsLimit: 120,
193
+ emitters: {
194
+ direction: engine_1.MoveDirection.top,
195
+ rate: {
196
+ delay: 0.3,
197
+ quantity: 1,
165
198
  },
166
- animation: {
167
- enable: true,
168
- sync: true,
169
- speed: 90,
170
- startValue: engine_1.StartValueType.max,
171
- destroy: engine_1.DestroyType.min,
199
+ size: {
200
+ width: 100,
201
+ height: 0,
172
202
  },
173
- },
174
- stroke: {
175
- color: {
176
- value: "#ffffff",
203
+ position: {
204
+ y: 100,
205
+ x: 50,
177
206
  },
178
- width: 1,
179
- },
180
- rotate: {
181
- path: true,
182
207
  },
183
- move: {
184
- enable: true,
185
- gravity: {
186
- acceleration: 15,
187
- enable: true,
188
- inverse: true,
189
- maxSpeed: 100,
208
+ particles: {
209
+ number: {
210
+ value: 0,
190
211
  },
191
- speed: {
192
- min: 10,
193
- max: 20,
212
+ destroy: {
213
+ mode: "split",
214
+ bounds: {
215
+ top: { min: 15, max: 35 },
216
+ },
217
+ split: {
218
+ sizeOffset: false,
219
+ count: 1,
220
+ factor: {
221
+ value: 0.333333,
222
+ },
223
+ rate: {
224
+ value: { min: 75, max: 150 },
225
+ },
226
+ particles: fireworksOptions,
227
+ },
194
228
  },
195
- outModes: {
196
- default: engine_1.OutMode.destroy,
197
- top: engine_1.OutMode.none,
229
+ life: {
230
+ count: 1,
198
231
  },
199
- trail: {
200
- fill: {
201
- color: "#000",
232
+ shape: {
233
+ type: "circle",
234
+ },
235
+ effect: {
236
+ type: "trail",
237
+ options: {
238
+ trail: {
239
+ length: {
240
+ min: 5,
241
+ max: 15,
242
+ },
243
+ minWidth: 1,
244
+ maxWidth: 1,
245
+ },
246
+ },
247
+ },
248
+ size: {
249
+ value: 1,
250
+ },
251
+ stroke: {
252
+ color: {
253
+ value: "#ffffff",
202
254
  },
255
+ width: 1,
256
+ },
257
+ move: {
203
258
  enable: true,
204
- length: 10,
259
+ gravity: {
260
+ acceleration: 15,
261
+ enable: true,
262
+ inverse: true,
263
+ maxSpeed: 100,
264
+ },
265
+ speed: {
266
+ min: 10,
267
+ max: 20,
268
+ },
269
+ outModes: {
270
+ default: engine_1.OutMode.destroy,
271
+ top: engine_1.OutMode.none,
272
+ },
205
273
  },
206
274
  },
207
- },
208
- sounds: {
209
- enable: true,
210
- events: [
211
- {
212
- event: engine_1.EventType.particleRemoved,
213
- filter: explodeSoundCheck,
214
- audio: [
215
- "https://particles.js.org/audio/explosion0.mp3",
216
- "https://particles.js.org/audio/explosion1.mp3",
217
- "https://particles.js.org/audio/explosion2.mp3",
218
- ],
219
- },
220
- ],
221
- volume: 50,
222
- },
223
- };
275
+ sounds: {
276
+ enable: true,
277
+ events: [
278
+ {
279
+ event: engine_1.EventType.particleRemoved,
280
+ filter: explodeSoundCheck,
281
+ audio: [
282
+ "https://particles.js.org/audio/explosion0.mp3",
283
+ "https://particles.js.org/audio/explosion1.mp3",
284
+ "https://particles.js.org/audio/explosion2.mp3",
285
+ ],
286
+ },
287
+ ],
288
+ volume: 50,
289
+ },
290
+ };
291
+ }
224
292
  });