@tsparticles/updater-size 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/985.min.js +1 -0
- package/README.md +29 -0
- package/browser/SizeUpdater.js +8 -4
- package/browser/index.js +4 -4
- package/cjs/SizeUpdater.js +8 -4
- package/cjs/index.js +4 -4
- package/dist_browser_SizeUpdater_js.js +2 -2
- package/esm/SizeUpdater.js +8 -4
- package/esm/index.js +4 -4
- package/package.json +4 -5
- package/report.html +84 -29
- package/tsparticles.updater.size.js +2 -2
- package/tsparticles.updater.size.min.js +2 -2
- package/types/SizeUpdater.d.ts +3 -1
- package/140.min.js +0 -1
- package/umd/SizeUpdater.js +0 -46
- package/umd/index.js +0 -56
package/985.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_updater_size=this.webpackChunk_tsparticles_updater_size||[]).push([[985],{985(e,i,s){s.d(i,{SizeUpdater:()=>n});var t=s(303);class n{_container;constructor(e){this._container=e}init(e){let i=this._container,s=e.options.size.animation;s.enable&&(e.size.velocity=e.retina.sizeAnimationSpeed/t.percentDenominator*i.retina.reduceFactor,s.sync||(e.size.velocity*=(0,t.getRandom)()))}isEnabled(e){return!e.destroyed&&!e.spawning&&e.size.enable&&((e.size.maxLoops??0)<=0||(e.size.maxLoops??0)>0&&(e.size.loops??0)<(e.size.maxLoops??0))}reset(e){e.size.time=0,e.size.loops=0}update(e,i){this.isEnabled(e)&&(0,t.updateAnimation)(e,e.size,!0,e.options.size.animation.destroy,i)}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) updater plugin for size 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 { loadSizeUpdater } from "@tsparticles/updater-size";
|
|
|
72
78
|
await loadSizeUpdater(tsParticles);
|
|
73
79
|
})();
|
|
74
80
|
```
|
|
81
|
+
|
|
82
|
+
## Option mapping
|
|
83
|
+
|
|
84
|
+
- Primary options key: `particles.size`
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"particles": {
|
|
89
|
+
"size": {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Common pitfalls
|
|
95
|
+
|
|
96
|
+
- Calling `tsParticles.load(...)` before `loadSizeUpdater(...)`
|
|
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/>
|
package/browser/SizeUpdater.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { getRandom, percentDenominator, updateAnimation, } from "@tsparticles/engine";
|
|
2
2
|
const minLoops = 0;
|
|
3
3
|
export class SizeUpdater {
|
|
4
|
+
_container;
|
|
5
|
+
constructor(container) {
|
|
6
|
+
this._container = container;
|
|
7
|
+
}
|
|
4
8
|
init(particle) {
|
|
5
|
-
const container =
|
|
9
|
+
const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;
|
|
6
10
|
if (sizeAnimation.enable) {
|
|
7
11
|
particle.size.velocity =
|
|
8
|
-
(
|
|
9
|
-
container.retina.reduceFactor;
|
|
12
|
+
(particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
|
|
10
13
|
if (!sizeAnimation.sync) {
|
|
11
14
|
particle.size.velocity *= getRandom();
|
|
12
15
|
}
|
|
@@ -21,7 +24,8 @@ export class SizeUpdater {
|
|
|
21
24
|
(particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
|
|
22
25
|
}
|
|
23
26
|
reset(particle) {
|
|
24
|
-
particle.size.
|
|
27
|
+
particle.size.time = 0;
|
|
28
|
+
particle.size.loops = 0;
|
|
25
29
|
}
|
|
26
30
|
update(particle, delta) {
|
|
27
31
|
if (!this.isEnabled(particle)) {
|
package/browser/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function loadSizeUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("size", async () => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("size", async (container) => {
|
|
5
5
|
const { SizeUpdater } = await import("./SizeUpdater.js");
|
|
6
|
-
return new SizeUpdater();
|
|
6
|
+
return new SizeUpdater(container);
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
package/cjs/SizeUpdater.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { getRandom, percentDenominator, updateAnimation, } from "@tsparticles/engine";
|
|
2
2
|
const minLoops = 0;
|
|
3
3
|
export class SizeUpdater {
|
|
4
|
+
_container;
|
|
5
|
+
constructor(container) {
|
|
6
|
+
this._container = container;
|
|
7
|
+
}
|
|
4
8
|
init(particle) {
|
|
5
|
-
const container =
|
|
9
|
+
const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;
|
|
6
10
|
if (sizeAnimation.enable) {
|
|
7
11
|
particle.size.velocity =
|
|
8
|
-
(
|
|
9
|
-
container.retina.reduceFactor;
|
|
12
|
+
(particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
|
|
10
13
|
if (!sizeAnimation.sync) {
|
|
11
14
|
particle.size.velocity *= getRandom();
|
|
12
15
|
}
|
|
@@ -21,7 +24,8 @@ export class SizeUpdater {
|
|
|
21
24
|
(particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
|
|
22
25
|
}
|
|
23
26
|
reset(particle) {
|
|
24
|
-
particle.size.
|
|
27
|
+
particle.size.time = 0;
|
|
28
|
+
particle.size.loops = 0;
|
|
25
29
|
}
|
|
26
30
|
update(particle, delta) {
|
|
27
31
|
if (!this.isEnabled(particle)) {
|
package/cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function loadSizeUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("size", async () => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("size", async (container) => {
|
|
5
5
|
const { SizeUpdater } = await import("./SizeUpdater.js");
|
|
6
|
-
return new SizeUpdater();
|
|
6
|
+
return new SizeUpdater(container);
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
|
@@ -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 */ SizeUpdater: () => (/* binding */ SizeUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst minLoops = 0;\nclass SizeUpdater {\n init(particle) {\n const container =
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SizeUpdater: () => (/* binding */ SizeUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst minLoops = 0;\nclass SizeUpdater {\n _container;\n constructor(container){\n this._container = container;\n }\n init(particle) {\n const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;\n if (sizeAnimation.enable) {\n particle.size.velocity = particle.retina.sizeAnimationSpeed / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator * container.retina.reduceFactor;\n if (!sizeAnimation.sync) {\n particle.size.velocity *= (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n }\n }\n }\n isEnabled(particle) {\n return !particle.destroyed && !particle.spawning && particle.size.enable && ((particle.size.maxLoops ?? minLoops) <= minLoops || (particle.size.maxLoops ?? minLoops) > minLoops && (particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops));\n }\n reset(particle) {\n particle.size.time = 0;\n particle.size.loops = 0;\n }\n update(particle, delta) {\n if (!this.isEnabled(particle)) {\n return;\n }\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateAnimation)(particle, particle.size, true, particle.options.size.animation.destroy, delta);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-size/./dist/browser/SizeUpdater.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ }
|
|
29
29
|
|
package/esm/SizeUpdater.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { getRandom, percentDenominator, updateAnimation, } from "@tsparticles/engine";
|
|
2
2
|
const minLoops = 0;
|
|
3
3
|
export class SizeUpdater {
|
|
4
|
+
_container;
|
|
5
|
+
constructor(container) {
|
|
6
|
+
this._container = container;
|
|
7
|
+
}
|
|
4
8
|
init(particle) {
|
|
5
|
-
const container =
|
|
9
|
+
const container = this._container, sizeOptions = particle.options.size, sizeAnimation = sizeOptions.animation;
|
|
6
10
|
if (sizeAnimation.enable) {
|
|
7
11
|
particle.size.velocity =
|
|
8
|
-
(
|
|
9
|
-
container.retina.reduceFactor;
|
|
12
|
+
(particle.retina.sizeAnimationSpeed / percentDenominator) * container.retina.reduceFactor;
|
|
10
13
|
if (!sizeAnimation.sync) {
|
|
11
14
|
particle.size.velocity *= getRandom();
|
|
12
15
|
}
|
|
@@ -21,7 +24,8 @@ export class SizeUpdater {
|
|
|
21
24
|
(particle.size.loops ?? minLoops) < (particle.size.maxLoops ?? minLoops))));
|
|
22
25
|
}
|
|
23
26
|
reset(particle) {
|
|
24
|
-
particle.size.
|
|
27
|
+
particle.size.time = 0;
|
|
28
|
+
particle.size.loops = 0;
|
|
25
29
|
}
|
|
26
30
|
update(particle, delta) {
|
|
27
31
|
if (!this.isEnabled(particle)) {
|
package/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function loadSizeUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("size", async () => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("size", async (container) => {
|
|
5
5
|
const { SizeUpdater } = await import("./SizeUpdater.js");
|
|
6
|
-
return new SizeUpdater();
|
|
6
|
+
return new SizeUpdater(container);
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-size",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "tsParticles particles size 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"
|