@tsparticles/fireworks 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/browser/FireworkOptions.js +63 -0
- package/browser/IFireworkOptions.js +1 -0
- package/browser/bundle.js +2 -0
- package/browser/fireworks.js +264 -0
- package/browser/index.js +1 -0
- package/cjs/FireworkOptions.js +67 -0
- package/cjs/IFireworkOptions.js +2 -0
- package/cjs/bundle.js +18 -0
- package/cjs/fireworks.js +268 -0
- package/cjs/index.js +17 -0
- package/esm/FireworkOptions.js +63 -0
- package/esm/IFireworkOptions.js +1 -0
- package/esm/bundle.js +2 -0
- package/esm/fireworks.js +264 -0
- package/esm/index.js +1 -0
- package/package.json +103 -0
- package/report.html +39 -0
- package/tsparticles.fireworks.bundle.js +8752 -0
- package/tsparticles.fireworks.bundle.min.js +2 -0
- package/tsparticles.fireworks.bundle.min.js.LICENSE.txt +1 -0
- package/tsparticles.fireworks.js +717 -0
- package/tsparticles.fireworks.min.js +2 -0
- package/tsparticles.fireworks.min.js.LICENSE.txt +1 -0
- package/types/FireworkOptions.d.ts +15 -0
- package/types/IFireworkOptions.d.ts +12 -0
- package/types/bundle.d.ts +2 -0
- package/types/fireworks.d.ts +21 -0
- package/types/index.d.ts +4 -0
- package/umd/FireworkOptions.js +77 -0
- package/umd/IFireworkOptions.js +12 -0
- package/umd/bundle.js +28 -0
- package/umd/fireworks.js +278 -0
- package/umd/index.js +27 -0
package/cjs/fireworks.js
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fireworks = void 0;
|
|
4
|
+
const engine_1 = require("@tsparticles/engine");
|
|
5
|
+
const FireworkOptions_1 = require("./FireworkOptions");
|
|
6
|
+
const basic_1 = require("@tsparticles/basic");
|
|
7
|
+
const updater_destroy_1 = require("@tsparticles/updater-destroy");
|
|
8
|
+
const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
|
|
9
|
+
const updater_life_1 = require("@tsparticles/updater-life");
|
|
10
|
+
const shape_line_1 = require("@tsparticles/shape-line");
|
|
11
|
+
const updater_rotate_1 = require("@tsparticles/updater-rotate");
|
|
12
|
+
const plugin_sounds_1 = require("@tsparticles/plugin-sounds");
|
|
13
|
+
const updater_stroke_color_1 = require("@tsparticles/updater-stroke-color");
|
|
14
|
+
let initialized = false;
|
|
15
|
+
let initializing = false;
|
|
16
|
+
const explodeSoundCheck = (args) => {
|
|
17
|
+
const data = args.data;
|
|
18
|
+
return data.particle.shape === "line";
|
|
19
|
+
};
|
|
20
|
+
class FireworksInstance {
|
|
21
|
+
constructor(container) {
|
|
22
|
+
this._container = container;
|
|
23
|
+
}
|
|
24
|
+
pause() {
|
|
25
|
+
this._container.pause();
|
|
26
|
+
}
|
|
27
|
+
play() {
|
|
28
|
+
this._container.play();
|
|
29
|
+
}
|
|
30
|
+
stop() {
|
|
31
|
+
this._container.stop();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function initPlugins() {
|
|
35
|
+
if (initialized) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (initializing) {
|
|
39
|
+
return new Promise((resolve) => {
|
|
40
|
+
const interval = setInterval(() => {
|
|
41
|
+
if (!initialized) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
clearInterval(interval);
|
|
45
|
+
resolve();
|
|
46
|
+
}, 100);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
initializing = true;
|
|
50
|
+
await (0, plugin_emitters_1.loadEmittersPlugin)(engine_1.tsParticles, false);
|
|
51
|
+
await (0, plugin_sounds_1.loadSoundsPlugin)(engine_1.tsParticles, false);
|
|
52
|
+
await (0, shape_line_1.loadLineShape)(engine_1.tsParticles, false);
|
|
53
|
+
await (0, updater_rotate_1.loadRotateUpdater)(engine_1.tsParticles, false);
|
|
54
|
+
await (0, updater_destroy_1.loadDestroyUpdater)(engine_1.tsParticles, false);
|
|
55
|
+
await (0, updater_life_1.loadLifeUpdater)(engine_1.tsParticles, false);
|
|
56
|
+
await (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine_1.tsParticles, false);
|
|
57
|
+
await (0, basic_1.loadBasic)(engine_1.tsParticles, false);
|
|
58
|
+
initializing = false;
|
|
59
|
+
initialized = true;
|
|
60
|
+
}
|
|
61
|
+
async function fireworks(idOrOptions, sourceOptions) {
|
|
62
|
+
await initPlugins();
|
|
63
|
+
let id;
|
|
64
|
+
const options = new FireworkOptions_1.FireworkOptions();
|
|
65
|
+
if ((0, engine_1.isString)(idOrOptions)) {
|
|
66
|
+
id = idOrOptions;
|
|
67
|
+
options.load(sourceOptions);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
id = "fireworks";
|
|
71
|
+
options.load(idOrOptions);
|
|
72
|
+
}
|
|
73
|
+
const particlesOptions = {
|
|
74
|
+
detectRetina: true,
|
|
75
|
+
background: {
|
|
76
|
+
color: "#000",
|
|
77
|
+
},
|
|
78
|
+
fpsLimit: 120,
|
|
79
|
+
emitters: {
|
|
80
|
+
direction: "top",
|
|
81
|
+
life: {
|
|
82
|
+
count: 0,
|
|
83
|
+
duration: 0.1,
|
|
84
|
+
delay: 0.1,
|
|
85
|
+
},
|
|
86
|
+
rate: {
|
|
87
|
+
delay: (0, engine_1.isNumber)(options.rate)
|
|
88
|
+
? 1 / options.rate
|
|
89
|
+
: { min: 1 / (0, engine_1.getRangeMin)(options.rate), max: 1 / (0, engine_1.getRangeMax)(options.rate) },
|
|
90
|
+
quantity: 1,
|
|
91
|
+
},
|
|
92
|
+
size: {
|
|
93
|
+
width: 100,
|
|
94
|
+
height: 0,
|
|
95
|
+
},
|
|
96
|
+
position: {
|
|
97
|
+
y: 100,
|
|
98
|
+
x: 50,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
particles: {
|
|
102
|
+
number: {
|
|
103
|
+
value: 0,
|
|
104
|
+
},
|
|
105
|
+
color: {
|
|
106
|
+
value: options.colors,
|
|
107
|
+
},
|
|
108
|
+
destroy: {
|
|
109
|
+
mode: "split",
|
|
110
|
+
bounds: {
|
|
111
|
+
top: (0, engine_1.setRangeValue)(options.minHeight),
|
|
112
|
+
},
|
|
113
|
+
split: {
|
|
114
|
+
sizeOffset: false,
|
|
115
|
+
count: 1,
|
|
116
|
+
factor: {
|
|
117
|
+
value: 0.333333,
|
|
118
|
+
},
|
|
119
|
+
rate: {
|
|
120
|
+
value: options.splitCount,
|
|
121
|
+
},
|
|
122
|
+
colorOffset: {
|
|
123
|
+
s: options.saturation,
|
|
124
|
+
l: options.brightness,
|
|
125
|
+
},
|
|
126
|
+
particles: {
|
|
127
|
+
stroke: {
|
|
128
|
+
width: 0,
|
|
129
|
+
},
|
|
130
|
+
number: {
|
|
131
|
+
value: 0,
|
|
132
|
+
},
|
|
133
|
+
opacity: {
|
|
134
|
+
value: {
|
|
135
|
+
min: 0.1,
|
|
136
|
+
max: 1,
|
|
137
|
+
},
|
|
138
|
+
animation: {
|
|
139
|
+
enable: true,
|
|
140
|
+
speed: 0.7,
|
|
141
|
+
sync: false,
|
|
142
|
+
startValue: "max",
|
|
143
|
+
destroy: "min",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
shape: {
|
|
147
|
+
type: "circle",
|
|
148
|
+
},
|
|
149
|
+
size: {
|
|
150
|
+
value: { min: 1, max: 2 },
|
|
151
|
+
animation: {
|
|
152
|
+
enable: true,
|
|
153
|
+
speed: 5,
|
|
154
|
+
count: 1,
|
|
155
|
+
sync: false,
|
|
156
|
+
startValue: "min",
|
|
157
|
+
destroy: "none",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
life: {
|
|
161
|
+
count: 1,
|
|
162
|
+
duration: {
|
|
163
|
+
value: {
|
|
164
|
+
min: 0.25,
|
|
165
|
+
max: 0.5,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
move: {
|
|
170
|
+
decay: { min: 0.05, max: 0.1 },
|
|
171
|
+
enable: true,
|
|
172
|
+
gravity: {
|
|
173
|
+
enable: true,
|
|
174
|
+
inverse: false,
|
|
175
|
+
acceleration: (0, engine_1.setRangeValue)(options.gravity),
|
|
176
|
+
},
|
|
177
|
+
speed: (0, engine_1.setRangeValue)(options.speed),
|
|
178
|
+
direction: "none",
|
|
179
|
+
outModes: "destroy",
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
life: {
|
|
185
|
+
count: 1,
|
|
186
|
+
},
|
|
187
|
+
shape: {
|
|
188
|
+
type: "line",
|
|
189
|
+
options: {
|
|
190
|
+
line: {
|
|
191
|
+
cap: "round",
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
size: {
|
|
196
|
+
value: {
|
|
197
|
+
min: 0.1,
|
|
198
|
+
max: 50,
|
|
199
|
+
},
|
|
200
|
+
animation: {
|
|
201
|
+
enable: true,
|
|
202
|
+
sync: true,
|
|
203
|
+
speed: 90,
|
|
204
|
+
startValue: "max",
|
|
205
|
+
destroy: "min",
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
stroke: {
|
|
209
|
+
color: {
|
|
210
|
+
value: "#ffffff",
|
|
211
|
+
},
|
|
212
|
+
width: 0.5,
|
|
213
|
+
},
|
|
214
|
+
rotate: {
|
|
215
|
+
path: true,
|
|
216
|
+
},
|
|
217
|
+
move: {
|
|
218
|
+
enable: true,
|
|
219
|
+
gravity: {
|
|
220
|
+
acceleration: 15,
|
|
221
|
+
enable: true,
|
|
222
|
+
inverse: true,
|
|
223
|
+
maxSpeed: 100,
|
|
224
|
+
},
|
|
225
|
+
speed: {
|
|
226
|
+
min: 10,
|
|
227
|
+
max: 20,
|
|
228
|
+
},
|
|
229
|
+
outModes: {
|
|
230
|
+
default: "destroy",
|
|
231
|
+
top: "none",
|
|
232
|
+
},
|
|
233
|
+
trail: {
|
|
234
|
+
fill: {
|
|
235
|
+
color: "#000",
|
|
236
|
+
},
|
|
237
|
+
enable: true,
|
|
238
|
+
length: 10,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
sounds: {
|
|
243
|
+
enable: options.sounds,
|
|
244
|
+
events: [
|
|
245
|
+
{
|
|
246
|
+
event: "particleRemoved",
|
|
247
|
+
filter: explodeSoundCheck,
|
|
248
|
+
audio: [
|
|
249
|
+
"https://particles.js.org/audio/explosion0.mp3",
|
|
250
|
+
"https://particles.js.org/audio/explosion1.mp3",
|
|
251
|
+
"https://particles.js.org/audio/explosion2.mp3",
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
volume: 50,
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
const container = await engine_1.tsParticles.load({ id, options: particlesOptions });
|
|
259
|
+
if (!container) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
return new FireworksInstance(container);
|
|
263
|
+
}
|
|
264
|
+
exports.fireworks = fireworks;
|
|
265
|
+
fireworks.version = engine_1.tsParticles.version;
|
|
266
|
+
if (!(0, engine_1.isSsr)()) {
|
|
267
|
+
window.fireworks = fireworks;
|
|
268
|
+
}
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./fireworks"), exports);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { isArray, setRangeValue, } from "@tsparticles/engine";
|
|
2
|
+
export class FireworkOptions {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.brightness = {
|
|
5
|
+
min: -30,
|
|
6
|
+
max: 30,
|
|
7
|
+
};
|
|
8
|
+
this.colors = ["#ff595e", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"];
|
|
9
|
+
this.gravity = 5;
|
|
10
|
+
this.minHeight = {
|
|
11
|
+
min: 10,
|
|
12
|
+
max: 30,
|
|
13
|
+
};
|
|
14
|
+
this.rate = 20;
|
|
15
|
+
this.saturation = {
|
|
16
|
+
min: -30,
|
|
17
|
+
max: 30,
|
|
18
|
+
};
|
|
19
|
+
this.sounds = true;
|
|
20
|
+
this.speed = { min: 5, max: 15 };
|
|
21
|
+
this.splitCount = {
|
|
22
|
+
min: 75,
|
|
23
|
+
max: 150,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
load(data) {
|
|
27
|
+
if (!data) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (data.colors !== undefined) {
|
|
31
|
+
if (isArray(data.colors)) {
|
|
32
|
+
this.colors = [...data.colors];
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.colors = data.colors;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (data.brightness !== undefined) {
|
|
39
|
+
this.brightness = setRangeValue(data.brightness);
|
|
40
|
+
}
|
|
41
|
+
if (data.gravity !== undefined) {
|
|
42
|
+
this.gravity = setRangeValue(data.gravity);
|
|
43
|
+
}
|
|
44
|
+
if (data.minHeight !== undefined) {
|
|
45
|
+
this.minHeight = setRangeValue(data.minHeight);
|
|
46
|
+
}
|
|
47
|
+
if (data.rate !== undefined) {
|
|
48
|
+
this.rate = setRangeValue(data.rate);
|
|
49
|
+
}
|
|
50
|
+
if (data.saturation !== undefined) {
|
|
51
|
+
this.saturation = setRangeValue(data.saturation);
|
|
52
|
+
}
|
|
53
|
+
if (data.sounds !== undefined) {
|
|
54
|
+
this.sounds = data.sounds;
|
|
55
|
+
}
|
|
56
|
+
if (data.speed !== undefined) {
|
|
57
|
+
this.speed = setRangeValue(data.speed);
|
|
58
|
+
}
|
|
59
|
+
if (data.splitCount !== undefined) {
|
|
60
|
+
this.splitCount = setRangeValue(data.splitCount);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/bundle.js
ADDED
package/esm/fireworks.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { getRangeMax, getRangeMin, isNumber, isSsr, isString, setRangeValue, tsParticles, } from "@tsparticles/engine";
|
|
2
|
+
import { FireworkOptions } from "./FireworkOptions";
|
|
3
|
+
import { loadBasic } from "@tsparticles/basic";
|
|
4
|
+
import { loadDestroyUpdater } from "@tsparticles/updater-destroy";
|
|
5
|
+
import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
|
|
6
|
+
import { loadLifeUpdater } from "@tsparticles/updater-life";
|
|
7
|
+
import { loadLineShape } from "@tsparticles/shape-line";
|
|
8
|
+
import { loadRotateUpdater } from "@tsparticles/updater-rotate";
|
|
9
|
+
import { loadSoundsPlugin } from "@tsparticles/plugin-sounds";
|
|
10
|
+
import { loadStrokeColorUpdater } from "@tsparticles/updater-stroke-color";
|
|
11
|
+
let initialized = false;
|
|
12
|
+
let initializing = false;
|
|
13
|
+
const explodeSoundCheck = (args) => {
|
|
14
|
+
const data = args.data;
|
|
15
|
+
return data.particle.shape === "line";
|
|
16
|
+
};
|
|
17
|
+
class FireworksInstance {
|
|
18
|
+
constructor(container) {
|
|
19
|
+
this._container = container;
|
|
20
|
+
}
|
|
21
|
+
pause() {
|
|
22
|
+
this._container.pause();
|
|
23
|
+
}
|
|
24
|
+
play() {
|
|
25
|
+
this._container.play();
|
|
26
|
+
}
|
|
27
|
+
stop() {
|
|
28
|
+
this._container.stop();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function initPlugins() {
|
|
32
|
+
if (initialized) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (initializing) {
|
|
36
|
+
return new Promise((resolve) => {
|
|
37
|
+
const interval = setInterval(() => {
|
|
38
|
+
if (!initialized) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
clearInterval(interval);
|
|
42
|
+
resolve();
|
|
43
|
+
}, 100);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
initializing = true;
|
|
47
|
+
await loadEmittersPlugin(tsParticles, false);
|
|
48
|
+
await loadSoundsPlugin(tsParticles, false);
|
|
49
|
+
await loadLineShape(tsParticles, false);
|
|
50
|
+
await loadRotateUpdater(tsParticles, false);
|
|
51
|
+
await loadDestroyUpdater(tsParticles, false);
|
|
52
|
+
await loadLifeUpdater(tsParticles, false);
|
|
53
|
+
await loadStrokeColorUpdater(tsParticles, false);
|
|
54
|
+
await loadBasic(tsParticles, false);
|
|
55
|
+
initializing = false;
|
|
56
|
+
initialized = true;
|
|
57
|
+
}
|
|
58
|
+
export async function fireworks(idOrOptions, sourceOptions) {
|
|
59
|
+
await initPlugins();
|
|
60
|
+
let id;
|
|
61
|
+
const options = new FireworkOptions();
|
|
62
|
+
if (isString(idOrOptions)) {
|
|
63
|
+
id = idOrOptions;
|
|
64
|
+
options.load(sourceOptions);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
id = "fireworks";
|
|
68
|
+
options.load(idOrOptions);
|
|
69
|
+
}
|
|
70
|
+
const particlesOptions = {
|
|
71
|
+
detectRetina: true,
|
|
72
|
+
background: {
|
|
73
|
+
color: "#000",
|
|
74
|
+
},
|
|
75
|
+
fpsLimit: 120,
|
|
76
|
+
emitters: {
|
|
77
|
+
direction: "top",
|
|
78
|
+
life: {
|
|
79
|
+
count: 0,
|
|
80
|
+
duration: 0.1,
|
|
81
|
+
delay: 0.1,
|
|
82
|
+
},
|
|
83
|
+
rate: {
|
|
84
|
+
delay: isNumber(options.rate)
|
|
85
|
+
? 1 / options.rate
|
|
86
|
+
: { min: 1 / getRangeMin(options.rate), max: 1 / getRangeMax(options.rate) },
|
|
87
|
+
quantity: 1,
|
|
88
|
+
},
|
|
89
|
+
size: {
|
|
90
|
+
width: 100,
|
|
91
|
+
height: 0,
|
|
92
|
+
},
|
|
93
|
+
position: {
|
|
94
|
+
y: 100,
|
|
95
|
+
x: 50,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
particles: {
|
|
99
|
+
number: {
|
|
100
|
+
value: 0,
|
|
101
|
+
},
|
|
102
|
+
color: {
|
|
103
|
+
value: options.colors,
|
|
104
|
+
},
|
|
105
|
+
destroy: {
|
|
106
|
+
mode: "split",
|
|
107
|
+
bounds: {
|
|
108
|
+
top: setRangeValue(options.minHeight),
|
|
109
|
+
},
|
|
110
|
+
split: {
|
|
111
|
+
sizeOffset: false,
|
|
112
|
+
count: 1,
|
|
113
|
+
factor: {
|
|
114
|
+
value: 0.333333,
|
|
115
|
+
},
|
|
116
|
+
rate: {
|
|
117
|
+
value: options.splitCount,
|
|
118
|
+
},
|
|
119
|
+
colorOffset: {
|
|
120
|
+
s: options.saturation,
|
|
121
|
+
l: options.brightness,
|
|
122
|
+
},
|
|
123
|
+
particles: {
|
|
124
|
+
stroke: {
|
|
125
|
+
width: 0,
|
|
126
|
+
},
|
|
127
|
+
number: {
|
|
128
|
+
value: 0,
|
|
129
|
+
},
|
|
130
|
+
opacity: {
|
|
131
|
+
value: {
|
|
132
|
+
min: 0.1,
|
|
133
|
+
max: 1,
|
|
134
|
+
},
|
|
135
|
+
animation: {
|
|
136
|
+
enable: true,
|
|
137
|
+
speed: 0.7,
|
|
138
|
+
sync: false,
|
|
139
|
+
startValue: "max",
|
|
140
|
+
destroy: "min",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
shape: {
|
|
144
|
+
type: "circle",
|
|
145
|
+
},
|
|
146
|
+
size: {
|
|
147
|
+
value: { min: 1, max: 2 },
|
|
148
|
+
animation: {
|
|
149
|
+
enable: true,
|
|
150
|
+
speed: 5,
|
|
151
|
+
count: 1,
|
|
152
|
+
sync: false,
|
|
153
|
+
startValue: "min",
|
|
154
|
+
destroy: "none",
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
life: {
|
|
158
|
+
count: 1,
|
|
159
|
+
duration: {
|
|
160
|
+
value: {
|
|
161
|
+
min: 0.25,
|
|
162
|
+
max: 0.5,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
move: {
|
|
167
|
+
decay: { min: 0.05, max: 0.1 },
|
|
168
|
+
enable: true,
|
|
169
|
+
gravity: {
|
|
170
|
+
enable: true,
|
|
171
|
+
inverse: false,
|
|
172
|
+
acceleration: setRangeValue(options.gravity),
|
|
173
|
+
},
|
|
174
|
+
speed: setRangeValue(options.speed),
|
|
175
|
+
direction: "none",
|
|
176
|
+
outModes: "destroy",
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
life: {
|
|
182
|
+
count: 1,
|
|
183
|
+
},
|
|
184
|
+
shape: {
|
|
185
|
+
type: "line",
|
|
186
|
+
options: {
|
|
187
|
+
line: {
|
|
188
|
+
cap: "round",
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
size: {
|
|
193
|
+
value: {
|
|
194
|
+
min: 0.1,
|
|
195
|
+
max: 50,
|
|
196
|
+
},
|
|
197
|
+
animation: {
|
|
198
|
+
enable: true,
|
|
199
|
+
sync: true,
|
|
200
|
+
speed: 90,
|
|
201
|
+
startValue: "max",
|
|
202
|
+
destroy: "min",
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
stroke: {
|
|
206
|
+
color: {
|
|
207
|
+
value: "#ffffff",
|
|
208
|
+
},
|
|
209
|
+
width: 0.5,
|
|
210
|
+
},
|
|
211
|
+
rotate: {
|
|
212
|
+
path: true,
|
|
213
|
+
},
|
|
214
|
+
move: {
|
|
215
|
+
enable: true,
|
|
216
|
+
gravity: {
|
|
217
|
+
acceleration: 15,
|
|
218
|
+
enable: true,
|
|
219
|
+
inverse: true,
|
|
220
|
+
maxSpeed: 100,
|
|
221
|
+
},
|
|
222
|
+
speed: {
|
|
223
|
+
min: 10,
|
|
224
|
+
max: 20,
|
|
225
|
+
},
|
|
226
|
+
outModes: {
|
|
227
|
+
default: "destroy",
|
|
228
|
+
top: "none",
|
|
229
|
+
},
|
|
230
|
+
trail: {
|
|
231
|
+
fill: {
|
|
232
|
+
color: "#000",
|
|
233
|
+
},
|
|
234
|
+
enable: true,
|
|
235
|
+
length: 10,
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
sounds: {
|
|
240
|
+
enable: options.sounds,
|
|
241
|
+
events: [
|
|
242
|
+
{
|
|
243
|
+
event: "particleRemoved",
|
|
244
|
+
filter: explodeSoundCheck,
|
|
245
|
+
audio: [
|
|
246
|
+
"https://particles.js.org/audio/explosion0.mp3",
|
|
247
|
+
"https://particles.js.org/audio/explosion1.mp3",
|
|
248
|
+
"https://particles.js.org/audio/explosion2.mp3",
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
volume: 50,
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
const container = await tsParticles.load({ id, options: particlesOptions });
|
|
256
|
+
if (!container) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
return new FireworksInstance(container);
|
|
260
|
+
}
|
|
261
|
+
fireworks.version = tsParticles.version;
|
|
262
|
+
if (!isSsr()) {
|
|
263
|
+
window.fireworks = fireworks;
|
|
264
|
+
}
|
package/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./fireworks";
|