@tsparticles/interaction-external-slow 3.9.1 → 4.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/366.min.js +2 -0
- package/366.min.js.LICENSE.txt +1 -0
- package/browser/Slower.js +2 -4
- package/browser/index.js +8 -7
- package/cjs/Options/Classes/Slow.js +3 -7
- package/cjs/Options/Classes/SlowOptions.js +1 -2
- package/cjs/Options/Interfaces/ISlow.js +1 -2
- package/cjs/Slower.js +7 -13
- package/cjs/Types.js +1 -2
- package/cjs/index.js +9 -25
- package/dist_browser_Slower_js.js +30 -0
- package/esm/Slower.js +2 -4
- package/esm/index.js +8 -7
- package/package.json +4 -3
- package/report.html +5 -4
- package/tsparticles.interaction.external.slow.js +213 -34
- package/tsparticles.interaction.external.slow.min.js +1 -1
- package/tsparticles.interaction.external.slow.min.js.LICENSE.txt +1 -1
- package/types/Slower.d.ts +1 -1
- package/types/index.d.ts +2 -2
- package/umd/Slower.js +2 -4
- package/umd/index.js +32 -8
package/366.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 366.min.js.LICENSE.txt */
|
|
2
|
+
(this.webpackChunk_tsparticles_interaction_external_slow=this.webpackChunk_tsparticles_interaction_external_slow||[]).push([[366],{366(t,i,e){e.d(i,{Slower:()=>s});var o=e(303),n=e(299);class s extends o.ExternalInteractorBase{constructor(t){super(t)}clear(t,i,e){t.slow.inRange&&!e||(t.slow.factor=1)}init(){const t=this.container,i=t.actualOptions.interactivity.modes.slow;i&&(t.retina.slowModeRadius=i.radius*t.retina.pixelRatio)}interact(){}isEnabled(t){const i=this.container,e=i.interactivity.mouse,n=(t?.interactivity??i.actualOptions.interactivity).events;return n.onHover.enable&&!!e.position&&(0,o.isInArray)("slow",n.onHover.mode)}loadModeOptions(t,...i){t.slow??=new n.w;for(const e of i)t.slow.load(e?.slow)}reset(t){t.slow.inRange=!1;const i=this.container,e=i.actualOptions,n=i.interactivity.mouse.position,s=i.retina.slowModeRadius,a=e.interactivity.modes.slow;if(!a||!s||s<0||!n)return;const r=t.getPosition(),c=(0,o.getDistance)(n,r),l=c/s,w=a.factor,{slow:u}=t;c>s||(u.inRange=!0,u.factor=l/w)}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Slow External Interaction v4.0.0-alpha.0 by Matteo Bruni */
|
package/browser/Slower.js
CHANGED
|
@@ -5,7 +5,7 @@ export class Slower extends ExternalInteractorBase {
|
|
|
5
5
|
constructor(container) {
|
|
6
6
|
super(container);
|
|
7
7
|
}
|
|
8
|
-
clear(particle,
|
|
8
|
+
clear(particle, _delta, force) {
|
|
9
9
|
if (particle.slow.inRange && !force) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
@@ -25,9 +25,7 @@ export class Slower extends ExternalInteractorBase {
|
|
|
25
25
|
return events.onHover.enable && !!mouse.position && isInArray(slowMode, events.onHover.mode);
|
|
26
26
|
}
|
|
27
27
|
loadModeOptions(options, ...sources) {
|
|
28
|
-
|
|
29
|
-
options.slow = new Slow();
|
|
30
|
-
}
|
|
28
|
+
options.slow ??= new Slow();
|
|
31
29
|
for (const source of sources) {
|
|
32
30
|
options.slow.load(source?.slow);
|
|
33
31
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
engine.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export function loadExternalSlowInteraction(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
3
|
+
engine.register(e => {
|
|
4
|
+
e.addInteractor("externalSlow", async (container) => {
|
|
5
|
+
const { Slower } = await import("./Slower.js");
|
|
6
|
+
return new Slower(container);
|
|
7
|
+
});
|
|
8
|
+
});
|
|
7
9
|
}
|
|
8
10
|
export * from "./Options/Classes/Slow.js";
|
|
9
|
-
export * from "./Options/Interfaces/ISlow.js";
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Slow = void 0;
|
|
4
|
-
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
class Slow {
|
|
1
|
+
import { isNull } from "@tsparticles/engine";
|
|
2
|
+
export class Slow {
|
|
6
3
|
constructor() {
|
|
7
4
|
this.factor = 3;
|
|
8
5
|
this.radius = 200;
|
|
9
6
|
}
|
|
10
7
|
load(data) {
|
|
11
|
-
if (
|
|
8
|
+
if (isNull(data)) {
|
|
12
9
|
return;
|
|
13
10
|
}
|
|
14
11
|
if (data.factor !== undefined) {
|
|
@@ -19,4 +16,3 @@ class Slow {
|
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
|
-
exports.Slow = Slow;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/cjs/Slower.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Slower = void 0;
|
|
4
|
-
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const Slow_js_1 = require("./Options/Classes/Slow.js");
|
|
1
|
+
import { ExternalInteractorBase, getDistance, isInArray, } from "@tsparticles/engine";
|
|
2
|
+
import { Slow } from "./Options/Classes/Slow.js";
|
|
6
3
|
const slowMode = "slow", minRadius = 0;
|
|
7
|
-
class Slower extends
|
|
4
|
+
export class Slower extends ExternalInteractorBase {
|
|
8
5
|
constructor(container) {
|
|
9
6
|
super(container);
|
|
10
7
|
}
|
|
11
|
-
clear(particle,
|
|
8
|
+
clear(particle, _delta, force) {
|
|
12
9
|
if (particle.slow.inRange && !force) {
|
|
13
10
|
return;
|
|
14
11
|
}
|
|
@@ -25,12 +22,10 @@ class Slower extends engine_1.ExternalInteractorBase {
|
|
|
25
22
|
}
|
|
26
23
|
isEnabled(particle) {
|
|
27
24
|
const container = this.container, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity).events;
|
|
28
|
-
return events.onHover.enable && !!mouse.position &&
|
|
25
|
+
return events.onHover.enable && !!mouse.position && isInArray(slowMode, events.onHover.mode);
|
|
29
26
|
}
|
|
30
27
|
loadModeOptions(options, ...sources) {
|
|
31
|
-
|
|
32
|
-
options.slow = new Slow_js_1.Slow();
|
|
33
|
-
}
|
|
28
|
+
options.slow ??= new Slow();
|
|
34
29
|
for (const source of sources) {
|
|
35
30
|
options.slow.load(source?.slow);
|
|
36
31
|
}
|
|
@@ -41,7 +36,7 @@ class Slower extends engine_1.ExternalInteractorBase {
|
|
|
41
36
|
if (!slowOptions || !radius || radius < minRadius || !mousePos) {
|
|
42
37
|
return;
|
|
43
38
|
}
|
|
44
|
-
const particlePos = particle.getPosition(), dist =
|
|
39
|
+
const particlePos = particle.getPosition(), dist = getDistance(mousePos, particlePos), proximityFactor = dist / radius, slowFactor = slowOptions.factor, { slow } = particle;
|
|
45
40
|
if (dist > radius) {
|
|
46
41
|
return;
|
|
47
42
|
}
|
|
@@ -49,4 +44,3 @@ class Slower extends engine_1.ExternalInteractorBase {
|
|
|
49
44
|
slow.factor = proximityFactor / slowFactor;
|
|
50
45
|
}
|
|
51
46
|
}
|
|
52
|
-
exports.Slower = Slower;
|
package/cjs/Types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/cjs/index.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.loadExternalSlowInteraction = loadExternalSlowInteraction;
|
|
18
|
-
const Slower_js_1 = require("./Slower.js");
|
|
19
|
-
async function loadExternalSlowInteraction(engine, refresh = true) {
|
|
20
|
-
engine.checkVersion("3.9.1");
|
|
21
|
-
await engine.addInteractor("externalSlow", container => {
|
|
22
|
-
return Promise.resolve(new Slower_js_1.Slower(container));
|
|
23
|
-
}, refresh);
|
|
1
|
+
export function loadExternalSlowInteraction(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
3
|
+
engine.register(e => {
|
|
4
|
+
e.addInteractor("externalSlow", async (container) => {
|
|
5
|
+
const { Slower } = await import("./Slower.js");
|
|
6
|
+
return new Slower(container);
|
|
7
|
+
});
|
|
8
|
+
});
|
|
24
9
|
}
|
|
25
|
-
|
|
26
|
-
__exportStar(require("./Options/Interfaces/ISlow.js"), exports);
|
|
10
|
+
export * from "./Options/Classes/Slow.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Author : Matteo Bruni
|
|
3
|
+
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
+
* Demo / Generator : https://particles.js.org/
|
|
5
|
+
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
+
* How to use? : Check the GitHub README
|
|
7
|
+
* v4.0.0-alpha.0
|
|
8
|
+
*/
|
|
9
|
+
"use strict";
|
|
10
|
+
/*
|
|
11
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
+
* This devtool is neither made for production nor for readable output files.
|
|
13
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
+
* or disable the default devtool with "devtool: false".
|
|
16
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
+
*/
|
|
18
|
+
(this["webpackChunk_tsparticles_interaction_external_slow"] = this["webpackChunk_tsparticles_interaction_external_slow"] || []).push([["dist_browser_Slower_js"],{
|
|
19
|
+
|
|
20
|
+
/***/ "./dist/browser/Slower.js"
|
|
21
|
+
/*!********************************!*\
|
|
22
|
+
!*** ./dist/browser/Slower.js ***!
|
|
23
|
+
\********************************/
|
|
24
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
|
+
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Slower: () => (/* binding */ Slower)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Options_Classes_Slow_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Slow.js */ \"./dist/browser/Options/Classes/Slow.js\");\n\n\nconst slowMode = \"slow\",\n minRadius = 0;\nclass Slower extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container) {\n super(container);\n }\n clear(particle, _delta, force) {\n if (particle.slow.inRange && !force) {\n return;\n }\n particle.slow.factor = 1;\n }\n init() {\n const container = this.container,\n slow = container.actualOptions.interactivity.modes.slow;\n if (!slow) {\n return;\n }\n container.retina.slowModeRadius = slow.radius * container.retina.pixelRatio;\n }\n interact() {}\n isEnabled(particle) {\n const container = this.container,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? container.actualOptions.interactivity).events;\n return events.onHover.enable && !!mouse.position && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(slowMode, events.onHover.mode);\n }\n loadModeOptions(options, ...sources) {\n options.slow ??= new _Options_Classes_Slow_js__WEBPACK_IMPORTED_MODULE_1__.Slow();\n for (const source of sources) {\n options.slow.load(source?.slow);\n }\n }\n reset(particle) {\n particle.slow.inRange = false;\n const container = this.container,\n options = container.actualOptions,\n mousePos = container.interactivity.mouse.position,\n radius = container.retina.slowModeRadius,\n slowOptions = options.interactivity.modes.slow;\n if (!slowOptions || !radius || radius < minRadius || !mousePos) {\n return;\n }\n const particlePos = particle.getPosition(),\n dist = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(mousePos, particlePos),\n proximityFactor = dist / radius,\n slowFactor = slowOptions.factor,\n {\n slow\n } = particle;\n if (dist > radius) {\n return;\n }\n slow.inRange = true;\n slow.factor = proximityFactor / slowFactor;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-slow/./dist/browser/Slower.js?\n}");
|
|
27
|
+
|
|
28
|
+
/***/ }
|
|
29
|
+
|
|
30
|
+
}]);
|
package/esm/Slower.js
CHANGED
|
@@ -5,7 +5,7 @@ export class Slower extends ExternalInteractorBase {
|
|
|
5
5
|
constructor(container) {
|
|
6
6
|
super(container);
|
|
7
7
|
}
|
|
8
|
-
clear(particle,
|
|
8
|
+
clear(particle, _delta, force) {
|
|
9
9
|
if (particle.slow.inRange && !force) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
@@ -25,9 +25,7 @@ export class Slower extends ExternalInteractorBase {
|
|
|
25
25
|
return events.onHover.enable && !!mouse.position && isInArray(slowMode, events.onHover.mode);
|
|
26
26
|
}
|
|
27
27
|
loadModeOptions(options, ...sources) {
|
|
28
|
-
|
|
29
|
-
options.slow = new Slow();
|
|
30
|
-
}
|
|
28
|
+
options.slow ??= new Slow();
|
|
31
29
|
for (const source of sources) {
|
|
32
30
|
options.slow.load(source?.slow);
|
|
33
31
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
engine.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export function loadExternalSlowInteraction(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
3
|
+
engine.register(e => {
|
|
4
|
+
e.addInteractor("externalSlow", async (container) => {
|
|
5
|
+
const { Slower } = await import("./Slower.js");
|
|
6
|
+
return new Slower(container);
|
|
7
|
+
});
|
|
8
|
+
});
|
|
7
9
|
}
|
|
8
10
|
export * from "./Options/Classes/Slow.js";
|
|
9
|
-
export * from "./Options/Interfaces/ISlow.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-slow",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.0",
|
|
4
4
|
"description": "tsParticles slow external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,9 +87,10 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "
|
|
90
|
+
"@tsparticles/engine": "4.0.0-alpha.0"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
|
94
|
-
}
|
|
94
|
+
},
|
|
95
|
+
"type": "module"
|
|
95
96
|
}
|