@tsparticles/interaction-light 3.0.0-beta.0 → 3.0.0-beta.2
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 +1 -1
- package/browser/ExternalLighter.js +2 -2
- package/browser/Options/Classes/Light.js +2 -2
- package/browser/Options/Classes/LightArea.js +1 -1
- package/browser/ParticlesLighter.js +1 -1
- package/browser/index.js +10 -10
- package/browser/package.json +1 -0
- package/cjs/ExternalLighter.js +4 -4
- package/cjs/Options/Classes/Light.js +4 -4
- package/cjs/Options/Classes/LightArea.js +2 -2
- package/cjs/ParticlesLighter.js +2 -2
- package/cjs/index.js +12 -12
- package/cjs/package.json +1 -0
- package/esm/ExternalLighter.js +2 -2
- package/esm/Options/Classes/Light.js +2 -2
- package/esm/Options/Classes/LightArea.js +1 -1
- package/esm/ParticlesLighter.js +1 -1
- package/esm/index.js +10 -10
- package/esm/package.json +1 -0
- package/package.json +18 -6
- package/report.html +23 -5
- package/tsparticles.interaction.light.js +1 -1
- package/tsparticles.interaction.light.min.js.LICENSE.txt +1 -1
- package/types/ExternalLighter.d.ts +2 -2
- package/types/Options/Classes/Light.d.ts +3 -3
- package/types/Options/Classes/LightArea.d.ts +2 -2
- package/types/Options/Classes/LightGradient.d.ts +1 -1
- package/types/Options/Classes/LightOptions.d.ts +1 -1
- package/types/Options/Classes/LightShadow.d.ts +1 -1
- package/types/Options/Interfaces/ILight.d.ts +2 -2
- package/types/Options/Interfaces/ILightArea.d.ts +1 -1
- package/types/ParticlesLighter.d.ts +1 -1
- package/types/Types.d.ts +3 -3
- package/types/Utils.d.ts +1 -1
- package/types/index.d.ts +8 -8
- package/umd/ExternalLighter.js +5 -5
- package/umd/Options/Classes/Light.js +5 -5
- package/umd/Options/Classes/LightArea.js +3 -3
- package/umd/ParticlesLighter.js +3 -3
- package/umd/index.js +13 -13
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@tsparticles/interaction-light)
|
|
7
7
|
[](https://www.npmjs.com/package/@tsparticles/interaction-light) [](https://github.com/sponsors/matteobruni)
|
|
8
8
|
|
|
9
|
-
[tsParticles](https://github.com/
|
|
9
|
+
[tsParticles](https://github.com/tsparticles/tsparticles) interaction plugin for light effect.
|
|
10
10
|
|
|
11
11
|
## How to use it
|
|
12
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExternalInteractorBase, isInArray, rangeColorToRgb, } from "@tsparticles/engine";
|
|
2
|
-
import { Light } from "./Options/Classes/Light";
|
|
3
|
-
import { drawLight } from "./Utils";
|
|
2
|
+
import { Light } from "./Options/Classes/Light.js";
|
|
3
|
+
import { drawLight } from "./Utils.js";
|
|
4
4
|
export class ExternalLighter extends ExternalInteractorBase {
|
|
5
5
|
constructor(container) {
|
|
6
6
|
super(container);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParticlesInteractorBase, isInArray, rangeColorToRgb } from "@tsparticles/engine";
|
|
2
|
-
import { drawParticleShadow } from "./Utils";
|
|
2
|
+
import { drawParticleShadow } from "./Utils.js";
|
|
3
3
|
export class ParticlesLighter extends ParticlesInteractorBase {
|
|
4
4
|
constructor(container) {
|
|
5
5
|
super(container);
|
package/browser/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ExternalLighter } from "./ExternalLighter";
|
|
2
|
-
import { ParticlesLighter } from "./ParticlesLighter";
|
|
1
|
+
import { ExternalLighter } from "./ExternalLighter.js";
|
|
2
|
+
import { ParticlesLighter } from "./ParticlesLighter.js";
|
|
3
3
|
export async function loadLightInteraction(engine, refresh = true) {
|
|
4
4
|
await engine.addInteractor("externalLight", (container) => new ExternalLighter(container), refresh);
|
|
5
5
|
await engine.addInteractor("particlesLight", (container) => new ParticlesLighter(container), refresh);
|
|
6
6
|
}
|
|
7
|
-
export * from "./Options/Classes/Light";
|
|
8
|
-
export * from "./Options/Classes/LightArea";
|
|
9
|
-
export * from "./Options/Classes/LightGradient";
|
|
10
|
-
export * from "./Options/Classes/LightShadow";
|
|
11
|
-
export * from "./Options/Interfaces/ILight";
|
|
12
|
-
export * from "./Options/Interfaces/ILightArea";
|
|
13
|
-
export * from "./Options/Interfaces/ILightGradient";
|
|
14
|
-
export * from "./Options/Interfaces/ILightShadow";
|
|
7
|
+
export * from "./Options/Classes/Light.js";
|
|
8
|
+
export * from "./Options/Classes/LightArea.js";
|
|
9
|
+
export * from "./Options/Classes/LightGradient.js";
|
|
10
|
+
export * from "./Options/Classes/LightShadow.js";
|
|
11
|
+
export * from "./Options/Interfaces/ILight.js";
|
|
12
|
+
export * from "./Options/Interfaces/ILightArea.js";
|
|
13
|
+
export * from "./Options/Interfaces/ILightGradient.js";
|
|
14
|
+
export * from "./Options/Interfaces/ILightShadow.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
package/cjs/ExternalLighter.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExternalLighter = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const Light_js_1 = require("./Options/Classes/Light.js");
|
|
6
|
+
const Utils_js_1 = require("./Utils.js");
|
|
7
7
|
class ExternalLighter extends engine_1.ExternalInteractorBase {
|
|
8
8
|
constructor(container) {
|
|
9
9
|
super(container);
|
|
@@ -22,7 +22,7 @@ class ExternalLighter extends engine_1.ExternalInteractorBase {
|
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
container.canvas.draw((ctx) => {
|
|
25
|
-
(0,
|
|
25
|
+
(0, Utils_js_1.drawLight)(container, ctx, mousePos);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
isEnabled(particle) {
|
|
@@ -42,7 +42,7 @@ class ExternalLighter extends engine_1.ExternalInteractorBase {
|
|
|
42
42
|
}
|
|
43
43
|
loadModeOptions(options, ...sources) {
|
|
44
44
|
if (!options.light) {
|
|
45
|
-
options.light = new
|
|
45
|
+
options.light = new Light_js_1.Light();
|
|
46
46
|
}
|
|
47
47
|
for (const source of sources) {
|
|
48
48
|
options.light.load(source?.light);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Light = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const LightArea_js_1 = require("./LightArea.js");
|
|
5
|
+
const LightShadow_js_1 = require("./LightShadow.js");
|
|
6
6
|
class Light {
|
|
7
7
|
constructor() {
|
|
8
|
-
this.area = new
|
|
9
|
-
this.shadow = new
|
|
8
|
+
this.area = new LightArea_js_1.LightArea();
|
|
9
|
+
this.shadow = new LightShadow_js_1.LightShadow();
|
|
10
10
|
}
|
|
11
11
|
load(data) {
|
|
12
12
|
if (!data) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LightArea = void 0;
|
|
4
|
-
const
|
|
4
|
+
const LightGradient_js_1 = require("./LightGradient.js");
|
|
5
5
|
class LightArea {
|
|
6
6
|
constructor() {
|
|
7
|
-
this.gradient = new
|
|
7
|
+
this.gradient = new LightGradient_js_1.LightGradient();
|
|
8
8
|
this.radius = 1000;
|
|
9
9
|
}
|
|
10
10
|
load(data) {
|
package/cjs/ParticlesLighter.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ParticlesLighter = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const
|
|
5
|
+
const Utils_js_1 = require("./Utils.js");
|
|
6
6
|
class ParticlesLighter extends engine_1.ParticlesInteractorBase {
|
|
7
7
|
constructor(container) {
|
|
8
8
|
super(container);
|
|
@@ -21,7 +21,7 @@ class ParticlesLighter extends engine_1.ParticlesInteractorBase {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
container.canvas.draw((ctx) => {
|
|
24
|
-
(0,
|
|
24
|
+
(0, Utils_js_1.drawParticleShadow)(container, ctx, particle, mousePos);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
isEnabled(particle) {
|
package/cjs/index.js
CHANGED
|
@@ -15,18 +15,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.loadLightInteraction = void 0;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
18
|
+
const ExternalLighter_js_1 = require("./ExternalLighter.js");
|
|
19
|
+
const ParticlesLighter_js_1 = require("./ParticlesLighter.js");
|
|
20
20
|
async function loadLightInteraction(engine, refresh = true) {
|
|
21
|
-
await engine.addInteractor("externalLight", (container) => new
|
|
22
|
-
await engine.addInteractor("particlesLight", (container) => new
|
|
21
|
+
await engine.addInteractor("externalLight", (container) => new ExternalLighter_js_1.ExternalLighter(container), refresh);
|
|
22
|
+
await engine.addInteractor("particlesLight", (container) => new ParticlesLighter_js_1.ParticlesLighter(container), refresh);
|
|
23
23
|
}
|
|
24
24
|
exports.loadLightInteraction = loadLightInteraction;
|
|
25
|
-
__exportStar(require("./Options/Classes/Light"), exports);
|
|
26
|
-
__exportStar(require("./Options/Classes/LightArea"), exports);
|
|
27
|
-
__exportStar(require("./Options/Classes/LightGradient"), exports);
|
|
28
|
-
__exportStar(require("./Options/Classes/LightShadow"), exports);
|
|
29
|
-
__exportStar(require("./Options/Interfaces/ILight"), exports);
|
|
30
|
-
__exportStar(require("./Options/Interfaces/ILightArea"), exports);
|
|
31
|
-
__exportStar(require("./Options/Interfaces/ILightGradient"), exports);
|
|
32
|
-
__exportStar(require("./Options/Interfaces/ILightShadow"), exports);
|
|
25
|
+
__exportStar(require("./Options/Classes/Light.js"), exports);
|
|
26
|
+
__exportStar(require("./Options/Classes/LightArea.js"), exports);
|
|
27
|
+
__exportStar(require("./Options/Classes/LightGradient.js"), exports);
|
|
28
|
+
__exportStar(require("./Options/Classes/LightShadow.js"), exports);
|
|
29
|
+
__exportStar(require("./Options/Interfaces/ILight.js"), exports);
|
|
30
|
+
__exportStar(require("./Options/Interfaces/ILightArea.js"), exports);
|
|
31
|
+
__exportStar(require("./Options/Interfaces/ILightGradient.js"), exports);
|
|
32
|
+
__exportStar(require("./Options/Interfaces/ILightShadow.js"), exports);
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
package/esm/ExternalLighter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExternalInteractorBase, isInArray, rangeColorToRgb, } from "@tsparticles/engine";
|
|
2
|
-
import { Light } from "./Options/Classes/Light";
|
|
3
|
-
import { drawLight } from "./Utils";
|
|
2
|
+
import { Light } from "./Options/Classes/Light.js";
|
|
3
|
+
import { drawLight } from "./Utils.js";
|
|
4
4
|
export class ExternalLighter extends ExternalInteractorBase {
|
|
5
5
|
constructor(container) {
|
|
6
6
|
super(container);
|
package/esm/ParticlesLighter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParticlesInteractorBase, isInArray, rangeColorToRgb } from "@tsparticles/engine";
|
|
2
|
-
import { drawParticleShadow } from "./Utils";
|
|
2
|
+
import { drawParticleShadow } from "./Utils.js";
|
|
3
3
|
export class ParticlesLighter extends ParticlesInteractorBase {
|
|
4
4
|
constructor(container) {
|
|
5
5
|
super(container);
|
package/esm/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ExternalLighter } from "./ExternalLighter";
|
|
2
|
-
import { ParticlesLighter } from "./ParticlesLighter";
|
|
1
|
+
import { ExternalLighter } from "./ExternalLighter.js";
|
|
2
|
+
import { ParticlesLighter } from "./ParticlesLighter.js";
|
|
3
3
|
export async function loadLightInteraction(engine, refresh = true) {
|
|
4
4
|
await engine.addInteractor("externalLight", (container) => new ExternalLighter(container), refresh);
|
|
5
5
|
await engine.addInteractor("particlesLight", (container) => new ParticlesLighter(container), refresh);
|
|
6
6
|
}
|
|
7
|
-
export * from "./Options/Classes/Light";
|
|
8
|
-
export * from "./Options/Classes/LightArea";
|
|
9
|
-
export * from "./Options/Classes/LightGradient";
|
|
10
|
-
export * from "./Options/Classes/LightShadow";
|
|
11
|
-
export * from "./Options/Interfaces/ILight";
|
|
12
|
-
export * from "./Options/Interfaces/ILightArea";
|
|
13
|
-
export * from "./Options/Interfaces/ILightGradient";
|
|
14
|
-
export * from "./Options/Interfaces/ILightShadow";
|
|
7
|
+
export * from "./Options/Classes/Light.js";
|
|
8
|
+
export * from "./Options/Classes/LightArea.js";
|
|
9
|
+
export * from "./Options/Classes/LightGradient.js";
|
|
10
|
+
export * from "./Options/Classes/LightShadow.js";
|
|
11
|
+
export * from "./Options/Interfaces/ILight.js";
|
|
12
|
+
export * from "./Options/Interfaces/ILightArea.js";
|
|
13
|
+
export * from "./Options/Interfaces/ILightGradient.js";
|
|
14
|
+
export * from "./Options/Interfaces/ILightShadow.js";
|
package/esm/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-light",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"description": "tsParticles Light interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/
|
|
8
|
+
"url": "git+https://github.com/tsparticles/tsparticles.git",
|
|
9
9
|
"directory": "interactions/light"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
|
67
67
|
"license": "MIT",
|
|
68
68
|
"bugs": {
|
|
69
|
-
"url": "https://github.com/
|
|
69
|
+
"url": "https://github.com/tsparticles/tsparticles/issues"
|
|
70
70
|
},
|
|
71
71
|
"funding": [
|
|
72
72
|
{
|
|
@@ -82,14 +82,26 @@
|
|
|
82
82
|
"url": "https://www.buymeacoffee.com/matteobruni"
|
|
83
83
|
}
|
|
84
84
|
],
|
|
85
|
-
"
|
|
85
|
+
"sideEffects": false,
|
|
86
86
|
"jsdelivr": "tsparticles.interaction.light.min.js",
|
|
87
87
|
"unpkg": "tsparticles.interaction.light.min.js",
|
|
88
|
+
"browser": "browser/index.js",
|
|
89
|
+
"main": "cjs/index.js",
|
|
88
90
|
"module": "esm/index.js",
|
|
89
91
|
"types": "types/index.d.ts",
|
|
90
|
-
"
|
|
92
|
+
"exports": {
|
|
93
|
+
".": {
|
|
94
|
+
"types": "./types/index.d.ts",
|
|
95
|
+
"browser": "./browser/index.js",
|
|
96
|
+
"import": "./esm/index.js",
|
|
97
|
+
"require": "./cjs/index.js",
|
|
98
|
+
"umd": "./umd/index.js",
|
|
99
|
+
"default": "./cjs/index.js"
|
|
100
|
+
},
|
|
101
|
+
"./package.json": "./package.json"
|
|
102
|
+
},
|
|
91
103
|
"dependencies": {
|
|
92
|
-
"@tsparticles/engine": "^3.0.0-beta.
|
|
104
|
+
"@tsparticles/engine": "^3.0.0-beta.2"
|
|
93
105
|
},
|
|
94
106
|
"publishConfig": {
|
|
95
107
|
"access": "public"
|