@tsparticles/preset-confetti 3.0.1 → 3.1.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 +83 -175
- package/browser/bundle.js +0 -1
- package/browser/index.js +2 -1
- package/cjs/bundle.js +0 -1
- package/cjs/index.js +2 -1
- package/esm/bundle.js +0 -1
- package/esm/index.js +2 -1
- package/package.json +11 -11
- package/report.html +3 -3
- package/tsparticles.preset.confetti.bundle.js +2718 -7717
- package/tsparticles.preset.confetti.bundle.min.js +1 -1
- package/tsparticles.preset.confetti.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.preset.confetti.js +93 -211
- package/tsparticles.preset.confetti.min.js +1 -1
- package/tsparticles.preset.confetti.min.js.LICENSE.txt +1 -1
- package/umd/bundle.js +0 -1
- package/umd/index.js +2 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.jsdelivr.com/package/npm/@tsparticles/preset-confetti) [](https://www.npmjs.com/package/@tsparticles/preset-confetti) [](https://www.npmjs.com/package/@tsparticles/preset-confetti) [](https://github.com/sponsors/matteobruni)
|
|
6
6
|
|
|
7
|
-
[tsParticles](https://github.com/
|
|
7
|
+
[tsParticles](https://github.com/tsparticles/tsparticles) preset for white and red confetti launched from the screen
|
|
8
8
|
center on a transparent background.
|
|
9
9
|
|
|
10
10
|
[](https://join.slack.com/t/tsparticles/shared_invite/enQtOTcxNTQxNjQ4NzkxLWE2MTZhZWExMWRmOWI5MTMxNjczOGE1Yjk0MjViYjdkYTUzODM3OTc5MGQ5MjFlODc4MzE0N2Q1OWQxZDc1YzI) [](https://discord.gg/hACwv45Hme) [](https://t.me/tsparticles)
|
|
@@ -13,43 +13,14 @@ center on a transparent background.
|
|
|
13
13
|
|
|
14
14
|
## Sample
|
|
15
15
|
|
|
16
|
-
[](https://particles.js.org/samples/presets/confetti)
|
|
17
17
|
|
|
18
18
|
## How to use it
|
|
19
19
|
|
|
20
20
|
### CDN / Vanilla JS / jQuery
|
|
21
21
|
|
|
22
|
-
The first step is installing [tsParticles](https://github.com/matteobruni/tsparticles) following the instructions for
|
|
23
|
-
vanilla javascript in the main project [here](https://github.com/matteobruni/tsparticles)
|
|
24
|
-
|
|
25
|
-
Once added the script you need one more script to be included in your page (or you can download that
|
|
26
|
-
from [jsDelivr](https://www.jsdelivr.com/package/npm/@tsparticles/preset-confetti):
|
|
27
|
-
|
|
28
22
|
```html
|
|
29
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/
|
|
30
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/basic@2/tsparticles.basic.min.js"></script>
|
|
31
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/move-base@2/tsparticles.move.base.min.js"></script>
|
|
32
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/plugin-emitters@2/tsparticles.plugin.emitters.min.js"></script>
|
|
33
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/shape-circle@2/tsparticles.shape.circle.min.js"></script>
|
|
34
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/shape-square@2/tsparticles.shape.square.min.js"></script>
|
|
35
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-color@2/tsparticles.updater.color.min.js"></script>
|
|
36
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-life@2/tsparticles.updater.life.min.js"></script>
|
|
37
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-opacity@2/tsparticles.updater.opacity.min.js"></script>
|
|
38
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-out-modes@2/tsparticles.updater.out-modes.min.js"></script>
|
|
39
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-roll@2/tsparticles.updater.roll.min.js"></script>
|
|
40
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-rotate@2/tsparticles.updater.angle.min.js"></script>
|
|
41
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-size@2/tsparticles.updater.size.min.js"></script>
|
|
42
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-tilt@2/tsparticles.updater.tilt.min.js"></script>
|
|
43
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-wobble@2/tsparticles.updater.wobble.min.js"></script>
|
|
44
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-confetti@2/tsparticles.preset.confetti.min.js"></script>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
#### Bundle
|
|
48
|
-
|
|
49
|
-
A bundled script can also be used, this will include every needed plugin needed by the preset.
|
|
50
|
-
|
|
51
|
-
```html
|
|
52
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-confetti@2/tsparticles.preset.confetti.bundle.min.js"></script>
|
|
23
|
+
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-confetti@3/tsparticles.preset.confetti.bundle.min.js"></script>
|
|
53
24
|
```
|
|
54
25
|
|
|
55
26
|
### Usage
|
|
@@ -57,25 +28,27 @@ A bundled script can also be used, this will include every needed plugin needed
|
|
|
57
28
|
Once the scripts are loaded you can set up `tsParticles` like this:
|
|
58
29
|
|
|
59
30
|
```javascript
|
|
60
|
-
(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
await tsParticles.load("tsparticles", {
|
|
31
|
+
tsParticles.load({
|
|
32
|
+
id: "tsparticles",
|
|
33
|
+
options: {
|
|
64
34
|
preset: "confetti",
|
|
65
|
-
}
|
|
66
|
-
})
|
|
35
|
+
},
|
|
36
|
+
});
|
|
67
37
|
```
|
|
68
38
|
|
|
69
39
|
### Customization
|
|
70
40
|
|
|
71
41
|
```javascript
|
|
72
|
-
tsParticles.load(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
42
|
+
tsParticles.load({
|
|
43
|
+
id: "tsparticles",
|
|
44
|
+
options: {
|
|
45
|
+
particles: {
|
|
46
|
+
color: {
|
|
47
|
+
value: ["#0000ff", "#00ff00"],
|
|
48
|
+
},
|
|
76
49
|
},
|
|
50
|
+
preset: "confetti",
|
|
77
51
|
},
|
|
78
|
-
preset: "confetti",
|
|
79
52
|
});
|
|
80
53
|
```
|
|
81
54
|
|
|
@@ -132,13 +105,16 @@ will last forever.
|
|
|
132
105
|
###### Sample
|
|
133
106
|
|
|
134
107
|
```javascript
|
|
135
|
-
tsParticles.load(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
108
|
+
tsParticles.load({
|
|
109
|
+
id: "tsparticles",
|
|
110
|
+
options: {
|
|
111
|
+
emitters: {
|
|
112
|
+
life: {
|
|
113
|
+
duration: 0,
|
|
114
|
+
},
|
|
139
115
|
},
|
|
116
|
+
preset: "confetti",
|
|
140
117
|
},
|
|
141
|
-
preset: "confetti",
|
|
142
118
|
});
|
|
143
119
|
```
|
|
144
120
|
|
|
@@ -159,22 +135,25 @@ have a random position every "explosion". If a coordinate is set, that will be u
|
|
|
159
135
|
canvas size.
|
|
160
136
|
|
|
161
137
|
```javascript
|
|
162
|
-
tsParticles.load(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
138
|
+
tsParticles.load({
|
|
139
|
+
id: "tsparticles",
|
|
140
|
+
options: {
|
|
141
|
+
emitters: {
|
|
142
|
+
life: {
|
|
143
|
+
count: 0,
|
|
144
|
+
},
|
|
145
|
+
position: {
|
|
146
|
+
// uncomment only one of these lines,
|
|
147
|
+
// to have explosions on the x or y axis
|
|
148
|
+
// centered on the other one
|
|
149
|
+
// if everything is kept commented,
|
|
150
|
+
// random positions will be used everytime the cannon fires
|
|
151
|
+
// x: 50,
|
|
152
|
+
// y: 50
|
|
153
|
+
},
|
|
175
154
|
},
|
|
155
|
+
preset: "confetti",
|
|
176
156
|
},
|
|
177
|
-
preset: "confetti",
|
|
178
157
|
});
|
|
179
158
|
```
|
|
180
159
|
|
|
@@ -189,9 +168,12 @@ First let's start overriding the emitters (cannons) options placing an array ins
|
|
|
189
168
|
Like this:
|
|
190
169
|
|
|
191
170
|
```javascript
|
|
192
|
-
tsParticles.load(
|
|
193
|
-
|
|
194
|
-
|
|
171
|
+
tsParticles.load({
|
|
172
|
+
id: "tsparticles",
|
|
173
|
+
options: {
|
|
174
|
+
emitters: [],
|
|
175
|
+
preset: "confetti",
|
|
176
|
+
},
|
|
195
177
|
});
|
|
196
178
|
```
|
|
197
179
|
|
|
@@ -202,128 +184,54 @@ Now you can add emitters to the array, using the standard tsParticles emitters o
|
|
|
202
184
|
###### Sample
|
|
203
185
|
|
|
204
186
|
```javascript
|
|
205
|
-
tsParticles.load(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
187
|
+
tsParticles.load({
|
|
188
|
+
id: "tsparticles",
|
|
189
|
+
options: {
|
|
190
|
+
emitters: [
|
|
191
|
+
{
|
|
192
|
+
life: {
|
|
193
|
+
duration: 5,
|
|
194
|
+
count: 1,
|
|
195
|
+
},
|
|
196
|
+
position: {
|
|
197
|
+
x: 0,
|
|
198
|
+
y: 30,
|
|
199
|
+
},
|
|
200
|
+
particles: {
|
|
201
|
+
move: {
|
|
202
|
+
direction: "top-right",
|
|
203
|
+
},
|
|
219
204
|
},
|
|
220
205
|
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
206
|
+
{
|
|
207
|
+
life: {
|
|
208
|
+
duration: 5,
|
|
209
|
+
count: 1,
|
|
210
|
+
},
|
|
211
|
+
position: {
|
|
212
|
+
x: 100,
|
|
213
|
+
y: 30,
|
|
214
|
+
},
|
|
215
|
+
particles: {
|
|
216
|
+
move: {
|
|
217
|
+
direction: "top-left",
|
|
218
|
+
},
|
|
234
219
|
},
|
|
235
220
|
},
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
221
|
+
],
|
|
222
|
+
preset: "confetti",
|
|
223
|
+
},
|
|
239
224
|
});
|
|
240
225
|
```
|
|
241
226
|
|
|
242
227
|
This samples creates two cannons, one on the left and one on the right of the canvas, at 30% of canvas height, shooting
|
|
243
228
|
in opposite directions.
|
|
244
229
|
|
|
245
|
-
###
|
|
246
|
-
|
|
247
|
-
_The syntax for `React.js`, `Preact` and `Inferno` is the same_.
|
|
248
|
-
|
|
249
|
-
This sample uses the class component syntax, but you can use hooks as well (if the library supports it).
|
|
250
|
-
|
|
251
|
-
```typescript jsx
|
|
252
|
-
import Particles from "react-particles";
|
|
253
|
-
import type { Engine } from "@tsparticles/engine";
|
|
254
|
-
import { loadConfettiPreset } from "@tsparticles/preset-confetti";
|
|
255
|
-
|
|
256
|
-
export class ParticlesContainer extends React.PureComponent<IProps> {
|
|
257
|
-
// this customizes the component tsParticles installation
|
|
258
|
-
async customInit(engine: Engine): Promise<void> {
|
|
259
|
-
// this adds the preset to tsParticles, you can safely use the
|
|
260
|
-
await loadConfettiPreset(engine);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
render() {
|
|
264
|
-
const options = {
|
|
265
|
-
preset: "confetti",
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
return <Particles options={options} init={this.customInit} />;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
### Vue (2.x and 3.x)
|
|
274
|
-
|
|
275
|
-
_The syntax for `Vue.js 2.x` and `3.x` is the same_
|
|
276
|
-
|
|
277
|
-
```vue
|
|
278
|
-
<Particles id="tsparticles" :particlesInit="particlesInit" :options="particlesOptions" />
|
|
279
|
-
```
|
|
230
|
+
### Frameworks with a tsParticles component library
|
|
280
231
|
|
|
281
|
-
|
|
282
|
-
const particlesOptions = {
|
|
283
|
-
preset: "confetti",
|
|
284
|
-
};
|
|
232
|
+
Checkout the documentation in the component library repository and call the `loadConfettiPreset` function instead of `loadFull`, `loadSlim` or similar functions.
|
|
285
233
|
|
|
286
|
-
|
|
287
|
-
await loadConfettiPreset(engine);
|
|
288
|
-
}
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### Angular
|
|
292
|
-
|
|
293
|
-
```html
|
|
294
|
-
<ng-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></ng-particles>
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
```ts
|
|
298
|
-
const particlesOptions = {
|
|
299
|
-
preset: "confetti",
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
async function particlesInit(engine: Engine): Promise<void> {
|
|
303
|
-
await loadConfettiPreset(engine);
|
|
304
|
-
}
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### Svelte
|
|
308
|
-
|
|
309
|
-
```sveltehtml
|
|
310
|
-
|
|
311
|
-
<Particles
|
|
312
|
-
id="tsparticles"
|
|
313
|
-
options={options}
|
|
314
|
-
particlesInit={particlesInit}
|
|
315
|
-
/>
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
```js
|
|
319
|
-
let particlesOptions = {
|
|
320
|
-
preset: "confetti",
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
let particlesInit = async (engine) => {
|
|
324
|
-
await loadConfettiPreset(engine);
|
|
325
|
-
};
|
|
326
|
-
```
|
|
234
|
+
The options shown above are valid for all the component libraries.
|
|
327
235
|
|
|
328
236
|
---
|
|
329
237
|
|
package/browser/bundle.js
CHANGED
package/browser/index.js
CHANGED
|
@@ -18,7 +18,8 @@ async function loadPreset(engine, refresh = true) {
|
|
|
18
18
|
await loadRotateUpdater(engine, false);
|
|
19
19
|
await loadTiltUpdater(engine, false);
|
|
20
20
|
await loadLifeUpdater(engine, false);
|
|
21
|
-
await engine.addPreset("confetti", options,
|
|
21
|
+
await engine.addPreset("confetti", options, false);
|
|
22
|
+
await engine.refresh(refresh);
|
|
22
23
|
}
|
|
23
24
|
export async function loadConfettiPreset(engine) {
|
|
24
25
|
await loadPreset(engine);
|
package/cjs/bundle.js
CHANGED
|
@@ -5,4 +5,3 @@ const index_js_1 = require("./index.js");
|
|
|
5
5
|
Object.defineProperty(exports, "loadConfettiPreset", { enumerable: true, get: function () { return index_js_1.loadConfettiPreset; } });
|
|
6
6
|
const engine_1 = require("@tsparticles/engine");
|
|
7
7
|
Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
|
|
8
|
-
void (0, index_js_1.loadConfettiPreset)(engine_1.tsParticles);
|
package/cjs/index.js
CHANGED
|
@@ -21,7 +21,8 @@ async function loadPreset(engine, refresh = true) {
|
|
|
21
21
|
await (0, updater_rotate_1.loadRotateUpdater)(engine, false);
|
|
22
22
|
await (0, updater_tilt_1.loadTiltUpdater)(engine, false);
|
|
23
23
|
await (0, updater_life_1.loadLifeUpdater)(engine, false);
|
|
24
|
-
await engine.addPreset("confetti", options_js_1.options,
|
|
24
|
+
await engine.addPreset("confetti", options_js_1.options, false);
|
|
25
|
+
await engine.refresh(refresh);
|
|
25
26
|
}
|
|
26
27
|
async function loadConfettiPreset(engine) {
|
|
27
28
|
await loadPreset(engine);
|
package/esm/bundle.js
CHANGED
package/esm/index.js
CHANGED
|
@@ -18,7 +18,8 @@ async function loadPreset(engine, refresh = true) {
|
|
|
18
18
|
await loadRotateUpdater(engine, false);
|
|
19
19
|
await loadTiltUpdater(engine, false);
|
|
20
20
|
await loadLifeUpdater(engine, false);
|
|
21
|
-
await engine.addPreset("confetti", options,
|
|
21
|
+
await engine.addPreset("confetti", options, false);
|
|
22
|
+
await engine.refresh(refresh);
|
|
22
23
|
}
|
|
23
24
|
export async function loadConfettiPreset(engine) {
|
|
24
25
|
await loadPreset(engine);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/preset-confetti",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "tsParticles confetti preset",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,16 +87,16 @@
|
|
|
87
87
|
"module": "esm/index.js",
|
|
88
88
|
"types": "types/index.d.ts",
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/basic": "^3.
|
|
91
|
-
"@tsparticles/engine": "^3.
|
|
92
|
-
"@tsparticles/plugin-emitters": "^3.
|
|
93
|
-
"@tsparticles/plugin-motion": "^3.
|
|
94
|
-
"@tsparticles/shape-square": "^3.
|
|
95
|
-
"@tsparticles/updater-life": "^3.
|
|
96
|
-
"@tsparticles/updater-roll": "^3.
|
|
97
|
-
"@tsparticles/updater-rotate": "^3.
|
|
98
|
-
"@tsparticles/updater-tilt": "^3.
|
|
99
|
-
"@tsparticles/updater-wobble": "^3.
|
|
90
|
+
"@tsparticles/basic": "^3.4.0",
|
|
91
|
+
"@tsparticles/engine": "^3.4.0",
|
|
92
|
+
"@tsparticles/plugin-emitters": "^3.4.0",
|
|
93
|
+
"@tsparticles/plugin-motion": "^3.4.0",
|
|
94
|
+
"@tsparticles/shape-square": "^3.4.0",
|
|
95
|
+
"@tsparticles/updater-life": "^3.4.0",
|
|
96
|
+
"@tsparticles/updater-roll": "^3.4.0",
|
|
97
|
+
"@tsparticles/updater-rotate": "^3.4.0",
|
|
98
|
+
"@tsparticles/updater-tilt": "^3.4.0",
|
|
99
|
+
"@tsparticles/updater-wobble": "^3.4.0"
|
|
100
100
|
},
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"access": "public"
|