@tsparticles/updater-wobble 3.0.0-alpha.1 → 3.0.0-beta.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/README.md +16 -12
- package/browser/Options/Classes/Wobble.js +3 -3
- package/browser/Types.js +1 -0
- package/browser/Utils.js +13 -0
- package/browser/WobbleUpdater.js +7 -22
- package/browser/index.js +3 -3
- package/browser/package.json +1 -0
- package/cjs/Options/Classes/Wobble.js +3 -3
- package/cjs/Types.js +2 -0
- package/cjs/Utils.js +17 -0
- package/cjs/WobbleUpdater.js +8 -23
- package/cjs/index.js +3 -14
- package/cjs/package.json +1 -0
- package/esm/Options/Classes/Wobble.js +3 -3
- package/esm/Types.js +1 -0
- package/esm/Utils.js +13 -0
- package/esm/WobbleUpdater.js +7 -22
- package/esm/index.js +3 -3
- package/esm/package.json +1 -0
- package/package.json +19 -6
- package/report.html +4 -4
- package/tsparticles.updater.wobble.js +33 -26
- package/tsparticles.updater.wobble.min.js +1 -1
- package/tsparticles.updater.wobble.min.js.LICENSE.txt +1 -8
- package/types/Options/Classes/Wobble.d.ts +3 -3
- package/types/Options/Classes/WobbleSpeed.d.ts +2 -2
- package/types/Options/Interfaces/IWobble.d.ts +1 -1
- package/types/Types.d.ts +22 -0
- package/types/Utils.d.ts +3 -0
- package/types/WobbleUpdater.d.ts +2 -22
- package/types/index.d.ts +1 -1
- package/umd/Options/Classes/Wobble.js +4 -4
- package/umd/Types.js +12 -0
- package/umd/Utils.js +27 -0
- package/umd/WobbleUpdater.js +9 -24
- package/umd/index.js +4 -4
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# tsParticles Wobble Updater
|
|
4
4
|
|
|
5
|
-
[](https://www.jsdelivr.com/package/npm/@tsparticles/updater-wobble)
|
|
6
|
+
[](https://www.npmjs.com/package/@tsparticles/updater-wobble)
|
|
7
|
+
[](https://www.npmjs.com/package/@tsparticles/updater-wobble) [](https://github.com/sponsors/matteobruni)
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/matteobruni/tsparticles) updater plugin for wobble 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 loadWobbleUpdater();
|
|
29
|
+
await loadWobbleUpdater(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-wobble
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
or
|
|
49
49
|
|
|
50
50
|
```shell
|
|
51
|
-
$ yarn add tsparticles
|
|
51
|
+
$ yarn add @tsparticles/updater-wobble
|
|
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 { loadWobbleUpdater } = require("tsparticles
|
|
57
|
+
const { tsParticles } = require("@tsparticles/engine");
|
|
58
|
+
const { loadWobbleUpdater } = require("@tsparticles/updater-wobble");
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
(async () => {
|
|
61
|
+
await loadWobbleUpdater(tsParticles);
|
|
62
|
+
})();
|
|
61
63
|
```
|
|
62
64
|
|
|
63
65
|
or
|
|
64
66
|
|
|
65
67
|
```javascript
|
|
66
|
-
import { tsParticles } from "tsparticles
|
|
67
|
-
import { loadWobbleUpdater } from "tsparticles
|
|
68
|
+
import { tsParticles } from "@tsparticles/engine";
|
|
69
|
+
import { loadWobbleUpdater } from "@tsparticles/updater-wobble";
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
(async () => {
|
|
72
|
+
await loadWobbleUpdater(tsParticles);
|
|
73
|
+
})();
|
|
70
74
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isNumber, setRangeValue, } from "@tsparticles/engine";
|
|
2
|
+
import { WobbleSpeed } from "./WobbleSpeed.js";
|
|
3
3
|
export class Wobble {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.distance = 5;
|
|
@@ -17,7 +17,7 @@ export class Wobble {
|
|
|
17
17
|
this.enable = data.enable;
|
|
18
18
|
}
|
|
19
19
|
if (data.speed !== undefined) {
|
|
20
|
-
if (
|
|
20
|
+
if (isNumber(data.speed)) {
|
|
21
21
|
this.speed.load({ angle: data.speed });
|
|
22
22
|
}
|
|
23
23
|
else {
|
package/browser/Types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/browser/Utils.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function updateWobble(particle, delta) {
|
|
2
|
+
const { wobble: wobbleOptions } = particle.options, { wobble } = particle;
|
|
3
|
+
if (!wobbleOptions?.enable || !wobble) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI, { position } = particle;
|
|
7
|
+
wobble.angle += angleSpeed;
|
|
8
|
+
if (wobble.angle > max) {
|
|
9
|
+
wobble.angle -= max;
|
|
10
|
+
}
|
|
11
|
+
position.x += distance * Math.cos(wobble.angle);
|
|
12
|
+
position.y += distance * Math.abs(Math.sin(wobble.angle));
|
|
13
|
+
}
|
package/browser/WobbleUpdater.js
CHANGED
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
import { getRandom, getRangeValue } from "@tsparticles/engine";
|
|
2
|
-
import { Wobble } from "./Options/Classes/Wobble";
|
|
3
|
-
|
|
4
|
-
var _a;
|
|
5
|
-
const wobble = particle.options.wobble;
|
|
6
|
-
if (!(wobble === null || wobble === void 0 ? void 0 : wobble.enable) || !particle.wobble) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const angleSpeed = particle.wobble.angleSpeed * delta.factor, moveSpeed = particle.wobble.moveSpeed * delta.factor, distance = (moveSpeed * (((_a = particle.retina.wobbleDistance) !== null && _a !== void 0 ? _a : 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI;
|
|
10
|
-
particle.wobble.angle += angleSpeed;
|
|
11
|
-
if (particle.wobble.angle > max) {
|
|
12
|
-
particle.wobble.angle -= max;
|
|
13
|
-
}
|
|
14
|
-
particle.position.x += distance * Math.cos(particle.wobble.angle);
|
|
15
|
-
particle.position.y += distance * Math.abs(Math.sin(particle.wobble.angle));
|
|
16
|
-
}
|
|
1
|
+
import { getRandom, getRangeValue, } from "@tsparticles/engine";
|
|
2
|
+
import { Wobble } from "./Options/Classes/Wobble.js";
|
|
3
|
+
import { updateWobble } from "./Utils.js";
|
|
17
4
|
export class WobbleUpdater {
|
|
18
5
|
constructor(container) {
|
|
19
6
|
this.container = container;
|
|
20
7
|
}
|
|
21
8
|
init(particle) {
|
|
22
|
-
var _a;
|
|
23
9
|
const wobbleOpt = particle.options.wobble;
|
|
24
|
-
if (wobbleOpt
|
|
10
|
+
if (wobbleOpt?.enable) {
|
|
25
11
|
particle.wobble = {
|
|
26
12
|
angle: getRandom() * Math.PI * 2,
|
|
27
13
|
angleSpeed: getRangeValue(wobbleOpt.speed.angle) / 360,
|
|
@@ -35,18 +21,17 @@ export class WobbleUpdater {
|
|
|
35
21
|
moveSpeed: 0,
|
|
36
22
|
};
|
|
37
23
|
}
|
|
38
|
-
particle.retina.wobbleDistance = getRangeValue(
|
|
24
|
+
particle.retina.wobbleDistance = getRangeValue(wobbleOpt?.distance ?? 0) * this.container.retina.pixelRatio;
|
|
39
25
|
}
|
|
40
26
|
isEnabled(particle) {
|
|
41
|
-
|
|
42
|
-
return !particle.destroyed && !particle.spawning && !!((_a = particle.options.wobble) === null || _a === void 0 ? void 0 : _a.enable);
|
|
27
|
+
return !particle.destroyed && !particle.spawning && !!particle.options.wobble?.enable;
|
|
43
28
|
}
|
|
44
29
|
loadOptions(options, ...sources) {
|
|
45
30
|
if (!options.wobble) {
|
|
46
31
|
options.wobble = new Wobble();
|
|
47
32
|
}
|
|
48
33
|
for (const source of sources) {
|
|
49
|
-
options.wobble.load(source
|
|
34
|
+
options.wobble.load(source?.wobble);
|
|
50
35
|
}
|
|
51
36
|
}
|
|
52
37
|
update(particle, delta) {
|
package/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WobbleUpdater } from "./WobbleUpdater";
|
|
2
|
-
export async function loadWobbleUpdater(engine) {
|
|
3
|
-
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container));
|
|
1
|
+
import { WobbleUpdater } from "./WobbleUpdater.js";
|
|
2
|
+
export async function loadWobbleUpdater(engine, refresh = true) {
|
|
3
|
+
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container), refresh);
|
|
4
4
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Wobble = void 0;
|
|
4
|
-
const WobbleSpeed_1 = require("./WobbleSpeed");
|
|
5
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
+
const WobbleSpeed_js_1 = require("./WobbleSpeed.js");
|
|
6
6
|
class Wobble {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.distance = 5;
|
|
9
9
|
this.enable = false;
|
|
10
|
-
this.speed = new
|
|
10
|
+
this.speed = new WobbleSpeed_js_1.WobbleSpeed();
|
|
11
11
|
}
|
|
12
12
|
load(data) {
|
|
13
13
|
if (!data) {
|
|
@@ -20,7 +20,7 @@ class Wobble {
|
|
|
20
20
|
this.enable = data.enable;
|
|
21
21
|
}
|
|
22
22
|
if (data.speed !== undefined) {
|
|
23
|
-
if (
|
|
23
|
+
if ((0, engine_1.isNumber)(data.speed)) {
|
|
24
24
|
this.speed.load({ angle: data.speed });
|
|
25
25
|
}
|
|
26
26
|
else {
|
package/cjs/Types.js
ADDED
package/cjs/Utils.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateWobble = void 0;
|
|
4
|
+
function updateWobble(particle, delta) {
|
|
5
|
+
const { wobble: wobbleOptions } = particle.options, { wobble } = particle;
|
|
6
|
+
if (!wobbleOptions?.enable || !wobble) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI, { position } = particle;
|
|
10
|
+
wobble.angle += angleSpeed;
|
|
11
|
+
if (wobble.angle > max) {
|
|
12
|
+
wobble.angle -= max;
|
|
13
|
+
}
|
|
14
|
+
position.x += distance * Math.cos(wobble.angle);
|
|
15
|
+
position.y += distance * Math.abs(Math.sin(wobble.angle));
|
|
16
|
+
}
|
|
17
|
+
exports.updateWobble = updateWobble;
|
package/cjs/WobbleUpdater.js
CHANGED
|
@@ -2,29 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WobbleUpdater = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
var _a;
|
|
8
|
-
const wobble = particle.options.wobble;
|
|
9
|
-
if (!(wobble === null || wobble === void 0 ? void 0 : wobble.enable) || !particle.wobble) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const angleSpeed = particle.wobble.angleSpeed * delta.factor, moveSpeed = particle.wobble.moveSpeed * delta.factor, distance = (moveSpeed * (((_a = particle.retina.wobbleDistance) !== null && _a !== void 0 ? _a : 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI;
|
|
13
|
-
particle.wobble.angle += angleSpeed;
|
|
14
|
-
if (particle.wobble.angle > max) {
|
|
15
|
-
particle.wobble.angle -= max;
|
|
16
|
-
}
|
|
17
|
-
particle.position.x += distance * Math.cos(particle.wobble.angle);
|
|
18
|
-
particle.position.y += distance * Math.abs(Math.sin(particle.wobble.angle));
|
|
19
|
-
}
|
|
5
|
+
const Wobble_js_1 = require("./Options/Classes/Wobble.js");
|
|
6
|
+
const Utils_js_1 = require("./Utils.js");
|
|
20
7
|
class WobbleUpdater {
|
|
21
8
|
constructor(container) {
|
|
22
9
|
this.container = container;
|
|
23
10
|
}
|
|
24
11
|
init(particle) {
|
|
25
|
-
var _a;
|
|
26
12
|
const wobbleOpt = particle.options.wobble;
|
|
27
|
-
if (wobbleOpt
|
|
13
|
+
if (wobbleOpt?.enable) {
|
|
28
14
|
particle.wobble = {
|
|
29
15
|
angle: (0, engine_1.getRandom)() * Math.PI * 2,
|
|
30
16
|
angleSpeed: (0, engine_1.getRangeValue)(wobbleOpt.speed.angle) / 360,
|
|
@@ -38,25 +24,24 @@ class WobbleUpdater {
|
|
|
38
24
|
moveSpeed: 0,
|
|
39
25
|
};
|
|
40
26
|
}
|
|
41
|
-
particle.retina.wobbleDistance = (0, engine_1.getRangeValue)(
|
|
27
|
+
particle.retina.wobbleDistance = (0, engine_1.getRangeValue)(wobbleOpt?.distance ?? 0) * this.container.retina.pixelRatio;
|
|
42
28
|
}
|
|
43
29
|
isEnabled(particle) {
|
|
44
|
-
|
|
45
|
-
return !particle.destroyed && !particle.spawning && !!((_a = particle.options.wobble) === null || _a === void 0 ? void 0 : _a.enable);
|
|
30
|
+
return !particle.destroyed && !particle.spawning && !!particle.options.wobble?.enable;
|
|
46
31
|
}
|
|
47
32
|
loadOptions(options, ...sources) {
|
|
48
33
|
if (!options.wobble) {
|
|
49
|
-
options.wobble = new
|
|
34
|
+
options.wobble = new Wobble_js_1.Wobble();
|
|
50
35
|
}
|
|
51
36
|
for (const source of sources) {
|
|
52
|
-
options.wobble.load(source
|
|
37
|
+
options.wobble.load(source?.wobble);
|
|
53
38
|
}
|
|
54
39
|
}
|
|
55
40
|
update(particle, delta) {
|
|
56
41
|
if (!this.isEnabled(particle)) {
|
|
57
42
|
return;
|
|
58
43
|
}
|
|
59
|
-
updateWobble(particle, delta);
|
|
44
|
+
(0, Utils_js_1.updateWobble)(particle, delta);
|
|
60
45
|
}
|
|
61
46
|
}
|
|
62
47
|
exports.WobbleUpdater = WobbleUpdater;
|
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.loadWobbleUpdater = void 0;
|
|
13
|
-
const
|
|
14
|
-
function loadWobbleUpdater(engine) {
|
|
15
|
-
|
|
16
|
-
yield engine.addParticleUpdater("wobble", (container) => new WobbleUpdater_1.WobbleUpdater(container));
|
|
17
|
-
});
|
|
4
|
+
const WobbleUpdater_js_1 = require("./WobbleUpdater.js");
|
|
5
|
+
async function loadWobbleUpdater(engine, refresh = true) {
|
|
6
|
+
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater_js_1.WobbleUpdater(container), refresh);
|
|
18
7
|
}
|
|
19
8
|
exports.loadWobbleUpdater = loadWobbleUpdater;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isNumber, setRangeValue, } from "@tsparticles/engine";
|
|
2
|
+
import { WobbleSpeed } from "./WobbleSpeed.js";
|
|
3
3
|
export class Wobble {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.distance = 5;
|
|
@@ -17,7 +17,7 @@ export class Wobble {
|
|
|
17
17
|
this.enable = data.enable;
|
|
18
18
|
}
|
|
19
19
|
if (data.speed !== undefined) {
|
|
20
|
-
if (
|
|
20
|
+
if (isNumber(data.speed)) {
|
|
21
21
|
this.speed.load({ angle: data.speed });
|
|
22
22
|
}
|
|
23
23
|
else {
|
package/esm/Types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/Utils.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function updateWobble(particle, delta) {
|
|
2
|
+
const { wobble: wobbleOptions } = particle.options, { wobble } = particle;
|
|
3
|
+
if (!wobbleOptions?.enable || !wobble) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI, { position } = particle;
|
|
7
|
+
wobble.angle += angleSpeed;
|
|
8
|
+
if (wobble.angle > max) {
|
|
9
|
+
wobble.angle -= max;
|
|
10
|
+
}
|
|
11
|
+
position.x += distance * Math.cos(wobble.angle);
|
|
12
|
+
position.y += distance * Math.abs(Math.sin(wobble.angle));
|
|
13
|
+
}
|
package/esm/WobbleUpdater.js
CHANGED
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
import { getRandom, getRangeValue } from "@tsparticles/engine";
|
|
2
|
-
import { Wobble } from "./Options/Classes/Wobble";
|
|
3
|
-
|
|
4
|
-
var _a;
|
|
5
|
-
const wobble = particle.options.wobble;
|
|
6
|
-
if (!(wobble === null || wobble === void 0 ? void 0 : wobble.enable) || !particle.wobble) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const angleSpeed = particle.wobble.angleSpeed * delta.factor, moveSpeed = particle.wobble.moveSpeed * delta.factor, distance = (moveSpeed * (((_a = particle.retina.wobbleDistance) !== null && _a !== void 0 ? _a : 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI;
|
|
10
|
-
particle.wobble.angle += angleSpeed;
|
|
11
|
-
if (particle.wobble.angle > max) {
|
|
12
|
-
particle.wobble.angle -= max;
|
|
13
|
-
}
|
|
14
|
-
particle.position.x += distance * Math.cos(particle.wobble.angle);
|
|
15
|
-
particle.position.y += distance * Math.abs(Math.sin(particle.wobble.angle));
|
|
16
|
-
}
|
|
1
|
+
import { getRandom, getRangeValue, } from "@tsparticles/engine";
|
|
2
|
+
import { Wobble } from "./Options/Classes/Wobble.js";
|
|
3
|
+
import { updateWobble } from "./Utils.js";
|
|
17
4
|
export class WobbleUpdater {
|
|
18
5
|
constructor(container) {
|
|
19
6
|
this.container = container;
|
|
20
7
|
}
|
|
21
8
|
init(particle) {
|
|
22
|
-
var _a;
|
|
23
9
|
const wobbleOpt = particle.options.wobble;
|
|
24
|
-
if (wobbleOpt
|
|
10
|
+
if (wobbleOpt?.enable) {
|
|
25
11
|
particle.wobble = {
|
|
26
12
|
angle: getRandom() * Math.PI * 2,
|
|
27
13
|
angleSpeed: getRangeValue(wobbleOpt.speed.angle) / 360,
|
|
@@ -35,18 +21,17 @@ export class WobbleUpdater {
|
|
|
35
21
|
moveSpeed: 0,
|
|
36
22
|
};
|
|
37
23
|
}
|
|
38
|
-
particle.retina.wobbleDistance = getRangeValue(
|
|
24
|
+
particle.retina.wobbleDistance = getRangeValue(wobbleOpt?.distance ?? 0) * this.container.retina.pixelRatio;
|
|
39
25
|
}
|
|
40
26
|
isEnabled(particle) {
|
|
41
|
-
|
|
42
|
-
return !particle.destroyed && !particle.spawning && !!((_a = particle.options.wobble) === null || _a === void 0 ? void 0 : _a.enable);
|
|
27
|
+
return !particle.destroyed && !particle.spawning && !!particle.options.wobble?.enable;
|
|
43
28
|
}
|
|
44
29
|
loadOptions(options, ...sources) {
|
|
45
30
|
if (!options.wobble) {
|
|
46
31
|
options.wobble = new Wobble();
|
|
47
32
|
}
|
|
48
33
|
for (const source of sources) {
|
|
49
|
-
options.wobble.load(source
|
|
34
|
+
options.wobble.load(source?.wobble);
|
|
50
35
|
}
|
|
51
36
|
}
|
|
52
37
|
update(particle, delta) {
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WobbleUpdater } from "./WobbleUpdater";
|
|
2
|
-
export async function loadWobbleUpdater(engine) {
|
|
3
|
-
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container));
|
|
1
|
+
import { WobbleUpdater } from "./WobbleUpdater.js";
|
|
2
|
+
export async function loadWobbleUpdater(engine, refresh = true) {
|
|
3
|
+
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container), refresh);
|
|
4
4
|
}
|
package/esm/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-wobble",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.1",
|
|
4
4
|
"description": "tsParticles particles wobble updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -68,15 +68,28 @@
|
|
|
68
68
|
"bugs": {
|
|
69
69
|
"url": "https://github.com/matteobruni/tsparticles/issues"
|
|
70
70
|
},
|
|
71
|
-
"
|
|
71
|
+
"sideEffects": false,
|
|
72
72
|
"jsdelivr": "tsparticles.updater.wobble.min.js",
|
|
73
73
|
"unpkg": "tsparticles.updater.wobble.min.js",
|
|
74
|
+
"browser": "browser/index.js",
|
|
75
|
+
"main": "cjs/index.js",
|
|
74
76
|
"module": "esm/index.js",
|
|
75
77
|
"types": "types/index.d.ts",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
+
"exports": {
|
|
79
|
+
".": {
|
|
80
|
+
"types": "./types/index.d.ts",
|
|
81
|
+
"browser": "./browser/index.js",
|
|
82
|
+
"import": "./esm/index.js",
|
|
83
|
+
"require": "./cjs/index.js",
|
|
84
|
+
"umd": "./umd/index.js",
|
|
85
|
+
"default": "./cjs/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./package.json": "./package.json"
|
|
78
88
|
},
|
|
79
89
|
"dependencies": {
|
|
80
|
-
"@tsparticles/engine": "^3.0.0-
|
|
90
|
+
"@tsparticles/engine": "^3.0.0-beta.1"
|
|
91
|
+
},
|
|
92
|
+
"publishConfig": {
|
|
93
|
+
"access": "public"
|
|
81
94
|
}
|
|
82
|
-
}
|
|
95
|
+
}
|