/*! * Author : Matteo Bruni * MIT license: https://opensource.org/licenses/MIT * Demo / Generator : https://particles.js.org/ * GitHub : https://www.github.com/matteobruni/tsparticles * How to use? : Check the GitHub README * v2.8.0 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("tsparticles-engine")); else if(typeof define === 'function' && define.amd) define(["tsparticles-engine"], factory); else { var a = typeof exports === 'object' ? factory(require("tsparticles-engine")) : factory(root["window"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(this, (__WEBPACK_EXTERNAL_MODULE__961__) => { return /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ 961: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE__961__; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "loadLifeUpdater": () => (/* binding */ loadLifeUpdater) }); // EXTERNAL MODULE: external {"commonjs":"tsparticles-engine","commonjs2":"tsparticles-engine","amd":"tsparticles-engine","root":"window"} var external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_ = __webpack_require__(961); ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/LifeDelay.js class LifeDelay extends external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ValueWithRandom { constructor() { super(); this.sync = false; } load(data) { if (!data) { return; } super.load(data); if (data.sync !== undefined) { this.sync = data.sync; } } } ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/LifeDuration.js class LifeDuration extends external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ValueWithRandom { constructor() { super(); this.random.minimumValue = 0.0001; this.sync = false; } load(data) { if (!data) { return; } super.load(data); if (data.sync !== undefined) { this.sync = data.sync; } } } ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/Life.js class Life { constructor() { this.count = 0; this.delay = new LifeDelay(); this.duration = new LifeDuration(); } load(data) { if (!data) { return; } if (data.count !== undefined) { this.count = data.count; } this.delay.load(data.delay); this.duration.load(data.duration); } } ;// CONCATENATED MODULE: ./dist/browser/LifeUpdater.js class LifeUpdater { constructor(container) { this.container = container; } init(particle) { const container = this.container, particlesOptions = particle.options, lifeOptions = particlesOptions.life; if (!lifeOptions) { return; } particle.life = { delay: container.retina.reduceFactor ? (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)(lifeOptions.delay.value) * (lifeOptions.delay.sync ? 1 : (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRandom)()) / container.retina.reduceFactor * 1000 : 0, delayTime: 0, duration: container.retina.reduceFactor ? (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)(lifeOptions.duration.value) * (lifeOptions.duration.sync ? 1 : (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRandom)()) / container.retina.reduceFactor * 1000 : 0, time: 0, count: lifeOptions.count }; if (particle.life.duration <= 0) { particle.life.duration = -1; } if (particle.life.count <= 0) { particle.life.count = -1; } if (particle.life) { particle.spawning = particle.life.delay > 0; } } isEnabled(particle) { return !particle.destroyed; } loadOptions(options, ...sources) { if (!options.life) { options.life = new Life(); } for (const source of sources) { options.life.load(source === null || source === void 0 ? void 0 : source.life); } } update(particle, delta) { if (!this.isEnabled(particle) || !particle.life) { return; } const life = particle.life; let justSpawned = false; if (particle.spawning) { life.delayTime += delta.value; if (life.delayTime >= particle.life.delay) { justSpawned = true; particle.spawning = false; life.delayTime = 0; life.time = 0; } else { return; } } if (life.duration === -1) { return; } if (particle.spawning) { return; } if (justSpawned) { life.time = 0; } else { life.time += delta.value; } if (life.time < life.duration) { return; } life.time = 0; if (particle.life.count > 0) { particle.life.count--; } if (particle.life.count === 0) { particle.destroy(); return; } const canvasSize = this.container.canvas.size, widthRange = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.setRangeValue)(0, canvasSize.width), heightRange = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.setRangeValue)(0, canvasSize.width); particle.position.x = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.randomInRange)(widthRange); particle.position.y = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.randomInRange)(heightRange); particle.spawning = true; life.delayTime = 0; life.time = 0; particle.reset(); const lifeOptions = particle.options.life; if (lifeOptions) { life.delay = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)(lifeOptions.delay.value) * 1000; life.duration = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)(lifeOptions.duration.value) * 1000; } } } ;// CONCATENATED MODULE: ./dist/browser/index.js async function loadLifeUpdater(engine) { await engine.addParticleUpdater("life", container => new LifeUpdater(container)); } })(); /******/ return __webpack_exports__; /******/ })() ; });