@tsparticles/preset-fireworks 3.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/LICENSE +21 -0
- package/README.md +212 -0
- package/browser/bundle.js +6 -0
- package/browser/index.js +30 -0
- package/browser/options.js +203 -0
- package/cjs/bundle.js +19 -0
- package/cjs/index.js +45 -0
- package/cjs/options.js +206 -0
- package/esm/bundle.js +6 -0
- package/esm/index.js +30 -0
- package/esm/options.js +203 -0
- package/package.json +104 -0
- package/report.html +39 -0
- package/tsparticles.preset.fireworks.bundle.js +8504 -0
- package/tsparticles.preset.fireworks.bundle.min.js +2 -0
- package/tsparticles.preset.fireworks.bundle.min.js.LICENSE.txt +8 -0
- package/tsparticles.preset.fireworks.js +471 -0
- package/tsparticles.preset.fireworks.min.js +2 -0
- package/tsparticles.preset.fireworks.min.js.LICENSE.txt +8 -0
- package/types/bundle.d.ts +3 -0
- package/types/index.d.ts +2 -0
- package/types/options.d.ts +2 -0
- package/umd/bundle.js +20 -0
- package/umd/index.js +44 -0
- package/umd/options.js +216 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Matteo Bruni
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
[](https://particles.js.org)
|
|
2
|
+
|
|
3
|
+
# tsParticles Fireworks Preset
|
|
4
|
+
|
|
5
|
+
[](https://www.jsdelivr.com/package/npm/@tsparticles/preset-fireworks) [](https://www.npmjs.com/package/@tsparticles/preset-fireworks) [](https://www.npmjs.com/package/@tsparticles/preset-fireworks) [](https://github.com/sponsors/matteobruni)
|
|
6
|
+
|
|
7
|
+
[tsParticles](https://github.com/matteobruni/tsparticles) preset for fireworks effect.
|
|
8
|
+
|
|
9
|
+
[](https://join.slack.com/t/tsparticles/shared_invite/enQtOTcxNTQxNjQ4NzkxLWE2MTZhZWExMWRmOWI5MTMxNjczOGE1Yjk0MjViYjdkYTUzODM3OTc5MGQ5MjFlODc4MzE0N2Q1OWQxZDc1YzI) [](https://discord.gg/hACwv45Hme) [](https://t.me/tsparticles)
|
|
10
|
+
|
|
11
|
+
[](https://www.producthunt.com/posts/tsparticles?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-tsparticles") <a href="https://www.buymeacoffee.com/matteobruni"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a beer&emoji=🍺&slug=matteobruni&button_colour=5F7FFF&font_colour=ffffff&font_family=Arial&outline_colour=000000&coffee_colour=FFDD00"></a>
|
|
12
|
+
|
|
13
|
+
## Sample
|
|
14
|
+
|
|
15
|
+
[](https://particles.js.org/samples/presets/fireworks)
|
|
16
|
+
|
|
17
|
+
## How to use it
|
|
18
|
+
|
|
19
|
+
### CDN / Vanilla JS / jQuery
|
|
20
|
+
|
|
21
|
+
The first step is installing [tsParticles](https://github.com/matteobruni/tsparticles) following the instructions for
|
|
22
|
+
vanilla javascript in the main project [here](https://github.com/matteobruni/tsparticles)
|
|
23
|
+
|
|
24
|
+
Once installed you need one more script to be included in your page (or you can download that
|
|
25
|
+
from [jsDelivr](https://www.jsdelivr.com/package/npm/@tsparticles/preset-fireworks):
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-engine@2/tsparticles.engine.min.js"></script>
|
|
29
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-move-base@2/tsparticles.move.base.min.js"></script>
|
|
30
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-plugin-emitters@2/tsparticles.plugin.emitters.min.js"></script>
|
|
31
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-shape-circle@2/tsparticles.shape.circle.min.js"></script>
|
|
32
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-shape-line@2/tsparticles.shape.line.min.js"></script>
|
|
33
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-angle@2/tsparticles.updater.angle.min.js"></script>
|
|
34
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-color@2/tsparticles.updater.color.min.js"></script>
|
|
35
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-life@2/tsparticles.updater.life.min.js"></script>
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-opacity@2/tsparticles.updater.opacity.min.js"></script>
|
|
37
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-out-modes@2/tsparticles.updater.out-modes.min.js"></script>
|
|
38
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-size@2/tsparticles.updater.size.min.js"></script>
|
|
39
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-stroke-color@2/tsparticles.updater.stroke-color.min.js"></script>
|
|
40
|
+
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-fireworks@2/tsparticles.preset.fireworks.min.js"></script>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This script **MUST** be placed after the `tsParticles` one.
|
|
44
|
+
|
|
45
|
+
#### Bundle
|
|
46
|
+
|
|
47
|
+
A bundled script can also be used, this will include every needed plugin needed by the preset.
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-fireworks@2/tsparticles.preset.fireworks.bundle.min.js"></script>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Usage
|
|
54
|
+
|
|
55
|
+
Once the scripts are loaded you can set up `tsParticles` like this:
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
(async () => {
|
|
59
|
+
await loadFireworksPreset(tsParticles); // this is required only if you are not using the bundle script
|
|
60
|
+
|
|
61
|
+
await tsParticles.load("tsparticles", {
|
|
62
|
+
preset: "fireworks",
|
|
63
|
+
});
|
|
64
|
+
})();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### Customization
|
|
68
|
+
|
|
69
|
+
**Important ⚠️**
|
|
70
|
+
You can override all the options defining the properties like in any standard `tsParticles` installation.
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
tsParticles.load("tsparticles", {
|
|
74
|
+
particles: {
|
|
75
|
+
shape: {
|
|
76
|
+
type: "square", // starting from v2, this require the square shape script
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
preset: "fireworks",
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Like in the sample above, the circles will be replaced by squares.
|
|
84
|
+
|
|
85
|
+
### React.js / Preact / Inferno
|
|
86
|
+
|
|
87
|
+
_The syntax for `React.js`, `Preact` and `Inferno` is the same_.
|
|
88
|
+
|
|
89
|
+
This sample uses the class component syntax, but you can use hooks as well (if the library supports it).
|
|
90
|
+
|
|
91
|
+
```typescript jsx
|
|
92
|
+
import Particles from "react-particles";
|
|
93
|
+
import type { Engine } from "tsparticles-engine";
|
|
94
|
+
import { loadFireworksPreset } from "@tsparticles/preset-fireworks";
|
|
95
|
+
|
|
96
|
+
export class ParticlesContainer extends React.PureComponent<IProps> {
|
|
97
|
+
// this customizes the component tsParticles installation
|
|
98
|
+
async customInit(engine: Engine): Promise<void> {
|
|
99
|
+
// this adds the preset to tsParticles, you can safely use the
|
|
100
|
+
await loadFireworksPreset(engine);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
render() {
|
|
104
|
+
const options = {
|
|
105
|
+
preset: "fireworks",
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
return <Particles options={options} init={this.customInit} />;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Vue (2.x and 3.x)
|
|
114
|
+
|
|
115
|
+
_The syntax for `Vue.js 2.x` and `3.x` is the same_
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<Particles id="tsparticles" :particlesInit="particlesInit" :options="particlesOptions" />
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
const particlesOptions = {
|
|
123
|
+
preset: "fireworks",
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
async function particlesInit(engine: Engine): Promise<void> {
|
|
127
|
+
await loadFireworksPreset(engine);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Angular
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<angular-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></angular-particles>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
const particlesOptions = {
|
|
139
|
+
preset: "fireworks",
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
async function particlesInit(engine: Engine): Promise<void> {
|
|
143
|
+
await loadFireworksPreset(engine);
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Svelte
|
|
148
|
+
|
|
149
|
+
```sveltehtml
|
|
150
|
+
|
|
151
|
+
<Particles
|
|
152
|
+
id="tsparticles"
|
|
153
|
+
options={particlesOptions}
|
|
154
|
+
particlesInit={particlesInit}
|
|
155
|
+
/>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
let particlesOptions = {
|
|
160
|
+
preset: "fireworks",
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
let particlesInit = async (engine) => {
|
|
164
|
+
await loadFireworksPreset(engine);
|
|
165
|
+
};
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
```mermaid
|
|
171
|
+
flowchart TD
|
|
172
|
+
|
|
173
|
+
subgraph m [Movers]
|
|
174
|
+
mb[Base]
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
e[tsParticles Engine] --> m
|
|
178
|
+
|
|
179
|
+
subgraph pl [Plugins]
|
|
180
|
+
ple[Emitters]
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
e --> pl
|
|
184
|
+
|
|
185
|
+
subgraph s [Shapes]
|
|
186
|
+
sc[Circle]
|
|
187
|
+
sl[Line]
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
e --> s
|
|
191
|
+
|
|
192
|
+
subgraph u [Updaters]
|
|
193
|
+
ua[Angle]
|
|
194
|
+
uc[Color]
|
|
195
|
+
ud[Destroy]
|
|
196
|
+
ul[Life]
|
|
197
|
+
uop[Opacity]
|
|
198
|
+
uou[Out Modes]
|
|
199
|
+
usi[Size]
|
|
200
|
+
ust[Stroke Color]
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
e --> u
|
|
204
|
+
|
|
205
|
+
subgraph pr [Presets]
|
|
206
|
+
prfw[Fireworks]
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
e --> pr
|
|
210
|
+
|
|
211
|
+
mb & ple & sc & sl & ua & uc & ud & ul & uop & uou & usi & ust --> prfw
|
|
212
|
+
```
|
package/browser/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { loadAngleUpdater } from "@tsparticles/updater-angle";
|
|
2
|
+
import { loadBaseMover } from "@tsparticles/move-base";
|
|
3
|
+
import { loadCircleShape } from "@tsparticles/shape-circle";
|
|
4
|
+
import { loadColorUpdater } from "@tsparticles/updater-color";
|
|
5
|
+
import { loadDestroyUpdater } from "@tsparticles/updater-destroy";
|
|
6
|
+
import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
|
|
7
|
+
import { loadLifeUpdater } from "@tsparticles/updater-life";
|
|
8
|
+
import { loadLineShape } from "@tsparticles/shape-line";
|
|
9
|
+
import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
|
|
10
|
+
import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
|
|
11
|
+
import { loadSizeUpdater } from "@tsparticles/updater-size";
|
|
12
|
+
import { loadSoundsPlugin } from "@tsparticles/plugin-sounds";
|
|
13
|
+
import { loadStrokeColorUpdater } from "@tsparticles/updater-stroke-color";
|
|
14
|
+
import { options } from "./options";
|
|
15
|
+
export async function loadFireworksPreset(engine) {
|
|
16
|
+
await loadBaseMover(engine);
|
|
17
|
+
await loadEmittersPlugin(engine);
|
|
18
|
+
await loadSoundsPlugin(engine);
|
|
19
|
+
await loadCircleShape(engine);
|
|
20
|
+
await loadLineShape(engine);
|
|
21
|
+
await loadAngleUpdater(engine);
|
|
22
|
+
await loadColorUpdater(engine);
|
|
23
|
+
await loadDestroyUpdater(engine);
|
|
24
|
+
await loadLifeUpdater(engine);
|
|
25
|
+
await loadOpacityUpdater(engine);
|
|
26
|
+
await loadOutModesUpdater(engine);
|
|
27
|
+
await loadSizeUpdater(engine);
|
|
28
|
+
await loadStrokeColorUpdater(engine);
|
|
29
|
+
await engine.addPreset("fireworks", options);
|
|
30
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { rgbToHsl, setRangeValue, stringToRgb, } from "@tsparticles/engine";
|
|
2
|
+
const explodeSoundCheck = (args) => {
|
|
3
|
+
const data = args.data;
|
|
4
|
+
return data.particle.shape === "line";
|
|
5
|
+
};
|
|
6
|
+
const fixRange = (value, min, max) => {
|
|
7
|
+
const diffSMax = value.max > max ? value.max - max : 0;
|
|
8
|
+
let res = setRangeValue(value);
|
|
9
|
+
if (diffSMax) {
|
|
10
|
+
res = setRangeValue(value.min - diffSMax, max);
|
|
11
|
+
}
|
|
12
|
+
const diffSMin = value.min < min ? value.min : 0;
|
|
13
|
+
if (diffSMin) {
|
|
14
|
+
res = setRangeValue(0, value.max + diffSMin);
|
|
15
|
+
}
|
|
16
|
+
return res;
|
|
17
|
+
};
|
|
18
|
+
const fireworksOptions = ["#ff595e", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"]
|
|
19
|
+
.map((color) => {
|
|
20
|
+
const rgb = stringToRgb(color);
|
|
21
|
+
if (!rgb) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const hsl = rgbToHsl(rgb), sRange = fixRange({ min: hsl.s - 30, max: hsl.s + 30 }, 0, 100), lRange = fixRange({ min: hsl.l - 30, max: hsl.l + 30 }, 0, 100);
|
|
25
|
+
return {
|
|
26
|
+
color: {
|
|
27
|
+
value: {
|
|
28
|
+
h: hsl.h,
|
|
29
|
+
s: sRange,
|
|
30
|
+
l: lRange,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
stroke: {
|
|
34
|
+
width: 0,
|
|
35
|
+
},
|
|
36
|
+
number: {
|
|
37
|
+
value: 0,
|
|
38
|
+
},
|
|
39
|
+
opacity: {
|
|
40
|
+
value: {
|
|
41
|
+
min: 0.1,
|
|
42
|
+
max: 1,
|
|
43
|
+
},
|
|
44
|
+
animation: {
|
|
45
|
+
enable: true,
|
|
46
|
+
speed: 0.7,
|
|
47
|
+
sync: false,
|
|
48
|
+
startValue: "max",
|
|
49
|
+
destroy: "min",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
shape: {
|
|
53
|
+
type: "circle",
|
|
54
|
+
},
|
|
55
|
+
size: {
|
|
56
|
+
value: { min: 1, max: 2 },
|
|
57
|
+
animation: {
|
|
58
|
+
enable: true,
|
|
59
|
+
speed: 5,
|
|
60
|
+
count: 1,
|
|
61
|
+
sync: false,
|
|
62
|
+
startValue: "min",
|
|
63
|
+
destroy: "none",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
life: {
|
|
67
|
+
count: 1,
|
|
68
|
+
duration: {
|
|
69
|
+
value: {
|
|
70
|
+
min: 1,
|
|
71
|
+
max: 2,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
move: {
|
|
76
|
+
decay: { min: 0.075, max: 0.1 },
|
|
77
|
+
enable: true,
|
|
78
|
+
gravity: {
|
|
79
|
+
enable: true,
|
|
80
|
+
inverse: false,
|
|
81
|
+
acceleration: 5,
|
|
82
|
+
},
|
|
83
|
+
speed: { min: 5, max: 15 },
|
|
84
|
+
direction: "none",
|
|
85
|
+
outModes: "destroy",
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
})
|
|
89
|
+
.filter((t) => t !== undefined);
|
|
90
|
+
export const options = {
|
|
91
|
+
detectRetina: true,
|
|
92
|
+
background: {
|
|
93
|
+
color: "#000",
|
|
94
|
+
},
|
|
95
|
+
fpsLimit: 120,
|
|
96
|
+
emitters: {
|
|
97
|
+
direction: "top",
|
|
98
|
+
life: {
|
|
99
|
+
count: 0,
|
|
100
|
+
duration: 0.1,
|
|
101
|
+
delay: 0.1,
|
|
102
|
+
},
|
|
103
|
+
rate: {
|
|
104
|
+
delay: 0.05,
|
|
105
|
+
quantity: 1,
|
|
106
|
+
},
|
|
107
|
+
size: {
|
|
108
|
+
width: 100,
|
|
109
|
+
height: 0,
|
|
110
|
+
},
|
|
111
|
+
position: {
|
|
112
|
+
y: 100,
|
|
113
|
+
x: 50,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
particles: {
|
|
117
|
+
number: {
|
|
118
|
+
value: 0,
|
|
119
|
+
},
|
|
120
|
+
destroy: {
|
|
121
|
+
mode: "split",
|
|
122
|
+
bounds: {
|
|
123
|
+
top: { min: 10, max: 30 },
|
|
124
|
+
},
|
|
125
|
+
split: {
|
|
126
|
+
sizeOffset: false,
|
|
127
|
+
count: 1,
|
|
128
|
+
factor: {
|
|
129
|
+
value: 0.333333,
|
|
130
|
+
},
|
|
131
|
+
rate: {
|
|
132
|
+
value: { min: 75, max: 150 },
|
|
133
|
+
},
|
|
134
|
+
particles: fireworksOptions,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
life: {
|
|
138
|
+
count: 1,
|
|
139
|
+
},
|
|
140
|
+
shape: {
|
|
141
|
+
type: "line",
|
|
142
|
+
},
|
|
143
|
+
size: {
|
|
144
|
+
value: {
|
|
145
|
+
min: 0.1,
|
|
146
|
+
max: 50,
|
|
147
|
+
},
|
|
148
|
+
animation: {
|
|
149
|
+
enable: true,
|
|
150
|
+
sync: true,
|
|
151
|
+
speed: 90,
|
|
152
|
+
startValue: "max",
|
|
153
|
+
destroy: "min",
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
stroke: {
|
|
157
|
+
color: {
|
|
158
|
+
value: "#ffffff",
|
|
159
|
+
},
|
|
160
|
+
width: 1,
|
|
161
|
+
},
|
|
162
|
+
rotate: {
|
|
163
|
+
path: true,
|
|
164
|
+
},
|
|
165
|
+
move: {
|
|
166
|
+
enable: true,
|
|
167
|
+
gravity: {
|
|
168
|
+
acceleration: 15,
|
|
169
|
+
enable: true,
|
|
170
|
+
inverse: true,
|
|
171
|
+
maxSpeed: 100,
|
|
172
|
+
},
|
|
173
|
+
speed: {
|
|
174
|
+
min: 10,
|
|
175
|
+
max: 20,
|
|
176
|
+
},
|
|
177
|
+
outModes: {
|
|
178
|
+
default: "destroy",
|
|
179
|
+
top: "none",
|
|
180
|
+
},
|
|
181
|
+
trail: {
|
|
182
|
+
fillColor: "#000",
|
|
183
|
+
enable: true,
|
|
184
|
+
length: 10,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
sounds: {
|
|
189
|
+
enable: true,
|
|
190
|
+
events: [
|
|
191
|
+
{
|
|
192
|
+
event: "particleRemoved",
|
|
193
|
+
filter: explodeSoundCheck,
|
|
194
|
+
audio: [
|
|
195
|
+
"https://particles.js.org/audio/explosion0.mp3",
|
|
196
|
+
"https://particles.js.org/audio/explosion1.mp3",
|
|
197
|
+
"https://particles.js.org/audio/explosion2.mp3",
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
volume: 50,
|
|
202
|
+
},
|
|
203
|
+
};
|
package/cjs/bundle.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.tsParticles = exports.loadFireworksPreset = void 0;
|
|
13
|
+
const _1 = require(".");
|
|
14
|
+
Object.defineProperty(exports, "loadFireworksPreset", { enumerable: true, get: function () { return _1.loadFireworksPreset; } });
|
|
15
|
+
const engine_1 = require("@tsparticles/engine");
|
|
16
|
+
Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
|
|
17
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
yield (0, _1.loadFireworksPreset)(engine_1.tsParticles);
|
|
19
|
+
}))();
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadFireworksPreset = void 0;
|
|
13
|
+
const updater_angle_1 = require("@tsparticles/updater-angle");
|
|
14
|
+
const move_base_1 = require("@tsparticles/move-base");
|
|
15
|
+
const shape_circle_1 = require("@tsparticles/shape-circle");
|
|
16
|
+
const updater_color_1 = require("@tsparticles/updater-color");
|
|
17
|
+
const updater_destroy_1 = require("@tsparticles/updater-destroy");
|
|
18
|
+
const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
|
|
19
|
+
const updater_life_1 = require("@tsparticles/updater-life");
|
|
20
|
+
const shape_line_1 = require("@tsparticles/shape-line");
|
|
21
|
+
const updater_opacity_1 = require("@tsparticles/updater-opacity");
|
|
22
|
+
const updater_out_modes_1 = require("@tsparticles/updater-out-modes");
|
|
23
|
+
const updater_size_1 = require("@tsparticles/updater-size");
|
|
24
|
+
const plugin_sounds_1 = require("@tsparticles/plugin-sounds");
|
|
25
|
+
const updater_stroke_color_1 = require("@tsparticles/updater-stroke-color");
|
|
26
|
+
const options_1 = require("./options");
|
|
27
|
+
function loadFireworksPreset(engine) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
yield (0, move_base_1.loadBaseMover)(engine);
|
|
30
|
+
yield (0, plugin_emitters_1.loadEmittersPlugin)(engine);
|
|
31
|
+
yield (0, plugin_sounds_1.loadSoundsPlugin)(engine);
|
|
32
|
+
yield (0, shape_circle_1.loadCircleShape)(engine);
|
|
33
|
+
yield (0, shape_line_1.loadLineShape)(engine);
|
|
34
|
+
yield (0, updater_angle_1.loadAngleUpdater)(engine);
|
|
35
|
+
yield (0, updater_color_1.loadColorUpdater)(engine);
|
|
36
|
+
yield (0, updater_destroy_1.loadDestroyUpdater)(engine);
|
|
37
|
+
yield (0, updater_life_1.loadLifeUpdater)(engine);
|
|
38
|
+
yield (0, updater_opacity_1.loadOpacityUpdater)(engine);
|
|
39
|
+
yield (0, updater_out_modes_1.loadOutModesUpdater)(engine);
|
|
40
|
+
yield (0, updater_size_1.loadSizeUpdater)(engine);
|
|
41
|
+
yield (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine);
|
|
42
|
+
yield engine.addPreset("fireworks", options_1.options);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
exports.loadFireworksPreset = loadFireworksPreset;
|