UNPKG

8.7 kBJavaScriptView Raw
1/*! For license information please see tsparticles.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-cards"),require("tsparticles-shape-circle"),require("tsparticles-updater-color"),require("tsparticles-plugin-emitters"),require("tsparticles-shape-heart"),require("tsparticles-shape-image"),require("tsparticles-updater-life"),require("tsparticles-plugin-motion"),require("tsparticles-updater-opacity"),require("tsparticles-updater-out-modes"),require("tsparticles-shape-polygon"),require("tsparticles-updater-roll"),require("tsparticles-updater-size"),require("tsparticles-shape-square"),require("tsparticles-shape-star"),require("tsparticles-shape-text"),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-cards","tsparticles-shape-circle","tsparticles-updater-color","tsparticles-plugin-emitters","tsparticles-shape-heart","tsparticles-shape-image","tsparticles-updater-life","tsparticles-plugin-motion","tsparticles-updater-opacity","tsparticles-updater-out-modes","tsparticles-shape-polygon","tsparticles-updater-roll","tsparticles-updater-size","tsparticles-shape-square","tsparticles-shape-star","tsparticles-shape-text","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-cards"),require("tsparticles-shape-circle"),require("tsparticles-updater-color"),require("tsparticles-plugin-emitters"),require("tsparticles-shape-heart"),require("tsparticles-shape-image"),require("tsparticles-updater-life"),require("tsparticles-plugin-motion"),require("tsparticles-updater-opacity"),require("tsparticles-updater-out-modes"),require("tsparticles-shape-polygon"),require("tsparticles-updater-roll"),require("tsparticles-updater-size"),require("tsparticles-shape-square"),require("tsparticles-shape-star"),require("tsparticles-shape-text"),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,e.window,e.window,e.window,e.window,e.window,e.window);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(this,((e,t,i,s,a,r,o,l,p,n,c,d,u,h,f,w,y,v,x,m,g)=>(()=>{"use strict";var q={961:t=>{t.exports=e},565:e=>{e.exports=i},716:e=>{e.exports=o},255:e=>{e.exports=c},522:e=>{e.exports=s},851:e=>{e.exports=a},516:e=>{e.exports=l},520:e=>{e.exports=p},841:e=>{e.exports=h},860:e=>{e.exports=y},208:e=>{e.exports=v},706:e=>{e.exports=x},490:e=>{e.exports=t},613:e=>{e.exports=r},86:e=>{e.exports=n},515:e=>{e.exports=d},509:e=>{e.exports=u},852:e=>{e.exports=f},694:e=>{e.exports=w},95:e=>{e.exports=m},585:e=>{e.exports=g}},b={};function P(e){var t=b[e];if(void 0!==t)return t.exports;var i=b[e]={exports:{}};return q[e](i,i.exports,P),i.exports}P.d=(e,t)=>{for(var i in t)P.o(t,i)&&!P.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},P.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),P.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var S={};return(()=>{P.r(S),P.d(S,{confetti:()=>U});var e=P(961);class t{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=["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],this.shapes=["square","circle"],this.scalar=1,this.zIndex=100,this.disableForReducedMotion=!0,this.shapeOptions={}}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(t){var i,s;if(!t)return;void 0!==t.angle&&(this.angle=t.angle);const a=null!==(i=t.count)&&void 0!==i?i:t.particleCount;void 0!==a&&(this.count=a),void 0!==t.spread&&(this.spread=t.spread),void 0!==t.startVelocity&&(this.startVelocity=t.startVelocity),void 0!==t.decay&&(this.decay=t.decay),void 0!==t.gravity&&(this.gravity=t.gravity),void 0!==t.drift&&(this.drift=t.drift),void 0!==t.ticks&&(this.ticks=t.ticks);const r=t.origin;r&&!t.position&&(t.position={x:void 0!==r.x?100*r.x:void 0,y:void 0!==r.y?100*r.y:void 0});const o=t.position;o&&(void 0!==o.x&&(this.position.x=o.x),void 0!==o.y&&(this.position.y=o.y)),void 0!==t.colors&&(t.colors instanceof Array?this.colors=[...t.colors]:this.colors=t.colors);const l=t.shapeOptions;if(void 0!==l)for(const t in l){const i=l[t];i&&(this.shapeOptions[t]=(0,e.deepExtend)(null!==(s=this.shapeOptions[t])&&void 0!==s?s:{},i))}void 0!==t.shapes&&(t.shapes instanceof Array?this.shapes=[...t.shapes]:this.shapes=t.shapes),void 0!==t.scalar&&(this.scalar=t.scalar),void 0!==t.zIndex&&(this.zIndex=t.zIndex),void 0!==t.disableForReducedMotion&&(this.disableForReducedMotion=t.disableForReducedMotion)}}var i=P(490),s=P(565),a=P(522),r=P(851),o=P(613),l=P(716),p=P(516),n=P(520),c=P(86),d=P(255),u=P(515),h=P(509),f=P(841),w=P(852),y=P(694),v=P(860),x=P(208),m=P(706),g=P(95),q=P(585);let b=!1,z=!1;const O=new Map;async function M(){if(!b){if(z)return new Promise((e=>{const t=setInterval((()=>{b&&(clearInterval(t),e())}),100)}));z=!0,await(0,s.loadBaseMover)(e.tsParticles),await(0,l.loadEmittersPlugin)(e.tsParticles),await(0,d.loadMotionPlugin)(e.tsParticles),await(0,a.loadCardsShape)(e.tsParticles),await(0,r.loadCircleShape)(e.tsParticles),await(0,p.loadHeartShape)(e.tsParticles),await(0,n.loadImageShape)(e.tsParticles),await(0,f.loadPolygonShape)(e.tsParticles),await(0,v.loadSquareShape)(e.tsParticles),await(0,x.loadStarShape)(e.tsParticles),await(0,m.loadTextShape)(e.tsParticles),await(0,i.loadAngleUpdater)(e.tsParticles),await(0,o.loadColorUpdater)(e.tsParticles),await(0,c.loadLifeUpdater)(e.tsParticles),await(0,u.loadOpacityUpdater)(e.tsParticles),await(0,h.loadOutModesUpdater)(e.tsParticles),await(0,w.loadRollUpdater)(e.tsParticles),await(0,y.loadSizeUpdater)(e.tsParticles),await(0,g.loadTiltUpdater)(e.tsParticles),await(0,q.loadWobbleUpdater)(e.tsParticles),z=!1,b=!0}}async function I(i){const s=new t;let a;if(s.load(i.options),O.has(i.id)&&(a=O.get(i.id),a&&!a.destroyed)){const e=a;if(e.addEmitter)return void e.addEmitter({startCount:s.count,position:s.position,size:{width:0,height:0},rate:{delay:0,quantity:0},life:{duration:.1,count:1},particles:{color:{value:s.colors},shape:{type:s.shapes,options:s.shapeOptions},size:{value:5*s.scalar},life:{duration:{value:s.ticks/60}},move:{angle:{value:s.spread,offset:0},drift:{min:-s.drift,max:s.drift},gravity:{acceleration:9.81*s.gravity},speed:3*s.startVelocity,decay:1-s.decay,direction:-s.angle}}})}const r={fullScreen:{enable:!i.canvas,zIndex:s.zIndex},fpsLimit:120,particles:{number:{value:0},color:{value:s.colors},shape:{type:s.shapes,options:s.shapeOptions},opacity:{value:{min:0,max:1},animation:{enable:!0,speed:.5,startValue:"max",destroy:"min"}},size:{value:5*s.scalar},links:{enable:!1},life:{duration:{sync:!0,value:s.ticks/60},count:1},move:{angle:{value:s.spread,offset:0},drift:{min:-s.drift,max:s.drift},enable:!0,gravity:{enable:!0,acceleration:9.81*s.gravity},speed:3*s.startVelocity,decay:1-s.decay,direction:-s.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:s.disableForReducedMotion},emitters:{name:"confetti",startCount:s.count,position:s.position,size:{width:0,height:0},rate:{delay:0,quantity:0},life:{duration:.1,count:1}}};return i.id?a=await e.tsParticles.load(i.id,r):i.canvas&&(a=await e.tsParticles.set(i.id,i.canvas,r)),O.set(i.id,a),a}async function U(e,t){let i,s;return await M(),"string"==typeof e?(s=e,i=null!=t?t:{}):(s="confetti",i=e),I({id:s,options:i})}U.create=async(e,t)=>{if(!e)return U;await M();const i=e.getAttribute("id")||"confetti";return e.setAttribute("id",i),async(s,a)=>{let r,o;return"string"==typeof s?(o=s,r=null!=a?a:t):(o=i,r=s),I({id:o,canvas:e,options:r})}}})(),S})()));
\No newline at end of file