@tsparticles/updater-opacity 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/839.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 839.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_updater_opacity=this.webpackChunk_tsparticles_updater_opacity||[]).push([[839],{839(t,a,i){i.d(a,{OpacityUpdater:()=>e});var o=i(303);class e{constructor(t){this.container=t}init(t){const a=t.options.opacity;t.opacity=(0,o.initParticleNumericAnimationValue)(a,1);const i=a.animation;i.enable&&(t.opacity.velocity=(0,o.getRangeValue)(i.speed)/o.percentDenominator*this.container.retina.reduceFactor,i.sync||(t.opacity.velocity*=(0,o.getRandom)()))}isEnabled(t){return!t.destroyed&&!t.spawning&&!!t.opacity&&t.opacity.enable&&((t.opacity.maxLoops??0)<=0||(t.opacity.maxLoops??0)>0&&(t.opacity.loops??0)<(t.opacity.maxLoops??0))}reset(t){t.opacity&&(t.opacity.time=0,t.opacity.loops=0)}update(t,a){this.isEnabled(t)&&t.opacity&&(0,o.updateAnimation)(t,t.opacity,!0,t.options.opacity.animation.destroy,a)}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Opacity Updater v4.0.0-alpha.1 by Matteo Bruni */
package/browser/index.js CHANGED
@@ -1,7 +1,9 @@
1
- import { OpacityUpdater } from "./OpacityUpdater.js";
2
- export async function loadOpacityUpdater(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addParticleUpdater("opacity", container => {
5
- return Promise.resolve(new OpacityUpdater(container));
6
- }, refresh);
1
+ export function loadOpacityUpdater(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(e => {
4
+ e.addParticleUpdater("opacity", async (container) => {
5
+ const { OpacityUpdater } = await import("./OpacityUpdater.js");
6
+ return new OpacityUpdater(container);
7
+ });
8
+ });
7
9
  }
@@ -1,20 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OpacityUpdater = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
- class OpacityUpdater {
1
+ import { getRandom, getRangeValue, initParticleNumericAnimationValue, percentDenominator, updateAnimation, } from "@tsparticles/engine";
2
+ export class OpacityUpdater {
6
3
  constructor(container) {
7
4
  this.container = container;
8
5
  }
9
6
  init(particle) {
10
7
  const opacityOptions = particle.options.opacity, pxRatio = 1;
11
- particle.opacity = (0, engine_1.initParticleNumericAnimationValue)(opacityOptions, pxRatio);
8
+ particle.opacity = initParticleNumericAnimationValue(opacityOptions, pxRatio);
12
9
  const opacityAnimation = opacityOptions.animation;
13
10
  if (opacityAnimation.enable) {
14
11
  particle.opacity.velocity =
15
- ((0, engine_1.getRangeValue)(opacityAnimation.speed) / engine_1.percentDenominator) * this.container.retina.reduceFactor;
12
+ (getRangeValue(opacityAnimation.speed) / percentDenominator) * this.container.retina.reduceFactor;
16
13
  if (!opacityAnimation.sync) {
17
- particle.opacity.velocity *= (0, engine_1.getRandom)();
14
+ particle.opacity.velocity *= getRandom();
18
15
  }
19
16
  }
20
17
  }
@@ -38,7 +35,6 @@ class OpacityUpdater {
38
35
  if (!this.isEnabled(particle) || !particle.opacity) {
39
36
  return;
40
37
  }
41
- (0, engine_1.updateAnimation)(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);
38
+ updateAnimation(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);
42
39
  }
43
40
  }
44
- exports.OpacityUpdater = OpacityUpdater;
package/cjs/index.js CHANGED
@@ -1,10 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadOpacityUpdater = loadOpacityUpdater;
4
- const OpacityUpdater_js_1 = require("./OpacityUpdater.js");
5
- async function loadOpacityUpdater(engine, refresh = true) {
6
- engine.checkVersion("3.9.1");
7
- await engine.addParticleUpdater("opacity", container => {
8
- return Promise.resolve(new OpacityUpdater_js_1.OpacityUpdater(container));
9
- }, refresh);
1
+ export function loadOpacityUpdater(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(e => {
4
+ e.addParticleUpdater("opacity", async (container) => {
5
+ const { OpacityUpdater } = await import("./OpacityUpdater.js");
6
+ return new OpacityUpdater(container);
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_updater_opacity"] = this["webpackChunk_tsparticles_updater_opacity"] || []).push([["dist_browser_OpacityUpdater_js"],{
19
+
20
+ /***/ "./dist/browser/OpacityUpdater.js"
21
+ /*!****************************************!*\
22
+ !*** ./dist/browser/OpacityUpdater.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 */ OpacityUpdater: () => (/* binding */ OpacityUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass OpacityUpdater {\n constructor(container) {\n this.container = container;\n }\n init(particle) {\n const opacityOptions = particle.options.opacity,\n pxRatio = 1;\n particle.opacity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.initParticleNumericAnimationValue)(opacityOptions, pxRatio);\n const opacityAnimation = opacityOptions.animation;\n if (opacityAnimation.enable) {\n particle.opacity.velocity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(opacityAnimation.speed) / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator * this.container.retina.reduceFactor;\n if (!opacityAnimation.sync) {\n particle.opacity.velocity *= (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n }\n }\n }\n isEnabled(particle) {\n const none = 0;\n return !particle.destroyed && !particle.spawning && !!particle.opacity && particle.opacity.enable && ((particle.opacity.maxLoops ?? none) <= none || (particle.opacity.maxLoops ?? none) > none && (particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none));\n }\n reset(particle) {\n if (particle.opacity) {\n particle.opacity.time = 0;\n particle.opacity.loops = 0;\n }\n }\n update(particle, delta) {\n if (!this.isEnabled(particle) || !particle.opacity) {\n return;\n }\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateAnimation)(particle, particle.opacity, true, particle.options.opacity.animation.destroy, delta);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-opacity/./dist/browser/OpacityUpdater.js?\n}");
27
+
28
+ /***/ }
29
+
30
+ }]);
package/esm/index.js CHANGED
@@ -1,7 +1,9 @@
1
- import { OpacityUpdater } from "./OpacityUpdater.js";
2
- export async function loadOpacityUpdater(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addParticleUpdater("opacity", container => {
5
- return Promise.resolve(new OpacityUpdater(container));
6
- }, refresh);
1
+ export function loadOpacityUpdater(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(e => {
4
+ e.addParticleUpdater("opacity", async (container) => {
5
+ const { OpacityUpdater } = await import("./OpacityUpdater.js");
6
+ return new OpacityUpdater(container);
7
+ });
8
+ });
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-opacity",
3
- "version": "3.9.1",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "tsParticles particles opacity updater",
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": "3.9.1"
90
+ "@tsparticles/engine": "4.0.0-alpha.1"
91
91
  },
92
92
  "publishConfig": {
93
93
  "access": "public"
94
- }
94
+ },
95
+ "type": "module"
95
96
  }