@tsparticles/preset-confetti 3.0.0-alpha.1 → 3.0.0-beta.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/README.md CHANGED
@@ -26,20 +26,21 @@ Once added the script you need one more script to be included in your page (or y
26
26
  from [jsDelivr](https://www.jsdelivr.com/package/npm/@tsparticles/preset-confetti):
27
27
 
28
28
  ```html
29
- <script src="https://cdn.jsdelivr.net/npm/tsparticles-engine@2/tsparticles.engine.min.js"></script>
30
- <script src="https://cdn.jsdelivr.net/npm/tsparticles-move-base@2/tsparticles.move.base.min.js"></script>
31
- <script src="https://cdn.jsdelivr.net/npm/tsparticles-plugin-emitters@2/tsparticles.plugin.emitters.min.js"></script>
32
- <script src="https://cdn.jsdelivr.net/npm/tsparticles-shape-circle@2/tsparticles.shape.circle.min.js"></script>
33
- <script src="https://cdn.jsdelivr.net/npm/tsparticles-shape-square@2/tsparticles.shape.square.min.js"></script>
34
- <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-angle@2/tsparticles.updater.angle.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-size@2/tsparticles.updater.size.min.js"></script>
41
- <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-tilt@2/tsparticles.updater.tilt.min.js"></script>
42
- <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-wobble@2/tsparticles.updater.wobble.min.js"></script>
29
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/engine@2/tsparticles.engine.min.js"></script>
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>
43
44
  <script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-confetti@2/tsparticles.preset.confetti.min.js"></script>
44
45
  ```
45
46
 
@@ -249,7 +250,7 @@ This sample uses the class component syntax, but you can use hooks as well (if t
249
250
 
250
251
  ```typescript jsx
251
252
  import Particles from "react-particles";
252
- import type { Engine } from "tsparticles-engine";
253
+ import type { Engine } from "@tsparticles/engine";
253
254
  import { loadConfettiPreset } from "@tsparticles/preset-confetti";
254
255
 
255
256
  export class ParticlesContainer extends React.PureComponent<IProps> {
@@ -290,7 +291,7 @@ async function particlesInit(engine: Engine): Promise<void> {
290
291
  ### Angular
291
292
 
292
293
  ```html
293
- <angular-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></angular-particles>
294
+ <ng-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></ng-particles>
294
295
  ```
295
296
 
296
297
  ```ts
@@ -324,130 +325,41 @@ let particlesInit = async (engine) => {
324
325
  };
325
326
  ```
326
327
 
327
- ### Alternative Usage
328
-
329
- This module exports another method for using the confetti preset
330
-
331
- ```javascript
332
- confetti("tsparticles", {
333
- /**
334
- * @deprecated use count property instead
335
- */
336
- particleCount: 50,
337
- /**
338
- * @deprecated use position property instead
339
- */
340
- origin: {
341
- x: 50,
342
- y: 50,
343
- },
344
- //------------------------------------------
345
- angle: 90,
346
- count: 50,
347
- position: {
348
- x: 50,
349
- y: 50,
350
- },
351
- spread: 45,
352
- startVelocity: 45,
353
- decay: 0.9,
354
- gravity: 1,
355
- drift: 0,
356
- ticks: 200,
357
- colors: ["#ffffff", "#ff0000"],
358
- shapes: ["square", "circle"],
359
- scalar: 1,
360
- zIndex: 100,
361
- disableForReducedMotion: true,
362
- });
363
- ```
364
-
365
- This method doesn't need to call the `loadConfettiPreset` method since it's called automatically.
366
-
367
- #### Customization
368
-
369
- **Important ⚠️**
370
- You can override all the options defining the properties like in any standard `tsParticles` installation. This works
371
- only with the classic `loadConfettiPreset` method, the `confetti` function has its own parameters.
372
-
373
- #### Options
374
-
375
- The `confetti` first parameter is the `tsParticles` container id and the second parameter is a single `options` object,
376
- which has the following properties:
377
-
378
- - `count` _Integer (default: 50)_: The number of confetti to launch. More is always fun... but be cool, there's a lot of
379
- math involved. (`particleCount` can be used too, but it's deprecated)
380
- - `angle` _Number (default: 90)_: The angle in which to launch the confetti, in degrees: 90 is straight up.
381
- - `spread` _Number (default: 45)_: How far off center the confetti can go, in degrees. 45 means the confetti will launch
382
- at the defined `angle` plus or minus 22.5 degrees.
383
- - `startVelocity` _Number (default: 45)_: How fast the confetti will start going, in pixels.
384
- - `decay` _Number (default: 0.9)_: How quickly the confetti will lose speed. Keep this number between 0 and 1, otherwise
385
- the confetti will gain speed. Better yet, just never change it.
386
- - `gravity` _Number (default: 1)_: How quickly the particles are pulled down: 1 is full gravity, 0.5 is half gravity,
387
- etc., but there are no limits. You can even make particles go up if you'd like.
388
- - `drift` _Number (default: 0)_: How much to the side the confetti will drift. The default is 0, meaning that they will
389
- fall straight down. Use a negative number for left and positive number for right.
390
- - `ticks` _Number (default: 200)_: How many times the confetti will move. This is abstract... but play with it if the
391
- confetti disappear too quickly for you.
392
- - `position` _Object_: Where to start firing confetti from. Feel free to launch off-screen if you'd like. (`origin` can
393
- be used too, but it's deprecated)
394
- - `position.x` _Number (default: 0.5)_: The `x` position on the page, with `0` being the left edge and `1` being the
395
- right edge.
396
- - `position.y` _Number (default: 0.5)_: The `y` position on the page, with `0` being the top edge and `1` being the
397
- bottom edge.
398
- - `colors` _Array&lt;String&gt;_: An array of color strings, in the HEX format... you know, like `#bada55`.
399
- - `shapes` _Array&lt;String&gt;_: An array of shapes for the confetti. The possible values are `square` and `circle`.
400
- The default is to use both shapes in an even mix. You can even change the mix by providing a value such
401
- as `['circle', 'circle', 'square']` to use two third circles and one third squares.
402
- - `scalar` _Number (default: 1)_: Scale factor for each confetti particle. Use decimals to make the confetti smaller. Go
403
- on, try teeny tiny confetti, they are adorable!
404
- - `zIndex` _Integer (default: 100)_: The confetti should be on top, after all. But if you have a crazy high page, you
405
- can set it even higher.
406
- - `disableForReducedMotion` _Boolean (default: true)_: Disables confetti entirely for users
407
- that [prefer reduced motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion).
408
-
409
328
  ---
410
329
 
411
330
  ```mermaid
412
331
  flowchart TD
413
332
 
414
- subgraph m [Movers]
415
- mb[Base]
333
+ subgraph b [Bundles]
334
+ bb[tsParticles Basic]
416
335
  end
417
336
 
418
- e[tsParticles Engine] --> m
419
-
420
337
  subgraph pl [Plugins]
421
338
  ple[Emitters]
422
339
  plm[Motion]
423
340
  end
424
341
 
425
- e --> pl
342
+ bb --> pl
426
343
 
427
344
  subgraph s [Shapes]
428
- sc[Circle]
429
345
  ssq[Square]
430
346
  end
431
347
 
432
- e --> s
348
+ bb --> s
433
349
 
434
350
  subgraph u [Updaters]
435
- ua[Angle]
436
- uc[Color]
437
351
  ul[Life]
438
- uop[Opacity]
439
- uou[Out Modes]
440
- ur[Roll]
441
- usi[Size]
352
+ urol[Roll]
353
+ urot[Rotate]
442
354
  uti[Tilt]
443
355
  uw[Wobble]
444
356
  end
445
357
 
446
- e --> u
358
+ bb --> u
447
359
 
448
360
  subgraph pr [Presets]
449
361
  prc[Confetti]
450
362
  end
451
363
 
452
- mb & ple & plm & sc & ssq & ua & uc & ul & uop & uou & ur & usi & uti & uw --> prc
364
+ bb & ple & plm & ssq & ul & urol & urot & uti & uw --> prc
453
365
  ```
package/browser/bundle.js CHANGED
@@ -1,6 +1,6 @@
1
- import { confetti, loadConfettiPreset } from "./index";
1
+ import { loadConfettiPreset } from "./index";
2
2
  import { tsParticles } from "@tsparticles/engine";
3
3
  (async () => {
4
4
  await loadConfettiPreset(tsParticles);
5
5
  })();
6
- export { confetti, loadConfettiPreset, tsParticles };
6
+ export { loadConfettiPreset, tsParticles };
package/browser/index.js CHANGED
@@ -1,55 +1,25 @@
1
- import { getRandom, tsParticles } from "@tsparticles/engine";
2
- import { loadAngleUpdater } from "@tsparticles/updater-angle";
3
- import { loadBaseMover } from "@tsparticles/move-base";
4
- import { loadCircleShape } from "@tsparticles/shape-circle";
5
- import { loadColorUpdater } from "@tsparticles/updater-color";
1
+ import { loadBasic } from "@tsparticles/basic";
6
2
  import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
7
3
  import { loadLifeUpdater } from "@tsparticles/updater-life";
8
4
  import { loadMotionPlugin } from "@tsparticles/plugin-motion";
9
- import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
10
- import { loadOptions } from "./options";
11
- import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
12
5
  import { loadRollUpdater } from "@tsparticles/updater-roll";
13
- import { loadSizeUpdater } from "@tsparticles/updater-size";
6
+ import { loadRotateUpdater } from "@tsparticles/updater-rotate";
14
7
  import { loadSquareShape } from "@tsparticles/shape-square";
15
8
  import { loadTiltUpdater } from "@tsparticles/updater-tilt";
16
9
  import { loadWobbleUpdater } from "@tsparticles/updater-wobble";
17
- async function loadPreset(engine, confettiOptions, override = false) {
18
- await loadBaseMover(engine);
19
- await loadCircleShape(engine);
20
- await loadSquareShape(engine);
21
- await loadColorUpdater(engine);
22
- await loadSizeUpdater(engine);
23
- await loadOpacityUpdater(engine);
24
- await loadOutModesUpdater(engine);
25
- await loadEmittersPlugin(engine);
26
- await loadMotionPlugin(engine);
27
- await loadWobbleUpdater(engine);
28
- await loadRollUpdater(engine);
29
- await loadAngleUpdater(engine);
30
- await loadTiltUpdater(engine);
31
- await loadLifeUpdater(engine);
32
- await engine.addPreset("confetti", loadOptions(confettiOptions), override);
10
+ import { options } from "./options";
11
+ async function loadPreset(engine, refresh = true) {
12
+ await loadBasic(engine, false);
13
+ await loadSquareShape(engine, false);
14
+ await loadEmittersPlugin(engine, false);
15
+ await loadMotionPlugin(engine, false);
16
+ await loadWobbleUpdater(engine, false);
17
+ await loadRollUpdater(engine, false);
18
+ await loadRotateUpdater(engine, false);
19
+ await loadTiltUpdater(engine, false);
20
+ await loadLifeUpdater(engine, false);
21
+ await engine.addPreset("confetti", options, refresh);
33
22
  }
34
- export async function loadConfettiPreset(main) {
35
- await loadPreset(main, {}, true);
36
- }
37
- export async function confetti(idOrOptions, confettiOptions) {
38
- let options;
39
- let id;
40
- if (typeof idOrOptions === "string") {
41
- id = idOrOptions;
42
- options = confettiOptions !== null && confettiOptions !== void 0 ? confettiOptions : {};
43
- }
44
- else {
45
- id = `tsparticles_${Math.floor(getRandom() * 1000)}`;
46
- options = idOrOptions;
47
- }
48
- await loadPreset(tsParticles, options, true);
49
- await tsParticles.load({
50
- id,
51
- options: {
52
- preset: "confetti",
53
- },
54
- });
23
+ export async function loadConfettiPreset(engine) {
24
+ await loadPreset(engine);
55
25
  }
@@ -1,131 +1,127 @@
1
- import { ConfettiOptions } from "./ConfettiOptions";
2
- export const loadOptions = (confettiOptions) => {
3
- const actualOptions = new ConfettiOptions();
4
- actualOptions.load(confettiOptions);
5
- return {
6
- fullScreen: {
7
- enable: true,
8
- zIndex: actualOptions.zIndex,
1
+ export const options = {
2
+ fullScreen: {
3
+ enable: true,
4
+ zIndex: 100,
5
+ },
6
+ fpsLimit: 120,
7
+ particles: {
8
+ number: {
9
+ value: 0,
9
10
  },
10
- fpsLimit: 120,
11
- particles: {
12
- number: {
13
- value: 0,
14
- },
15
- color: {
16
- value: actualOptions.colors,
11
+ color: {
12
+ value: ["#26ccff", "#a25afd", "#ff5e7e", "#88ff5a", "#fcff42", "#ffa62d", "#ff36ff"],
13
+ },
14
+ shape: {
15
+ type: ["square", "circle"],
16
+ },
17
+ opacity: {
18
+ value: { min: 0, max: 1 },
19
+ animation: {
20
+ enable: true,
21
+ speed: 0.5,
22
+ startValue: "max",
23
+ destroy: "min",
17
24
  },
18
- shape: {
19
- type: actualOptions.shapes,
25
+ },
26
+ size: {
27
+ value: 5,
28
+ },
29
+ links: {
30
+ enable: false,
31
+ },
32
+ life: {
33
+ duration: {
34
+ sync: true,
35
+ value: 20 / 6,
20
36
  },
21
- opacity: {
22
- value: { min: 0, max: 1 },
23
- animation: {
24
- enable: true,
25
- speed: 0.5,
26
- startValue: "max",
27
- destroy: "min",
28
- },
37
+ count: 1,
38
+ },
39
+ move: {
40
+ angle: {
41
+ value: 45,
42
+ offset: 0,
29
43
  },
30
- size: {
31
- value: 5 * actualOptions.scalar,
44
+ drift: 0,
45
+ enable: true,
46
+ gravity: {
47
+ enable: true,
48
+ acceleration: 9.81,
32
49
  },
33
- links: {
34
- enable: false,
50
+ speed: 45,
51
+ decay: 0.1,
52
+ direction: -90,
53
+ random: true,
54
+ straight: false,
55
+ outModes: {
56
+ default: "none",
57
+ bottom: "destroy",
35
58
  },
36
- life: {
37
- duration: {
38
- sync: true,
39
- value: actualOptions.ticks / 60,
40
- },
41
- count: 1,
59
+ },
60
+ rotate: {
61
+ value: {
62
+ min: 0,
63
+ max: 360,
42
64
  },
43
- move: {
44
- angle: {
45
- value: actualOptions.spread,
46
- offset: 0,
47
- },
48
- drift: {
49
- min: -actualOptions.drift,
50
- max: actualOptions.drift,
51
- },
65
+ direction: "random",
66
+ animation: {
52
67
  enable: true,
53
- gravity: {
54
- enable: true,
55
- acceleration: actualOptions.gravity * 9.81,
56
- },
57
- speed: actualOptions.startVelocity,
58
- decay: 1 - actualOptions.decay,
59
- direction: -actualOptions.angle,
60
- random: true,
61
- straight: false,
62
- outModes: {
63
- default: "none",
64
- bottom: "destroy",
65
- },
68
+ speed: 60,
66
69
  },
67
- rotate: {
68
- value: {
69
- min: 0,
70
- max: 360,
71
- },
72
- direction: "random",
73
- animation: {
74
- enable: true,
75
- speed: 60,
76
- },
70
+ },
71
+ tilt: {
72
+ direction: "random",
73
+ enable: true,
74
+ value: {
75
+ min: 0,
76
+ max: 360,
77
77
  },
78
- tilt: {
79
- direction: "random",
78
+ animation: {
80
79
  enable: true,
81
- value: {
82
- min: 0,
83
- max: 360,
84
- },
85
- animation: {
86
- enable: true,
87
- speed: 60,
88
- },
80
+ speed: 60,
89
81
  },
90
- roll: {
91
- darken: {
92
- enable: true,
93
- value: 25,
94
- },
82
+ },
83
+ roll: {
84
+ darken: {
95
85
  enable: true,
96
- speed: {
97
- min: 15,
98
- max: 25,
99
- },
86
+ value: 25,
100
87
  },
101
- wobble: {
102
- distance: 30,
103
- enable: true,
104
- speed: {
105
- min: -15,
106
- max: 15,
107
- },
88
+ enable: true,
89
+ speed: {
90
+ min: 15,
91
+ max: 25,
108
92
  },
109
93
  },
110
- detectRetina: true,
111
- motion: {
112
- disable: actualOptions.disableForReducedMotion,
113
- },
114
- emitters: {
115
- startCount: actualOptions.count,
116
- position: actualOptions.position,
117
- size: {
118
- width: 0,
119
- height: 0,
120
- },
121
- rate: {
122
- delay: 0,
123
- quantity: 0,
124
- },
125
- life: {
126
- duration: 0.1,
127
- count: 1,
94
+ wobble: {
95
+ distance: 30,
96
+ enable: true,
97
+ speed: {
98
+ min: -15,
99
+ max: 15,
128
100
  },
129
101
  },
130
- };
102
+ },
103
+ detectRetina: true,
104
+ motion: {
105
+ disable: true,
106
+ },
107
+ emitters: {
108
+ name: "confetti",
109
+ startCount: 50,
110
+ position: {
111
+ x: 50,
112
+ y: 50,
113
+ },
114
+ size: {
115
+ width: 0,
116
+ height: 0,
117
+ },
118
+ rate: {
119
+ delay: 0,
120
+ quantity: 0,
121
+ },
122
+ life: {
123
+ duration: 0.1,
124
+ count: 1,
125
+ },
126
+ },
131
127
  };
@@ -0,0 +1 @@
1
+ { "type": "module" }
package/cjs/bundle.js CHANGED
@@ -1,20 +1,10 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.tsParticles = exports.loadConfettiPreset = exports.confetti = void 0;
3
+ exports.tsParticles = exports.loadConfettiPreset = void 0;
13
4
  const index_1 = require("./index");
14
- Object.defineProperty(exports, "confetti", { enumerable: true, get: function () { return index_1.confetti; } });
15
5
  Object.defineProperty(exports, "loadConfettiPreset", { enumerable: true, get: function () { return index_1.loadConfettiPreset; } });
16
6
  const engine_1 = require("@tsparticles/engine");
17
7
  Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
18
- (() => __awaiter(void 0, void 0, void 0, function* () {
19
- yield (0, index_1.loadConfettiPreset)(engine_1.tsParticles);
20
- }))();
8
+ (async () => {
9
+ await (0, index_1.loadConfettiPreset)(engine_1.tsParticles);
10
+ })();
package/cjs/index.js CHANGED
@@ -1,75 +1,29 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.confetti = exports.loadConfettiPreset = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- const updater_angle_1 = require("@tsparticles/updater-angle");
15
- const move_base_1 = require("@tsparticles/move-base");
16
- const shape_circle_1 = require("@tsparticles/shape-circle");
17
- const updater_color_1 = require("@tsparticles/updater-color");
3
+ exports.loadConfettiPreset = void 0;
4
+ const basic_1 = require("@tsparticles/basic");
18
5
  const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
19
6
  const updater_life_1 = require("@tsparticles/updater-life");
20
7
  const plugin_motion_1 = require("@tsparticles/plugin-motion");
21
- const updater_opacity_1 = require("@tsparticles/updater-opacity");
22
- const options_1 = require("./options");
23
- const updater_out_modes_1 = require("@tsparticles/updater-out-modes");
24
8
  const updater_roll_1 = require("@tsparticles/updater-roll");
25
- const updater_size_1 = require("@tsparticles/updater-size");
9
+ const updater_rotate_1 = require("@tsparticles/updater-rotate");
26
10
  const shape_square_1 = require("@tsparticles/shape-square");
27
11
  const updater_tilt_1 = require("@tsparticles/updater-tilt");
28
12
  const updater_wobble_1 = require("@tsparticles/updater-wobble");
29
- function loadPreset(engine, confettiOptions, override = false) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- yield (0, move_base_1.loadBaseMover)(engine);
32
- yield (0, shape_circle_1.loadCircleShape)(engine);
33
- yield (0, shape_square_1.loadSquareShape)(engine);
34
- yield (0, updater_color_1.loadColorUpdater)(engine);
35
- yield (0, updater_size_1.loadSizeUpdater)(engine);
36
- yield (0, updater_opacity_1.loadOpacityUpdater)(engine);
37
- yield (0, updater_out_modes_1.loadOutModesUpdater)(engine);
38
- yield (0, plugin_emitters_1.loadEmittersPlugin)(engine);
39
- yield (0, plugin_motion_1.loadMotionPlugin)(engine);
40
- yield (0, updater_wobble_1.loadWobbleUpdater)(engine);
41
- yield (0, updater_roll_1.loadRollUpdater)(engine);
42
- yield (0, updater_angle_1.loadAngleUpdater)(engine);
43
- yield (0, updater_tilt_1.loadTiltUpdater)(engine);
44
- yield (0, updater_life_1.loadLifeUpdater)(engine);
45
- yield engine.addPreset("confetti", (0, options_1.loadOptions)(confettiOptions), override);
46
- });
13
+ const options_1 = require("./options");
14
+ async function loadPreset(engine, refresh = true) {
15
+ await (0, basic_1.loadBasic)(engine, false);
16
+ await (0, shape_square_1.loadSquareShape)(engine, false);
17
+ await (0, plugin_emitters_1.loadEmittersPlugin)(engine, false);
18
+ await (0, plugin_motion_1.loadMotionPlugin)(engine, false);
19
+ await (0, updater_wobble_1.loadWobbleUpdater)(engine, false);
20
+ await (0, updater_roll_1.loadRollUpdater)(engine, false);
21
+ await (0, updater_rotate_1.loadRotateUpdater)(engine, false);
22
+ await (0, updater_tilt_1.loadTiltUpdater)(engine, false);
23
+ await (0, updater_life_1.loadLifeUpdater)(engine, false);
24
+ await engine.addPreset("confetti", options_1.options, refresh);
47
25
  }
48
- function loadConfettiPreset(main) {
49
- return __awaiter(this, void 0, void 0, function* () {
50
- yield loadPreset(main, {}, true);
51
- });
26
+ async function loadConfettiPreset(engine) {
27
+ await loadPreset(engine);
52
28
  }
53
29
  exports.loadConfettiPreset = loadConfettiPreset;
54
- function confetti(idOrOptions, confettiOptions) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- let options;
57
- let id;
58
- if (typeof idOrOptions === "string") {
59
- id = idOrOptions;
60
- options = confettiOptions !== null && confettiOptions !== void 0 ? confettiOptions : {};
61
- }
62
- else {
63
- id = `tsparticles_${Math.floor((0, engine_1.getRandom)() * 1000)}`;
64
- options = idOrOptions;
65
- }
66
- yield loadPreset(engine_1.tsParticles, options, true);
67
- yield engine_1.tsParticles.load({
68
- id,
69
- options: {
70
- preset: "confetti",
71
- },
72
- });
73
- });
74
- }
75
- exports.confetti = confetti;