@tsparticles/preset-fireworks 3.2.0 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/125.min.js +2 -0
- package/125.min.js.LICENSE.txt +1 -0
- package/171.min.js +2 -0
- package/171.min.js.LICENSE.txt +1 -0
- package/213.min.js +2 -0
- package/213.min.js.LICENSE.txt +1 -0
- package/22.min.js +2 -0
- package/22.min.js.LICENSE.txt +1 -0
- package/226.min.js +2 -0
- package/226.min.js.LICENSE.txt +1 -0
- package/237.min.js +2 -0
- package/237.min.js.LICENSE.txt +1 -0
- package/264.min.js +2 -0
- package/264.min.js.LICENSE.txt +1 -0
- package/267.min.js +2 -0
- package/267.min.js.LICENSE.txt +1 -0
- package/280.min.js +2 -0
- package/280.min.js.LICENSE.txt +1 -0
- package/283.min.js +2 -0
- package/283.min.js.LICENSE.txt +1 -0
- package/301.min.js +2 -0
- package/301.min.js.LICENSE.txt +1 -0
- package/313.min.js +2 -0
- package/313.min.js.LICENSE.txt +1 -0
- package/319.min.js +2 -0
- package/319.min.js.LICENSE.txt +1 -0
- package/349.min.js +2 -0
- package/349.min.js.LICENSE.txt +1 -0
- package/389.min.js +2 -0
- package/389.min.js.LICENSE.txt +1 -0
- package/397.min.js +2 -0
- package/397.min.js.LICENSE.txt +1 -0
- package/418.min.js +2 -0
- package/418.min.js.LICENSE.txt +1 -0
- package/453.min.js +2 -0
- package/453.min.js.LICENSE.txt +1 -0
- package/455.min.js +2 -0
- package/455.min.js.LICENSE.txt +1 -0
- package/459.min.js +2 -0
- package/459.min.js.LICENSE.txt +1 -0
- package/477.min.js +2 -0
- package/477.min.js.LICENSE.txt +1 -0
- package/481.min.js +2 -0
- package/481.min.js.LICENSE.txt +1 -0
- package/488.min.js +2 -0
- package/488.min.js.LICENSE.txt +1 -0
- package/49.min.js +2 -0
- package/49.min.js.LICENSE.txt +1 -0
- package/509.min.js +2 -0
- package/509.min.js.LICENSE.txt +1 -0
- package/527.min.js +2 -0
- package/527.min.js.LICENSE.txt +1 -0
- package/541.min.js +2 -0
- package/541.min.js.LICENSE.txt +1 -0
- package/597.min.js +2 -0
- package/597.min.js.LICENSE.txt +1 -0
- package/633.min.js +2 -0
- package/633.min.js.LICENSE.txt +1 -0
- package/637.min.js +2 -0
- package/637.min.js.LICENSE.txt +1 -0
- package/669.min.js +2 -0
- package/669.min.js.LICENSE.txt +1 -0
- package/751.min.js +2 -0
- package/751.min.js.LICENSE.txt +1 -0
- package/802.min.js +2 -0
- package/802.min.js.LICENSE.txt +1 -0
- package/803.min.js +2 -0
- package/803.min.js.LICENSE.txt +1 -0
- package/819.min.js +2 -0
- package/819.min.js.LICENSE.txt +1 -0
- package/829.min.js +2 -0
- package/829.min.js.LICENSE.txt +1 -0
- package/890.min.js +2 -0
- package/890.min.js.LICENSE.txt +1 -0
- package/908.min.js +2 -0
- package/908.min.js.LICENSE.txt +1 -0
- package/926.min.js +2 -0
- package/926.min.js.LICENSE.txt +1 -0
- package/98.min.js +2 -0
- package/98.min.js.LICENSE.txt +1 -0
- package/browser/bundle.js +2 -3
- package/browser/index.js +18 -22
- package/browser/options.js +97 -38
- package/cjs/bundle.js +2 -7
- package/cjs/index.js +18 -26
- package/cjs/options.js +110 -55
- package/dist_browser_options_js.js +30 -0
- package/esm/bundle.js +2 -3
- package/esm/index.js +18 -22
- package/esm/options.js +97 -38
- package/node_modules_pnpm_tsparticles_basic_4_0_0-alpha_2_node_modules_tsparticles_basic_browser_index_js.js +30 -0
- package/node_modules_pnpm_tsparticles_effect-trail_4_0_0-alpha_2_node_modules_tsparticles_effect-trai-3395e5.js +30 -0
- package/node_modules_pnpm_tsparticles_effect-trail_4_0_0-alpha_2_node_modules_tsparticles_effect-trai-8c7216.js +30 -0
- package/node_modules_pnpm_tsparticles_move-base_4_0_0-alpha_2_node_modules_tsparticles_move-base_brow-7d79eb.js +40 -0
- package/node_modules_pnpm_tsparticles_move-base_4_0_0-alpha_2_node_modules_tsparticles_move-base_brow-fb148a.js +30 -0
- package/node_modules_pnpm_tsparticles_plugin-emitters-shape-square_4_0_0-alpha_2_node_modules_tsparti-cafd8c.js +30 -0
- package/node_modules_pnpm_tsparticles_plugin-emitters-shape-square_4_0_0-alpha_2_node_modules_tsparti-cf2f58.js +70 -0
- package/node_modules_pnpm_tsparticles_plugin-emitters_4_0_0-alpha_2_node_modules_tsparticles_plugin-e-122a51.js +30 -0
- package/node_modules_pnpm_tsparticles_plugin-emitters_4_0_0-alpha_2_node_modules_tsparticles_plugin-e-6bd6f8.js +50 -0
- package/node_modules_pnpm_tsparticles_plugin-hex-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--91288b.js +30 -0
- package/node_modules_pnpm_tsparticles_plugin-hex-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--d06b2a.js +30 -0
- package/node_modules_pnpm_tsparticles_plugin-hsl-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--70976c.js +30 -0
- package/node_modules_pnpm_tsparticles_plugin-hsl-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--e141e9.js +30 -0
- package/node_modules_pnpm_tsparticles_plugin-rgb-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--60c9df.js +30 -0
- package/node_modules_pnpm_tsparticles_plugin-rgb-color_4_0_0-alpha_2_node_modules_tsparticles_plugin--732407.js +30 -0
- package/node_modules_pnpm_tsparticles_plugin-sounds_4_0_0-alpha_2_node_modules_tsparticles_plugin-sou-6e6a34.js +30 -0
- package/node_modules_pnpm_tsparticles_shape-circle_4_0_0-alpha_2_node_modules_tsparticles_shape-circl-c98489.js +40 -0
- package/node_modules_pnpm_tsparticles_shape-circle_4_0_0-alpha_2_node_modules_tsparticles_shape-circl-ce96e8.js +30 -0
- package/node_modules_pnpm_tsparticles_shape-line_4_0_0-alpha_2_node_modules_tsparticles_shape-line_br-01d607.js +30 -0
- package/node_modules_pnpm_tsparticles_shape-line_4_0_0-alpha_2_node_modules_tsparticles_shape-line_br-eb7b65.js +40 -0
- package/node_modules_pnpm_tsparticles_updater-color_4_0_0-alpha_2_node_modules_tsparticles_updater-co-210bd6.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-color_4_0_0-alpha_2_node_modules_tsparticles_updater-co-6ff909.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-destroy_4_0_0-alpha_2_node_modules_tsparticles_updater--cef2d9.js +100 -0
- package/node_modules_pnpm_tsparticles_updater-destroy_4_0_0-alpha_2_node_modules_tsparticles_updater--f71d4c.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-life_4_0_0-alpha_2_node_modules_tsparticles_updater-lif-50f821.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-life_4_0_0-alpha_2_node_modules_tsparticles_updater-lif-dbf90f.js +70 -0
- package/node_modules_pnpm_tsparticles_updater-opacity_4_0_0-alpha_2_node_modules_tsparticles_updater--4e8c57.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-opacity_4_0_0-alpha_2_node_modules_tsparticles_updater--ac14ff.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-out-modes_4_0_0-alpha_2_node_modules_tsparticles_update-cd317f.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-rotate_4_0_0-alpha_2_node_modules_tsparticles_updater-r-0de212.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-rotate_4_0_0-alpha_2_node_modules_tsparticles_updater-r-e97427.js +50 -0
- package/node_modules_pnpm_tsparticles_updater-size_4_0_0-alpha_2_node_modules_tsparticles_updater-siz-53e0fe.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-size_4_0_0-alpha_2_node_modules_tsparticles_updater-siz-aaa117.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-stroke-color_4_0_0-alpha_2_node_modules_tsparticles_upd-74b323.js +30 -0
- package/node_modules_pnpm_tsparticles_updater-stroke-color_4_0_0-alpha_2_node_modules_tsparticles_upd-ca004c.js +30 -0
- package/package.json +30 -13
- package/report.html +5 -4
- package/tsparticles.preset.fireworks.bundle.js +774 -2583
- package/tsparticles.preset.fireworks.bundle.min.js +1 -1
- package/tsparticles.preset.fireworks.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.preset.fireworks.js +306 -57
- package/tsparticles.preset.fireworks.min.js +1 -1
- package/tsparticles.preset.fireworks.min.js.LICENSE.txt +1 -1
- package/types/bundle.d.ts +2 -3
- package/types/index.d.ts +1 -1
- package/types/options.d.ts +3 -2
- package/umd/bundle.js +2 -2
- package/umd/index.js +54 -25
- package/umd/options.js +98 -39
- package/vendors-node_modules_pnpm_tsparticles_engine_4_0_0-alpha_2_node_modules_tsparticles_engine_br-9c0a0f.js +100 -0
- package/vendors-node_modules_pnpm_tsparticles_plugin-emitters_4_0_0-alpha_2_node_modules_tsparticles_-1e60b5.js +110 -0
- package/vendors-node_modules_pnpm_tsparticles_plugin-sounds_4_0_0-alpha_2_node_modules_tsparticles_pl-a36589.js +140 -0
- package/vendors-node_modules_pnpm_tsparticles_updater-out-modes_4_0_0-alpha_2_node_modules_tsparticle-124574.js +80 -0
package/browser/index.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { loadDestroyUpdater }
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
await loadLifeUpdater(engine, false);
|
|
20
|
-
await loadStrokeColorUpdater(engine, false);
|
|
21
|
-
await engine.addPreset("fireworks", initOptions(engine), 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
|
}
|
package/browser/options.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { DestroyType, EventType, MoveDirection, OutMode, StartValueType, rgbToHsl, setRangeValue,
|
|
2
|
-
export
|
|
1
|
+
import { DestroyType, EventType, MoveDirection, OutMode, StartValueType, defaultAlpha, none, rgbToHsl, setRangeValue, } from "@tsparticles/engine";
|
|
2
|
+
export const presetName = "fireworks";
|
|
3
|
+
export function initOptions() {
|
|
3
4
|
const explodeSoundCheck = (args) => {
|
|
4
5
|
const data = args.data;
|
|
5
|
-
return data.particle.
|
|
6
|
+
return data.particle.options.move.gravity.inverse;
|
|
6
7
|
}, fixRange = (value, min, max) => {
|
|
7
8
|
const minValue = 0, diffSMax = value.max > max ? value.max - max : minValue;
|
|
8
9
|
let res = setRangeValue(value);
|
|
@@ -14,15 +15,74 @@ export function initOptions(engine) {
|
|
|
14
15
|
res = setRangeValue(minValue, value.max + diffSMin);
|
|
15
16
|
}
|
|
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
|
+
};
|
|
17
46
|
}, fireworksOptions = [
|
|
18
|
-
"#
|
|
19
|
-
"#
|
|
20
|
-
"#
|
|
21
|
-
"#
|
|
22
|
-
"#
|
|
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",
|
|
23
83
|
]
|
|
24
84
|
.map(color => {
|
|
25
|
-
const rgb =
|
|
85
|
+
const rgb = hexToRgba(color);
|
|
26
86
|
if (!rgb) {
|
|
27
87
|
return undefined;
|
|
28
88
|
}
|
|
@@ -63,6 +123,17 @@ export function initOptions(engine) {
|
|
|
63
123
|
shape: {
|
|
64
124
|
type: "circle",
|
|
65
125
|
},
|
|
126
|
+
effect: {
|
|
127
|
+
type: "trail",
|
|
128
|
+
options: {
|
|
129
|
+
trail: {
|
|
130
|
+
length: {
|
|
131
|
+
min: 5,
|
|
132
|
+
max: 10,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
66
137
|
size: {
|
|
67
138
|
value: { min: 1, max: 2 },
|
|
68
139
|
animation: {
|
|
@@ -106,13 +177,8 @@ export function initOptions(engine) {
|
|
|
106
177
|
fpsLimit: 120,
|
|
107
178
|
emitters: {
|
|
108
179
|
direction: MoveDirection.top,
|
|
109
|
-
life: {
|
|
110
|
-
count: 0,
|
|
111
|
-
duration: 0.1,
|
|
112
|
-
delay: 0.1,
|
|
113
|
-
},
|
|
114
180
|
rate: {
|
|
115
|
-
delay: 0.
|
|
181
|
+
delay: 0.3,
|
|
116
182
|
quantity: 1,
|
|
117
183
|
},
|
|
118
184
|
size: {
|
|
@@ -131,7 +197,7 @@ export function initOptions(engine) {
|
|
|
131
197
|
destroy: {
|
|
132
198
|
mode: "split",
|
|
133
199
|
bounds: {
|
|
134
|
-
top: { min:
|
|
200
|
+
top: { min: 15, max: 35 },
|
|
135
201
|
},
|
|
136
202
|
split: {
|
|
137
203
|
sizeOffset: false,
|
|
@@ -149,30 +215,30 @@ export function initOptions(engine) {
|
|
|
149
215
|
count: 1,
|
|
150
216
|
},
|
|
151
217
|
shape: {
|
|
152
|
-
type: "
|
|
218
|
+
type: "circle",
|
|
153
219
|
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
220
|
+
effect: {
|
|
221
|
+
type: "trail",
|
|
222
|
+
options: {
|
|
223
|
+
trail: {
|
|
224
|
+
length: {
|
|
225
|
+
min: 5,
|
|
226
|
+
max: 15,
|
|
227
|
+
},
|
|
228
|
+
minWidth: 1,
|
|
229
|
+
maxWidth: 1,
|
|
230
|
+
},
|
|
165
231
|
},
|
|
166
232
|
},
|
|
233
|
+
size: {
|
|
234
|
+
value: 1,
|
|
235
|
+
},
|
|
167
236
|
stroke: {
|
|
168
237
|
color: {
|
|
169
238
|
value: "#ffffff",
|
|
170
239
|
},
|
|
171
240
|
width: 1,
|
|
172
241
|
},
|
|
173
|
-
rotate: {
|
|
174
|
-
path: true,
|
|
175
|
-
},
|
|
176
242
|
move: {
|
|
177
243
|
enable: true,
|
|
178
244
|
gravity: {
|
|
@@ -189,13 +255,6 @@ export function initOptions(engine) {
|
|
|
189
255
|
default: OutMode.destroy,
|
|
190
256
|
top: OutMode.none,
|
|
191
257
|
},
|
|
192
|
-
trail: {
|
|
193
|
-
fill: {
|
|
194
|
-
color: "#000",
|
|
195
|
-
},
|
|
196
|
-
enable: true,
|
|
197
|
-
length: 10,
|
|
198
|
-
},
|
|
199
258
|
},
|
|
200
259
|
},
|
|
201
260
|
sounds: {
|
package/cjs/bundle.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.tsParticles = exports.loadFireworksPreset = void 0;
|
|
4
|
-
const index_js_1 = require("./index.js");
|
|
5
|
-
Object.defineProperty(exports, "loadFireworksPreset", { enumerable: true, get: function () { return index_js_1.loadFireworksPreset; } });
|
|
6
|
-
const engine_1 = require("@tsparticles/engine");
|
|
7
|
-
Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
|
|
1
|
+
export { loadFireworksPreset } from "./index.js";
|
|
2
|
+
export { tsParticles } from "@tsparticles/engine";
|
package/cjs/index.js
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
await (0, shape_line_1.loadLineShape)(engine, false);
|
|
20
|
-
await (0, updater_rotate_1.loadRotateUpdater)(engine, false);
|
|
21
|
-
await (0, updater_destroy_1.loadDestroyUpdater)(engine, false);
|
|
22
|
-
await (0, updater_life_1.loadLifeUpdater)(engine, false);
|
|
23
|
-
await (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine, false);
|
|
24
|
-
await engine.addPreset("fireworks", (0, options_js_1.initOptions)(engine), false);
|
|
25
|
-
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
|
+
});
|
|
26
19
|
}
|
|
27
|
-
exports.loadFireworksPreset = loadFireworksPreset;
|
package/cjs/options.js
CHANGED
|
@@ -1,35 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
function initOptions(engine) {
|
|
1
|
+
import { DestroyType, EventType, MoveDirection, OutMode, StartValueType, defaultAlpha, none, rgbToHsl, setRangeValue, } from "@tsparticles/engine";
|
|
2
|
+
export const presetName = "fireworks";
|
|
3
|
+
export function initOptions() {
|
|
6
4
|
const explodeSoundCheck = (args) => {
|
|
7
5
|
const data = args.data;
|
|
8
|
-
return data.particle.
|
|
6
|
+
return data.particle.options.move.gravity.inverse;
|
|
9
7
|
}, fixRange = (value, min, max) => {
|
|
10
8
|
const minValue = 0, diffSMax = value.max > max ? value.max - max : minValue;
|
|
11
|
-
let res =
|
|
9
|
+
let res = setRangeValue(value);
|
|
12
10
|
if (diffSMax) {
|
|
13
|
-
res =
|
|
11
|
+
res = setRangeValue(value.min - diffSMax, max);
|
|
14
12
|
}
|
|
15
13
|
const diffSMin = value.min < min ? value.min : minValue;
|
|
16
14
|
if (diffSMin) {
|
|
17
|
-
res =
|
|
15
|
+
res = setRangeValue(minValue, value.max + diffSMin);
|
|
18
16
|
}
|
|
19
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
|
+
};
|
|
20
46
|
}, fireworksOptions = [
|
|
21
|
-
"#
|
|
22
|
-
"#
|
|
23
|
-
"#
|
|
24
|
-
"#
|
|
25
|
-
"#
|
|
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",
|
|
26
83
|
]
|
|
27
84
|
.map(color => {
|
|
28
|
-
const rgb = (
|
|
85
|
+
const rgb = hexToRgba(color);
|
|
29
86
|
if (!rgb) {
|
|
30
87
|
return undefined;
|
|
31
88
|
}
|
|
32
|
-
const hsl =
|
|
89
|
+
const hsl = rgbToHsl(rgb), sOffset = 30, lOffset = 30, sBounds = {
|
|
33
90
|
min: 0,
|
|
34
91
|
max: 100,
|
|
35
92
|
}, lBounds = {
|
|
@@ -59,13 +116,24 @@ function initOptions(engine) {
|
|
|
59
116
|
enable: true,
|
|
60
117
|
speed: 0.7,
|
|
61
118
|
sync: false,
|
|
62
|
-
startValue:
|
|
63
|
-
destroy:
|
|
119
|
+
startValue: StartValueType.max,
|
|
120
|
+
destroy: DestroyType.min,
|
|
64
121
|
},
|
|
65
122
|
},
|
|
66
123
|
shape: {
|
|
67
124
|
type: "circle",
|
|
68
125
|
},
|
|
126
|
+
effect: {
|
|
127
|
+
type: "trail",
|
|
128
|
+
options: {
|
|
129
|
+
trail: {
|
|
130
|
+
length: {
|
|
131
|
+
min: 5,
|
|
132
|
+
max: 10,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
69
137
|
size: {
|
|
70
138
|
value: { min: 1, max: 2 },
|
|
71
139
|
animation: {
|
|
@@ -73,8 +141,8 @@ function initOptions(engine) {
|
|
|
73
141
|
speed: 5,
|
|
74
142
|
count: 1,
|
|
75
143
|
sync: false,
|
|
76
|
-
startValue:
|
|
77
|
-
destroy:
|
|
144
|
+
startValue: StartValueType.min,
|
|
145
|
+
destroy: DestroyType.none,
|
|
78
146
|
},
|
|
79
147
|
},
|
|
80
148
|
life: {
|
|
@@ -96,7 +164,7 @@ function initOptions(engine) {
|
|
|
96
164
|
},
|
|
97
165
|
speed: { min: 5, max: 15 },
|
|
98
166
|
direction: "none",
|
|
99
|
-
outModes:
|
|
167
|
+
outModes: OutMode.destroy,
|
|
100
168
|
},
|
|
101
169
|
};
|
|
102
170
|
})
|
|
@@ -108,14 +176,9 @@ function initOptions(engine) {
|
|
|
108
176
|
},
|
|
109
177
|
fpsLimit: 120,
|
|
110
178
|
emitters: {
|
|
111
|
-
direction:
|
|
112
|
-
life: {
|
|
113
|
-
count: 0,
|
|
114
|
-
duration: 0.1,
|
|
115
|
-
delay: 0.1,
|
|
116
|
-
},
|
|
179
|
+
direction: MoveDirection.top,
|
|
117
180
|
rate: {
|
|
118
|
-
delay: 0.
|
|
181
|
+
delay: 0.3,
|
|
119
182
|
quantity: 1,
|
|
120
183
|
},
|
|
121
184
|
size: {
|
|
@@ -134,7 +197,7 @@ function initOptions(engine) {
|
|
|
134
197
|
destroy: {
|
|
135
198
|
mode: "split",
|
|
136
199
|
bounds: {
|
|
137
|
-
top: { min:
|
|
200
|
+
top: { min: 15, max: 35 },
|
|
138
201
|
},
|
|
139
202
|
split: {
|
|
140
203
|
sizeOffset: false,
|
|
@@ -152,30 +215,30 @@ function initOptions(engine) {
|
|
|
152
215
|
count: 1,
|
|
153
216
|
},
|
|
154
217
|
shape: {
|
|
155
|
-
type: "
|
|
218
|
+
type: "circle",
|
|
156
219
|
},
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
220
|
+
effect: {
|
|
221
|
+
type: "trail",
|
|
222
|
+
options: {
|
|
223
|
+
trail: {
|
|
224
|
+
length: {
|
|
225
|
+
min: 5,
|
|
226
|
+
max: 15,
|
|
227
|
+
},
|
|
228
|
+
minWidth: 1,
|
|
229
|
+
maxWidth: 1,
|
|
230
|
+
},
|
|
168
231
|
},
|
|
169
232
|
},
|
|
233
|
+
size: {
|
|
234
|
+
value: 1,
|
|
235
|
+
},
|
|
170
236
|
stroke: {
|
|
171
237
|
color: {
|
|
172
238
|
value: "#ffffff",
|
|
173
239
|
},
|
|
174
240
|
width: 1,
|
|
175
241
|
},
|
|
176
|
-
rotate: {
|
|
177
|
-
path: true,
|
|
178
|
-
},
|
|
179
242
|
move: {
|
|
180
243
|
enable: true,
|
|
181
244
|
gravity: {
|
|
@@ -189,15 +252,8 @@ function initOptions(engine) {
|
|
|
189
252
|
max: 20,
|
|
190
253
|
},
|
|
191
254
|
outModes: {
|
|
192
|
-
default:
|
|
193
|
-
top:
|
|
194
|
-
},
|
|
195
|
-
trail: {
|
|
196
|
-
fill: {
|
|
197
|
-
color: "#000",
|
|
198
|
-
},
|
|
199
|
-
enable: true,
|
|
200
|
-
length: 10,
|
|
255
|
+
default: OutMode.destroy,
|
|
256
|
+
top: OutMode.none,
|
|
201
257
|
},
|
|
202
258
|
},
|
|
203
259
|
},
|
|
@@ -205,7 +261,7 @@ function initOptions(engine) {
|
|
|
205
261
|
enable: true,
|
|
206
262
|
events: [
|
|
207
263
|
{
|
|
208
|
-
event:
|
|
264
|
+
event: EventType.particleRemoved,
|
|
209
265
|
filter: explodeSoundCheck,
|
|
210
266
|
audio: [
|
|
211
267
|
"https://particles.js.org/audio/explosion0.mp3",
|
|
@@ -218,4 +274,3 @@ function initOptions(engine) {
|
|
|
218
274
|
},
|
|
219
275
|
};
|
|
220
276
|
}
|
|
221
|
-
exports.initOptions = initOptions;
|
|
@@ -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.1
|
|
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 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 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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
import { loadDestroyUpdater }
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
await loadLifeUpdater(engine, false);
|
|
20
|
-
await loadStrokeColorUpdater(engine, false);
|
|
21
|
-
await engine.addPreset("fireworks", initOptions(engine), 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
|
}
|