@tsparticles/updater-life 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/{929.min.js → 549.min.js} +1 -1
- package/README.md +29 -0
- package/browser/index.js +3 -3
- package/cjs/index.js +3 -3
- package/dist_browser_LifeUpdater_js.js +1 -1
- package/esm/index.js +3 -3
- package/package.json +4 -5
- package/report.html +84 -29
- package/tsparticles.updater.life.js +2 -2
- package/tsparticles.updater.life.min.js +2 -2
- package/umd/LifeUpdater.js +0 -67
- package/umd/Options/Classes/Life.js +0 -37
- package/umd/Options/Classes/LifeDelay.js +0 -31
- package/umd/Options/Classes/LifeDuration.js +0 -31
- package/umd/Options/Interfaces/ILife.js +0 -12
- package/umd/Options/Interfaces/ILifeDelay.js +0 -12
- package/umd/Options/Interfaces/ILifeDuration.js +0 -12
- package/umd/Types.js +0 -12
- package/umd/Utils.js +0 -66
- package/umd/index.js +0 -56
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_updater_life=this.webpackChunk_tsparticles_updater_life||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_updater_life=this.webpackChunk_tsparticles_updater_life||[]).push([[549],{549(e,i,t){t.d(i,{LifeUpdater:()=>o});var n=t(303);class a extends n.ValueWithRandom{sync;constructor(){super(),this.sync=!1}load(e){(0,n.isNull)(e)||(super.load(e),void 0!==e.sync&&(this.sync=e.sync))}}class l extends n.ValueWithRandom{sync;constructor(){super(),this.sync=!1}load(e){(0,n.isNull)(e)||(super.load(e),void 0!==e.sync&&(this.sync=e.sync))}}class s{count;delay;duration;constructor(){this.count=0,this.delay=new a,this.duration=new l}load(e){(0,n.isNull)(e)||(void 0!==e.count&&(this.count=e.count),this.delay.load(e.delay),this.duration.load(e.duration))}}class o{container;constructor(e){this.container=e}init(e){let i=this.container,t=e.options.life;t&&(e.life={delay:i.retina.reduceFactor?(0,n.getRangeValue)(t.delay.value)*(t.delay.sync?1:(0,n.getRandom)())/i.retina.reduceFactor*n.millisecondsToSeconds:0,delayTime:0,duration:i.retina.reduceFactor?(0,n.getRangeValue)(t.duration.value)*(t.duration.sync?1:(0,n.getRandom)())/i.retina.reduceFactor*n.millisecondsToSeconds:0,time:0,count:t.count},e.life.duration<=0&&(e.life.duration=-1),e.life.count<=0&&(e.life.count=-1),e.spawning=e.life.delay>0)}isEnabled(e){return!e.destroyed}loadOptions(e,...i){for(let t of(e.life??=new s,i))e.life.load(t?.life)}update(e,i){this.isEnabled(e)&&e.life&&function(e,i,t){if(!e.life)return;let a=e.life,l=!1;if(e.spawning){if(a.delayTime+=i.value,!(a.delayTime>=e.life.delay))return;l=!0,e.spawning=!1,a.delayTime=0,a.time=0}if(-1===a.duration||(l?a.time=0:a.time+=i.value,a.time<a.duration))return;if(a.time=0,e.life.count>0&&e.life.count--,0===e.life.count)return e.destroy();let s=(0,n.setRangeValue)(0,t.width),o=(0,n.setRangeValue)(0,t.width);e.position.x=(0,n.randomInRangeValue)(s),e.position.y=(0,n.randomInRangeValue)(o),e.spawning=!0,a.delayTime=0,a.time=0,e.reset();let d=e.options.life;d&&(a.delay=(0,n.getRangeValue)(d.delay.value)*n.millisecondsToSeconds,a.duration=(0,n.getRangeValue)(d.duration.value)*n.millisecondsToSeconds)}(e,i,this.container.canvas.size)}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) updater plugin for life 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 { loadLifeUpdater } from "@tsparticles/updater-life";
|
|
|
72
78
|
await loadLifeUpdater(tsParticles);
|
|
73
79
|
})();
|
|
74
80
|
```
|
|
81
|
+
|
|
82
|
+
## Option mapping
|
|
83
|
+
|
|
84
|
+
- Primary options key: `particles.life`
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"particles": {
|
|
89
|
+
"life": {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Common pitfalls
|
|
95
|
+
|
|
96
|
+
- Calling `tsParticles.load(...)` before `loadLifeUpdater(...)`
|
|
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/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadLifeUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("life", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("life", async (container) => {
|
|
5
5
|
const { LifeUpdater } = await import("./LifeUpdater.js");
|
|
6
6
|
return new LifeUpdater(container);
|
|
7
7
|
});
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadLifeUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("life", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("life", async (container) => {
|
|
5
5
|
const { LifeUpdater } = await import("./LifeUpdater.js");
|
|
6
6
|
return new LifeUpdater(container);
|
|
7
7
|
});
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadLifeUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("life", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("life", async (container) => {
|
|
5
5
|
const { LifeUpdater } = await import("./LifeUpdater.js");
|
|
6
6
|
return new LifeUpdater(container);
|
|
7
7
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-life",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "tsParticles particles life 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"
|