@tsparticles/updater-opacity 4.0.0-beta.0 → 4.0.0-beta.10
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/{718.min.js → 765.min.js} +1 -1
- package/README.md +29 -0
- package/browser/OpacityUpdater.js +4 -3
- package/browser/index.js +3 -3
- package/cjs/OpacityUpdater.js +4 -3
- package/cjs/index.js +3 -3
- package/dist_browser_OpacityUpdater_js.js +2 -2
- package/esm/OpacityUpdater.js +4 -3
- package/esm/index.js +3 -3
- package/package.json +4 -5
- package/report.html +84 -29
- package/tsparticles.updater.opacity.js +2 -2
- package/tsparticles.updater.opacity.min.js +2 -2
- package/umd/OpacityUpdater.js +0 -55
- package/umd/index.js +0 -56
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_updater_opacity=this.webpackChunk_tsparticles_updater_opacity||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_updater_opacity=this.webpackChunk_tsparticles_updater_opacity||[]).push([[765],{765(t,a,i){i.d(a,{OpacityUpdater:()=>e});var o=i(303);class e{container;constructor(t){this.container=t}init(t){let a=t.options.opacity;t.opacity=(0,o.initParticleNumericAnimationValue)(a,1);let 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)}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) updater plugin for opacity animations.
|
|
10
10
|
|
|
11
|
+
## Quick checklist
|
|
12
|
+
|
|
13
|
+
1. Install `@tsparticles/engine` (or use the CDN bundle below)
|
|
14
|
+
2. Call the package loader function(s) before `tsParticles.load(...)`
|
|
15
|
+
3. Apply the package options in your `tsParticles.load(...)` config
|
|
16
|
+
|
|
11
17
|
## How to use it
|
|
12
18
|
|
|
13
19
|
### CDN / Vanilla JS / jQuery
|
|
@@ -72,3 +78,26 @@ import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
|
|
|
72
78
|
await loadOpacityUpdater(tsParticles);
|
|
73
79
|
})();
|
|
74
80
|
```
|
|
81
|
+
|
|
82
|
+
## Option mapping
|
|
83
|
+
|
|
84
|
+
- Primary options key: `particles.opacity`
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"particles": {
|
|
89
|
+
"opacity": {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Common pitfalls
|
|
95
|
+
|
|
96
|
+
- Calling `tsParticles.load(...)` before `loadOpacityUpdater(...)`
|
|
97
|
+
- Verify required peer packages before enabling advanced options
|
|
98
|
+
- Change one option group at a time to isolate regressions quickly
|
|
99
|
+
|
|
100
|
+
## Related docs
|
|
101
|
+
|
|
102
|
+
- All packages catalog: <https://github.com/tsparticles/tsparticles>
|
|
103
|
+
- Main docs: <https://particles.js.org/docs/>
|
|
@@ -27,10 +27,11 @@ export class OpacityUpdater {
|
|
|
27
27
|
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
28
28
|
}
|
|
29
29
|
reset(particle) {
|
|
30
|
-
if (particle.opacity) {
|
|
31
|
-
|
|
32
|
-
particle.opacity.loops = 0;
|
|
30
|
+
if (!particle.opacity) {
|
|
31
|
+
return;
|
|
33
32
|
}
|
|
33
|
+
particle.opacity.time = 0;
|
|
34
|
+
particle.opacity.loops = 0;
|
|
34
35
|
}
|
|
35
36
|
update(particle, delta) {
|
|
36
37
|
if (!this.isEnabled(particle) || !particle.opacity) {
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadOpacityUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("opacity", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("opacity", async (container) => {
|
|
5
5
|
const { OpacityUpdater } = await import("./OpacityUpdater.js");
|
|
6
6
|
return new OpacityUpdater(container);
|
|
7
7
|
});
|
package/cjs/OpacityUpdater.js
CHANGED
|
@@ -27,10 +27,11 @@ export class OpacityUpdater {
|
|
|
27
27
|
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
28
28
|
}
|
|
29
29
|
reset(particle) {
|
|
30
|
-
if (particle.opacity) {
|
|
31
|
-
|
|
32
|
-
particle.opacity.loops = 0;
|
|
30
|
+
if (!particle.opacity) {
|
|
31
|
+
return;
|
|
33
32
|
}
|
|
33
|
+
particle.opacity.time = 0;
|
|
34
|
+
particle.opacity.loops = 0;
|
|
34
35
|
}
|
|
35
36
|
update(particle, delta) {
|
|
36
37
|
if (!this.isEnabled(particle) || !particle.opacity) {
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadOpacityUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("opacity", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("opacity", async (container) => {
|
|
5
5
|
const { OpacityUpdater } = await import("./OpacityUpdater.js");
|
|
6
6
|
return new OpacityUpdater(container);
|
|
7
7
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-beta.
|
|
7
|
+
* v4.0.0-beta.10
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\****************************************/
|
|
24
24
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
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 container;\n constructor(container){\n this.container = container;\n }\n init(particle) {\n const opacityOptions = particle.options.opacity, 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
|
|
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 container;\n constructor(container){\n this.container = container;\n }\n init(particle) {\n const opacityOptions = particle.options.opacity, 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 return;\n }\n particle.opacity.time = 0;\n particle.opacity.loops = 0;\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\n//# sourceURL=webpack://@tsparticles/updater-opacity/./dist/browser/OpacityUpdater.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ }
|
|
29
29
|
|
package/esm/OpacityUpdater.js
CHANGED
|
@@ -27,10 +27,11 @@ export class OpacityUpdater {
|
|
|
27
27
|
(particle.opacity.loops ?? none) < (particle.opacity.maxLoops ?? none))));
|
|
28
28
|
}
|
|
29
29
|
reset(particle) {
|
|
30
|
-
if (particle.opacity) {
|
|
31
|
-
|
|
32
|
-
particle.opacity.loops = 0;
|
|
30
|
+
if (!particle.opacity) {
|
|
31
|
+
return;
|
|
33
32
|
}
|
|
33
|
+
particle.opacity.time = 0;
|
|
34
|
+
particle.opacity.loops = 0;
|
|
34
35
|
}
|
|
35
36
|
update(particle, delta) {
|
|
36
37
|
if (!this.isEnabled(particle) || !particle.opacity) {
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadOpacityUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("opacity", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("opacity", async (container) => {
|
|
5
5
|
const { OpacityUpdater } = await import("./OpacityUpdater.js");
|
|
6
6
|
return new OpacityUpdater(container);
|
|
7
7
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-opacity",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "tsParticles particles opacity updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -81,13 +81,12 @@
|
|
|
81
81
|
"browser": "./browser/index.js",
|
|
82
82
|
"import": "./esm/index.js",
|
|
83
83
|
"require": "./cjs/index.js",
|
|
84
|
-
"
|
|
85
|
-
"default": "./cjs/index.js"
|
|
84
|
+
"default": "./esm/index.js"
|
|
86
85
|
},
|
|
87
86
|
"./package.json": "./package.json"
|
|
88
87
|
},
|
|
89
|
-
"
|
|
90
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"@tsparticles/engine": "4.0.0-beta.10"
|
|
91
90
|
},
|
|
92
91
|
"publishConfig": {
|
|
93
92
|
"access": "public"
|