@tsparticles/interaction-light 4.0.0-beta.1 → 4.0.0-beta.11
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/{386.min.js → 481.min.js} +1 -1
- package/{456.min.js → 621.min.js} +1 -1
- package/README.md +60 -0
- package/browser/index.js +1 -1
- package/cjs/index.js +1 -1
- package/dist_browser_ExternalLighter_js.js +1 -1
- package/dist_browser_ParticlesLighter_js.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -6
- package/report.html +1 -1
- package/tsparticles.interaction.light.js +2 -2
- package/tsparticles.interaction.light.min.js +2 -2
- package/umd/ExternalLighter.js +0 -66
- package/umd/Options/Classes/Light.js +0 -32
- package/umd/Options/Classes/LightArea.js +0 -33
- package/umd/Options/Classes/LightGradient.js +0 -32
- package/umd/Options/Classes/LightOptions.js +0 -12
- package/umd/Options/Classes/LightShadow.js +0 -33
- package/umd/Options/Interfaces/ILight.js +0 -12
- package/umd/Options/Interfaces/ILightArea.js +0 -12
- package/umd/Options/Interfaces/ILightGradient.js +0 -12
- package/umd/Options/Interfaces/ILightShadow.js +0 -12
- package/umd/ParticlesLighter.js +0 -57
- package/umd/Types.js +0 -12
- package/umd/Utils.js +0 -79
- package/umd/index.js +0 -69
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_interaction_light=this.webpackChunk_tsparticles_interaction_light||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_interaction_light=this.webpackChunk_tsparticles_interaction_light||[]).push([[481],{481(t,e,i){i.d(e,{ParticlesLighter:()=>o});var a=i(702),r=i(303),n=i(206);class o extends a.ParticlesInteractorBase{maxDistance;_pluginManager;constructor(t,e){super(e),this._pluginManager=t,this.maxDistance=0}clear(){}init(){}interact(t,e){let i=this.container,a=i.actualOptions;if(!a.interactivity?.events.onHover.enable||"pointermove"!==e.status)return;let r=e.mouse.position;r&&i.canvas.render.draw(e=>{(0,n.No)(i,e,t,r)})}isEnabled(t,e){let i=t.interactivity,a=e.mouse,o=i.events;if(!(o.onHover.enable&&a.position))return!1;let l=(0,r.isInArray)(n.EF,o.onHover.mode);if(l&&i.modes.light){let e=i.modes.light.shadow;t.lightShadow=(0,r.rangeColorToRgb)(this._pluginManager,e.color)}return l}reset(){}}},206(t,e,i){i.d(e,{EF:()=>o,No:()=>s,tM:()=>l});var a=i(303);let r=Math.PI*a.half,n=Math.PI*a.quarter,o="light";function l(t,e,i){let r=t.actualOptions.interactivity?.modes.light?.area;if(!r)return;e.beginPath(),e.arc(i.x,i.y,r.radius,0,a.doublePI);let n=e.createRadialGradient(i.x,i.y,0,i.x,i.y,r.radius),o=t.canvas.mouseLight;o?.start&&o.stop&&(n.addColorStop(0,(0,a.getStyleFromRgb)(o.start,t.hdr)),n.addColorStop(1,(0,a.getStyleFromRgb)(o.stop,t.hdr)),e.fillStyle=n,e.fill())}function s(t,e,i,o){let l=i.getPosition(),s=t.actualOptions.interactivity?.modes.light?.shadow;if(!s)return;let h=i.lightShadow;if(!h)return;let d=i.getRadius(),c=i.sides,u=a.doublePI/c,g=-i.rotation+n,y=[];for(let t=0;t<c;t++)y.push({x:l.x+d*Math.sin(g+u*t)*1,y:l.y+d*Math.cos(g+u*t)*1});let p=[],f=s.length;for(let t of y){let e=Math.atan2(o.y-t.y,o.x-t.x),i={x:t.x+f*Math.sin(-e-r),y:t.y+f*Math.cos(-e-r)};p.push({end:i,start:t})}let x=(0,a.getStyleFromRgb)(h,t.hdr),m=p.length-1;for(let t=m,i=0;t>=0;i=t--){e.beginPath();let a=p[t],r=p[i];a&&r&&(e.moveTo(a.start.x,a.start.y),e.lineTo(r.start.x,r.start.y),e.lineTo(r.end.x,r.end.y),e.lineTo(a.end.x,a.end.y),e.fillStyle=x,e.fill())}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_interaction_light=this.webpackChunk_tsparticles_interaction_light||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_interaction_light=this.webpackChunk_tsparticles_interaction_light||[]).push([[621],{621(t,e,a){a.d(e,{ExternalLighter:()=>l});var i=a(702),r=a(303),n=a(206),o=a(913);class l extends i.ExternalInteractorBase{maxDistance=0;_pluginManager;constructor(t,e){super(e),this._pluginManager=t}clear(){}init(){}interact(t){let e=this.container,a=e.actualOptions;if(!a.interactivity?.events.onHover.enable||"pointermove"!==t.status)return;let i=t.mouse.position;i&&e.canvas.render.draw(t=>{(0,n.tM)(e,t,i)})}isEnabled(t,e){let a=this.container,i=t.mouse,o=e?.interactivity??a.actualOptions.interactivity,l=o?.events;if(!(l?.onHover.enable&&i.position))return!1;let s=(0,r.isInArray)(n.EF,l.onHover.mode);if(s&&o?.modes.light){let t=o.modes.light.area.gradient;a.canvas.mouseLight={start:(0,r.rangeColorToRgb)(this._pluginManager,t.start),stop:(0,r.rangeColorToRgb)(this._pluginManager,t.stop)}}return s}loadModeOptions(t,...e){for(let a of(t.light??=new o.v,e))t.light.load(a?.light)}reset(){}}},206(t,e,a){a.d(e,{EF:()=>o,No:()=>s,tM:()=>l});var i=a(303);let r=Math.PI*i.half,n=Math.PI*i.quarter,o="light";function l(t,e,a){let r=t.actualOptions.interactivity?.modes.light?.area;if(!r)return;e.beginPath(),e.arc(a.x,a.y,r.radius,0,i.doublePI);let n=e.createRadialGradient(a.x,a.y,0,a.x,a.y,r.radius),o=t.canvas.mouseLight;o?.start&&o.stop&&(n.addColorStop(0,(0,i.getStyleFromRgb)(o.start,t.hdr)),n.addColorStop(1,(0,i.getStyleFromRgb)(o.stop,t.hdr)),e.fillStyle=n,e.fill())}function s(t,e,a,o){let l=a.getPosition(),s=t.actualOptions.interactivity?.modes.light?.shadow;if(!s)return;let h=a.lightShadow;if(!h)return;let g=a.getRadius(),d=a.sides,u=i.doublePI/d,c=-a.rotation+n,p=[];for(let t=0;t<d;t++)p.push({x:l.x+g*Math.sin(c+u*t)*1,y:l.y+g*Math.cos(c+u*t)*1});let y=[],f=s.length;for(let t of p){let e=Math.atan2(o.y-t.y,o.x-t.x),a={x:t.x+f*Math.sin(-e-r),y:t.y+f*Math.cos(-e-r)};y.push({end:a,start:t})}let v=(0,i.getStyleFromRgb)(h,t.hdr),x=y.length-1;for(let t=x,a=0;t>=0;a=t--){e.beginPath();let i=y[t],r=y[a];i&&r&&(e.moveTo(i.start.x,i.start.y),e.lineTo(r.start.x,r.start.y),e.lineTo(r.end.x,r.end.y),e.lineTo(i.end.x,i.end.y),e.fillStyle=v,e.fill())}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) interaction plugin for light effect.
|
|
10
10
|
|
|
11
|
+
## Quick checklist
|
|
12
|
+
|
|
13
|
+
1. Install `@tsparticles/engine` (or use the CDN bundle below)
|
|
14
|
+
2. Call `loadInteractivityPlugin(tsParticles)` and `loadLightInteraction(tsParticles)` before `tsParticles.load(...)`
|
|
15
|
+
3. Enable `"light"` in interactivity events and configure `interactivity.modes.light`
|
|
16
|
+
|
|
11
17
|
## How to use it
|
|
12
18
|
|
|
13
19
|
### CDN / Vanilla JS / jQuery
|
|
@@ -77,3 +83,57 @@ import { loadLightInteraction } from "@tsparticles/interaction-light";
|
|
|
77
83
|
await loadLightInteraction(tsParticles);
|
|
78
84
|
})();
|
|
79
85
|
```
|
|
86
|
+
|
|
87
|
+
## Option mapping
|
|
88
|
+
|
|
89
|
+
- Event mode key: `interactivity.events.onHover.mode` or `interactivity.events.onClick.mode` with value `"light"`
|
|
90
|
+
- Mode options key: `interactivity.modes.light`
|
|
91
|
+
|
|
92
|
+
### `interactivity.modes.light` properties
|
|
93
|
+
|
|
94
|
+
| Key | Type | Default | Notes |
|
|
95
|
+
| --------------------- | -------- | ----------- | ------------------------ |
|
|
96
|
+
| `area.radius` | `number` | `1000` | Light interaction radius |
|
|
97
|
+
| `area.gradient.start` | `color` | | Gradient start color |
|
|
98
|
+
| `area.gradient.stop` | `color` | | Gradient stop color |
|
|
99
|
+
| `shadow.color` | `color` | `"#000000"` | Shadow/tint color |
|
|
100
|
+
| `shadow.length` | `number` | `2000` | Shadow projection length |
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"interactivity": {
|
|
105
|
+
"events": {
|
|
106
|
+
"onHover": {
|
|
107
|
+
"enable": true,
|
|
108
|
+
"mode": "light"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"modes": {
|
|
112
|
+
"light": {
|
|
113
|
+
"area": {
|
|
114
|
+
"radius": 700,
|
|
115
|
+
"gradient": {
|
|
116
|
+
"start": "#ffffff",
|
|
117
|
+
"stop": "#000000"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"shadow": {
|
|
121
|
+
"color": "#000000",
|
|
122
|
+
"length": 1400
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Common pitfalls
|
|
131
|
+
|
|
132
|
+
- Calling `tsParticles.load(...)` before both `loadInteractivityPlugin(...)` and `loadLightInteraction(...)`
|
|
133
|
+
- Verify required peer packages before enabling advanced options
|
|
134
|
+
- Change one option group at a time to isolate regressions quickly
|
|
135
|
+
|
|
136
|
+
## Related docs
|
|
137
|
+
|
|
138
|
+
- All packages catalog: <https://github.com/tsparticles/tsparticles>
|
|
139
|
+
- Main docs: <https://particles.js.org/docs/>
|
package/browser/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadLightInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
2
|
+
engine.checkVersion("4.0.0-beta.11");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
|
|
5
5
|
ensureInteractivityPluginLoaded(e);
|
package/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadLightInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
2
|
+
engine.checkVersion("4.0.0-beta.11");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
|
|
5
5
|
ensureInteractivityPluginLoaded(e);
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadLightInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
2
|
+
engine.checkVersion("4.0.0-beta.11");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
|
|
5
5
|
ensureInteractivityPluginLoaded(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-light",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.11",
|
|
4
4
|
"description": "tsParticles Light interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -95,14 +95,13 @@
|
|
|
95
95
|
"browser": "./browser/index.js",
|
|
96
96
|
"import": "./esm/index.js",
|
|
97
97
|
"require": "./cjs/index.js",
|
|
98
|
-
"
|
|
99
|
-
"default": "./cjs/index.js"
|
|
98
|
+
"default": "./esm/index.js"
|
|
100
99
|
},
|
|
101
100
|
"./package.json": "./package.json"
|
|
102
101
|
},
|
|
103
|
-
"
|
|
104
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
105
|
-
"@tsparticles/plugin-interactivity": "4.0.0-beta.
|
|
102
|
+
"peerDependencies": {
|
|
103
|
+
"@tsparticles/engine": "4.0.0-beta.11",
|
|
104
|
+
"@tsparticles/plugin-interactivity": "4.0.0-beta.11"
|
|
106
105
|
},
|
|
107
106
|
"publishConfig": {
|
|
108
107
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>@tsparticles/interaction-light [
|
|
6
|
+
<title>@tsparticles/interaction-light [8 Apr 2026 at 17:12]</title>
|
|
7
7
|
<link
|
|
8
8
|
rel="shortcut icon"
|
|
9
9
|
href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII="
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-beta.
|
|
7
|
+
* v4.0.0-beta.11
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -94,7 +94,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
94
94
|
\*******************************/
|
|
95
95
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
96
96
|
|
|
97
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Light: () => (/* reexport safe */ _Options_Classes_Light_js__WEBPACK_IMPORTED_MODULE_0__.Light),\n/* harmony export */ LightArea: () => (/* reexport safe */ _Options_Classes_LightArea_js__WEBPACK_IMPORTED_MODULE_1__.LightArea),\n/* harmony export */ LightGradient: () => (/* reexport safe */ _Options_Classes_LightGradient_js__WEBPACK_IMPORTED_MODULE_2__.LightGradient),\n/* harmony export */ LightShadow: () => (/* reexport safe */ _Options_Classes_LightShadow_js__WEBPACK_IMPORTED_MODULE_3__.LightShadow),\n/* harmony export */ loadLightInteraction: () => (/* binding */ loadLightInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Light_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Light.js */ \"./dist/browser/Options/Classes/Light.js\");\n/* harmony import */ var _Options_Classes_LightArea_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/LightArea.js */ \"./dist/browser/Options/Classes/LightArea.js\");\n/* harmony import */ var _Options_Classes_LightGradient_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/LightGradient.js */ \"./dist/browser/Options/Classes/LightGradient.js\");\n/* harmony import */ var _Options_Classes_LightShadow_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Options/Classes/LightShadow.js */ \"./dist/browser/Options/Classes/LightShadow.js\");\nasync function loadLightInteraction(engine) {\n engine.checkVersion(\"4.0.0-beta.
|
|
97
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Light: () => (/* reexport safe */ _Options_Classes_Light_js__WEBPACK_IMPORTED_MODULE_0__.Light),\n/* harmony export */ LightArea: () => (/* reexport safe */ _Options_Classes_LightArea_js__WEBPACK_IMPORTED_MODULE_1__.LightArea),\n/* harmony export */ LightGradient: () => (/* reexport safe */ _Options_Classes_LightGradient_js__WEBPACK_IMPORTED_MODULE_2__.LightGradient),\n/* harmony export */ LightShadow: () => (/* reexport safe */ _Options_Classes_LightShadow_js__WEBPACK_IMPORTED_MODULE_3__.LightShadow),\n/* harmony export */ loadLightInteraction: () => (/* binding */ loadLightInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Light_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Light.js */ \"./dist/browser/Options/Classes/Light.js\");\n/* harmony import */ var _Options_Classes_LightArea_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/LightArea.js */ \"./dist/browser/Options/Classes/LightArea.js\");\n/* harmony import */ var _Options_Classes_LightGradient_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/LightGradient.js */ \"./dist/browser/Options/Classes/LightGradient.js\");\n/* harmony import */ var _Options_Classes_LightShadow_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Options/Classes/LightShadow.js */ \"./dist/browser/Options/Classes/LightShadow.js\");\nasync function loadLightInteraction(engine) {\n engine.checkVersion(\"4.0.0-beta.11\");\n await engine.pluginManager.register(async (e)=>{\n const { ensureInteractivityPluginLoaded } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\", 19));\n ensureInteractivityPluginLoaded(e);\n e.pluginManager.addInteractor?.(\"externalLight\", async (container)=>{\n const { ExternalLighter } = await __webpack_require__.e(/*! import() */ \"dist_browser_ExternalLighter_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ExternalLighter.js */ \"./dist/browser/ExternalLighter.js\"));\n return new ExternalLighter(e.pluginManager, container);\n });\n e.pluginManager.addInteractor?.(\"particlesLight\", async (container)=>{\n const { ParticlesLighter } = await __webpack_require__.e(/*! import() */ \"dist_browser_ParticlesLighter_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ParticlesLighter.js */ \"./dist/browser/ParticlesLighter.js\"));\n return new ParticlesLighter(e.pluginManager, container);\n });\n });\n}\n\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-light/./dist/browser/index.js?\n}");
|
|
98
98
|
|
|
99
99
|
/***/ }
|
|
100
100
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/plugin-interactivity"],e);else{var r="object"==typeof exports?e(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity")):e(t.window,t.window);for(var o in r)("object"==typeof exports?exports:t)[o]=r[o]}}(this,(t,e)=>(()=>{"use strict";var r,o,i,a={303(e){e.exports=t},702(t){t.exports=e},
|
|
2
|
-
(`+i+": "+a+")",n.name="ChunkLoadError",n.type=i,n.request=a,o[1](n)}},"chunk-"+t,t)}},o=(t,e)=>{var o,i,[a,n,l]=e,c=0;if(a.some(t=>0!==r[t])){for(o in n)s.o(n,o)&&(s.m[o]=n[o]);l&&l(s)}for(t&&t(e);c<a.length;c++)i=a[c],s.o(r,i)&&r[i]&&r[i][0](),r[i]=0},(i=this.webpackChunk_tsparticles_interaction_light=this.webpackChunk_tsparticles_interaction_light||[]).forEach(o.bind(null,0)),i.push=o.bind(null,i.push.bind(i));var g={};s.r(g),s.d(g,{Light:()=>v.v,LightArea:()=>b.O,LightGradient:()=>y.V,LightShadow:()=>m.X,loadLightInteraction:()=>w});var v=s(
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/plugin-interactivity"],e);else{var r="object"==typeof exports?e(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity")):e(t.window,t.window);for(var o in r)("object"==typeof exports?exports:t)[o]=r[o]}}(this,(t,e)=>(()=>{"use strict";var r,o,i,a={303(e){e.exports=t},702(t){t.exports=e},913(t,e,r){r.d(e,{v:()=>n});var o=r(303),i=r(16),a=r(257);class n{area;shadow;constructor(){this.area=new i.O,this.shadow=new a.X}load(t){(0,o.isNull)(t)||(this.area.load(t.area),this.shadow.load(t.shadow))}}},16(t,e,r){r.d(e,{O:()=>a});var o=r(303),i=r(717);class a{gradient;radius;constructor(){this.gradient=new i.V,this.radius=1e3}load(t){(0,o.isNull)(t)||(this.gradient.load(t.gradient),void 0!==t.radius&&(this.radius=t.radius))}}},717(t,e,r){r.d(e,{V:()=>i});var o=r(303);class i{start;stop;constructor(){this.start=new o.OptionsColor,this.stop=new o.OptionsColor,this.start.value="#ffffff",this.stop.value="#000000"}load(t){(0,o.isNull)(t)||(this.start=o.OptionsColor.create(this.start,t.start),this.stop=o.OptionsColor.create(this.stop,t.stop))}}},257(t,e,r){r.d(e,{X:()=>i});var o=r(303);class i{color;length;constructor(){this.color=new o.OptionsColor,this.color.value="#000000",this.length=2e3}load(t){(0,o.isNull)(t)||(this.color=o.OptionsColor.create(this.color,t.color),void 0!==t.length&&(this.length=t.length))}}}},n={};function s(t){var e=n[t];if(void 0!==e)return e.exports;var r=n[t]={exports:{}};return a[t](r,r.exports,s),r.exports}s.m=a,c=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,s.t=function(t,e){if(1&e&&(t=this(t)),8&e||"object"==typeof t&&t&&(4&e&&t.__esModule||16&e&&"function"==typeof t.then))return t;var r=Object.create(null);s.r(r);var o={};l=l||[null,c({}),c([]),c(c)];for(var i=2&e&&t;("object"==typeof i||"function"==typeof i)&&!~l.indexOf(i);i=c(i))Object.getOwnPropertyNames(i).forEach(e=>o[e]=()=>t[e]);return o.default=()=>t,s.d(r,o),r},s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.f={},s.e=t=>Promise.all(Object.keys(s.f).reduce((e,r)=>(s.f[r](t,e),e),[])),s.u=t=>""+t+".min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),p={},s.l=(t,e,r,o)=>{if(p[t])return void p[t].push(e);if(void 0!==r)for(var i,a,n=document.getElementsByTagName("script"),l=0;l<n.length;l++){var c=n[l];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")=="@tsparticles/interaction-light:"+r){i=c;break}}i||(a=!0,(i=document.createElement("script")).charset="utf-8",s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack","@tsparticles/interaction-light:"+r),i.src=t),p[t]=[e];var u=(e,r)=>{i.onerror=i.onload=null,clearTimeout(d);var o=p[t];if(delete p[t],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(t=>t(r)),e)return e(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),a&&document.head.appendChild(i)},s.r=t=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.g.importScripts&&(u=s.g.location+"");var l,c,p,u,d=s.g.document;if(!u&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(u=d.currentScript.src),!u)){var h=d.getElementsByTagName("script");if(h.length)for(var f=h.length-1;f>-1&&(!u||!/^http(s?):/.test(u));)u=h[f--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");s.p=u=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={595:0},s.f.j=(t,e)=>{var o=s.o(r,t)?r[t]:void 0;if(0!==o)if(o)e.push(o[2]);else{var i=new Promise((e,i)=>o=r[t]=[e,i]);e.push(o[2]=i);var a=s.p+s.u(t),n=Error();s.l(a,e=>{if(s.o(r,t)&&(0!==(o=r[t])&&(r[t]=void 0),o)){var i=e&&("load"===e.type?"missing":e.type),a=e&&e.target&&e.target.src;n.message="Loading chunk "+t+` failed.
|
|
2
|
+
(`+i+": "+a+")",n.name="ChunkLoadError",n.type=i,n.request=a,o[1](n)}},"chunk-"+t,t)}},o=(t,e)=>{var o,i,[a,n,l]=e,c=0;if(a.some(t=>0!==r[t])){for(o in n)s.o(n,o)&&(s.m[o]=n[o]);l&&l(s)}for(t&&t(e);c<a.length;c++)i=a[c],s.o(r,i)&&r[i]&&r[i][0](),r[i]=0},(i=this.webpackChunk_tsparticles_interaction_light=this.webpackChunk_tsparticles_interaction_light||[]).forEach(o.bind(null,0)),i.push=o.bind(null,i.push.bind(i));var g={};s.r(g),s.d(g,{Light:()=>v.v,LightArea:()=>b.O,LightGradient:()=>y.V,LightShadow:()=>m.X,loadLightInteraction:()=>w});var v=s(913),b=s(16),y=s(717),m=s(257);async function w(t){t.checkVersion("4.0.0-beta.11"),await t.pluginManager.register(async t=>{let{ensureInteractivityPluginLoaded:e}=await Promise.resolve().then(s.t.bind(s,702,19));e(t),t.pluginManager.addInteractor?.("externalLight",async e=>{let{ExternalLighter:r}=await s.e(621).then(s.bind(s,621));return new r(t.pluginManager,e)}),t.pluginManager.addInteractor?.("particlesLight",async e=>{let{ParticlesLighter:r}=await s.e(481).then(s.bind(s,481));return new r(t.pluginManager,e)})})}return g})());
|
package/umd/ExternalLighter.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/plugin-interactivity", "@tsparticles/engine", "./Utils.js", "./Options/Classes/Light.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ExternalLighter = void 0;
|
|
13
|
-
const plugin_interactivity_1 = require("@tsparticles/plugin-interactivity");
|
|
14
|
-
const engine_1 = require("@tsparticles/engine");
|
|
15
|
-
const Utils_js_1 = require("./Utils.js");
|
|
16
|
-
const Light_js_1 = require("./Options/Classes/Light.js");
|
|
17
|
-
class ExternalLighter extends plugin_interactivity_1.ExternalInteractorBase {
|
|
18
|
-
maxDistance = 0;
|
|
19
|
-
_pluginManager;
|
|
20
|
-
constructor(pluginManager, container) {
|
|
21
|
-
super(container);
|
|
22
|
-
this._pluginManager = pluginManager;
|
|
23
|
-
}
|
|
24
|
-
clear() {
|
|
25
|
-
}
|
|
26
|
-
init() {
|
|
27
|
-
}
|
|
28
|
-
interact(interactivityData) {
|
|
29
|
-
const container = this.container, options = container.actualOptions, interactivity = interactivityData;
|
|
30
|
-
if (!options.interactivity?.events.onHover.enable || interactivity.status !== "pointermove") {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const mousePos = interactivity.mouse.position;
|
|
34
|
-
if (!mousePos) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
container.canvas.render.draw(ctx => {
|
|
38
|
-
(0, Utils_js_1.drawLight)(container, ctx, mousePos);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
isEnabled(interactivityData, particle) {
|
|
42
|
-
const container = this.container, mouse = interactivityData.mouse, interactivity = particle?.interactivity ?? container.actualOptions.interactivity, events = interactivity?.events;
|
|
43
|
-
if (!(events?.onHover.enable && mouse.position)) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
const res = (0, engine_1.isInArray)(Utils_js_1.lightMode, events.onHover.mode);
|
|
47
|
-
if (res && interactivity?.modes.light) {
|
|
48
|
-
const lightGradient = interactivity.modes.light.area.gradient;
|
|
49
|
-
container.canvas.mouseLight = {
|
|
50
|
-
start: (0, engine_1.rangeColorToRgb)(this._pluginManager, lightGradient.start),
|
|
51
|
-
stop: (0, engine_1.rangeColorToRgb)(this._pluginManager, lightGradient.stop),
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
return res;
|
|
55
|
-
}
|
|
56
|
-
loadModeOptions(options, ...sources) {
|
|
57
|
-
options.light ??= new Light_js_1.Light();
|
|
58
|
-
for (const source of sources) {
|
|
59
|
-
options.light.load(source?.light);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
reset() {
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.ExternalLighter = ExternalLighter;
|
|
66
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./LightArea.js", "./LightShadow.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Light = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const LightArea_js_1 = require("./LightArea.js");
|
|
15
|
-
const LightShadow_js_1 = require("./LightShadow.js");
|
|
16
|
-
class Light {
|
|
17
|
-
area;
|
|
18
|
-
shadow;
|
|
19
|
-
constructor() {
|
|
20
|
-
this.area = new LightArea_js_1.LightArea();
|
|
21
|
-
this.shadow = new LightShadow_js_1.LightShadow();
|
|
22
|
-
}
|
|
23
|
-
load(data) {
|
|
24
|
-
if ((0, engine_1.isNull)(data)) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
this.area.load(data.area);
|
|
28
|
-
this.shadow.load(data.shadow);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.Light = Light;
|
|
32
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./LightGradient.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.LightArea = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const LightGradient_js_1 = require("./LightGradient.js");
|
|
15
|
-
class LightArea {
|
|
16
|
-
gradient;
|
|
17
|
-
radius;
|
|
18
|
-
constructor() {
|
|
19
|
-
this.gradient = new LightGradient_js_1.LightGradient();
|
|
20
|
-
this.radius = 1000;
|
|
21
|
-
}
|
|
22
|
-
load(data) {
|
|
23
|
-
if ((0, engine_1.isNull)(data)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
this.gradient.load(data.gradient);
|
|
27
|
-
if (data.radius !== undefined) {
|
|
28
|
-
this.radius = data.radius;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.LightArea = LightArea;
|
|
33
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.LightGradient = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
class LightGradient {
|
|
15
|
-
start;
|
|
16
|
-
stop;
|
|
17
|
-
constructor() {
|
|
18
|
-
this.start = new engine_1.OptionsColor();
|
|
19
|
-
this.stop = new engine_1.OptionsColor();
|
|
20
|
-
this.start.value = "#ffffff";
|
|
21
|
-
this.stop.value = "#000000";
|
|
22
|
-
}
|
|
23
|
-
load(data) {
|
|
24
|
-
if ((0, engine_1.isNull)(data)) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
this.start = engine_1.OptionsColor.create(this.start, data.start);
|
|
28
|
-
this.stop = engine_1.OptionsColor.create(this.stop, data.stop);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.LightGradient = LightGradient;
|
|
32
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.LightShadow = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
class LightShadow {
|
|
15
|
-
color;
|
|
16
|
-
length;
|
|
17
|
-
constructor() {
|
|
18
|
-
this.color = new engine_1.OptionsColor();
|
|
19
|
-
this.color.value = "#000000";
|
|
20
|
-
this.length = 2000;
|
|
21
|
-
}
|
|
22
|
-
load(data) {
|
|
23
|
-
if ((0, engine_1.isNull)(data)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
this.color = engine_1.OptionsColor.create(this.color, data.color);
|
|
27
|
-
if (data.length !== undefined) {
|
|
28
|
-
this.length = data.length;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.LightShadow = LightShadow;
|
|
33
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
package/umd/ParticlesLighter.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/plugin-interactivity", "@tsparticles/engine", "./Utils.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ParticlesLighter = void 0;
|
|
13
|
-
const plugin_interactivity_1 = require("@tsparticles/plugin-interactivity");
|
|
14
|
-
const engine_1 = require("@tsparticles/engine");
|
|
15
|
-
const Utils_js_1 = require("./Utils.js");
|
|
16
|
-
class ParticlesLighter extends plugin_interactivity_1.ParticlesInteractorBase {
|
|
17
|
-
maxDistance;
|
|
18
|
-
_pluginManager;
|
|
19
|
-
constructor(pluginManager, container) {
|
|
20
|
-
super(container);
|
|
21
|
-
this._pluginManager = pluginManager;
|
|
22
|
-
this.maxDistance = 0;
|
|
23
|
-
}
|
|
24
|
-
clear() {
|
|
25
|
-
}
|
|
26
|
-
init() {
|
|
27
|
-
}
|
|
28
|
-
interact(particle, interactivityData) {
|
|
29
|
-
const container = this.container, options = container.actualOptions;
|
|
30
|
-
if (!options.interactivity?.events.onHover.enable || interactivityData.status !== "pointermove") {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const mousePos = interactivityData.mouse.position;
|
|
34
|
-
if (!mousePos) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
container.canvas.render.draw(ctx => {
|
|
38
|
-
(0, Utils_js_1.drawParticleShadow)(container, ctx, particle, mousePos);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
isEnabled(particle, interactivityData) {
|
|
42
|
-
const interactivity = particle.interactivity, mouse = interactivityData.mouse, events = interactivity.events;
|
|
43
|
-
if (!(events.onHover.enable && mouse.position)) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
const res = (0, engine_1.isInArray)(Utils_js_1.lightMode, events.onHover.mode);
|
|
47
|
-
if (res && interactivity.modes.light) {
|
|
48
|
-
const shadowOptions = interactivity.modes.light.shadow;
|
|
49
|
-
particle.lightShadow = (0, engine_1.rangeColorToRgb)(this._pluginManager, shadowOptions.color);
|
|
50
|
-
}
|
|
51
|
-
return res;
|
|
52
|
-
}
|
|
53
|
-
reset() {
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.ParticlesLighter = ParticlesLighter;
|
|
57
|
-
});
|
package/umd/Types.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
package/umd/Utils.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.lightMode = void 0;
|
|
13
|
-
exports.drawLight = drawLight;
|
|
14
|
-
exports.drawParticleShadow = drawParticleShadow;
|
|
15
|
-
const engine_1 = require("@tsparticles/engine");
|
|
16
|
-
const gradientPos = {
|
|
17
|
-
max: 1,
|
|
18
|
-
min: 0,
|
|
19
|
-
}, halfPI = Math.PI * engine_1.half, quarterPI = Math.PI * engine_1.quarter, arcStart = 0;
|
|
20
|
-
exports.lightMode = "light";
|
|
21
|
-
function drawLight(container, context, mousePos) {
|
|
22
|
-
const lightOptions = container.actualOptions.interactivity?.modes.light?.area;
|
|
23
|
-
if (!lightOptions) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
context.beginPath();
|
|
27
|
-
context.arc(mousePos.x, mousePos.y, lightOptions.radius, arcStart, engine_1.doublePI);
|
|
28
|
-
const gradientAmbientLight = context.createRadialGradient(mousePos.x, mousePos.y, arcStart, mousePos.x, mousePos.y, lightOptions.radius), gradientRgb = container.canvas.mouseLight;
|
|
29
|
-
if (!gradientRgb?.start || !gradientRgb.stop) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
gradientAmbientLight.addColorStop(gradientPos.min, (0, engine_1.getStyleFromRgb)(gradientRgb.start, container.hdr));
|
|
33
|
-
gradientAmbientLight.addColorStop(gradientPos.max, (0, engine_1.getStyleFromRgb)(gradientRgb.stop, container.hdr));
|
|
34
|
-
context.fillStyle = gradientAmbientLight;
|
|
35
|
-
context.fill();
|
|
36
|
-
}
|
|
37
|
-
function drawParticleShadow(container, context, particle, mousePos) {
|
|
38
|
-
const pos = particle.getPosition(), shadowOptions = container.actualOptions.interactivity?.modes.light?.shadow;
|
|
39
|
-
if (!shadowOptions) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const shadowRgb = particle.lightShadow;
|
|
43
|
-
if (!shadowRgb) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const radius = particle.getRadius(), sides = particle.sides, full = engine_1.doublePI / sides, angle = -particle.rotation + quarterPI, factor = 1, dots = [];
|
|
47
|
-
for (let i = 0; i < sides; i++) {
|
|
48
|
-
dots.push({
|
|
49
|
-
x: pos.x + radius * Math.sin(angle + full * i) * factor,
|
|
50
|
-
y: pos.y + radius * Math.cos(angle + full * i) * factor,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
const points = [], shadowLength = shadowOptions.length;
|
|
54
|
-
for (const dot of dots) {
|
|
55
|
-
const dotAngle = Math.atan2(mousePos.y - dot.y, mousePos.x - dot.x), end = {
|
|
56
|
-
x: dot.x + shadowLength * Math.sin(-dotAngle - halfPI),
|
|
57
|
-
y: dot.y + shadowLength * Math.cos(-dotAngle - halfPI),
|
|
58
|
-
};
|
|
59
|
-
points.push({
|
|
60
|
-
end: end,
|
|
61
|
-
start: dot,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
const shadowColor = (0, engine_1.getStyleFromRgb)(shadowRgb, container.hdr), lastOffset = 1, firstPos = 0, last = points.length - lastOffset;
|
|
65
|
-
for (let i = last, n = 0; i >= firstPos; n = i--) {
|
|
66
|
-
context.beginPath();
|
|
67
|
-
const iPoint = points[i], nPoint = points[n];
|
|
68
|
-
if (!iPoint || !nPoint) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
context.moveTo(iPoint.start.x, iPoint.start.y);
|
|
72
|
-
context.lineTo(nPoint.start.x, nPoint.start.y);
|
|
73
|
-
context.lineTo(nPoint.end.x, nPoint.end.y);
|
|
74
|
-
context.lineTo(iPoint.end.x, iPoint.end.y);
|
|
75
|
-
context.fillStyle = shadowColor;
|
|
76
|
-
context.fill();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
package/umd/index.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
-
}
|
|
7
|
-
Object.defineProperty(o, k2, desc);
|
|
8
|
-
}) : (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
o[k2] = m[k];
|
|
11
|
-
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
18
|
-
var ownKeys = function(o) {
|
|
19
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
20
|
-
var ar = [];
|
|
21
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
22
|
-
return ar;
|
|
23
|
-
};
|
|
24
|
-
return ownKeys(o);
|
|
25
|
-
};
|
|
26
|
-
return function (mod) {
|
|
27
|
-
if (mod && mod.__esModule) return mod;
|
|
28
|
-
var result = {};
|
|
29
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30
|
-
__setModuleDefault(result, mod);
|
|
31
|
-
return result;
|
|
32
|
-
};
|
|
33
|
-
})();
|
|
34
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
35
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
36
|
-
};
|
|
37
|
-
(function (factory) {
|
|
38
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
39
|
-
var v = factory(require, exports);
|
|
40
|
-
if (v !== undefined) module.exports = v;
|
|
41
|
-
}
|
|
42
|
-
else if (typeof define === "function" && define.amd) {
|
|
43
|
-
define(["require", "exports", "./Options/Classes/Light.js", "./Options/Classes/LightArea.js", "./Options/Classes/LightGradient.js", "./Options/Classes/LightShadow.js"], factory);
|
|
44
|
-
}
|
|
45
|
-
})(function (require, exports) {
|
|
46
|
-
"use strict";
|
|
47
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
48
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.loadLightInteraction = loadLightInteraction;
|
|
50
|
-
async function loadLightInteraction(engine) {
|
|
51
|
-
engine.checkVersion("4.0.0-beta.1");
|
|
52
|
-
await engine.pluginManager.register(async (e) => {
|
|
53
|
-
const { ensureInteractivityPluginLoaded } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-interactivity"))) : new Promise((resolve_1, reject_1) => { require(["@tsparticles/plugin-interactivity"], resolve_1, reject_1); }).then(__importStar));
|
|
54
|
-
ensureInteractivityPluginLoaded(e);
|
|
55
|
-
e.pluginManager.addInteractor?.("externalLight", async (container) => {
|
|
56
|
-
const { ExternalLighter } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ExternalLighter.js"))) : new Promise((resolve_2, reject_2) => { require(["./ExternalLighter.js"], resolve_2, reject_2); }).then(__importStar));
|
|
57
|
-
return new ExternalLighter(e.pluginManager, container);
|
|
58
|
-
});
|
|
59
|
-
e.pluginManager.addInteractor?.("particlesLight", async (container) => {
|
|
60
|
-
const { ParticlesLighter } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ParticlesLighter.js"))) : new Promise((resolve_3, reject_3) => { require(["./ParticlesLighter.js"], resolve_3, reject_3); }).then(__importStar));
|
|
61
|
-
return new ParticlesLighter(e.pluginManager, container);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
__exportStar(require("./Options/Classes/Light.js"), exports);
|
|
66
|
-
__exportStar(require("./Options/Classes/LightArea.js"), exports);
|
|
67
|
-
__exportStar(require("./Options/Classes/LightGradient.js"), exports);
|
|
68
|
-
__exportStar(require("./Options/Classes/LightShadow.js"), exports);
|
|
69
|
-
});
|