@tsparticles/updater-stroke-color 3.0.0-alpha.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/LICENSE +21 -0
- package/README.md +70 -0
- package/browser/StrokeColorUpdater.js +94 -0
- package/browser/index.js +4 -0
- package/cjs/StrokeColorUpdater.js +98 -0
- package/cjs/index.js +19 -0
- package/esm/StrokeColorUpdater.js +94 -0
- package/esm/index.js +4 -0
- package/package.json +82 -0
- package/report.html +39 -0
- package/tsparticles.updater.stroke-color.js +195 -0
- package/tsparticles.updater.stroke-color.min.js +2 -0
- package/tsparticles.updater.stroke-color.min.js.LICENSE.txt +8 -0
- package/types/StrokeColorUpdater.d.ts +12 -0
- package/types/index.d.ts +2 -0
- package/umd/StrokeColorUpdater.js +108 -0
- package/umd/index.js +18 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Matteo Bruni
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
[](https://particles.js.org)
|
|
2
|
+
|
|
3
|
+
# tsParticles Stroke Color Updater
|
|
4
|
+
|
|
5
|
+
[](https://www.jsdelivr.com/package/npm/tsparticles-updater-stroke-color)
|
|
6
|
+
[](https://www.npmjs.com/package/tsparticles-updater-stroke-color)
|
|
7
|
+
[](https://www.npmjs.com/package/tsparticles-updater-stroke-color) [](https://github.com/sponsors/matteobruni)
|
|
8
|
+
|
|
9
|
+
[tsParticles](https://github.com/matteobruni/tsparticles) updater plugin for stroke color animations.
|
|
10
|
+
|
|
11
|
+
## How to use it
|
|
12
|
+
|
|
13
|
+
### CDN / Vanilla JS / jQuery
|
|
14
|
+
|
|
15
|
+
The CDN/Vanilla version JS has one required file in vanilla configuration:
|
|
16
|
+
|
|
17
|
+
Including the `tsparticles.updater.stroke-color.min.js` file will export the function to load the updater plugin:
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
loadStrokeColorUpdater;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Usage
|
|
24
|
+
|
|
25
|
+
Once the scripts are loaded you can set up `tsParticles` and the updater plugin like this:
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
(async () => {
|
|
29
|
+
await loadStrokeColorUpdater();
|
|
30
|
+
|
|
31
|
+
await tsParticles.load({
|
|
32
|
+
id: "tsparticles",
|
|
33
|
+
options: {
|
|
34
|
+
/* options */
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
})();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### ESM / CommonJS
|
|
41
|
+
|
|
42
|
+
This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
|
|
43
|
+
|
|
44
|
+
```shell
|
|
45
|
+
$ npm install tsparticles-updater-stroke-color
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
or
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
$ yarn add tsparticles-updater-stroke-color
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Then you need to import it in the app, like this:
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
const { tsParticles } = require("tsparticles-engine");
|
|
58
|
+
const { loadStrokeColorUpdater } = require("tsparticles-updater-stroke-color");
|
|
59
|
+
|
|
60
|
+
loadStrokeColorUpdater(tsParticles);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
or
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
import { tsParticles } from "tsparticles-engine";
|
|
67
|
+
import { loadStrokeColorUpdater } from "tsparticles-updater-stroke-color";
|
|
68
|
+
|
|
69
|
+
loadStrokeColorUpdater(tsParticles);
|
|
70
|
+
```
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { getHslAnimationFromHsl, getRangeValue, itemFromSingleOrMultiple, randomInRange, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
|
+
function updateColorValue(delta, value, valueAnimation, max, decrease) {
|
|
3
|
+
var _a, _b;
|
|
4
|
+
const colorValue = value;
|
|
5
|
+
if (!colorValue ||
|
|
6
|
+
!colorValue.enable ||
|
|
7
|
+
(colorValue.loops !== undefined &&
|
|
8
|
+
colorValue.maxLoops !== undefined &&
|
|
9
|
+
colorValue.maxLoops > 0 &&
|
|
10
|
+
colorValue.loops >= colorValue.maxLoops)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const offset = randomInRange(valueAnimation.offset), velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6, decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
|
|
14
|
+
if (!decrease || colorValue.status === "increasing") {
|
|
15
|
+
colorValue.value += velocity;
|
|
16
|
+
if (colorValue.value > max) {
|
|
17
|
+
if (!colorValue.loops) {
|
|
18
|
+
colorValue.loops = 0;
|
|
19
|
+
}
|
|
20
|
+
colorValue.loops++;
|
|
21
|
+
if (decrease) {
|
|
22
|
+
colorValue.status = "decreasing";
|
|
23
|
+
colorValue.value -= colorValue.value % max;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
colorValue.value -= velocity;
|
|
29
|
+
if (colorValue.value < 0) {
|
|
30
|
+
if (!colorValue.loops) {
|
|
31
|
+
colorValue.loops = 0;
|
|
32
|
+
}
|
|
33
|
+
colorValue.loops++;
|
|
34
|
+
colorValue.status = "increasing";
|
|
35
|
+
colorValue.value += colorValue.value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (colorValue.velocity && decay !== 1) {
|
|
39
|
+
colorValue.velocity *= decay;
|
|
40
|
+
}
|
|
41
|
+
if (colorValue.value > max) {
|
|
42
|
+
colorValue.value %= max;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function updateStrokeColor(particle, delta) {
|
|
46
|
+
if (!particle.strokeColor || !particle.strokeAnimation) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const h = particle.strokeColor.h;
|
|
50
|
+
if (h) {
|
|
51
|
+
updateColorValue(delta, h, particle.strokeAnimation.h, 360, false);
|
|
52
|
+
}
|
|
53
|
+
const s = particle.strokeColor.s;
|
|
54
|
+
if (s) {
|
|
55
|
+
updateColorValue(delta, s, particle.strokeAnimation.s, 100, true);
|
|
56
|
+
}
|
|
57
|
+
const l = particle.strokeColor.l;
|
|
58
|
+
if (l) {
|
|
59
|
+
updateColorValue(delta, l, particle.strokeAnimation.l, 100, true);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export class StrokeColorUpdater {
|
|
63
|
+
constructor(container) {
|
|
64
|
+
this.container = container;
|
|
65
|
+
}
|
|
66
|
+
init(particle) {
|
|
67
|
+
var _a, _b, _c;
|
|
68
|
+
const container = this.container;
|
|
69
|
+
const stroke = itemFromSingleOrMultiple(particle.options.stroke, particle.id, particle.options.reduceDuplicates);
|
|
70
|
+
particle.strokeWidth = getRangeValue(stroke.width) * container.retina.pixelRatio;
|
|
71
|
+
particle.strokeOpacity = getRangeValue((_a = stroke.opacity) !== null && _a !== void 0 ? _a : 1);
|
|
72
|
+
particle.strokeAnimation = (_b = stroke.color) === null || _b === void 0 ? void 0 : _b.animation;
|
|
73
|
+
const strokeHslColor = (_c = rangeColorToHsl(stroke.color)) !== null && _c !== void 0 ? _c : particle.getFillColor();
|
|
74
|
+
if (strokeHslColor) {
|
|
75
|
+
particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, particle.strokeAnimation, container.retina.reduceFactor);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
isEnabled(particle) {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
const color = particle.strokeAnimation;
|
|
81
|
+
return (!particle.destroyed &&
|
|
82
|
+
!particle.spawning &&
|
|
83
|
+
!!color &&
|
|
84
|
+
((((_a = particle.strokeColor) === null || _a === void 0 ? void 0 : _a.h.value) !== undefined && particle.strokeColor.h.enable) ||
|
|
85
|
+
(((_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.s.value) !== undefined && particle.strokeColor.s.enable) ||
|
|
86
|
+
(((_c = particle.strokeColor) === null || _c === void 0 ? void 0 : _c.l.value) !== undefined && particle.strokeColor.l.enable)));
|
|
87
|
+
}
|
|
88
|
+
update(particle, delta) {
|
|
89
|
+
if (!this.isEnabled(particle)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
updateStrokeColor(particle, delta);
|
|
93
|
+
}
|
|
94
|
+
}
|
package/browser/index.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StrokeColorUpdater = void 0;
|
|
4
|
+
const engine_1 = require("@tsparticles/engine");
|
|
5
|
+
function updateColorValue(delta, value, valueAnimation, max, decrease) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const colorValue = value;
|
|
8
|
+
if (!colorValue ||
|
|
9
|
+
!colorValue.enable ||
|
|
10
|
+
(colorValue.loops !== undefined &&
|
|
11
|
+
colorValue.maxLoops !== undefined &&
|
|
12
|
+
colorValue.maxLoops > 0 &&
|
|
13
|
+
colorValue.loops >= colorValue.maxLoops)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const offset = (0, engine_1.randomInRange)(valueAnimation.offset), velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6, decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
|
|
17
|
+
if (!decrease || colorValue.status === "increasing") {
|
|
18
|
+
colorValue.value += velocity;
|
|
19
|
+
if (colorValue.value > max) {
|
|
20
|
+
if (!colorValue.loops) {
|
|
21
|
+
colorValue.loops = 0;
|
|
22
|
+
}
|
|
23
|
+
colorValue.loops++;
|
|
24
|
+
if (decrease) {
|
|
25
|
+
colorValue.status = "decreasing";
|
|
26
|
+
colorValue.value -= colorValue.value % max;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
colorValue.value -= velocity;
|
|
32
|
+
if (colorValue.value < 0) {
|
|
33
|
+
if (!colorValue.loops) {
|
|
34
|
+
colorValue.loops = 0;
|
|
35
|
+
}
|
|
36
|
+
colorValue.loops++;
|
|
37
|
+
colorValue.status = "increasing";
|
|
38
|
+
colorValue.value += colorValue.value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (colorValue.velocity && decay !== 1) {
|
|
42
|
+
colorValue.velocity *= decay;
|
|
43
|
+
}
|
|
44
|
+
if (colorValue.value > max) {
|
|
45
|
+
colorValue.value %= max;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function updateStrokeColor(particle, delta) {
|
|
49
|
+
if (!particle.strokeColor || !particle.strokeAnimation) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const h = particle.strokeColor.h;
|
|
53
|
+
if (h) {
|
|
54
|
+
updateColorValue(delta, h, particle.strokeAnimation.h, 360, false);
|
|
55
|
+
}
|
|
56
|
+
const s = particle.strokeColor.s;
|
|
57
|
+
if (s) {
|
|
58
|
+
updateColorValue(delta, s, particle.strokeAnimation.s, 100, true);
|
|
59
|
+
}
|
|
60
|
+
const l = particle.strokeColor.l;
|
|
61
|
+
if (l) {
|
|
62
|
+
updateColorValue(delta, l, particle.strokeAnimation.l, 100, true);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
class StrokeColorUpdater {
|
|
66
|
+
constructor(container) {
|
|
67
|
+
this.container = container;
|
|
68
|
+
}
|
|
69
|
+
init(particle) {
|
|
70
|
+
var _a, _b, _c;
|
|
71
|
+
const container = this.container;
|
|
72
|
+
const stroke = (0, engine_1.itemFromSingleOrMultiple)(particle.options.stroke, particle.id, particle.options.reduceDuplicates);
|
|
73
|
+
particle.strokeWidth = (0, engine_1.getRangeValue)(stroke.width) * container.retina.pixelRatio;
|
|
74
|
+
particle.strokeOpacity = (0, engine_1.getRangeValue)((_a = stroke.opacity) !== null && _a !== void 0 ? _a : 1);
|
|
75
|
+
particle.strokeAnimation = (_b = stroke.color) === null || _b === void 0 ? void 0 : _b.animation;
|
|
76
|
+
const strokeHslColor = (_c = (0, engine_1.rangeColorToHsl)(stroke.color)) !== null && _c !== void 0 ? _c : particle.getFillColor();
|
|
77
|
+
if (strokeHslColor) {
|
|
78
|
+
particle.strokeColor = (0, engine_1.getHslAnimationFromHsl)(strokeHslColor, particle.strokeAnimation, container.retina.reduceFactor);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
isEnabled(particle) {
|
|
82
|
+
var _a, _b, _c;
|
|
83
|
+
const color = particle.strokeAnimation;
|
|
84
|
+
return (!particle.destroyed &&
|
|
85
|
+
!particle.spawning &&
|
|
86
|
+
!!color &&
|
|
87
|
+
((((_a = particle.strokeColor) === null || _a === void 0 ? void 0 : _a.h.value) !== undefined && particle.strokeColor.h.enable) ||
|
|
88
|
+
(((_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.s.value) !== undefined && particle.strokeColor.s.enable) ||
|
|
89
|
+
(((_c = particle.strokeColor) === null || _c === void 0 ? void 0 : _c.l.value) !== undefined && particle.strokeColor.l.enable)));
|
|
90
|
+
}
|
|
91
|
+
update(particle, delta) {
|
|
92
|
+
if (!this.isEnabled(particle)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
updateStrokeColor(particle, delta);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.StrokeColorUpdater = StrokeColorUpdater;
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadStrokeColorUpdater = void 0;
|
|
13
|
+
const StrokeColorUpdater_1 = require("./StrokeColorUpdater");
|
|
14
|
+
function loadStrokeColorUpdater(engine) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
yield engine.addParticleUpdater("strokeColor", (container) => new StrokeColorUpdater_1.StrokeColorUpdater(container));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.loadStrokeColorUpdater = loadStrokeColorUpdater;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { getHslAnimationFromHsl, getRangeValue, itemFromSingleOrMultiple, randomInRange, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
|
+
function updateColorValue(delta, value, valueAnimation, max, decrease) {
|
|
3
|
+
var _a, _b;
|
|
4
|
+
const colorValue = value;
|
|
5
|
+
if (!colorValue ||
|
|
6
|
+
!colorValue.enable ||
|
|
7
|
+
(colorValue.loops !== undefined &&
|
|
8
|
+
colorValue.maxLoops !== undefined &&
|
|
9
|
+
colorValue.maxLoops > 0 &&
|
|
10
|
+
colorValue.loops >= colorValue.maxLoops)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const offset = randomInRange(valueAnimation.offset), velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6, decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
|
|
14
|
+
if (!decrease || colorValue.status === "increasing") {
|
|
15
|
+
colorValue.value += velocity;
|
|
16
|
+
if (colorValue.value > max) {
|
|
17
|
+
if (!colorValue.loops) {
|
|
18
|
+
colorValue.loops = 0;
|
|
19
|
+
}
|
|
20
|
+
colorValue.loops++;
|
|
21
|
+
if (decrease) {
|
|
22
|
+
colorValue.status = "decreasing";
|
|
23
|
+
colorValue.value -= colorValue.value % max;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
colorValue.value -= velocity;
|
|
29
|
+
if (colorValue.value < 0) {
|
|
30
|
+
if (!colorValue.loops) {
|
|
31
|
+
colorValue.loops = 0;
|
|
32
|
+
}
|
|
33
|
+
colorValue.loops++;
|
|
34
|
+
colorValue.status = "increasing";
|
|
35
|
+
colorValue.value += colorValue.value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (colorValue.velocity && decay !== 1) {
|
|
39
|
+
colorValue.velocity *= decay;
|
|
40
|
+
}
|
|
41
|
+
if (colorValue.value > max) {
|
|
42
|
+
colorValue.value %= max;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function updateStrokeColor(particle, delta) {
|
|
46
|
+
if (!particle.strokeColor || !particle.strokeAnimation) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const h = particle.strokeColor.h;
|
|
50
|
+
if (h) {
|
|
51
|
+
updateColorValue(delta, h, particle.strokeAnimation.h, 360, false);
|
|
52
|
+
}
|
|
53
|
+
const s = particle.strokeColor.s;
|
|
54
|
+
if (s) {
|
|
55
|
+
updateColorValue(delta, s, particle.strokeAnimation.s, 100, true);
|
|
56
|
+
}
|
|
57
|
+
const l = particle.strokeColor.l;
|
|
58
|
+
if (l) {
|
|
59
|
+
updateColorValue(delta, l, particle.strokeAnimation.l, 100, true);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export class StrokeColorUpdater {
|
|
63
|
+
constructor(container) {
|
|
64
|
+
this.container = container;
|
|
65
|
+
}
|
|
66
|
+
init(particle) {
|
|
67
|
+
var _a, _b, _c;
|
|
68
|
+
const container = this.container;
|
|
69
|
+
const stroke = itemFromSingleOrMultiple(particle.options.stroke, particle.id, particle.options.reduceDuplicates);
|
|
70
|
+
particle.strokeWidth = getRangeValue(stroke.width) * container.retina.pixelRatio;
|
|
71
|
+
particle.strokeOpacity = getRangeValue((_a = stroke.opacity) !== null && _a !== void 0 ? _a : 1);
|
|
72
|
+
particle.strokeAnimation = (_b = stroke.color) === null || _b === void 0 ? void 0 : _b.animation;
|
|
73
|
+
const strokeHslColor = (_c = rangeColorToHsl(stroke.color)) !== null && _c !== void 0 ? _c : particle.getFillColor();
|
|
74
|
+
if (strokeHslColor) {
|
|
75
|
+
particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, particle.strokeAnimation, container.retina.reduceFactor);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
isEnabled(particle) {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
const color = particle.strokeAnimation;
|
|
81
|
+
return (!particle.destroyed &&
|
|
82
|
+
!particle.spawning &&
|
|
83
|
+
!!color &&
|
|
84
|
+
((((_a = particle.strokeColor) === null || _a === void 0 ? void 0 : _a.h.value) !== undefined && particle.strokeColor.h.enable) ||
|
|
85
|
+
(((_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.s.value) !== undefined && particle.strokeColor.s.enable) ||
|
|
86
|
+
(((_c = particle.strokeColor) === null || _c === void 0 ? void 0 : _c.l.value) !== undefined && particle.strokeColor.l.enable)));
|
|
87
|
+
}
|
|
88
|
+
update(particle, delta) {
|
|
89
|
+
if (!this.isEnabled(particle)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
updateStrokeColor(particle, delta);
|
|
93
|
+
}
|
|
94
|
+
}
|
package/esm/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tsparticles/updater-stroke-color",
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
|
+
"description": "tsParticles particles stroke color updater",
|
|
5
|
+
"homepage": "https://particles.js.org",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/matteobruni/tsparticles.git",
|
|
9
|
+
"directory": "updaters/strokeColor"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"front-end",
|
|
13
|
+
"frontend",
|
|
14
|
+
"tsparticles",
|
|
15
|
+
"particles.js",
|
|
16
|
+
"particlesjs",
|
|
17
|
+
"particles",
|
|
18
|
+
"particle",
|
|
19
|
+
"canvas",
|
|
20
|
+
"jsparticles",
|
|
21
|
+
"xparticles",
|
|
22
|
+
"particles-js",
|
|
23
|
+
"particles-bg",
|
|
24
|
+
"particles-bg-vue",
|
|
25
|
+
"particles-ts",
|
|
26
|
+
"particles.ts",
|
|
27
|
+
"react-particles-js",
|
|
28
|
+
"react-particles.js",
|
|
29
|
+
"react-particles",
|
|
30
|
+
"react",
|
|
31
|
+
"reactjs",
|
|
32
|
+
"vue-particles",
|
|
33
|
+
"ngx-particles",
|
|
34
|
+
"angular-particles",
|
|
35
|
+
"particleground",
|
|
36
|
+
"vue",
|
|
37
|
+
"vuejs",
|
|
38
|
+
"preact",
|
|
39
|
+
"preactjs",
|
|
40
|
+
"jquery",
|
|
41
|
+
"angularjs",
|
|
42
|
+
"angular",
|
|
43
|
+
"typescript",
|
|
44
|
+
"javascript",
|
|
45
|
+
"animation",
|
|
46
|
+
"web",
|
|
47
|
+
"html5",
|
|
48
|
+
"web-design",
|
|
49
|
+
"webdesign",
|
|
50
|
+
"css",
|
|
51
|
+
"html",
|
|
52
|
+
"css3",
|
|
53
|
+
"animated",
|
|
54
|
+
"background",
|
|
55
|
+
"confetti",
|
|
56
|
+
"canvas",
|
|
57
|
+
"fireworks",
|
|
58
|
+
"fireworks-js",
|
|
59
|
+
"confetti-js",
|
|
60
|
+
"confettijs",
|
|
61
|
+
"fireworksjs",
|
|
62
|
+
"canvas-confetti",
|
|
63
|
+
"@tsparticles/plugin",
|
|
64
|
+
"@tsparticles/updater"
|
|
65
|
+
],
|
|
66
|
+
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
|
67
|
+
"license": "MIT",
|
|
68
|
+
"bugs": {
|
|
69
|
+
"url": "https://github.com/matteobruni/tsparticles/issues"
|
|
70
|
+
},
|
|
71
|
+
"main": "cjs/index.js",
|
|
72
|
+
"jsdelivr": "tsparticles.updater.stroke-color.min.js",
|
|
73
|
+
"unpkg": "tsparticles.updater.stroke-color.min.js",
|
|
74
|
+
"module": "esm/index.js",
|
|
75
|
+
"types": "types/index.d.ts",
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@tsparticles/engine": "^3.0.0-alpha.0"
|
|
81
|
+
}
|
|
82
|
+
}
|