@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.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.preset.confetti.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/updater-angle"),require("@tsparticles/move-base"),require("@tsparticles/shape-circle"),require("@tsparticles/updater-color"),require("@tsparticles/plugin-emitters"),require("@tsparticles/updater-life"),require("@tsparticles/plugin-motion"),require("@tsparticles/updater-opacity"),require("@tsparticles/updater-out-modes"),require("@tsparticles/updater-roll"),require("@tsparticles/updater-size"),require("@tsparticles/shape-square"),require("@tsparticles/updater-tilt"),require("@tsparticles/updater-wobble"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/updater-angle","@tsparticles/move-base","@tsparticles/shape-circle","@tsparticles/updater-color","@tsparticles/plugin-emitters","@tsparticles/updater-life","@tsparticles/plugin-motion","@tsparticles/updater-opacity","@tsparticles/updater-out-modes","@tsparticles/updater-roll","@tsparticles/updater-size","@tsparticles/shape-square","@tsparticles/updater-tilt","@tsparticles/updater-wobble"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/updater-angle"),require("@tsparticles/move-base"),require("@tsparticles/shape-circle"),require("@tsparticles/updater-color"),require("@tsparticles/plugin-emitters"),require("@tsparticles/updater-life"),require("@tsparticles/plugin-motion"),require("@tsparticles/updater-opacity"),require("@tsparticles/updater-out-modes"),require("@tsparticles/updater-roll"),require("@tsparticles/updater-size"),require("@tsparticles/shape-square"),require("@tsparticles/updater-tilt"),require("@tsparticles/updater-wobble")):t(e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window);for(var r in i)("object"==typeof exports?exports:e)[r]=i[r]}}(this,((e,t,i,r,a,s,o,l,n,p,d,c,u,h,f)=>(()=>{"use strict";var y={533:t=>{t.exports=e},619:e=>{e.exports=i},68:e=>{e.exports=s},82:e=>{e.exports=l},163:e=>{e.exports=r},652:e=>{e.exports=u},71:e=>{e.exports=t},501:e=>{e.exports=a},84:e=>{e.exports=o},686:e=>{e.exports=n},290:e=>{e.exports=p},734:e=>{e.exports=d},2:e=>{e.exports=c},448:e=>{e.exports=h},83:e=>{e.exports=f}},w={};function v(e){var t=w[e];if(void 0!==t)return t.exports;var i=w[e]={exports:{}};return y[e](i,i.exports,v),i.exports}v.d=(e,t)=>{for(var i in t)v.o(t,i)&&!v.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},v.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),v.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var m={};return(()=>{v.r(m),v.d(m,{confetti:()=>b,loadConfettiPreset:()=>x});var e=v(533),t=v(71),i=v(619),r=v(163),a=v(501),s=v(68),o=v(84),l=v(82),n=v(686);class p{constructor(){this.angle=90,this.count=50,this.spread=45,this.startVelocity=45,this.decay=.9,this.gravity=1,this.drift=0,this.ticks=200,this.position={x:50,y:50},this.colors=["#ffffff","#ff0000"],this.shapes=["square","circle"],this.scalar=1,this.zIndex=100,this.disableForReducedMotion=!0}get origin(){return{x:this.position.x/100,y:this.position.y/100}}set origin(e){this.position.x=100*e.x,this.position.y=100*e.y}get particleCount(){return this.count}set particleCount(e){this.count=e}load(e){var t,i;if(!e)return;void 0!==e.angle&&(this.angle=e.angle);const r=null!==(t=e.count)&&void 0!==t?t:e.particleCount;void 0!==r&&(this.count=r),void 0!==e.spread&&(this.spread=e.spread),void 0!==e.startVelocity&&(this.startVelocity=e.startVelocity),void 0!==e.decay&&(this.decay=e.decay),void 0!==e.gravity&&(this.gravity=e.gravity),void 0!==e.drift&&(this.drift=e.drift),void 0!==e.ticks&&(this.ticks=e.ticks);const a=null!==(i=e.position)&&void 0!==i?i:this.position;void 0!==(null==a?void 0:a.x)&&(this.position.x=a.x),void 0!==(null==a?void 0:a.y)&&(this.position.y=a.y),void 0!==e.colors&&(e.colors instanceof Array?this.colors=[...e.colors]:this.colors=e.colors),void 0!==e.shapes&&(e.shapes instanceof Array?this.shapes=[...e.shapes]:this.shapes=e.shapes),void 0!==e.scalar&&(this.scalar=e.scalar),void 0!==e.zIndex&&(this.zIndex=e.zIndex),void 0!==e.disableForReducedMotion&&(this.disableForReducedMotion=e.disableForReducedMotion)}}var d=v(290),c=v(734),u=v(2),h=v(652),f=v(448),y=v(83);async function w(e,w,v=!1){await(0,i.loadBaseMover)(e),await(0,r.loadCircleShape)(e),await(0,h.loadSquareShape)(e),await(0,a.loadColorUpdater)(e),await(0,u.loadSizeUpdater)(e),await(0,n.loadOpacityUpdater)(e),await(0,d.loadOutModesUpdater)(e),await(0,s.loadEmittersPlugin)(e),await(0,l.loadMotionPlugin)(e),await(0,y.loadWobbleUpdater)(e),await(0,c.loadRollUpdater)(e),await(0,t.loadAngleUpdater)(e),await(0,f.loadTiltUpdater)(e),await(0,o.loadLifeUpdater)(e),await e.addPreset("confetti",(e=>{const t=new p;return t.load(e),{fullScreen:{enable:!0,zIndex:t.zIndex},fpsLimit:120,particles:{number:{value:0},color:{value:t.colors},shape:{type:t.shapes},opacity:{value:{min:0,max:1},animation:{enable:!0,speed:.5,startValue:"max",destroy:"min"}},size:{value:5*t.scalar},links:{enable:!1},life:{duration:{sync:!0,value:t.ticks/60},count:1},move:{angle:{value:t.spread,offset:0},drift:{min:-t.drift,max:t.drift},enable:!0,gravity:{enable:!0,acceleration:9.81*t.gravity},speed:t.startVelocity,decay:1-t.decay,direction:-t.angle,random:!0,straight:!1,outModes:{default:"none",bottom:"destroy"}},rotate:{value:{min:0,max:360},direction:"random",animation:{enable:!0,speed:60}},tilt:{direction:"random",enable:!0,value:{min:0,max:360},animation:{enable:!0,speed:60}},roll:{darken:{enable:!0,value:25},enable:!0,speed:{min:15,max:25}},wobble:{distance:30,enable:!0,speed:{min:-15,max:15}}},detectRetina:!0,motion:{disable:t.disableForReducedMotion},emitters:{startCount:t.count,position:t.position,size:{width:0,height:0},rate:{delay:0,quantity:0},life:{duration:.1,count:1}}}})(w),v)}async function x(e){await w(e,{},!0)}async function b(t,i){let r,a;"string"==typeof t?(a=t,r=null!=i?i:{}):(a=`tsparticles_${Math.floor(1e3*(0,e.getRandom)())}`,r=t),await w(e.tsParticles,r,!0),await e.tsParticles.load({id:a,options:{preset:"confetti"}})}})(),m})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/move-base"),require("@tsparticles/shape-circle"),require("@tsparticles/updater-color"),require("@tsparticles/updater-opacity"),require("@tsparticles/updater-out-modes"),require("@tsparticles/updater-size"),require("@tsparticles/plugin-emitters"),require("@tsparticles/updater-life"),require("@tsparticles/plugin-motion"),require("@tsparticles/updater-roll"),require("@tsparticles/engine"),require("@tsparticles/shape-square"),require("@tsparticles/updater-tilt"),require("@tsparticles/updater-wobble"));else if("function"==typeof define&&define.amd)define(["@tsparticles/move-base","@tsparticles/shape-circle","@tsparticles/updater-color","@tsparticles/updater-opacity","@tsparticles/updater-out-modes","@tsparticles/updater-size","@tsparticles/plugin-emitters","@tsparticles/updater-life","@tsparticles/plugin-motion","@tsparticles/updater-roll","@tsparticles/engine","@tsparticles/shape-square","@tsparticles/updater-tilt","@tsparticles/updater-wobble"],t);else{var a="object"==typeof exports?t(require("@tsparticles/move-base"),require("@tsparticles/shape-circle"),require("@tsparticles/updater-color"),require("@tsparticles/updater-opacity"),require("@tsparticles/updater-out-modes"),require("@tsparticles/updater-size"),require("@tsparticles/plugin-emitters"),require("@tsparticles/updater-life"),require("@tsparticles/plugin-motion"),require("@tsparticles/updater-roll"),require("@tsparticles/engine"),require("@tsparticles/shape-square"),require("@tsparticles/updater-tilt"),require("@tsparticles/updater-wobble")):t(e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window);for(var i in a)("object"==typeof exports?exports:e)[i]=a[i]}}(this,((e,t,a,i,r,o,s,n,l,c,p,d,u,f)=>(()=>{"use strict";var w={533:e=>{e.exports=p},619:t=>{t.exports=e},68:e=>{e.exports=s},82:e=>{e.exports=l},163:e=>{e.exports=t},652:e=>{e.exports=d},501:e=>{e.exports=a},84:e=>{e.exports=n},686:e=>{e.exports=i},290:e=>{e.exports=r},734:e=>{e.exports=c},2:e=>{e.exports=o},448:e=>{e.exports=u},83:e=>{e.exports=f}},m={};function b(e){var t=m[e];if(void 0!==t)return t.exports;var a=m[e]={exports:{}};return w[e](a,a.exports,b),a.exports}b.d=(e,t)=>{for(var a in t)b.o(t,a)&&!b.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},b.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),b.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var v={};return(()=>{b.r(v),b.d(v,{loadConfettiPreset:()=>q});var e=b(619),t=b(163),a=b(501),i=b(686),r=b(290),o=b(2);var s=b(68),n=b(84),l=b(82),c=b(734),p=b(533);class d{constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(e){e&&(void 0!==e.enable&&(this.enable=e.enable),void 0!==e.speed&&(this.speed=(0,p.setRangeValue)(e.speed)),void 0!==e.decay&&(this.decay=(0,p.setRangeValue)(e.decay)),void 0!==e.sync&&(this.sync=e.sync))}}class u extends p.ValueWithRandom{constructor(){super(),this.animation=new d,this.direction="clockwise",this.path=!1,this.value=0}load(e){e&&(super.load(e),void 0!==e.direction&&(this.direction=e.direction),this.animation.load(e.animation),void 0!==e.path&&(this.path=e.path))}}class f{constructor(e){this.container=e}init(e){const t=e.options.rotate;if(!t)return;e.rotate={enable:t.animation.enable,value:(0,p.getRangeValue)(t.value)*Math.PI/180},e.pathRotation=t.path;let a=t.direction;if("random"===a){a=Math.floor(2*(0,p.getRandom)())>0?"counter-clockwise":"clockwise"}switch(a){case"counter-clockwise":case"counterClockwise":e.rotate.status="decreasing";break;case"clockwise":e.rotate.status="increasing"}const i=t.animation;i.enable&&(e.rotate.decay=1-(0,p.getRangeValue)(i.decay),e.rotate.velocity=(0,p.getRangeValue)(i.speed)/360*this.container.retina.reduceFactor,i.sync||(e.rotate.velocity*=(0,p.getRandom)())),e.rotation=e.rotate.value}isEnabled(e){const t=e.options.rotate;return!!t&&(!e.destroyed&&!e.spawning&&t.animation.enable&&!t.path)}loadOptions(e,...t){e.rotate||(e.rotate=new u);for(const a of t)e.rotate.load(a?.rotate)}update(e,t){this.isEnabled(e)&&(!function(e,t){const a=e.rotate,i=e.options.rotate;if(!a||!i)return;const r=i.animation,o=(a.velocity??0)*t.factor,s=2*Math.PI,n=a.decay??1;r.enable&&("increasing"===a.status?(a.value+=o,a.value>s&&(a.value-=s)):(a.value-=o,a.value<0&&(a.value+=s)),a.velocity&&1!==n&&(a.velocity*=n))}(e,t),e.rotation=e.rotate?.value??0)}}var w=b(652),m=b(448),y=b(83);const h={fullScreen:{enable:!0,zIndex:100},fpsLimit:120,particles:{number:{value:0},color:{value:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"]},shape:{type:["square","circle"]},opacity:{value:{min:0,max:1},animation:{enable:!0,speed:.5,startValue:"max",destroy:"min"}},size:{value:5},links:{enable:!1},life:{duration:{sync:!0,value:20/6},count:1},move:{angle:{value:45,offset:0},drift:0,enable:!0,gravity:{enable:!0,acceleration:9.81},speed:45,decay:.1,direction:-90,random:!0,straight:!1,outModes:{default:"none",bottom:"destroy"}},rotate:{value:{min:0,max:360},direction:"random",animation:{enable:!0,speed:60}},tilt:{direction:"random",enable:!0,value:{min:0,max:360},animation:{enable:!0,speed:60}},roll:{darken:{enable:!0,value:25},enable:!0,speed:{min:15,max:25}},wobble:{distance:30,enable:!0,speed:{min:-15,max:15}}},detectRetina:!0,motion:{disable:!0},emitters:{name:"confetti",startCount:50,position:{x:50,y:50},size:{width:0,height:0},rate:{delay:0,quantity:0},life:{duration:.1,count:1}}};async function g(p,d=!0){await async function(s,n=!0){await(0,e.loadBaseMover)(s,!1),await(0,t.loadCircleShape)(s,!1),await(0,a.loadColorUpdater)(s,!1),await(0,i.loadOpacityUpdater)(s,!1),await(0,r.loadOutModesUpdater)(s,!1),await(0,o.loadSizeUpdater)(s,!1),await s.refresh(n)}(p,!1),await(0,w.loadSquareShape)(p,!1),await(0,s.loadEmittersPlugin)(p,!1),await(0,l.loadMotionPlugin)(p,!1),await(0,y.loadWobbleUpdater)(p,!1),await(0,c.loadRollUpdater)(p,!1),await async function(e,t=!0){await e.addParticleUpdater("rotate",(e=>new f(e)),t)}(p,!1),await(0,m.loadTiltUpdater)(p,!1),await(0,n.loadLifeUpdater)(p,!1),await p.addPreset("confetti",h,d)}async function q(e){await g(e)}})(),v})()));
@@ -1,8 +1 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v3.0.0-alpha.1
8
- */
1
+ /*! tsParticles Confetti Preset v3.0.0-beta.1 by Matteo Bruni */
package/types/bundle.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { confetti, loadConfettiPreset } from "./index";
2
- import type { ConfettiOptions } from "./index";
1
+ import { loadConfettiPreset } from "./index";
3
2
  import { tsParticles } from "@tsparticles/engine";
4
- export type { ConfettiOptions };
5
- export { confetti, loadConfettiPreset, tsParticles };
3
+ export { loadConfettiPreset, tsParticles };
package/types/index.d.ts CHANGED
@@ -1,6 +1,2 @@
1
- import type { Engine, RecursivePartial } from "@tsparticles/engine";
2
- import type { IConfettiOptions } from "./IConfettiOptions";
3
- export declare function loadConfettiPreset(main: Engine): Promise<void>;
4
- export type ConfettiOptions = RecursivePartial<IConfettiOptions>;
5
- export type ConfettiFirstParam = string | ConfettiOptions;
6
- export declare function confetti(idOrOptions: ConfettiFirstParam, confettiOptions?: RecursivePartial<IConfettiOptions>): Promise<void>;
1
+ import type { Engine } from "@tsparticles/engine";
2
+ export declare function loadConfettiPreset(engine: Engine): Promise<void>;
@@ -1,3 +1,2 @@
1
- import type { ISourceOptions, RecursivePartial } from "@tsparticles/engine";
2
- import type { IConfettiOptions } from "./IConfettiOptions";
3
- export declare const loadOptions: (confettiOptions: RecursivePartial<IConfettiOptions>) => ISourceOptions;
1
+ import type { ISourceOptions } from "@tsparticles/engine";
2
+ export declare const options: ISourceOptions;
package/umd/bundle.js CHANGED
@@ -9,9 +9,8 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.tsParticles = exports.loadConfettiPreset = exports.confetti = void 0;
12
+ exports.tsParticles = exports.loadConfettiPreset = void 0;
13
13
  const index_1 = require("./index");
14
- Object.defineProperty(exports, "confetti", { enumerable: true, get: function () { return index_1.confetti; } });
15
14
  Object.defineProperty(exports, "loadConfettiPreset", { enumerable: true, get: function () { return index_1.loadConfettiPreset; } });
16
15
  const engine_1 = require("@tsparticles/engine");
17
16
  Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
package/umd/index.js CHANGED
@@ -4,67 +4,36 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "@tsparticles/updater-angle", "@tsparticles/move-base", "@tsparticles/shape-circle", "@tsparticles/updater-color", "@tsparticles/plugin-emitters", "@tsparticles/updater-life", "@tsparticles/plugin-motion", "@tsparticles/updater-opacity", "./options", "@tsparticles/updater-out-modes", "@tsparticles/updater-roll", "@tsparticles/updater-size", "@tsparticles/shape-square", "@tsparticles/updater-tilt", "@tsparticles/updater-wobble"], factory);
7
+ define(["require", "exports", "@tsparticles/basic", "@tsparticles/plugin-emitters", "@tsparticles/updater-life", "@tsparticles/plugin-motion", "@tsparticles/updater-roll", "@tsparticles/updater-rotate", "@tsparticles/shape-square", "@tsparticles/updater-tilt", "@tsparticles/updater-wobble", "./options"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  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");
12
+ exports.loadConfettiPreset = void 0;
13
+ const basic_1 = require("@tsparticles/basic");
18
14
  const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
19
15
  const updater_life_1 = require("@tsparticles/updater-life");
20
16
  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
17
  const updater_roll_1 = require("@tsparticles/updater-roll");
25
- const updater_size_1 = require("@tsparticles/updater-size");
18
+ const updater_rotate_1 = require("@tsparticles/updater-rotate");
26
19
  const shape_square_1 = require("@tsparticles/shape-square");
27
20
  const updater_tilt_1 = require("@tsparticles/updater-tilt");
28
21
  const updater_wobble_1 = require("@tsparticles/updater-wobble");
29
- async function loadPreset(engine, confettiOptions, override = false) {
30
- await (0, move_base_1.loadBaseMover)(engine);
31
- await (0, shape_circle_1.loadCircleShape)(engine);
32
- await (0, shape_square_1.loadSquareShape)(engine);
33
- await (0, updater_color_1.loadColorUpdater)(engine);
34
- await (0, updater_size_1.loadSizeUpdater)(engine);
35
- await (0, updater_opacity_1.loadOpacityUpdater)(engine);
36
- await (0, updater_out_modes_1.loadOutModesUpdater)(engine);
37
- await (0, plugin_emitters_1.loadEmittersPlugin)(engine);
38
- await (0, plugin_motion_1.loadMotionPlugin)(engine);
39
- await (0, updater_wobble_1.loadWobbleUpdater)(engine);
40
- await (0, updater_roll_1.loadRollUpdater)(engine);
41
- await (0, updater_angle_1.loadAngleUpdater)(engine);
42
- await (0, updater_tilt_1.loadTiltUpdater)(engine);
43
- await (0, updater_life_1.loadLifeUpdater)(engine);
44
- await engine.addPreset("confetti", (0, options_1.loadOptions)(confettiOptions), override);
22
+ const options_1 = require("./options");
23
+ async function loadPreset(engine, refresh = true) {
24
+ await (0, basic_1.loadBasic)(engine, false);
25
+ await (0, shape_square_1.loadSquareShape)(engine, false);
26
+ await (0, plugin_emitters_1.loadEmittersPlugin)(engine, false);
27
+ await (0, plugin_motion_1.loadMotionPlugin)(engine, false);
28
+ await (0, updater_wobble_1.loadWobbleUpdater)(engine, false);
29
+ await (0, updater_roll_1.loadRollUpdater)(engine, false);
30
+ await (0, updater_rotate_1.loadRotateUpdater)(engine, false);
31
+ await (0, updater_tilt_1.loadTiltUpdater)(engine, false);
32
+ await (0, updater_life_1.loadLifeUpdater)(engine, false);
33
+ await engine.addPreset("confetti", options_1.options, refresh);
45
34
  }
46
- async function loadConfettiPreset(main) {
47
- await loadPreset(main, {}, true);
35
+ async function loadConfettiPreset(engine) {
36
+ await loadPreset(engine);
48
37
  }
49
38
  exports.loadConfettiPreset = loadConfettiPreset;
50
- async function confetti(idOrOptions, confettiOptions) {
51
- let options;
52
- let id;
53
- if (typeof idOrOptions === "string") {
54
- id = idOrOptions;
55
- options = confettiOptions !== null && confettiOptions !== void 0 ? confettiOptions : {};
56
- }
57
- else {
58
- id = `tsparticles_${Math.floor((0, engine_1.getRandom)() * 1000)}`;
59
- options = idOrOptions;
60
- }
61
- await loadPreset(engine_1.tsParticles, options, true);
62
- await engine_1.tsParticles.load({
63
- id,
64
- options: {
65
- preset: "confetti",
66
- },
67
- });
68
- }
69
- exports.confetti = confetti;
70
39
  });
package/umd/options.js CHANGED
@@ -4,142 +4,137 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./ConfettiOptions"], factory);
7
+ define(["require", "exports"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.loadOptions = void 0;
13
- const ConfettiOptions_1 = require("./ConfettiOptions");
14
- const loadOptions = (confettiOptions) => {
15
- const actualOptions = new ConfettiOptions_1.ConfettiOptions();
16
- actualOptions.load(confettiOptions);
17
- return {
18
- fullScreen: {
19
- enable: true,
20
- zIndex: actualOptions.zIndex,
12
+ exports.options = void 0;
13
+ exports.options = {
14
+ fullScreen: {
15
+ enable: true,
16
+ zIndex: 100,
17
+ },
18
+ fpsLimit: 120,
19
+ particles: {
20
+ number: {
21
+ value: 0,
21
22
  },
22
- fpsLimit: 120,
23
- particles: {
24
- number: {
25
- value: 0,
26
- },
27
- color: {
28
- value: actualOptions.colors,
23
+ color: {
24
+ value: ["#26ccff", "#a25afd", "#ff5e7e", "#88ff5a", "#fcff42", "#ffa62d", "#ff36ff"],
25
+ },
26
+ shape: {
27
+ type: ["square", "circle"],
28
+ },
29
+ opacity: {
30
+ value: { min: 0, max: 1 },
31
+ animation: {
32
+ enable: true,
33
+ speed: 0.5,
34
+ startValue: "max",
35
+ destroy: "min",
29
36
  },
30
- shape: {
31
- type: actualOptions.shapes,
37
+ },
38
+ size: {
39
+ value: 5,
40
+ },
41
+ links: {
42
+ enable: false,
43
+ },
44
+ life: {
45
+ duration: {
46
+ sync: true,
47
+ value: 20 / 6,
32
48
  },
33
- opacity: {
34
- value: { min: 0, max: 1 },
35
- animation: {
36
- enable: true,
37
- speed: 0.5,
38
- startValue: "max",
39
- destroy: "min",
40
- },
49
+ count: 1,
50
+ },
51
+ move: {
52
+ angle: {
53
+ value: 45,
54
+ offset: 0,
41
55
  },
42
- size: {
43
- value: 5 * actualOptions.scalar,
56
+ drift: 0,
57
+ enable: true,
58
+ gravity: {
59
+ enable: true,
60
+ acceleration: 9.81,
44
61
  },
45
- links: {
46
- enable: false,
62
+ speed: 45,
63
+ decay: 0.1,
64
+ direction: -90,
65
+ random: true,
66
+ straight: false,
67
+ outModes: {
68
+ default: "none",
69
+ bottom: "destroy",
47
70
  },
48
- life: {
49
- duration: {
50
- sync: true,
51
- value: actualOptions.ticks / 60,
52
- },
53
- count: 1,
71
+ },
72
+ rotate: {
73
+ value: {
74
+ min: 0,
75
+ max: 360,
54
76
  },
55
- move: {
56
- angle: {
57
- value: actualOptions.spread,
58
- offset: 0,
59
- },
60
- drift: {
61
- min: -actualOptions.drift,
62
- max: actualOptions.drift,
63
- },
77
+ direction: "random",
78
+ animation: {
64
79
  enable: true,
65
- gravity: {
66
- enable: true,
67
- acceleration: actualOptions.gravity * 9.81,
68
- },
69
- speed: actualOptions.startVelocity,
70
- decay: 1 - actualOptions.decay,
71
- direction: -actualOptions.angle,
72
- random: true,
73
- straight: false,
74
- outModes: {
75
- default: "none",
76
- bottom: "destroy",
77
- },
80
+ speed: 60,
78
81
  },
79
- rotate: {
80
- value: {
81
- min: 0,
82
- max: 360,
83
- },
84
- direction: "random",
85
- animation: {
86
- enable: true,
87
- speed: 60,
88
- },
82
+ },
83
+ tilt: {
84
+ direction: "random",
85
+ enable: true,
86
+ value: {
87
+ min: 0,
88
+ max: 360,
89
89
  },
90
- tilt: {
91
- direction: "random",
90
+ animation: {
92
91
  enable: true,
93
- value: {
94
- min: 0,
95
- max: 360,
96
- },
97
- animation: {
98
- enable: true,
99
- speed: 60,
100
- },
92
+ speed: 60,
101
93
  },
102
- roll: {
103
- darken: {
104
- enable: true,
105
- value: 25,
106
- },
94
+ },
95
+ roll: {
96
+ darken: {
107
97
  enable: true,
108
- speed: {
109
- min: 15,
110
- max: 25,
111
- },
98
+ value: 25,
112
99
  },
113
- wobble: {
114
- distance: 30,
115
- enable: true,
116
- speed: {
117
- min: -15,
118
- max: 15,
119
- },
100
+ enable: true,
101
+ speed: {
102
+ min: 15,
103
+ max: 25,
120
104
  },
121
105
  },
122
- detectRetina: true,
123
- motion: {
124
- disable: actualOptions.disableForReducedMotion,
125
- },
126
- emitters: {
127
- startCount: actualOptions.count,
128
- position: actualOptions.position,
129
- size: {
130
- width: 0,
131
- height: 0,
132
- },
133
- rate: {
134
- delay: 0,
135
- quantity: 0,
136
- },
137
- life: {
138
- duration: 0.1,
139
- count: 1,
106
+ wobble: {
107
+ distance: 30,
108
+ enable: true,
109
+ speed: {
110
+ min: -15,
111
+ max: 15,
140
112
  },
141
113
  },
142
- };
114
+ },
115
+ detectRetina: true,
116
+ motion: {
117
+ disable: true,
118
+ },
119
+ emitters: {
120
+ name: "confetti",
121
+ startCount: 50,
122
+ position: {
123
+ x: 50,
124
+ y: 50,
125
+ },
126
+ size: {
127
+ width: 0,
128
+ height: 0,
129
+ },
130
+ rate: {
131
+ delay: 0,
132
+ quantity: 0,
133
+ },
134
+ life: {
135
+ duration: 0.1,
136
+ count: 1,
137
+ },
138
+ },
143
139
  };
144
- exports.loadOptions = loadOptions;
145
140
  });
@@ -1,100 +0,0 @@
1
- export class ConfettiOptions {
2
- constructor() {
3
- this.angle = 90;
4
- this.count = 50;
5
- this.spread = 45;
6
- this.startVelocity = 45;
7
- this.decay = 0.9;
8
- this.gravity = 1;
9
- this.drift = 0;
10
- this.ticks = 200;
11
- this.position = {
12
- x: 50,
13
- y: 50,
14
- };
15
- this.colors = ["#ffffff", "#ff0000"];
16
- this.shapes = ["square", "circle"];
17
- this.scalar = 1;
18
- this.zIndex = 100;
19
- this.disableForReducedMotion = true;
20
- }
21
- get origin() {
22
- return {
23
- x: this.position.x / 100,
24
- y: this.position.y / 100,
25
- };
26
- }
27
- set origin(value) {
28
- this.position.x = value.x * 100;
29
- this.position.y = value.y * 100;
30
- }
31
- get particleCount() {
32
- return this.count;
33
- }
34
- set particleCount(value) {
35
- this.count = value;
36
- }
37
- load(data) {
38
- var _a, _b;
39
- if (!data) {
40
- return;
41
- }
42
- if (data.angle !== undefined) {
43
- this.angle = data.angle;
44
- }
45
- const count = (_a = data.count) !== null && _a !== void 0 ? _a : data.particleCount;
46
- if (count !== undefined) {
47
- this.count = count;
48
- }
49
- if (data.spread !== undefined) {
50
- this.spread = data.spread;
51
- }
52
- if (data.startVelocity !== undefined) {
53
- this.startVelocity = data.startVelocity;
54
- }
55
- if (data.decay !== undefined) {
56
- this.decay = data.decay;
57
- }
58
- if (data.gravity !== undefined) {
59
- this.gravity = data.gravity;
60
- }
61
- if (data.drift !== undefined) {
62
- this.drift = data.drift;
63
- }
64
- if (data.ticks !== undefined) {
65
- this.ticks = data.ticks;
66
- }
67
- const position = (_b = data.position) !== null && _b !== void 0 ? _b : this.position;
68
- if ((position === null || position === void 0 ? void 0 : position.x) !== undefined) {
69
- this.position.x = position.x;
70
- }
71
- if ((position === null || position === void 0 ? void 0 : position.y) !== undefined) {
72
- this.position.y = position.y;
73
- }
74
- if (data.colors !== undefined) {
75
- if (data.colors instanceof Array) {
76
- this.colors = [...data.colors];
77
- }
78
- else {
79
- this.colors = data.colors;
80
- }
81
- }
82
- if (data.shapes !== undefined) {
83
- if (data.shapes instanceof Array) {
84
- this.shapes = [...data.shapes];
85
- }
86
- else {
87
- this.shapes = data.shapes;
88
- }
89
- }
90
- if (data.scalar !== undefined) {
91
- this.scalar = data.scalar;
92
- }
93
- if (data.zIndex !== undefined) {
94
- this.zIndex = data.zIndex;
95
- }
96
- if (data.disableForReducedMotion !== undefined) {
97
- this.disableForReducedMotion = data.disableForReducedMotion;
98
- }
99
- }
100
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,104 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfettiOptions = void 0;
4
- class ConfettiOptions {
5
- constructor() {
6
- this.angle = 90;
7
- this.count = 50;
8
- this.spread = 45;
9
- this.startVelocity = 45;
10
- this.decay = 0.9;
11
- this.gravity = 1;
12
- this.drift = 0;
13
- this.ticks = 200;
14
- this.position = {
15
- x: 50,
16
- y: 50,
17
- };
18
- this.colors = ["#ffffff", "#ff0000"];
19
- this.shapes = ["square", "circle"];
20
- this.scalar = 1;
21
- this.zIndex = 100;
22
- this.disableForReducedMotion = true;
23
- }
24
- get origin() {
25
- return {
26
- x: this.position.x / 100,
27
- y: this.position.y / 100,
28
- };
29
- }
30
- set origin(value) {
31
- this.position.x = value.x * 100;
32
- this.position.y = value.y * 100;
33
- }
34
- get particleCount() {
35
- return this.count;
36
- }
37
- set particleCount(value) {
38
- this.count = value;
39
- }
40
- load(data) {
41
- var _a, _b;
42
- if (!data) {
43
- return;
44
- }
45
- if (data.angle !== undefined) {
46
- this.angle = data.angle;
47
- }
48
- const count = (_a = data.count) !== null && _a !== void 0 ? _a : data.particleCount;
49
- if (count !== undefined) {
50
- this.count = count;
51
- }
52
- if (data.spread !== undefined) {
53
- this.spread = data.spread;
54
- }
55
- if (data.startVelocity !== undefined) {
56
- this.startVelocity = data.startVelocity;
57
- }
58
- if (data.decay !== undefined) {
59
- this.decay = data.decay;
60
- }
61
- if (data.gravity !== undefined) {
62
- this.gravity = data.gravity;
63
- }
64
- if (data.drift !== undefined) {
65
- this.drift = data.drift;
66
- }
67
- if (data.ticks !== undefined) {
68
- this.ticks = data.ticks;
69
- }
70
- const position = (_b = data.position) !== null && _b !== void 0 ? _b : this.position;
71
- if ((position === null || position === void 0 ? void 0 : position.x) !== undefined) {
72
- this.position.x = position.x;
73
- }
74
- if ((position === null || position === void 0 ? void 0 : position.y) !== undefined) {
75
- this.position.y = position.y;
76
- }
77
- if (data.colors !== undefined) {
78
- if (data.colors instanceof Array) {
79
- this.colors = [...data.colors];
80
- }
81
- else {
82
- this.colors = data.colors;
83
- }
84
- }
85
- if (data.shapes !== undefined) {
86
- if (data.shapes instanceof Array) {
87
- this.shapes = [...data.shapes];
88
- }
89
- else {
90
- this.shapes = data.shapes;
91
- }
92
- }
93
- if (data.scalar !== undefined) {
94
- this.scalar = data.scalar;
95
- }
96
- if (data.zIndex !== undefined) {
97
- this.zIndex = data.zIndex;
98
- }
99
- if (data.disableForReducedMotion !== undefined) {
100
- this.disableForReducedMotion = data.disableForReducedMotion;
101
- }
102
- }
103
- }
104
- exports.ConfettiOptions = ConfettiOptions;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });