lecoffre-back/node_modules/tsparticles-updater-wobble/tsparticles.updater.wobble.min.js
2023-02-17 11:06:01 +01:00

2 lines
2.6 KiB
JavaScript

/*! For license information please see tsparticles.updater.wobble.min.js.LICENSE.txt */
!function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],o);else{var t="object"==typeof exports?o(require("tsparticles-engine")):o(e.window);for(var n in t)("object"==typeof exports?exports:e)[n]=t[n]}}(this,(e=>(()=>{"use strict";var o={961:o=>{o.exports=e}},t={};function n(e){var a=t[e];if(void 0!==a)return a.exports;var l=t[e]={exports:{}};return o[e](l,l.exports,n),l.exports}n.d=(e,o)=>{for(var t in o)n.o(o,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},n.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{n.r(a),n.d(a,{loadWobbleUpdater:()=>i});var e=n(961);class o{constructor(){this.angle=50,this.move=10}load(o){o&&(void 0!==o.angle&&(this.angle=(0,e.setRangeValue)(o.angle)),void 0!==o.move&&(this.move=(0,e.setRangeValue)(o.move)))}}class t{constructor(){this.distance=5,this.enable=!1,this.speed=new o}load(o){if(o&&(void 0!==o.distance&&(this.distance=(0,e.setRangeValue)(o.distance)),void 0!==o.enable&&(this.enable=o.enable),void 0!==o.speed))if("number"==typeof o.speed)this.speed.load({angle:o.speed});else{const e=o.speed;void 0!==e.min?this.speed.load({angle:e}):this.speed.load(o.speed)}}}class l{constructor(e){this.container=e}init(o){var t;const n=o.options.wobble;(null==n?void 0:n.enable)?o.wobble={angle:(0,e.getRandom)()*Math.PI*2,angleSpeed:(0,e.getRangeValue)(n.speed.angle)/360,moveSpeed:(0,e.getRangeValue)(n.speed.move)/10}:o.wobble={angle:0,angleSpeed:0,moveSpeed:0},o.retina.wobbleDistance=(0,e.getRangeValue)(null!==(t=null==n?void 0:n.distance)&&void 0!==t?t:0)*this.container.retina.pixelRatio}isEnabled(e){var o;return!e.destroyed&&!e.spawning&&!!(null===(o=e.options.wobble)||void 0===o?void 0:o.enable)}loadOptions(e,...o){e.wobble||(e.wobble=new t);for(const t of o)e.wobble.load(null==t?void 0:t.wobble)}update(e,o){this.isEnabled(e)&&function(e,o){var t;const n=e.options.wobble;if(!(null==n?void 0:n.enable)||!e.wobble)return;const a=e.wobble.angleSpeed*o.factor,l=e.wobble.moveSpeed*o.factor*((null!==(t=e.retina.wobbleDistance)&&void 0!==t?t:0)*o.factor)/(1e3/60),i=2*Math.PI;e.wobble.angle+=a,e.wobble.angle>i&&(e.wobble.angle-=i),e.position.x+=l*Math.cos(e.wobble.angle),e.position.y+=l*Math.abs(Math.sin(e.wobble.angle))}(e,o)}}async function i(e){await e.addParticleUpdater("wobble",(e=>new l(e)))}})(),a})()));