@tsparticles/preset-fireworks 3.1.0 → 3.2.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/README.md +1 -1
- package/browser/index.js +2 -2
- package/browser/options.js +196 -190
- package/cjs/index.js +2 -2
- package/cjs/options.js +198 -191
- package/esm/index.js +2 -2
- package/esm/options.js +196 -190
- package/package.json +11 -11
- package/report.html +1 -1
- package/tsparticles.preset.fireworks.bundle.js +892 -852
- 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 +7 -7
- package/tsparticles.preset.fireworks.min.js +1 -1
- package/tsparticles.preset.fireworks.min.js.LICENSE.txt +1 -1
- package/types/options.d.ts +2 -2
- package/umd/index.js +3 -3
- package/umd/options.js +198 -191
package/cjs/options.js
CHANGED
|
@@ -1,214 +1,221 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.initOptions = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
value: 0,
|
|
47
|
-
},
|
|
48
|
-
opacity: {
|
|
49
|
-
value: {
|
|
50
|
-
min: 0.1,
|
|
51
|
-
max: 1,
|
|
5
|
+
function initOptions(engine) {
|
|
6
|
+
const explodeSoundCheck = (args) => {
|
|
7
|
+
const data = args.data;
|
|
8
|
+
return data.particle.shape === "line";
|
|
9
|
+
}, 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
|
+
}, fireworksOptions = [
|
|
21
|
+
"#ff595e",
|
|
22
|
+
"#ffca3a",
|
|
23
|
+
"#8ac926",
|
|
24
|
+
"#1982c4",
|
|
25
|
+
"#6a4c93",
|
|
26
|
+
]
|
|
27
|
+
.map(color => {
|
|
28
|
+
const rgb = (0, engine_1.stringToRgb)(engine, color);
|
|
29
|
+
if (!rgb) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const hsl = (0, engine_1.rgbToHsl)(rgb), sOffset = 30, lOffset = 30, sBounds = {
|
|
33
|
+
min: 0,
|
|
34
|
+
max: 100,
|
|
35
|
+
}, lBounds = {
|
|
36
|
+
min: 0,
|
|
37
|
+
max: 100,
|
|
38
|
+
}, 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);
|
|
39
|
+
return {
|
|
40
|
+
color: {
|
|
41
|
+
value: {
|
|
42
|
+
h: hsl.h,
|
|
43
|
+
s: sRange,
|
|
44
|
+
l: lRange,
|
|
45
|
+
},
|
|
52
46
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
speed: 0.7,
|
|
56
|
-
sync: false,
|
|
57
|
-
startValue: engine_1.StartValueType.max,
|
|
58
|
-
destroy: engine_1.DestroyType.min,
|
|
47
|
+
stroke: {
|
|
48
|
+
width: 0,
|
|
59
49
|
},
|
|
60
|
-
|
|
61
|
-
|
|
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,
|
|
50
|
+
number: {
|
|
51
|
+
value: 0,
|
|
73
52
|
},
|
|
74
|
-
|
|
75
|
-
life: {
|
|
76
|
-
count: 1,
|
|
77
|
-
duration: {
|
|
53
|
+
opacity: {
|
|
78
54
|
value: {
|
|
79
|
-
min: 1,
|
|
80
|
-
max:
|
|
55
|
+
min: 0.1,
|
|
56
|
+
max: 1,
|
|
57
|
+
},
|
|
58
|
+
animation: {
|
|
59
|
+
enable: true,
|
|
60
|
+
speed: 0.7,
|
|
61
|
+
sync: false,
|
|
62
|
+
startValue: engine_1.StartValueType.max,
|
|
63
|
+
destroy: engine_1.DestroyType.min,
|
|
81
64
|
},
|
|
82
65
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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 },
|
|
66
|
+
shape: {
|
|
67
|
+
type: "circle",
|
|
68
|
+
},
|
|
69
|
+
size: {
|
|
70
|
+
value: { min: 1, max: 2 },
|
|
71
|
+
animation: {
|
|
72
|
+
enable: true,
|
|
73
|
+
speed: 5,
|
|
74
|
+
count: 1,
|
|
75
|
+
sync: false,
|
|
76
|
+
startValue: engine_1.StartValueType.min,
|
|
77
|
+
destroy: engine_1.DestroyType.none,
|
|
78
|
+
},
|
|
133
79
|
},
|
|
134
|
-
|
|
135
|
-
sizeOffset: false,
|
|
80
|
+
life: {
|
|
136
81
|
count: 1,
|
|
137
|
-
|
|
138
|
-
value:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
82
|
+
duration: {
|
|
83
|
+
value: {
|
|
84
|
+
min: 1,
|
|
85
|
+
max: 2,
|
|
86
|
+
},
|
|
142
87
|
},
|
|
143
|
-
particles: fireworksOptions,
|
|
144
88
|
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
count: 1,
|
|
148
|
-
},
|
|
149
|
-
shape: {
|
|
150
|
-
type: "line",
|
|
151
|
-
},
|
|
152
|
-
size: {
|
|
153
|
-
value: {
|
|
154
|
-
min: 0.1,
|
|
155
|
-
max: 50,
|
|
156
|
-
},
|
|
157
|
-
animation: {
|
|
89
|
+
move: {
|
|
90
|
+
decay: { min: 0.075, max: 0.1 },
|
|
158
91
|
enable: true,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
92
|
+
gravity: {
|
|
93
|
+
enable: true,
|
|
94
|
+
inverse: false,
|
|
95
|
+
acceleration: 5,
|
|
96
|
+
},
|
|
97
|
+
speed: { min: 5, max: 15 },
|
|
98
|
+
direction: "none",
|
|
99
|
+
outModes: engine_1.OutMode.destroy,
|
|
163
100
|
},
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
101
|
+
};
|
|
102
|
+
})
|
|
103
|
+
.filter(t => t !== undefined);
|
|
104
|
+
return {
|
|
105
|
+
detectRetina: true,
|
|
106
|
+
background: {
|
|
107
|
+
color: "#000",
|
|
108
|
+
},
|
|
109
|
+
fpsLimit: 120,
|
|
110
|
+
emitters: {
|
|
111
|
+
direction: engine_1.MoveDirection.top,
|
|
112
|
+
life: {
|
|
113
|
+
count: 0,
|
|
114
|
+
duration: 0.1,
|
|
115
|
+
delay: 0.1,
|
|
116
|
+
},
|
|
117
|
+
rate: {
|
|
118
|
+
delay: 0.05,
|
|
119
|
+
quantity: 1,
|
|
120
|
+
},
|
|
121
|
+
size: {
|
|
122
|
+
width: 100,
|
|
123
|
+
height: 0,
|
|
124
|
+
},
|
|
125
|
+
position: {
|
|
126
|
+
y: 100,
|
|
127
|
+
x: 50,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
particles: {
|
|
131
|
+
number: {
|
|
132
|
+
value: 0,
|
|
133
|
+
},
|
|
134
|
+
destroy: {
|
|
135
|
+
mode: "split",
|
|
136
|
+
bounds: {
|
|
137
|
+
top: { min: 10, max: 30 },
|
|
138
|
+
},
|
|
139
|
+
split: {
|
|
140
|
+
sizeOffset: false,
|
|
141
|
+
count: 1,
|
|
142
|
+
factor: {
|
|
143
|
+
value: 0.333333,
|
|
144
|
+
},
|
|
145
|
+
rate: {
|
|
146
|
+
value: { min: 75, max: 150 },
|
|
147
|
+
},
|
|
148
|
+
particles: fireworksOptions,
|
|
149
|
+
},
|
|
168
150
|
},
|
|
169
|
-
|
|
170
|
-
|
|
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,
|
|
151
|
+
life: {
|
|
152
|
+
count: 1,
|
|
181
153
|
},
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
max: 20,
|
|
154
|
+
shape: {
|
|
155
|
+
type: "line",
|
|
185
156
|
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
157
|
+
size: {
|
|
158
|
+
value: {
|
|
159
|
+
min: 0.1,
|
|
160
|
+
max: 50,
|
|
161
|
+
},
|
|
162
|
+
animation: {
|
|
163
|
+
enable: true,
|
|
164
|
+
sync: true,
|
|
165
|
+
speed: 90,
|
|
166
|
+
startValue: engine_1.StartValueType.max,
|
|
167
|
+
destroy: engine_1.DestroyType.min,
|
|
168
|
+
},
|
|
189
169
|
},
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
170
|
+
stroke: {
|
|
171
|
+
color: {
|
|
172
|
+
value: "#ffffff",
|
|
193
173
|
},
|
|
174
|
+
width: 1,
|
|
175
|
+
},
|
|
176
|
+
rotate: {
|
|
177
|
+
path: true,
|
|
178
|
+
},
|
|
179
|
+
move: {
|
|
194
180
|
enable: true,
|
|
195
|
-
|
|
181
|
+
gravity: {
|
|
182
|
+
acceleration: 15,
|
|
183
|
+
enable: true,
|
|
184
|
+
inverse: true,
|
|
185
|
+
maxSpeed: 100,
|
|
186
|
+
},
|
|
187
|
+
speed: {
|
|
188
|
+
min: 10,
|
|
189
|
+
max: 20,
|
|
190
|
+
},
|
|
191
|
+
outModes: {
|
|
192
|
+
default: engine_1.OutMode.destroy,
|
|
193
|
+
top: engine_1.OutMode.none,
|
|
194
|
+
},
|
|
195
|
+
trail: {
|
|
196
|
+
fill: {
|
|
197
|
+
color: "#000",
|
|
198
|
+
},
|
|
199
|
+
enable: true,
|
|
200
|
+
length: 10,
|
|
201
|
+
},
|
|
196
202
|
},
|
|
197
203
|
},
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
}
|
|
204
|
+
sounds: {
|
|
205
|
+
enable: true,
|
|
206
|
+
events: [
|
|
207
|
+
{
|
|
208
|
+
event: engine_1.EventType.particleRemoved,
|
|
209
|
+
filter: explodeSoundCheck,
|
|
210
|
+
audio: [
|
|
211
|
+
"https://particles.js.org/audio/explosion0.mp3",
|
|
212
|
+
"https://particles.js.org/audio/explosion1.mp3",
|
|
213
|
+
"https://particles.js.org/audio/explosion2.mp3",
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
volume: 50,
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
exports.initOptions = initOptions;
|
package/esm/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { initOptions } from "./options.js";
|
|
1
2
|
import { loadBasic } from "@tsparticles/basic";
|
|
2
3
|
import { loadDestroyUpdater } from "@tsparticles/updater-destroy";
|
|
3
4
|
import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
|
|
@@ -7,7 +8,6 @@ import { loadLineShape } from "@tsparticles/shape-line";
|
|
|
7
8
|
import { loadRotateUpdater } from "@tsparticles/updater-rotate";
|
|
8
9
|
import { loadSoundsPlugin } from "@tsparticles/plugin-sounds";
|
|
9
10
|
import { loadStrokeColorUpdater } from "@tsparticles/updater-stroke-color";
|
|
10
|
-
import { options } from "./options.js";
|
|
11
11
|
export async function loadFireworksPreset(engine, refresh = true) {
|
|
12
12
|
await loadBasic(engine, false);
|
|
13
13
|
await loadEmittersPlugin(engine, false);
|
|
@@ -18,6 +18,6 @@ export async function loadFireworksPreset(engine, refresh = true) {
|
|
|
18
18
|
await loadDestroyUpdater(engine, false);
|
|
19
19
|
await loadLifeUpdater(engine, false);
|
|
20
20
|
await loadStrokeColorUpdater(engine, false);
|
|
21
|
-
await engine.addPreset("fireworks",
|
|
21
|
+
await engine.addPreset("fireworks", initOptions(engine), false);
|
|
22
22
|
await engine.refresh(refresh);
|
|
23
23
|
}
|