@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/cjs/options.js CHANGED
@@ -1,214 +1,278 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.options = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
- const explodeSoundCheck = (args) => {
6
- const data = args.data;
7
- return data.particle.shape === "line";
8
- };
9
- const fixRange = (value, min, max) => {
10
- const minValue = 0, diffSMax = value.max > max ? value.max - max : minValue;
11
- let res = (0, engine_1.setRangeValue)(value);
12
- if (diffSMax) {
13
- res = (0, engine_1.setRangeValue)(value.min - diffSMax, max);
14
- }
15
- const diffSMin = value.min < min ? value.min : minValue;
16
- if (diffSMin) {
17
- res = (0, engine_1.setRangeValue)(minValue, value.max + diffSMin);
18
- }
19
- return res;
20
- };
21
- const fireworksOptions = ["#ff595e", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"]
22
- .map(color => {
23
- const rgb = (0, engine_1.stringToRgb)(color);
24
- if (!rgb) {
25
- return undefined;
26
- }
27
- const hsl = (0, engine_1.rgbToHsl)(rgb), sOffset = 30, lOffset = 30, sBounds = {
28
- min: 0,
29
- max: 100,
30
- }, lBounds = {
31
- min: 0,
32
- max: 100,
33
- }, 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);
34
- return {
35
- color: {
36
- value: {
37
- h: hsl.h,
38
- s: sRange,
39
- l: lRange,
40
- },
41
- },
42
- stroke: {
43
- width: 0,
44
- },
45
- number: {
46
- value: 0,
47
- },
48
- opacity: {
49
- value: {
50
- min: 0.1,
51
- max: 1,
1
+ import { DestroyType, EventType, MoveDirection, OutMode, StartValueType, defaultAlpha, getLogger, none, rgbToHsl, setRangeValue, } from "@tsparticles/engine";
2
+ export const presetName = "fireworks";
3
+ export function initOptions() {
4
+ const explodeSoundCheck = (args) => {
5
+ const data = args.data;
6
+ return data.particle.options.move.gravity.inverse;
7
+ }, fixRange = (value, min, max) => {
8
+ const minValue = 0, diffSMax = value.max > max ? value.max - max : minValue;
9
+ let res = setRangeValue(value);
10
+ if (diffSMax) {
11
+ res = setRangeValue(value.min - diffSMax, max);
12
+ }
13
+ const diffSMin = value.min < min ? value.min : minValue;
14
+ if (diffSMin) {
15
+ res = setRangeValue(minValue, value.max + diffSMin);
16
+ }
17
+ return res;
18
+ }, hexToRgba = (hex) => {
19
+ let hexValue = hex;
20
+ const shortRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
21
+ if (shortRegex.test(hexValue)) {
22
+ hexValue = hexValue.replace(shortRegex, (_m, r, g, b, a) => r + r + g + g + b + b + (a ? a + a : ""));
23
+ }
24
+ const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i, result = regex.exec(hexValue);
25
+ if (!result) {
26
+ return undefined;
27
+ }
28
+ result.shift();
29
+ const indexes = {
30
+ a: 3,
31
+ b: 2,
32
+ g: 1,
33
+ r: 0,
34
+ }, values = {
35
+ a: result[indexes.a],
36
+ b: result[indexes.b],
37
+ g: result[indexes.g],
38
+ r: result[indexes.r],
39
+ }, hexRadix = 16;
40
+ return {
41
+ r: values.r ? Number.parseInt(values.r, hexRadix) : none,
42
+ g: values.g ? Number.parseInt(values.g, hexRadix) : none,
43
+ b: values.b ? Number.parseInt(values.b, hexRadix) : none,
44
+ a: values.a ? Number.parseInt(values.a, hexRadix) : defaultAlpha,
45
+ };
46
+ }, fireworksOptions = [
47
+ "#FF0000",
48
+ "#FF2A00",
49
+ "#FF5500",
50
+ "#FF8000",
51
+ "#FFAA00",
52
+ "#FFD400",
53
+ "#FFFF00",
54
+ "#D4FF00",
55
+ "#AAFF00",
56
+ "#80FF00",
57
+ "#55FF00",
58
+ "#2AFF00",
59
+ "#00FF00",
60
+ "#00FF2A",
61
+ "#00FF55",
62
+ "#00FF80",
63
+ "#00FFAA",
64
+ "#00FFD4",
65
+ "#00FFFF",
66
+ "#00D4FF",
67
+ "#00AAFF",
68
+ "#0080FF",
69
+ "#0055FF",
70
+ "#002AFF",
71
+ "#0000FF",
72
+ "#2A00FF",
73
+ "#5500FF",
74
+ "#8000FF",
75
+ "#AA00FF",
76
+ "#D400FF",
77
+ "#FF00FF",
78
+ "#FF00D4",
79
+ "#FF00AA",
80
+ "#FF0080",
81
+ "#FF0055",
82
+ "#FF002A",
83
+ ]
84
+ .map(color => {
85
+ const rgb = hexToRgba(color);
86
+ if (!rgb) {
87
+ getLogger().log("color not found", color);
88
+ return undefined;
89
+ }
90
+ const hsl = rgbToHsl(rgb), sOffset = 30, lOffset = 30, sBounds = {
91
+ min: 0,
92
+ max: 100,
93
+ }, lBounds = {
94
+ min: 0,
95
+ max: 100,
96
+ }, 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);
97
+ getLogger().log(hsl.h, sRange, lRange);
98
+ return {
99
+ color: {
100
+ value: {
101
+ h: hsl.h,
102
+ s: sRange,
103
+ l: lRange,
104
+ },
52
105
  },
53
- animation: {
54
- enable: true,
55
- speed: 0.7,
56
- sync: false,
57
- startValue: engine_1.StartValueType.max,
58
- destroy: engine_1.DestroyType.min,
106
+ stroke: {
107
+ width: 0,
59
108
  },
60
- },
61
- shape: {
62
- type: "circle",
63
- },
64
- size: {
65
- value: { min: 1, max: 2 },
66
- animation: {
67
- enable: true,
68
- speed: 5,
69
- count: 1,
70
- sync: false,
71
- startValue: engine_1.StartValueType.min,
72
- destroy: engine_1.DestroyType.none,
109
+ number: {
110
+ value: 0,
73
111
  },
74
- },
75
- life: {
76
- count: 1,
77
- duration: {
112
+ opacity: {
78
113
  value: {
79
- min: 1,
80
- max: 2,
114
+ min: 0.1,
115
+ max: 1,
116
+ },
117
+ animation: {
118
+ enable: true,
119
+ speed: 0.7,
120
+ sync: false,
121
+ startValue: StartValueType.max,
122
+ destroy: DestroyType.min,
81
123
  },
82
124
  },
83
- },
84
- move: {
85
- decay: { min: 0.075, max: 0.1 },
86
- enable: true,
87
- gravity: {
88
- enable: true,
89
- inverse: false,
90
- acceleration: 5,
125
+ shape: {
126
+ type: "circle",
91
127
  },
92
- speed: { min: 5, max: 15 },
93
- direction: "none",
94
- outModes: engine_1.OutMode.destroy,
95
- },
96
- };
97
- })
98
- .filter(t => t !== undefined);
99
- exports.options = {
100
- detectRetina: true,
101
- background: {
102
- color: "#000",
103
- },
104
- fpsLimit: 120,
105
- emitters: {
106
- direction: engine_1.MoveDirection.top,
107
- life: {
108
- count: 0,
109
- duration: 0.1,
110
- delay: 0.1,
111
- },
112
- rate: {
113
- delay: 0.05,
114
- quantity: 1,
115
- },
116
- size: {
117
- width: 100,
118
- height: 0,
119
- },
120
- position: {
121
- y: 100,
122
- x: 50,
123
- },
124
- },
125
- particles: {
126
- number: {
127
- value: 0,
128
- },
129
- destroy: {
130
- mode: "split",
131
- bounds: {
132
- top: { min: 10, max: 30 },
128
+ effect: {
129
+ type: "trail",
130
+ options: {
131
+ trail: {
132
+ length: {
133
+ min: 5,
134
+ max: 10,
135
+ },
136
+ },
137
+ },
138
+ },
139
+ size: {
140
+ value: { min: 1, max: 2 },
141
+ animation: {
142
+ enable: true,
143
+ speed: 5,
144
+ count: 1,
145
+ sync: false,
146
+ startValue: StartValueType.min,
147
+ destroy: DestroyType.none,
148
+ },
133
149
  },
134
- split: {
135
- sizeOffset: false,
150
+ life: {
136
151
  count: 1,
137
- factor: {
138
- value: 0.333333,
152
+ duration: {
153
+ value: {
154
+ min: 1,
155
+ max: 2,
156
+ },
139
157
  },
140
- rate: {
141
- value: { min: 75, max: 150 },
158
+ },
159
+ move: {
160
+ decay: { min: 0.075, max: 0.1 },
161
+ enable: true,
162
+ gravity: {
163
+ enable: true,
164
+ inverse: false,
165
+ acceleration: 5,
142
166
  },
143
- particles: fireworksOptions,
167
+ speed: { min: 5, max: 15 },
168
+ direction: "none",
169
+ outModes: OutMode.destroy,
144
170
  },
171
+ };
172
+ })
173
+ .filter(t => t !== undefined);
174
+ return {
175
+ detectRetina: true,
176
+ background: {
177
+ color: "#000",
145
178
  },
146
- life: {
147
- count: 1,
148
- },
149
- shape: {
150
- type: "line",
151
- },
152
- size: {
153
- value: {
154
- min: 0.1,
155
- max: 50,
179
+ fpsLimit: 120,
180
+ emitters: {
181
+ direction: MoveDirection.top,
182
+ rate: {
183
+ delay: 0.3,
184
+ quantity: 1,
156
185
  },
157
- animation: {
158
- enable: true,
159
- sync: true,
160
- speed: 90,
161
- startValue: engine_1.StartValueType.max,
162
- destroy: engine_1.DestroyType.min,
186
+ size: {
187
+ width: 100,
188
+ height: 0,
163
189
  },
164
- },
165
- stroke: {
166
- color: {
167
- value: "#ffffff",
190
+ position: {
191
+ y: 100,
192
+ x: 50,
168
193
  },
169
- width: 1,
170
194
  },
171
- rotate: {
172
- path: true,
173
- },
174
- move: {
175
- enable: true,
176
- gravity: {
177
- acceleration: 15,
178
- enable: true,
179
- inverse: true,
180
- maxSpeed: 100,
195
+ particles: {
196
+ number: {
197
+ value: 0,
181
198
  },
182
- speed: {
183
- min: 10,
184
- max: 20,
199
+ destroy: {
200
+ mode: "split",
201
+ bounds: {
202
+ top: { min: 15, max: 35 },
203
+ },
204
+ split: {
205
+ sizeOffset: false,
206
+ count: 1,
207
+ factor: {
208
+ value: 0.333333,
209
+ },
210
+ rate: {
211
+ value: { min: 75, max: 150 },
212
+ },
213
+ particles: fireworksOptions,
214
+ },
185
215
  },
186
- outModes: {
187
- default: engine_1.OutMode.destroy,
188
- top: engine_1.OutMode.none,
216
+ life: {
217
+ count: 1,
218
+ },
219
+ shape: {
220
+ type: "circle",
189
221
  },
190
- trail: {
191
- fill: {
192
- color: "#000",
222
+ effect: {
223
+ type: "trail",
224
+ options: {
225
+ trail: {
226
+ length: {
227
+ min: 5,
228
+ max: 15,
229
+ },
230
+ minWidth: 1,
231
+ maxWidth: 1,
232
+ },
193
233
  },
234
+ },
235
+ size: {
236
+ value: 1,
237
+ },
238
+ stroke: {
239
+ color: {
240
+ value: "#ffffff",
241
+ },
242
+ width: 1,
243
+ },
244
+ move: {
194
245
  enable: true,
195
- length: 10,
246
+ gravity: {
247
+ acceleration: 15,
248
+ enable: true,
249
+ inverse: true,
250
+ maxSpeed: 100,
251
+ },
252
+ speed: {
253
+ min: 10,
254
+ max: 20,
255
+ },
256
+ outModes: {
257
+ default: OutMode.destroy,
258
+ top: OutMode.none,
259
+ },
196
260
  },
197
261
  },
198
- },
199
- sounds: {
200
- enable: true,
201
- events: [
202
- {
203
- event: engine_1.EventType.particleRemoved,
204
- filter: explodeSoundCheck,
205
- audio: [
206
- "https://particles.js.org/audio/explosion0.mp3",
207
- "https://particles.js.org/audio/explosion1.mp3",
208
- "https://particles.js.org/audio/explosion2.mp3",
209
- ],
210
- },
211
- ],
212
- volume: 50,
213
- },
214
- };
262
+ sounds: {
263
+ enable: true,
264
+ events: [
265
+ {
266
+ event: EventType.particleRemoved,
267
+ filter: explodeSoundCheck,
268
+ audio: [
269
+ "https://particles.js.org/audio/explosion0.mp3",
270
+ "https://particles.js.org/audio/explosion1.mp3",
271
+ "https://particles.js.org/audio/explosion2.mp3",
272
+ ],
273
+ },
274
+ ],
275
+ volume: 50,
276
+ },
277
+ };
278
+ }
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-alpha.0
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_preset_fireworks"] = this["webpackChunk_tsparticles_preset_fireworks"] || []).push([["dist_browser_options_js"],{
19
+
20
+ /***/ "./dist/browser/options.js"
21
+ /*!*********************************!*\
22
+ !*** ./dist/browser/options.js ***!
23
+ \*********************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ initOptions: () => (/* binding */ initOptions),\n/* harmony export */ presetName: () => (/* binding */ presetName)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"../../node_modules/.pnpm/@tsparticles+engine@4.0.0-alpha.2/node_modules/@tsparticles/engine/browser/index.js\");\n\nconst presetName = \"fireworks\";\nfunction initOptions() {\n const explodeSoundCheck = args => {\n const data = args.data;\n return data.particle.options.move.gravity.inverse;\n },\n fixRange = (value, min, max) => {\n const minValue = 0,\n diffSMax = value.max > max ? value.max - max : minValue;\n let res = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(value);\n if (diffSMax) {\n res = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(value.min - diffSMax, max);\n }\n const diffSMin = value.min < min ? value.min : minValue;\n if (diffSMin) {\n res = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(minValue, value.max + diffSMin);\n }\n return res;\n },\n hexToRgba = hex => {\n let hexValue = hex;\n const shortRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])([a-f\\d])?$/i;\n if (shortRegex.test(hexValue)) {\n hexValue = hexValue.replace(shortRegex, (_m, r, g, b, a) => r + r + g + g + b + b + (a ? a + a : \"\"));\n }\n const regex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})?$/i,\n result = regex.exec(hexValue);\n if (!result) {\n return undefined;\n }\n result.shift();\n const indexes = {\n a: 3,\n b: 2,\n g: 1,\n r: 0\n },\n values = {\n a: result[indexes.a],\n b: result[indexes.b],\n g: result[indexes.g],\n r: result[indexes.r]\n },\n hexRadix = 16;\n return {\n r: values.r ? Number.parseInt(values.r, hexRadix) : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.none,\n g: values.g ? Number.parseInt(values.g, hexRadix) : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.none,\n b: values.b ? Number.parseInt(values.b, hexRadix) : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.none,\n a: values.a ? Number.parseInt(values.a, hexRadix) : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultAlpha\n };\n },\n fireworksOptions = [\"#FF0000\", \"#FF2A00\", \"#FF5500\", \"#FF8000\", \"#FFAA00\", \"#FFD400\", \"#FFFF00\", \"#D4FF00\", \"#AAFF00\", \"#80FF00\", \"#55FF00\", \"#2AFF00\", \"#00FF00\", \"#00FF2A\", \"#00FF55\", \"#00FF80\", \"#00FFAA\", \"#00FFD4\", \"#00FFFF\", \"#00D4FF\", \"#00AAFF\", \"#0080FF\", \"#0055FF\", \"#002AFF\", \"#0000FF\", \"#2A00FF\", \"#5500FF\", \"#8000FF\", \"#AA00FF\", \"#D400FF\", \"#FF00FF\", \"#FF00D4\", \"#FF00AA\", \"#FF0080\", \"#FF0055\", \"#FF002A\"].map(color => {\n const rgb = hexToRgba(color);\n if (!rgb) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLogger)().log(\"color not found\", color);\n return undefined;\n }\n const hsl = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rgbToHsl)(rgb),\n sOffset = 30,\n lOffset = 30,\n sBounds = {\n min: 0,\n max: 100\n },\n lBounds = {\n min: 0,\n max: 100\n },\n sRange = fixRange({\n min: hsl.s - sOffset,\n max: hsl.s + sOffset\n }, sBounds.min, sBounds.max),\n lRange = fixRange({\n min: hsl.l - lOffset,\n max: hsl.l + lOffset\n }, lBounds.min, lBounds.max);\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLogger)().log(hsl.h, sRange, lRange);\n return {\n color: {\n value: {\n h: hsl.h,\n s: sRange,\n l: lRange\n }\n },\n stroke: {\n width: 0\n },\n number: {\n value: 0\n },\n opacity: {\n value: {\n min: 0.1,\n max: 1\n },\n animation: {\n enable: true,\n speed: 0.7,\n sync: false,\n startValue: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.max,\n destroy: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.min\n }\n },\n shape: {\n type: \"circle\"\n },\n effect: {\n type: \"trail\",\n options: {\n trail: {\n length: {\n min: 5,\n max: 10\n }\n }\n }\n },\n size: {\n value: {\n min: 1,\n max: 2\n },\n animation: {\n enable: true,\n speed: 5,\n count: 1,\n sync: false,\n startValue: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.min,\n destroy: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.none\n }\n },\n life: {\n count: 1,\n duration: {\n value: {\n min: 1,\n max: 2\n }\n }\n },\n move: {\n decay: {\n min: 0.075,\n max: 0.1\n },\n enable: true,\n gravity: {\n enable: true,\n inverse: false,\n acceleration: 5\n },\n speed: {\n min: 5,\n max: 15\n },\n direction: \"none\",\n outModes: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.destroy\n }\n };\n }).filter(t => t !== undefined);\n return {\n detectRetina: true,\n background: {\n color: \"#000\"\n },\n fpsLimit: 120,\n emitters: {\n direction: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.MoveDirection.top,\n rate: {\n delay: 0.3,\n quantity: 1\n },\n size: {\n width: 100,\n height: 0\n },\n position: {\n y: 100,\n x: 50\n }\n },\n particles: {\n number: {\n value: 0\n },\n destroy: {\n mode: \"split\",\n bounds: {\n top: {\n min: 15,\n max: 35\n }\n },\n split: {\n sizeOffset: false,\n count: 1,\n factor: {\n value: 0.333333\n },\n rate: {\n value: {\n min: 75,\n max: 150\n }\n },\n particles: fireworksOptions\n }\n },\n life: {\n count: 1\n },\n shape: {\n type: \"circle\"\n },\n effect: {\n type: \"trail\",\n options: {\n trail: {\n length: {\n min: 5,\n max: 15\n },\n minWidth: 1,\n maxWidth: 1\n }\n }\n },\n size: {\n value: 1\n },\n stroke: {\n color: {\n value: \"#ffffff\"\n },\n width: 1\n },\n move: {\n enable: true,\n gravity: {\n acceleration: 15,\n enable: true,\n inverse: true,\n maxSpeed: 100\n },\n speed: {\n min: 10,\n max: 20\n },\n outModes: {\n default: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.destroy,\n top: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.none\n }\n }\n },\n sounds: {\n enable: true,\n events: [{\n event: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.EventType.particleRemoved,\n filter: explodeSoundCheck,\n audio: [\"https://particles.js.org/audio/explosion0.mp3\", \"https://particles.js.org/audio/explosion1.mp3\", \"https://particles.js.org/audio/explosion2.mp3\"]\n }],\n volume: 50\n }\n };\n}\n\n//# sourceURL=webpack://@tsparticles/preset-fireworks/./dist/browser/options.js?\n}");
27
+
28
+ /***/ }
29
+
30
+ }]);
package/esm/bundle.js CHANGED
@@ -1,3 +1,2 @@
1
- import { loadFireworksPreset } from "./index.js";
2
- import { tsParticles } from "@tsparticles/engine";
3
- export { loadFireworksPreset, tsParticles };
1
+ export { loadFireworksPreset } from "./index.js";
2
+ export { tsParticles } from "@tsparticles/engine";
package/esm/index.js CHANGED
@@ -1,23 +1,19 @@
1
- import { loadBasic } from "@tsparticles/basic";
2
- import { loadDestroyUpdater } from "@tsparticles/updater-destroy";
3
- import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
4
- import { loadEmittersShapeSquare } from "@tsparticles/plugin-emitters-shape-square";
5
- import { loadLifeUpdater } from "@tsparticles/updater-life";
6
- import { loadLineShape } from "@tsparticles/shape-line";
7
- import { loadRotateUpdater } from "@tsparticles/updater-rotate";
8
- import { loadSoundsPlugin } from "@tsparticles/plugin-sounds";
9
- import { loadStrokeColorUpdater } from "@tsparticles/updater-stroke-color";
10
- import { options } from "./options.js";
11
- export async function loadFireworksPreset(engine, refresh = true) {
12
- await loadBasic(engine, false);
13
- await loadEmittersPlugin(engine, false);
14
- await loadEmittersShapeSquare(engine, false);
15
- await loadSoundsPlugin(engine, false);
16
- await loadLineShape(engine, false);
17
- await loadRotateUpdater(engine, false);
18
- await loadDestroyUpdater(engine, false);
19
- await loadLifeUpdater(engine, false);
20
- await loadStrokeColorUpdater(engine, false);
21
- await engine.addPreset("fireworks", options, false);
22
- await engine.refresh(refresh);
1
+ export function loadFireworksPreset(engine) {
2
+ engine.register(async (e) => {
3
+ const { loadBasic } = await import("@tsparticles/basic"), { loadEmittersPlugin } = await import("@tsparticles/plugin-emitters"), { loadTrailEffect } = await import("@tsparticles/effect-trail"), { loadEmittersShapeSquare } = await import("@tsparticles/plugin-emitters-shape-square"), { loadHexColorPlugin } = await import("@tsparticles/plugin-hex-color"), { loadHslColorPlugin } = await import("@tsparticles/plugin-hsl-color"), { loadRgbColorPlugin } = await import("@tsparticles/plugin-rgb-color"), { loadSoundsPlugin } = await import("@tsparticles/plugin-sounds"), { loadLineShape } = await import("@tsparticles/shape-line"), { loadRotateUpdater } = await import("@tsparticles/updater-rotate"), { loadDestroyUpdater } = await import("@tsparticles/updater-destroy"), { loadLifeUpdater } = await import("@tsparticles/updater-life"), { loadStrokeColorUpdater } = await import("@tsparticles/updater-stroke-color"), { initOptions, presetName } = await import("./options.js");
4
+ loadBasic(e);
5
+ loadHexColorPlugin(e);
6
+ loadHslColorPlugin(e);
7
+ loadRgbColorPlugin(e);
8
+ loadEmittersPlugin(e);
9
+ loadTrailEffect(e);
10
+ loadEmittersShapeSquare(e);
11
+ loadSoundsPlugin(e);
12
+ loadLineShape(e);
13
+ loadRotateUpdater(e);
14
+ loadDestroyUpdater(e);
15
+ loadLifeUpdater(e);
16
+ loadStrokeColorUpdater(e);
17
+ e.addPreset(presetName, initOptions(), false);
18
+ });
23
19
  }