@tsparticles/move-parallax 3.9.1 → 4.0.0-alpha.1

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/189.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 189.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_move_parallax=this.webpackChunk_tsparticles_move_parallax||[]).push([[189],{189(t,a,e){e.d(a,{ParallaxMover:()=>i});class i{init(){}isEnabled(t){return!t.destroyed&&t.container.actualOptions.interactivity.events.onHover.parallax.enable}move(t){const a=t.container,e=a.actualOptions.interactivity.events.onHover.parallax;if(!e.enable)return;const i=e.force,n=a.interactivity.mouse.position;if(!n)return;const s=a.canvas.size,o=.5*s.width,r=.5*s.height,l=e.smooth,c=t.getRadius()/i,p=(n.x-o)*c,v=(n.y-r)*c,{offset:u}=t;u.x+=(p-u.x)/l,u.y+=(v-u.y)/l}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Parallax Move v4.0.0-alpha.1 by Matteo Bruni */
@@ -1,16 +1,13 @@
1
- import { isSsr } from "@tsparticles/engine";
2
1
  const half = 0.5;
3
2
  export class ParallaxMover {
4
3
  init() {
5
4
  }
6
5
  isEnabled(particle) {
7
- return (!isSsr() &&
8
- !particle.destroyed &&
9
- particle.container.actualOptions.interactivity.events.onHover.parallax.enable);
6
+ return !particle.destroyed && particle.container.actualOptions.interactivity.events.onHover.parallax.enable;
10
7
  }
11
8
  move(particle) {
12
9
  const container = particle.container, options = container.actualOptions, parallaxOptions = options.interactivity.events.onHover.parallax;
13
- if (isSsr() || !parallaxOptions.enable) {
10
+ if (!parallaxOptions.enable) {
14
11
  return;
15
12
  }
16
13
  const parallaxForce = parallaxOptions.force, mousePos = container.interactivity.mouse.position;
package/browser/index.js CHANGED
@@ -1,7 +1,9 @@
1
- import { ParallaxMover } from "./ParallaxMover.js";
2
- export async function loadParallaxMover(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addMover("parallax", () => {
5
- return Promise.resolve(new ParallaxMover());
6
- }, refresh);
1
+ export function loadParallaxMover(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(e => {
4
+ e.addMover("parallax", async () => {
5
+ const { ParallaxMover } = await import("./ParallaxMover.js");
6
+ return new ParallaxMover();
7
+ });
8
+ });
7
9
  }
@@ -1,19 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParallaxMover = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
1
  const half = 0.5;
6
- class ParallaxMover {
2
+ export class ParallaxMover {
7
3
  init() {
8
4
  }
9
5
  isEnabled(particle) {
10
- return (!(0, engine_1.isSsr)() &&
11
- !particle.destroyed &&
12
- particle.container.actualOptions.interactivity.events.onHover.parallax.enable);
6
+ return !particle.destroyed && particle.container.actualOptions.interactivity.events.onHover.parallax.enable;
13
7
  }
14
8
  move(particle) {
15
9
  const container = particle.container, options = container.actualOptions, parallaxOptions = options.interactivity.events.onHover.parallax;
16
- if ((0, engine_1.isSsr)() || !parallaxOptions.enable) {
10
+ if (!parallaxOptions.enable) {
17
11
  return;
18
12
  }
19
13
  const parallaxForce = parallaxOptions.force, mousePos = container.interactivity.mouse.position;
@@ -31,4 +25,3 @@ class ParallaxMover {
31
25
  offset.y += (centerDistance.y - offset.y) / parallaxSmooth;
32
26
  }
33
27
  }
34
- exports.ParallaxMover = ParallaxMover;
package/cjs/index.js CHANGED
@@ -1,10 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadParallaxMover = loadParallaxMover;
4
- const ParallaxMover_js_1 = require("./ParallaxMover.js");
5
- async function loadParallaxMover(engine, refresh = true) {
6
- engine.checkVersion("3.9.1");
7
- await engine.addMover("parallax", () => {
8
- return Promise.resolve(new ParallaxMover_js_1.ParallaxMover());
9
- }, refresh);
1
+ export function loadParallaxMover(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(e => {
4
+ e.addMover("parallax", async () => {
5
+ const { ParallaxMover } = await import("./ParallaxMover.js");
6
+ return new ParallaxMover();
7
+ });
8
+ });
10
9
  }
@@ -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.1
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_move_parallax"] = this["webpackChunk_tsparticles_move_parallax"] || []).push([["dist_browser_ParallaxMover_js"],{
19
+
20
+ /***/ "./dist/browser/ParallaxMover.js"
21
+ /*!***************************************!*\
22
+ !*** ./dist/browser/ParallaxMover.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 */ ParallaxMover: () => (/* binding */ ParallaxMover)\n/* harmony export */ });\nconst half = 0.5;\nclass ParallaxMover {\n init() {}\n isEnabled(particle) {\n return !particle.destroyed && particle.container.actualOptions.interactivity.events.onHover.parallax.enable;\n }\n move(particle) {\n const container = particle.container,\n options = container.actualOptions,\n parallaxOptions = options.interactivity.events.onHover.parallax;\n if (!parallaxOptions.enable) {\n return;\n }\n const parallaxForce = parallaxOptions.force,\n mousePos = container.interactivity.mouse.position;\n if (!mousePos) {\n return;\n }\n const canvasSize = container.canvas.size,\n canvasCenter = {\n x: canvasSize.width * half,\n y: canvasSize.height * half\n },\n parallaxSmooth = parallaxOptions.smooth,\n factor = particle.getRadius() / parallaxForce,\n centerDistance = {\n x: (mousePos.x - canvasCenter.x) * factor,\n y: (mousePos.y - canvasCenter.y) * factor\n },\n {\n offset\n } = particle;\n offset.x += (centerDistance.x - offset.x) / parallaxSmooth;\n offset.y += (centerDistance.y - offset.y) / parallaxSmooth;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/move-parallax/./dist/browser/ParallaxMover.js?\n}");
27
+
28
+ /***/ }
29
+
30
+ }]);
@@ -1,16 +1,13 @@
1
- import { isSsr } from "@tsparticles/engine";
2
1
  const half = 0.5;
3
2
  export class ParallaxMover {
4
3
  init() {
5
4
  }
6
5
  isEnabled(particle) {
7
- return (!isSsr() &&
8
- !particle.destroyed &&
9
- particle.container.actualOptions.interactivity.events.onHover.parallax.enable);
6
+ return !particle.destroyed && particle.container.actualOptions.interactivity.events.onHover.parallax.enable;
10
7
  }
11
8
  move(particle) {
12
9
  const container = particle.container, options = container.actualOptions, parallaxOptions = options.interactivity.events.onHover.parallax;
13
- if (isSsr() || !parallaxOptions.enable) {
10
+ if (!parallaxOptions.enable) {
14
11
  return;
15
12
  }
16
13
  const parallaxForce = parallaxOptions.force, mousePos = container.interactivity.mouse.position;
package/esm/index.js CHANGED
@@ -1,7 +1,9 @@
1
- import { ParallaxMover } from "./ParallaxMover.js";
2
- export async function loadParallaxMover(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addMover("parallax", () => {
5
- return Promise.resolve(new ParallaxMover());
6
- }, refresh);
1
+ export function loadParallaxMover(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(e => {
4
+ e.addMover("parallax", async () => {
5
+ const { ParallaxMover } = await import("./ParallaxMover.js");
6
+ return new ParallaxMover();
7
+ });
8
+ });
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/move-parallax",
3
- "version": "3.9.1",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "tsParticles Parallax movement",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -59,9 +59,10 @@
59
59
  "./package.json": "./package.json"
60
60
  },
61
61
  "dependencies": {
62
- "@tsparticles/engine": "3.9.1"
62
+ "@tsparticles/engine": "4.0.0-alpha.1"
63
63
  },
64
64
  "publishConfig": {
65
65
  "access": "public"
66
- }
66
+ },
67
+ "type": "module"
67
68
  }