New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tsparticles/interaction-external-attract

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/interaction-external-attract - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

4

browser/Attractor.js

@@ -53,6 +53,6 @@ import { ExternalInteractorBase, isInArray, millisecondsToSeconds, mouseMoveEvent, } from "@tsparticles/engine";

if (mouseMoveStatus && hoverEnabled && isInArray(attractMode, hoverMode)) {
hoverAttract(this.container, (p) => this.isEnabled(p));
hoverAttract(this.container, p => this.isEnabled(p));
}
else if (clickEnabled && isInArray(attractMode, clickMode)) {
clickAttract(this.container, (p) => this.isEnabled(p));
clickAttract(this.container, p => this.isEnabled(p));
}

@@ -59,0 +59,0 @@ }

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

import { Attractor } from "./Attractor.js";
export async function loadExternalAttractInteraction(engine, refresh = true) {
await engine.addInteractor("externalAttract", async (container) => {
const { Attractor } = await import("./Attractor.js");
return new Attractor(engine, container);
await engine.addInteractor("externalAttract", container => {
return Promise.resolve(new Attractor(engine, container));
}, refresh);

@@ -6,0 +6,0 @@ }

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

import { EasingType } from "@tsparticles/engine";
export class Attract {

@@ -5,3 +6,3 @@ constructor() {

this.duration = 0.4;
this.easing = "ease-out-quad";
this.easing = EasingType.easeOutQuad;
this.factor = 1;

@@ -8,0 +9,0 @@ this.maxSpeed = 50;

@@ -56,6 +56,6 @@ "use strict";

if (mouseMoveStatus && hoverEnabled && (0, engine_1.isInArray)(attractMode, hoverMode)) {
(0, Utils_js_1.hoverAttract)(this.container, (p) => this.isEnabled(p));
(0, Utils_js_1.hoverAttract)(this.container, p => this.isEnabled(p));
}
else if (clickEnabled && (0, engine_1.isInArray)(attractMode, clickMode)) {
(0, Utils_js_1.clickAttract)(this.container, (p) => this.isEnabled(p));
(0, Utils_js_1.clickAttract)(this.container, p => this.isEnabled(p));
}

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

@@ -18,6 +18,6 @@ "use strict";

exports.loadExternalAttractInteraction = void 0;
const Attractor_js_1 = require("./Attractor.js");
async function loadExternalAttractInteraction(engine, refresh = true) {
await engine.addInteractor("externalAttract", async (container) => {
const { Attractor } = await import("./Attractor.js");
return new Attractor(engine, container);
await engine.addInteractor("externalAttract", container => {
return Promise.resolve(new Attractor_js_1.Attractor(engine, container));
}, refresh);

@@ -24,0 +24,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Attract = void 0;
const engine_1 = require("@tsparticles/engine");
class Attract {

@@ -8,3 +9,3 @@ constructor() {

this.duration = 0.4;
this.easing = "ease-out-quad";
this.easing = engine_1.EasingType.easeOutQuad;
this.factor = 1;

@@ -11,0 +12,0 @@ this.maxSpeed = 50;

@@ -53,6 +53,6 @@ import { ExternalInteractorBase, isInArray, millisecondsToSeconds, mouseMoveEvent, } from "@tsparticles/engine";

if (mouseMoveStatus && hoverEnabled && isInArray(attractMode, hoverMode)) {
hoverAttract(this.container, (p) => this.isEnabled(p));
hoverAttract(this.container, p => this.isEnabled(p));
}
else if (clickEnabled && isInArray(attractMode, clickMode)) {
clickAttract(this.container, (p) => this.isEnabled(p));
clickAttract(this.container, p => this.isEnabled(p));
}

@@ -59,0 +59,0 @@ }

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

import { Attractor } from "./Attractor.js";
export async function loadExternalAttractInteraction(engine, refresh = true) {
await engine.addInteractor("externalAttract", async (container) => {
const { Attractor } = await import("./Attractor.js");
return new Attractor(engine, container);
await engine.addInteractor("externalAttract", container => {
return Promise.resolve(new Attractor(engine, container));
}, refresh);

@@ -6,0 +6,0 @@ }

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

import { EasingType } from "@tsparticles/engine";
export class Attract {

@@ -5,3 +6,3 @@ constructor() {

this.duration = 0.4;
this.easing = "ease-out-quad";
this.easing = EasingType.easeOutQuad;
this.factor = 1;

@@ -8,0 +9,0 @@ this.maxSpeed = 50;

{
"name": "@tsparticles/interaction-external-attract",
"version": "3.3.0",
"version": "3.4.0",
"description": "tsParticles attract external interaction",

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

"dependencies": {
"@tsparticles/engine": "^3.3.0"
"@tsparticles/engine": "^3.4.0"
},

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

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v3.3.0
* v3.4.0
*/

@@ -32,2 +32,12 @@ /*

/***/ "./dist/browser/Attractor.js":
/*!***********************************!*\
!*** ./dist/browser/Attractor.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 */ Attractor: () => (/* binding */ Attractor)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n/* harmony import */ var _Options_Classes_Attract_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Attract.js */ \"./dist/browser/Options/Classes/Attract.js\");\n\n\n\nconst attractMode = \"attract\";\nclass Attractor extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(engine, container) {\n super(container);\n this._engine = engine;\n if (!container.attract) {\n container.attract = {\n particles: []\n };\n }\n this.handleClickMode = mode => {\n const options = this.container.actualOptions,\n attract = options.interactivity.modes.attract;\n if (!attract || mode !== attractMode) {\n return;\n }\n if (!container.attract) {\n container.attract = {\n particles: []\n };\n }\n container.attract.clicking = true;\n container.attract.count = 0;\n for (const particle of container.attract.particles) {\n if (!this.isEnabled(particle)) {\n continue;\n }\n particle.velocity.setTo(particle.initialVelocity);\n }\n container.attract.particles = [];\n container.attract.finish = false;\n setTimeout(() => {\n if (container.destroyed) {\n return;\n }\n if (!container.attract) {\n container.attract = {\n particles: []\n };\n }\n container.attract.clicking = false;\n }, attract.duration * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds);\n };\n }\n clear() {}\n init() {\n const container = this.container,\n attract = container.actualOptions.interactivity.modes.attract;\n if (!attract) {\n return;\n }\n container.retina.attractModeDistance = attract.distance * container.retina.pixelRatio;\n }\n interact() {\n const container = this.container,\n options = container.actualOptions,\n mouseMoveStatus = container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent,\n events = options.interactivity.events,\n {\n enable: hoverEnabled,\n mode: hoverMode\n } = events.onHover,\n {\n enable: clickEnabled,\n mode: clickMode\n } = events.onClick;\n if (mouseMoveStatus && hoverEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(attractMode, hoverMode)) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.hoverAttract)(this.container, p => this.isEnabled(p));\n } else if (clickEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(attractMode, clickMode)) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.clickAttract)(this.container, p => this.isEnabled(p));\n }\n }\n isEnabled(particle) {\n const container = this.container,\n options = container.actualOptions,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? options.interactivity).events;\n if ((!mouse.position || !events.onHover.enable) && (!mouse.clickPosition || !events.onClick.enable)) {\n return false;\n }\n const hoverMode = events.onHover.mode,\n clickMode = events.onClick.mode;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(attractMode, hoverMode) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(attractMode, clickMode);\n }\n loadModeOptions(options, ...sources) {\n if (!options.attract) {\n options.attract = new _Options_Classes_Attract_js__WEBPACK_IMPORTED_MODULE_2__.Attract();\n }\n for (const source of sources) {\n options.attract.load(source?.attract);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-attract/./dist/browser/Attractor.js?");
/***/ }),
/***/ "./dist/browser/Options/Classes/Attract.js":

@@ -39,6 +49,16 @@ /*!*************************************************!*\

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Attract: () => (/* binding */ Attract)\n/* harmony export */ });\nclass Attract {\n constructor() {\n this.distance = 200;\n this.duration = 0.4;\n this.easing = \"ease-out-quad\";\n this.factor = 1;\n this.maxSpeed = 50;\n this.speed = 1;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n if (data.duration !== undefined) {\n this.duration = data.duration;\n }\n if (data.easing !== undefined) {\n this.easing = data.easing;\n }\n if (data.factor !== undefined) {\n this.factor = data.factor;\n }\n if (data.maxSpeed !== undefined) {\n this.maxSpeed = data.maxSpeed;\n }\n if (data.speed !== undefined) {\n this.speed = data.speed;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-attract/./dist/browser/Options/Classes/Attract.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Attract: () => (/* binding */ Attract)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass Attract {\n constructor() {\n this.distance = 200;\n this.duration = 0.4;\n this.easing = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.EasingType.easeOutQuad;\n this.factor = 1;\n this.maxSpeed = 50;\n this.speed = 1;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n if (data.duration !== undefined) {\n this.duration = data.duration;\n }\n if (data.easing !== undefined) {\n this.easing = data.easing;\n }\n if (data.factor !== undefined) {\n this.factor = data.factor;\n }\n if (data.maxSpeed !== undefined) {\n this.maxSpeed = data.maxSpeed;\n }\n if (data.speed !== undefined) {\n this.speed = data.speed;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-attract/./dist/browser/Options/Classes/Attract.js?");
/***/ }),
/***/ "./dist/browser/Utils.js":
/*!*******************************!*\
!*** ./dist/browser/Utils.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 */ clickAttract: () => (/* binding */ clickAttract),\n/* harmony export */ hoverAttract: () => (/* binding */ hoverAttract)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst minFactor = 1,\n identity = 1,\n minRadius = 0;\nfunction processAttract(container, position, attractRadius, area, queryCb) {\n const attractOptions = container.actualOptions.interactivity.modes.attract;\n if (!attractOptions) {\n return;\n }\n const query = container.particles.quadTree.query(area, queryCb);\n for (const particle of query) {\n const {\n dx,\n dy,\n distance\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, position),\n velocity = attractOptions.speed * attractOptions.factor,\n attractFactor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getEasing)(attractOptions.easing)(identity - distance / attractRadius) * velocity, minFactor, attractOptions.maxSpeed),\n normVec = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(!distance ? velocity : dx / distance * attractFactor, !distance ? velocity : dy / distance * attractFactor);\n particle.position.subFrom(normVec);\n }\n}\nfunction clickAttract(container, enabledCb) {\n if (!container.attract) {\n container.attract = {\n particles: []\n };\n }\n const {\n attract\n } = container;\n if (!attract.finish) {\n if (!attract.count) {\n attract.count = 0;\n }\n attract.count++;\n if (attract.count === container.particles.count) {\n attract.finish = true;\n }\n }\n if (attract.clicking) {\n const mousePos = container.interactivity.mouse.clickPosition,\n attractRadius = container.retina.attractModeDistance;\n if (!attractRadius || attractRadius < minRadius || !mousePos) {\n return;\n }\n processAttract(container, mousePos, attractRadius, new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(mousePos.x, mousePos.y, attractRadius), p => enabledCb(p));\n } else if (attract.clicking === false) {\n attract.particles = [];\n }\n}\nfunction hoverAttract(container, enabledCb) {\n const mousePos = container.interactivity.mouse.position,\n attractRadius = container.retina.attractModeDistance;\n if (!attractRadius || attractRadius < minRadius || !mousePos) {\n return;\n }\n processAttract(container, mousePos, attractRadius, new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(mousePos.x, mousePos.y, attractRadius), p => enabledCb(p));\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-attract/./dist/browser/Utils.js?");
/***/ }),
/***/ "./dist/browser/index.js":

@@ -50,3 +70,3 @@ /*!*******************************!*\

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Attract: () => (/* reexport safe */ _Options_Classes_Attract_js__WEBPACK_IMPORTED_MODULE_0__.Attract),\n/* harmony export */ loadExternalAttractInteraction: () => (/* binding */ loadExternalAttractInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Attract_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Attract.js */ \"./dist/browser/Options/Classes/Attract.js\");\nasync function loadExternalAttractInteraction(engine, refresh = true) {\n await engine.addInteractor(\"externalAttract\", async container => {\n const {\n Attractor\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_Attractor_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Attractor.js */ \"./dist/browser/Attractor.js\"));\n return new Attractor(engine, container);\n }, refresh);\n}\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-attract/./dist/browser/index.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Attract: () => (/* reexport safe */ _Options_Classes_Attract_js__WEBPACK_IMPORTED_MODULE_1__.Attract),\n/* harmony export */ loadExternalAttractInteraction: () => (/* binding */ loadExternalAttractInteraction)\n/* harmony export */ });\n/* harmony import */ var _Attractor_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Attractor.js */ \"./dist/browser/Attractor.js\");\n/* harmony import */ var _Options_Classes_Attract_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Attract.js */ \"./dist/browser/Options/Classes/Attract.js\");\n\nasync function loadExternalAttractInteraction(engine, refresh = true) {\n await engine.addInteractor(\"externalAttract\", container => {\n return Promise.resolve(new _Attractor_js__WEBPACK_IMPORTED_MODULE_0__.Attractor(engine, container));\n }, refresh);\n}\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-attract/./dist/browser/index.js?");

@@ -91,5 +111,2 @@ /***/ }),

/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/

@@ -120,36 +137,2 @@ /******/ /* webpack/runtime/compat get default export */

/******/
/******/ /* 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 */

@@ -160,48 +143,2 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/load script */
/******/ (() => {
/******/ var inProgress = {};
/******/ var dataWebpackPrefix = "@tsparticles/interaction-external-attract:";
/******/ // 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 */

@@ -218,117 +155,2 @@ /******/ (() => {

/******/
/******/ /* 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 || !/^http(s?):/.test(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.interaction.external.attract": 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_interaction_external_attract"] = this["webpackChunk_tsparticles_interaction_external_attract"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/

@@ -335,0 +157,0 @@ /******/

/*! For license information please see tsparticles.interaction.external.attract.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 r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,(e=>(()=>{var t,r,i={3:(e,t,r)=>{r.d(t,{K:()=>i});class i{constructor(){this.distance=200,this.duration=.4,this.easing="ease-out-quad",this.factor=1,this.maxSpeed=50,this.speed=1}load(e){e&&(void 0!==e.distance&&(this.distance=e.distance),void 0!==e.duration&&(this.duration=e.duration),void 0!==e.easing&&(this.easing=e.easing),void 0!==e.factor&&(this.factor=e.factor),void 0!==e.maxSpeed&&(this.maxSpeed=e.maxSpeed),void 0!==e.speed&&(this.speed=e.speed))}}},303:t=>{t.exports=e}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return i[e](r,r.exports,a),r.exports}a.m=i,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,r)=>(a.f[r](e,t),t)),[])),a.u=e=>e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/interaction-external-attract:",a.l=(e,i,o,n)=>{if(t[e])t[e].push(i);else{var s,c;if(void 0!==o)for(var d=document.getElementsByTagName("script"),l=0;l<d.length;l++){var p=d[l];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==r+o){s=p;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",r+o),s.src=e),t[e]=[i];var u=(r,i)=>{s.onerror=s.onload=null,clearTimeout(f);var o=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((e=>e(i))),r)return r(i)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=u.bind(null,s.onerror),s.onload=u.bind(null,s.onload),c&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={261:0};a.f.j=(t,r)=>{var i=a.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var o=new Promise(((r,o)=>i=e[t]=[r,o]));r.push(i[2]=o);var n=a.p+a.u(t),s=new Error;a.l(n,(r=>{if(a.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var o=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+n+")",s.name="ChunkLoadError",s.type=o,s.request=n,i[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var i,o,n=r[0],s=r[1],c=r[2],d=0;if(n.some((t=>0!==e[t]))){for(i in s)a.o(s,i)&&(a.m[i]=s[i]);if(c)c(a)}for(t&&t(r);d<n.length;d++)o=n[d],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=this.webpackChunk_tsparticles_interaction_external_attract=this.webpackChunk_tsparticles_interaction_external_attract||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var n={};return(()=>{a.r(n),a.d(n,{Attract:()=>e.K,loadExternalAttractInteraction:()=>t});var e=a(3);async function t(e,t=!0){await e.addInteractor("externalAttract",(async t=>{const{Attractor:r}=await a.e(376).then(a.bind(a,376));return new r(e,t)}),t)}})(),n})()));
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var i="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var a in i)("object"==typeof exports?exports:t)[a]=i[a]}}(this,(t=>(()=>{var e={303:e=>{e.exports=t}},i={};function a(t){var n=i[t];if(void 0!==n)return n.exports;var o=i[t]={exports:{}};return e[t](o,o.exports,a),o.exports}a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{a.r(n),a.d(n,{Attract:()=>r,loadExternalAttractInteraction:()=>d});var t=a(303);const e=1,i=1;function o(a,n,o,r,c){const s=a.actualOptions.interactivity.modes.attract;if(!s)return;const d=a.particles.quadTree.query(r,c);for(const a of d){const{dx:r,dy:c,distance:d}=(0,t.getDistances)(a.position,n),l=s.speed*s.factor,p=(0,t.clamp)((0,t.getEasing)(s.easing)(i-d/o)*l,e,s.maxSpeed),u=t.Vector.create(d?r/d*p:l,d?c/d*p:l);a.position.subFrom(u)}}class r{constructor(){this.distance=200,this.duration=.4,this.easing=t.EasingType.easeOutQuad,this.factor=1,this.maxSpeed=50,this.speed=1}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),void 0!==t.duration&&(this.duration=t.duration),void 0!==t.easing&&(this.easing=t.easing),void 0!==t.factor&&(this.factor=t.factor),void 0!==t.maxSpeed&&(this.maxSpeed=t.maxSpeed),void 0!==t.speed&&(this.speed=t.speed))}}const c="attract";class s extends t.ExternalInteractorBase{constructor(e,i){super(i),this._engine=e,i.attract||(i.attract={particles:[]}),this.handleClickMode=e=>{const a=this.container.actualOptions.interactivity.modes.attract;if(a&&e===c){i.attract||(i.attract={particles:[]}),i.attract.clicking=!0,i.attract.count=0;for(const t of i.attract.particles)this.isEnabled(t)&&t.velocity.setTo(t.initialVelocity);i.attract.particles=[],i.attract.finish=!1,setTimeout((()=>{i.destroyed||(i.attract||(i.attract={particles:[]}),i.attract.clicking=!1)}),a.duration*t.millisecondsToSeconds)}}}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.attract;e&&(t.retina.attractModeDistance=e.distance*t.retina.pixelRatio)}interact(){const e=this.container,i=e.actualOptions,a=e.interactivity.status===t.mouseMoveEvent,n=i.interactivity.events,{enable:r,mode:s}=n.onHover,{enable:d,mode:l}=n.onClick;a&&r&&(0,t.isInArray)(c,s)?function(e,i){const a=e.interactivity.mouse.position,n=e.retina.attractModeDistance;!n||n<0||!a||o(e,a,n,new t.Circle(a.x,a.y,n),(t=>i(t)))}(this.container,(t=>this.isEnabled(t))):d&&(0,t.isInArray)(c,l)&&function(e,i){e.attract||(e.attract={particles:[]});const{attract:a}=e;if(a.finish||(a.count||(a.count=0),a.count++,a.count===e.particles.count&&(a.finish=!0)),a.clicking){const a=e.interactivity.mouse.clickPosition,n=e.retina.attractModeDistance;if(!n||n<0||!a)return;o(e,a,n,new t.Circle(a.x,a.y,n),(t=>i(t)))}else!1===a.clicking&&(a.particles=[])}(this.container,(t=>this.isEnabled(t)))}isEnabled(e){const i=this.container,a=i.actualOptions,n=i.interactivity.mouse,o=(e?.interactivity??a.interactivity).events;if(!(n.position&&o.onHover.enable||n.clickPosition&&o.onClick.enable))return!1;const r=o.onHover.mode,s=o.onClick.mode;return(0,t.isInArray)(c,r)||(0,t.isInArray)(c,s)}loadModeOptions(t,...e){t.attract||(t.attract=new r);for(const i of e)t.attract.load(i?.attract)}reset(){}}async function d(t,e=!0){await t.addInteractor("externalAttract",(e=>Promise.resolve(new s(t,e))),e)}})(),n})()));

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

/*! tsParticles Attract External Interaction v3.3.0 by Matteo Bruni */
/*! tsParticles Attract External Interaction v3.4.0 by Matteo Bruni */

@@ -65,6 +65,6 @@ (function (factory) {

if (mouseMoveStatus && hoverEnabled && (0, engine_1.isInArray)(attractMode, hoverMode)) {
(0, Utils_js_1.hoverAttract)(this.container, (p) => this.isEnabled(p));
(0, Utils_js_1.hoverAttract)(this.container, p => this.isEnabled(p));
}
else if (clickEnabled && (0, engine_1.isInArray)(attractMode, clickMode)) {
(0, Utils_js_1.clickAttract)(this.container, (p) => this.isEnabled(p));
(0, Utils_js_1.clickAttract)(this.container, p => this.isEnabled(p));
}

@@ -71,0 +71,0 @@ }

@@ -12,14 +12,2 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

}));
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;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {

@@ -34,13 +22,12 @@ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./Options/Classes/Attract.js", "./Options/Interfaces/IAttract.js"], factory);
define(["require", "exports", "./Attractor.js", "./Options/Classes/Attract.js", "./Options/Interfaces/IAttract.js"], factory);
}
})(function (require, exports) {
"use strict";
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadExternalAttractInteraction = void 0;
const Attractor_js_1 = require("./Attractor.js");
async function loadExternalAttractInteraction(engine, refresh = true) {
await engine.addInteractor("externalAttract", async (container) => {
const { Attractor } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Attractor.js"))) : new Promise((resolve_1, reject_1) => { require(["./Attractor.js"], resolve_1, reject_1); }).then(__importStar));
return new Attractor(engine, container);
await engine.addInteractor("externalAttract", container => {
return Promise.resolve(new Attractor_js_1.Attractor(engine, container));
}, refresh);

@@ -47,0 +34,0 @@ }

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
define(["require", "exports", "@tsparticles/engine"], factory);
}

@@ -14,2 +14,3 @@ })(function (require, exports) {

exports.Attract = void 0;
const engine_1 = require("@tsparticles/engine");
class Attract {

@@ -19,3 +20,3 @@ constructor() {

this.duration = 0.4;
this.easing = "ease-out-quad";
this.easing = engine_1.EasingType.easeOutQuad;
this.factor = 1;

@@ -22,0 +23,0 @@ this.maxSpeed = 50;

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