@tsparticles/updater-life 3.0.0-alpha.0 → 3.0.0-beta.0
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/README.md +16 -12
- package/browser/LifeUpdater.js +2 -2
- package/browser/Types.js +1 -0
- package/browser/index.js +2 -2
- package/cjs/LifeUpdater.js +1 -1
- package/cjs/Types.js +2 -0
- package/cjs/index.js +2 -13
- package/esm/LifeUpdater.js +2 -2
- package/esm/Types.js +1 -0
- package/esm/index.js +2 -2
- package/package.json +6 -5
- package/report.html +4 -4
- package/tsparticles.updater.life.js +5 -5
- package/tsparticles.updater.life.min.js +1 -1
- package/tsparticles.updater.life.min.js.LICENSE.txt +1 -8
- package/types/LifeUpdater.d.ts +2 -21
- package/types/Options/Classes/LifeDelay.d.ts +1 -2
- package/types/Options/Classes/LifeDuration.d.ts +1 -2
- package/types/Types.d.ts +20 -0
- package/types/index.d.ts +1 -1
- package/umd/LifeUpdater.js +1 -1
- package/umd/Types.js +12 -0
- package/umd/index.js +2 -2
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# tsParticles Life Updater
|
|
4
4
|
|
|
5
|
-
[](https://www.jsdelivr.com/package/npm/@tsparticles/updater-life)
|
|
6
|
+
[](https://www.npmjs.com/package/@tsparticles/updater-life)
|
|
7
|
+
[](https://www.npmjs.com/package/@tsparticles/updater-life) [](https://github.com/sponsors/matteobruni)
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/matteobruni/tsparticles) updater plugin for life animations.
|
|
10
10
|
|
|
@@ -26,7 +26,7 @@ Once the scripts are loaded you can set up `tsParticles` and the updater plugin
|
|
|
26
26
|
|
|
27
27
|
```javascript
|
|
28
28
|
(async () => {
|
|
29
|
-
await loadLifeUpdater();
|
|
29
|
+
await loadLifeUpdater(tsParticles);
|
|
30
30
|
|
|
31
31
|
await tsParticles.load({
|
|
32
32
|
id: "tsparticles",
|
|
@@ -42,29 +42,33 @@ Once the scripts are loaded you can set up `tsParticles` and the updater plugin
|
|
|
42
42
|
This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
|
|
43
43
|
|
|
44
44
|
```shell
|
|
45
|
-
$ npm install tsparticles
|
|
45
|
+
$ npm install @tsparticles/updater-life
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
or
|
|
49
49
|
|
|
50
50
|
```shell
|
|
51
|
-
$ yarn add tsparticles
|
|
51
|
+
$ yarn add @tsparticles/updater-life
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Then you need to import it in the app, like this:
|
|
55
55
|
|
|
56
56
|
```javascript
|
|
57
|
-
const { tsParticles } = require("tsparticles
|
|
58
|
-
const { loadLifeUpdater } = require("tsparticles
|
|
57
|
+
const { tsParticles } = require("@tsparticles/engine");
|
|
58
|
+
const { loadLifeUpdater } = require("@tsparticles/updater-life");
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
(async () => {
|
|
61
|
+
await loadLifeUpdater(tsParticles);
|
|
62
|
+
})();
|
|
61
63
|
```
|
|
62
64
|
|
|
63
65
|
or
|
|
64
66
|
|
|
65
67
|
```javascript
|
|
66
|
-
import { tsParticles } from "tsparticles
|
|
67
|
-
import { loadLifeUpdater } from "tsparticles
|
|
68
|
+
import { tsParticles } from "@tsparticles/engine";
|
|
69
|
+
import { loadLifeUpdater } from "@tsparticles/updater-life";
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
(async () => {
|
|
72
|
+
await loadLifeUpdater(tsParticles);
|
|
73
|
+
})();
|
|
70
74
|
```
|
package/browser/LifeUpdater.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRandom, getRangeValue, randomInRange, setRangeValue } from "@tsparticles/engine";
|
|
1
|
+
import { getRandom, getRangeValue, randomInRange, setRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
import { Life } from "./Options/Classes/Life";
|
|
3
3
|
export class LifeUpdater {
|
|
4
4
|
constructor(container) {
|
|
@@ -42,7 +42,7 @@ export class LifeUpdater {
|
|
|
42
42
|
options.life = new Life();
|
|
43
43
|
}
|
|
44
44
|
for (const source of sources) {
|
|
45
|
-
options.life.load(source
|
|
45
|
+
options.life.load(source?.life);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
update(particle, delta) {
|
package/browser/Types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LifeUpdater } from "./LifeUpdater";
|
|
2
|
-
export async function loadLifeUpdater(engine) {
|
|
3
|
-
await engine.addParticleUpdater("life", (container) => new LifeUpdater(container));
|
|
2
|
+
export async function loadLifeUpdater(engine, refresh = true) {
|
|
3
|
+
await engine.addParticleUpdater("life", (container) => new LifeUpdater(container), refresh);
|
|
4
4
|
}
|
package/cjs/LifeUpdater.js
CHANGED
package/cjs/Types.js
ADDED
package/cjs/index.js
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.loadLifeUpdater = void 0;
|
|
13
4
|
const LifeUpdater_1 = require("./LifeUpdater");
|
|
14
|
-
function loadLifeUpdater(engine) {
|
|
15
|
-
|
|
16
|
-
yield engine.addParticleUpdater("life", (container) => new LifeUpdater_1.LifeUpdater(container));
|
|
17
|
-
});
|
|
5
|
+
async function loadLifeUpdater(engine, refresh = true) {
|
|
6
|
+
await engine.addParticleUpdater("life", (container) => new LifeUpdater_1.LifeUpdater(container), refresh);
|
|
18
7
|
}
|
|
19
8
|
exports.loadLifeUpdater = loadLifeUpdater;
|
package/esm/LifeUpdater.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRandom, getRangeValue, randomInRange, setRangeValue } from "@tsparticles/engine";
|
|
1
|
+
import { getRandom, getRangeValue, randomInRange, setRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
import { Life } from "./Options/Classes/Life";
|
|
3
3
|
export class LifeUpdater {
|
|
4
4
|
constructor(container) {
|
|
@@ -42,7 +42,7 @@ export class LifeUpdater {
|
|
|
42
42
|
options.life = new Life();
|
|
43
43
|
}
|
|
44
44
|
for (const source of sources) {
|
|
45
|
-
options.life.load(source
|
|
45
|
+
options.life.load(source?.life);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
update(particle, delta) {
|
package/esm/Types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LifeUpdater } from "./LifeUpdater";
|
|
2
|
-
export async function loadLifeUpdater(engine) {
|
|
3
|
-
await engine.addParticleUpdater("life", (container) => new LifeUpdater(container));
|
|
2
|
+
export async function loadLifeUpdater(engine, refresh = true) {
|
|
3
|
+
await engine.addParticleUpdater("life", (container) => new LifeUpdater(container), refresh);
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-life",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"description": "tsParticles particles life updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -73,10 +73,11 @@
|
|
|
73
73
|
"unpkg": "tsparticles.updater.life.min.js",
|
|
74
74
|
"module": "esm/index.js",
|
|
75
75
|
"types": "types/index.d.ts",
|
|
76
|
+
"sideEffects": false,
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@tsparticles/engine": "^3.0.0-beta.0"
|
|
79
|
+
},
|
|
76
80
|
"publishConfig": {
|
|
77
81
|
"access": "public"
|
|
78
|
-
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
"@tsparticles/engine": "^3.0.0-alpha.0"
|
|
81
82
|
}
|
|
82
|
-
}
|
|
83
|
+
}
|