Socket
Socket
Sign inDemoInstall

@tsparticles/updater-wobble

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/updater-wobble - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

103.min.js

6

browser/index.js

@@ -1,4 +0,6 @@

import { WobbleUpdater } from "./WobbleUpdater.js";
export async function loadWobbleUpdater(engine, refresh = true) {
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container), refresh);
await engine.addParticleUpdater("wobble", async (container) => {
const { WobbleUpdater } = await import("./WobbleUpdater.js");
return new WobbleUpdater(container);
}, refresh);
}
import { getRandom, getRangeValue, } from "@tsparticles/engine";
import { Wobble } from "./Options/Classes/Wobble.js";
import { updateWobble } from "./Utils.js";
const double = 2, doublePI = Math.PI * double, maxAngle = 360, moveSpeedFactor = 10, defaultDistance = 0;

@@ -9,3 +8,3 @@ export class WobbleUpdater {

}
init(particle) {
async init(particle) {
const wobbleOpt = particle.options.wobble;

@@ -28,2 +27,3 @@ if (wobbleOpt?.enable) {

getRangeValue(wobbleOpt?.distance ?? defaultDistance) * this.container.retina.pixelRatio;
await Promise.resolve();
}

@@ -41,8 +41,9 @@ isEnabled(particle) {

}
update(particle, delta) {
async update(particle, delta) {
if (!this.isEnabled(particle)) {
return;
}
const { updateWobble } = await import("./Utils.js");
updateWobble(particle, delta);
}
}
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadWobbleUpdater = void 0;
const WobbleUpdater_js_1 = require("./WobbleUpdater.js");
async function loadWobbleUpdater(engine, refresh = true) {
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater_js_1.WobbleUpdater(container), refresh);
await engine.addParticleUpdater("wobble", async (container) => {
const { WobbleUpdater } = await Promise.resolve().then(() => __importStar(require("./WobbleUpdater.js")));
return new WobbleUpdater(container);
}, refresh);
}
exports.loadWobbleUpdater = loadWobbleUpdater;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,3 +29,2 @@ exports.WobbleUpdater = void 0;

const Wobble_js_1 = require("./Options/Classes/Wobble.js");
const Utils_js_1 = require("./Utils.js");
const double = 2, doublePI = Math.PI * double, maxAngle = 360, moveSpeedFactor = 10, defaultDistance = 0;

@@ -13,3 +35,3 @@ class WobbleUpdater {

}
init(particle) {
async init(particle) {
const wobbleOpt = particle.options.wobble;

@@ -32,2 +54,3 @@ if (wobbleOpt?.enable) {

(0, engine_1.getRangeValue)(wobbleOpt?.distance ?? defaultDistance) * this.container.retina.pixelRatio;
await Promise.resolve();
}

@@ -45,9 +68,10 @@ isEnabled(particle) {

}
update(particle, delta) {
async update(particle, delta) {
if (!this.isEnabled(particle)) {
return;
}
(0, Utils_js_1.updateWobble)(particle, delta);
const { updateWobble } = await Promise.resolve().then(() => __importStar(require("./Utils.js")));
updateWobble(particle, delta);
}
}
exports.WobbleUpdater = WobbleUpdater;

@@ -1,4 +0,6 @@

import { WobbleUpdater } from "./WobbleUpdater.js";
export async function loadWobbleUpdater(engine, refresh = true) {
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container), refresh);
await engine.addParticleUpdater("wobble", async (container) => {
const { WobbleUpdater } = await import("./WobbleUpdater.js");
return new WobbleUpdater(container);
}, refresh);
}
import { getRandom, getRangeValue, } from "@tsparticles/engine";
import { Wobble } from "./Options/Classes/Wobble.js";
import { updateWobble } from "./Utils.js";
const double = 2, doublePI = Math.PI * double, maxAngle = 360, moveSpeedFactor = 10, defaultDistance = 0;

@@ -9,3 +8,3 @@ export class WobbleUpdater {

}
init(particle) {
async init(particle) {
const wobbleOpt = particle.options.wobble;

@@ -28,2 +27,3 @@ if (wobbleOpt?.enable) {

getRangeValue(wobbleOpt?.distance ?? defaultDistance) * this.container.retina.pixelRatio;
await Promise.resolve();
}

@@ -41,8 +41,9 @@ isEnabled(particle) {

}
update(particle, delta) {
async update(particle, delta) {
if (!this.isEnabled(particle)) {
return;
}
const { updateWobble } = await import("./Utils.js");
updateWobble(particle, delta);
}
}
{
"name": "@tsparticles/updater-wobble",
"version": "3.1.0",
"version": "3.2.0",
"description": "tsParticles particles wobble updater",

@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org",

"dependencies": {
"@tsparticles/engine": "^3.1.0"
"@tsparticles/engine": "^3.2.0"
},

@@ -93,0 +93,0 @@ "publishConfig": {

@@ -7,4 +7,12 @@ /*!

* How to use? : Check the GitHub README
* v3.1.0
* v3.2.0
*/
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
(function webpackUniversalModuleDefinition(root, factory) {

@@ -19,3 +27,3 @@ if(typeof exports === 'object' && typeof module === 'object')

}
})(this, (__WEBPACK_EXTERNAL_MODULE__533__) => {
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
return /******/ (() => { // webpackBootstrap

@@ -25,6 +33,19 @@ /******/ "use strict";

/***/ 533:
/***/ "./dist/browser/index.js":
/*!*******************************!*\
!*** ./dist/browser/index.js ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadWobbleUpdater: () => (/* binding */ loadWobbleUpdater)\n/* harmony export */ });\nasync function loadWobbleUpdater(engine, refresh = true) {\n await engine.addParticleUpdater(\"wobble\", async container => {\n const {\n WobbleUpdater\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_WobbleUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./WobbleUpdater.js */ \"./dist/browser/WobbleUpdater.js\"));\n return new WobbleUpdater(container);\n }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/updater-wobble/./dist/browser/index.js?");
/***/ }),
/***/ "@tsparticles/engine":
/*!*********************************************************************************************************************************!*\
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
\*********************************************************************************************************************************/
/***/ ((module) => {
module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;

@@ -59,3 +80,18 @@ /***/ })

/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */

@@ -73,2 +109,36 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = (chunkId) => {
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ __webpack_require__.f[key](chunkId, promises);
/******/ return promises;
/******/ }, []));
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get javascript chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + chunkId + ".js";
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */

@@ -79,2 +149,48 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/load script */
/******/ (() => {
/******/ var inProgress = {};
/******/ var dataWebpackPrefix = "@tsparticles/updater-wobble:";
/******/ // loadScript function to load a script via script tag
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ for(var i = 0; i < scripts.length; i++) {
/******/ var s = scripts[i];
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
/******/ }
/******/ }
/******/ if(!script) {
/******/ needAttach = true;
/******/ script = document.createElement('script');
/******/
/******/ script.charset = 'utf-8';
/******/ script.timeout = 120;
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
/******/
/******/ script.src = url;
/******/ }
/******/ inProgress[url] = [done];
/******/ var onScriptComplete = (prev, event) => {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
/******/ clearTimeout(timeout);
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
/******/ needAttach && document.head.appendChild(script);
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */

@@ -91,157 +207,124 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ var scriptUrl;
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ var document = __webpack_require__.g.document;
/******/ if (!scriptUrl && document) {
/******/ if (document.currentScript)
/******/ scriptUrl = document.currentScript.src;
/******/ if (!scriptUrl) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ if(scripts.length) {
/******/ var i = scripts.length - 1;
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
/******/ }
/******/ }
/******/ }
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "tsparticles.updater.wobble": 0
/******/ };
/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
/******/
/******/ // a Promise means "currently loading".
/******/ if(installedChunkData) {
/******/ promises.push(installedChunkData[2]);
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ var loadingEnded = (event) => {
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
/******/ installedChunkData = installedChunks[chunkId];
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
/******/ if(installedChunkData) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ installedChunkData[1](error);
/******/ }
/******/ }
/******/ };
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ }
/******/ }
/******/ }
/******/ };
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var chunkIds = data[0];
/******/ var moreModules = data[1];
/******/ var runtime = data[2];
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_updater_wobble"] = this["webpackChunk_tsparticles_updater_wobble"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/
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__, {
loadWobbleUpdater: () => (/* binding */ loadWobbleUpdater)
});
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
var engine_root_window_ = __webpack_require__(533);
;// CONCATENATED MODULE: ./dist/browser/Options/Classes/WobbleSpeed.js
class WobbleSpeed {
constructor() {
this.angle = 50;
this.move = 10;
}
load(data) {
if (!data) {
return;
}
if (data.angle !== undefined) {
this.angle = (0,engine_root_window_.setRangeValue)(data.angle);
}
if (data.move !== undefined) {
this.move = (0,engine_root_window_.setRangeValue)(data.move);
}
}
}
;// CONCATENATED MODULE: ./dist/browser/Options/Classes/Wobble.js
class Wobble {
constructor() {
this.distance = 5;
this.enable = false;
this.speed = new WobbleSpeed();
}
load(data) {
if (!data) {
return;
}
if (data.distance !== undefined) {
this.distance = (0,engine_root_window_.setRangeValue)(data.distance);
}
if (data.enable !== undefined) {
this.enable = data.enable;
}
if (data.speed !== undefined) {
if ((0,engine_root_window_.isNumber)(data.speed)) {
this.speed.load({
angle: data.speed
});
} else {
const rangeSpeed = data.speed;
if (rangeSpeed.min !== undefined) {
this.speed.load({
angle: rangeSpeed
});
} else {
this.speed.load(data.speed);
}
}
}
}
}
;// CONCATENATED MODULE: ./dist/browser/Utils.js
const defaultDistance = 0,
Utils_double = 2,
doublePI = Math.PI * Utils_double,
distanceFactor = 60;
function updateWobble(particle, delta) {
const {
wobble: wobbleOptions
} = particle.options,
{
wobble
} = particle;
if (!wobbleOptions?.enable || !wobble) {
return;
}
const angleSpeed = wobble.angleSpeed * delta.factor,
moveSpeed = wobble.moveSpeed * delta.factor,
distance = moveSpeed * ((particle.retina.wobbleDistance ?? defaultDistance) * delta.factor) / (engine_root_window_.millisecondsToSeconds / distanceFactor),
max = doublePI,
{
position
} = particle;
wobble.angle += angleSpeed;
if (wobble.angle > max) {
wobble.angle -= max;
}
position.x += distance * Math.cos(wobble.angle);
position.y += distance * Math.abs(Math.sin(wobble.angle));
}
;// CONCATENATED MODULE: ./dist/browser/WobbleUpdater.js
const WobbleUpdater_double = 2,
WobbleUpdater_doublePI = Math.PI * WobbleUpdater_double,
maxAngle = 360,
moveSpeedFactor = 10,
WobbleUpdater_defaultDistance = 0;
class WobbleUpdater {
constructor(container) {
this.container = container;
}
init(particle) {
const wobbleOpt = particle.options.wobble;
if (wobbleOpt?.enable) {
particle.wobble = {
angle: (0,engine_root_window_.getRandom)() * WobbleUpdater_doublePI,
angleSpeed: (0,engine_root_window_.getRangeValue)(wobbleOpt.speed.angle) / maxAngle,
moveSpeed: (0,engine_root_window_.getRangeValue)(wobbleOpt.speed.move) / moveSpeedFactor
};
} else {
particle.wobble = {
angle: 0,
angleSpeed: 0,
moveSpeed: 0
};
}
particle.retina.wobbleDistance = (0,engine_root_window_.getRangeValue)(wobbleOpt?.distance ?? WobbleUpdater_defaultDistance) * this.container.retina.pixelRatio;
}
isEnabled(particle) {
return !particle.destroyed && !particle.spawning && !!particle.options.wobble?.enable;
}
loadOptions(options, ...sources) {
if (!options.wobble) {
options.wobble = new Wobble();
}
for (const source of sources) {
options.wobble.load(source?.wobble);
}
}
update(particle, delta) {
if (!this.isEnabled(particle)) {
return;
}
updateWobble(particle, delta);
}
}
;// CONCATENATED MODULE: ./dist/browser/index.js
async function loadWobbleUpdater(engine, refresh = true) {
await engine.addParticleUpdater("wobble", container => new WobbleUpdater(container), refresh);
}
})();
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
/******/
/******/ return __webpack_exports__;

@@ -248,0 +331,0 @@ /******/ })()

/*! For license information please see tsparticles.updater.wobble.min.js.LICENSE.txt */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function n(e){var a=o[e];if(void 0!==a)return a.exports;var s=o[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),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:()=>r});var e=n(533);class t{constructor(){this.angle=50,this.move=10}load(t){t&&(void 0!==t.angle&&(this.angle=(0,e.setRangeValue)(t.angle)),void 0!==t.move&&(this.move=(0,e.setRangeValue)(t.move)))}}class o{constructor(){this.distance=5,this.enable=!1,this.speed=new t}load(t){if(t&&(void 0!==t.distance&&(this.distance=(0,e.setRangeValue)(t.distance)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed))if((0,e.isNumber)(t.speed))this.speed.load({angle:t.speed});else{const e=t.speed;void 0!==e.min?this.speed.load({angle:e}):this.speed.load(t.speed)}}}const s=2*Math.PI;const i=2*Math.PI;class l{constructor(e){this.container=e}init(t){const o=t.options.wobble;t.wobble=o?.enable?{angle:(0,e.getRandom)()*i,angleSpeed:(0,e.getRangeValue)(o.speed.angle)/360,moveSpeed:(0,e.getRangeValue)(o.speed.move)/10}:{angle:0,angleSpeed:0,moveSpeed:0},t.retina.wobbleDistance=(0,e.getRangeValue)(o?.distance??0)*this.container.retina.pixelRatio}isEnabled(e){return!e.destroyed&&!e.spawning&&!!e.options.wobble?.enable}loadOptions(e,...t){e.wobble||(e.wobble=new o);for(const o of t)e.wobble.load(o?.wobble)}update(t,o){this.isEnabled(t)&&function(t,o){const{wobble:n}=t.options,{wobble:a}=t;if(!n?.enable||!a)return;const i=a.angleSpeed*o.factor,l=a.moveSpeed*o.factor*((t.retina.wobbleDistance??0)*o.factor)/(e.millisecondsToSeconds/60),r=s,{position:d}=t;a.angle+=i,a.angle>r&&(a.angle-=r),d.x+=l*Math.cos(a.angle),d.y+=l*Math.abs(Math.sin(a.angle))}(t,o)}}async function r(e,t=!0){await e.addParticleUpdater("wobble",(e=>new l(e)),t)}})(),a})()));
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t,r,o={533:t=>{t.exports=e}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/updater-wobble:",i.l=(e,o,n,a)=>{if(t[e])t[e].push(o);else{var l,s;if(void 0!==n)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var p=u[c];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==r+n){l=p;break}}l||(s=!0,(l=document.createElement("script")).charset="utf-8",l.timeout=120,i.nc&&l.setAttribute("nonce",i.nc),l.setAttribute("data-webpack",r+n),l.src=e),t[e]=[o];var d=(r,o)=>{l.onerror=l.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),s&&document.head.appendChild(l)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&!e;)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={860:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise(((r,n)=>o=e[t]=[r,n]));r.push(o[2]=n);var a=i.p+i.u(t),l=new Error;i.l(a,(r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;l.message="Loading chunk "+t+" failed.\n("+n+": "+a+")",l.name="ChunkLoadError",l.type=n,l.request=a,o[1](l)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,a=r[0],l=r[1],s=r[2],u=0;if(a.some((t=>0!==e[t]))){for(o in l)i.o(l,o)&&(i.m[o]=l[o]);if(s)s(i)}for(t&&t(r);u<a.length;u++)n=a[u],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=this.webpackChunk_tsparticles_updater_wobble=this.webpackChunk_tsparticles_updater_wobble||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};return(()=>{async function e(e,t=!0){await e.addParticleUpdater("wobble",(async e=>{const{WobbleUpdater:t}=await i.e(998).then(i.bind(i,998));return new t(e)}),t)}i.r(a),i.d(a,{loadWobbleUpdater:()=>e})})(),a})()));

@@ -1,1 +0,1 @@

/*! tsParticles Wobble Updater v3.1.0 by Matteo Bruni */
/*! tsParticles Wobble Updater v3.2.0 by Matteo Bruni */

@@ -6,6 +6,6 @@ import { type Container, type IDelta, type IParticleUpdater, type RecursivePartial } from "@tsparticles/engine";

constructor(container: Container);
init(particle: WobbleParticle): void;
init(particle: WobbleParticle): Promise<void>;
isEnabled(particle: WobbleParticle): boolean;
loadOptions(options: WobbleParticlesOptions, ...sources: (RecursivePartial<IWobbleParticlesOptions> | undefined)[]): void;
update(particle: WobbleParticle, delta: IDelta): void;
update(particle: WobbleParticle, delta: IDelta): Promise<void>;
}

@@ -0,1 +1,24 @@

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
(function (factory) {

@@ -7,13 +30,16 @@ if (typeof module === "object" && typeof module.exports === "object") {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./WobbleUpdater.js"], factory);
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadWobbleUpdater = void 0;
const WobbleUpdater_js_1 = require("./WobbleUpdater.js");
async function loadWobbleUpdater(engine, refresh = true) {
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater_js_1.WobbleUpdater(container), refresh);
await engine.addParticleUpdater("wobble", async (container) => {
const { WobbleUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./WobbleUpdater.js"))) : new Promise((resolve_1, reject_1) => { require(["./WobbleUpdater.js"], resolve_1, reject_1); }).then(__importStar));
return new WobbleUpdater(container);
}, refresh);
}
exports.loadWobbleUpdater = loadWobbleUpdater;
});

@@ -0,1 +1,24 @@

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
(function (factory) {

@@ -7,6 +30,7 @@ if (typeof module === "object" && typeof module.exports === "object") {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Wobble.js", "./Utils.js"], factory);
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Wobble.js"], factory);
}
})(function (require, exports) {
"use strict";
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -16,3 +40,2 @@ exports.WobbleUpdater = void 0;

const Wobble_js_1 = require("./Options/Classes/Wobble.js");
const Utils_js_1 = require("./Utils.js");
const double = 2, doublePI = Math.PI * double, maxAngle = 360, moveSpeedFactor = 10, defaultDistance = 0;

@@ -23,3 +46,3 @@ class WobbleUpdater {

}
init(particle) {
async init(particle) {
const wobbleOpt = particle.options.wobble;

@@ -42,2 +65,3 @@ if (wobbleOpt?.enable) {

(0, engine_1.getRangeValue)(wobbleOpt?.distance ?? defaultDistance) * this.container.retina.pixelRatio;
await Promise.resolve();
}

@@ -55,7 +79,8 @@ isEnabled(particle) {

}
update(particle, delta) {
async update(particle, delta) {
if (!this.isEnabled(particle)) {
return;
}
(0, Utils_js_1.updateWobble)(particle, delta);
const { updateWobble } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Utils.js"))) : new Promise((resolve_1, reject_1) => { require(["./Utils.js"], resolve_1, reject_1); }).then(__importStar));
updateWobble(particle, delta);
}

@@ -62,0 +87,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc