@tsparticles/interaction-light 4.0.0-beta.11 → 4.0.0-beta.15
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/browser/browser.js +5 -0
- package/browser/index.js +9 -9
- package/browser/index.lazy.js +19 -0
- package/cjs/browser.js +5 -0
- package/cjs/index.js +9 -9
- package/cjs/index.lazy.js +19 -0
- package/esm/browser.js +5 -0
- package/esm/index.js +9 -9
- package/esm/index.lazy.js +19 -0
- package/package.json +10 -3
- package/report.html +4949 -94
- package/tsparticles.interaction.light.js +248 -386
- package/tsparticles.interaction.light.min.js +1 -2
- package/types/browser.d.ts +1 -0
- package/types/index.lazy.d.ts +10 -0
- package/481.min.js +0 -1
- package/621.min.js +0 -1
- package/dist_browser_ExternalLighter_js.js +0 -40
- package/dist_browser_ParticlesLighter_js.js +0 -40
|
@@ -1,2 +1 @@
|
|
|
1
|
-
!function(t
|
|
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})());
|
|
1
|
+
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var s="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,s){return s in t||(t[s]={}),t[s]}})}:function(t){return t};t.__tsParticlesInternals.bundles=s(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=s(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=s(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=s(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=s(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=s(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=s(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=s(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=s(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=s(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=s(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=s(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=s(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.interactions.light=t.__tsParticlesInternals.interactions.light||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,s,e){"use strict";const n=1,a=0,r=Math.PI*e.half,i=Math.PI*e.quarter,l="light";class o{start;stop;constructor(){this.start=new e.OptionsColor,this.stop=new e.OptionsColor,this.start.value="#ffffff",this.stop.value="#000000"}load(t){e.isNull(t)||(this.start=e.OptionsColor.create(this.start,t.start),this.stop=e.OptionsColor.create(this.stop,t.stop))}}class c{gradient;radius;constructor(){this.gradient=new o,this.radius=1e3}load(t){e.isNull(t)||(this.gradient.load(t.gradient),void 0!==t.radius&&(this.radius=t.radius))}}class _{color;length;constructor(){this.color=new e.OptionsColor,this.color.value="#000000",this.length=2e3}load(t){e.isNull(t)||(this.color=e.OptionsColor.create(this.color,t.color),void 0!==t.length&&(this.length=t.length))}}class h{area;shadow;constructor(){this.area=new c,this.shadow=new _}load(t){e.isNull(t)||(this.area.load(t.area),this.shadow.load(t.shadow))}}class u extends s.ExternalInteractorBase{maxDistance=0;_pluginManager;constructor(t,s){super(s),this._pluginManager=t}clear(){}init(){}interact(t){const s=this.container,r=s.actualOptions,i=t;if(!r.interactivity?.events.onHover.enable||"pointermove"!==i.status)return;const l=i.mouse.position;l&&s.canvas.render.draw(t=>{!function(t,s,r){const i=t.actualOptions.interactivity?.modes.light?.area;if(!i)return;s.beginPath(),s.arc(r.x,r.y,i.radius,0,e.doublePI);const l=s.createRadialGradient(r.x,r.y,0,r.x,r.y,i.radius),o=t.canvas.mouseLight;o?.start&&o.stop&&(l.addColorStop(a,e.getStyleFromRgb(o.start,t.hdr)),l.addColorStop(n,e.getStyleFromRgb(o.stop,t.hdr)),s.fillStyle=l,s.fill())}(s,t,l)})}isEnabled(t,s){const n=this.container,a=t.mouse,r=s?.interactivity??n.actualOptions.interactivity,i=r?.events;if(!i?.onHover.enable||!a.position)return!1;const o=e.isInArray(l,i.onHover.mode);if(o&&r?.modes.light){const t=r.modes.light.area.gradient;n.canvas.mouseLight={start:e.rangeColorToRgb(this._pluginManager,t.start),stop:e.rangeColorToRgb(this._pluginManager,t.stop)}}return o}loadModeOptions(t,...s){t.light??=new h;for(const e of s)t.light.load(e?.light)}reset(){}}class p extends s.ParticlesInteractorBase{maxDistance;_pluginManager;constructor(t,s){super(s),this._pluginManager=t,this.maxDistance=0}clear(){}init(){}interact(t,s){const n=this.container,a=n.actualOptions;if(!a.interactivity?.events.onHover.enable||"pointermove"!==s.status)return;const l=s.mouse.position;l&&n.canvas.render.draw(s=>{!function(t,s,n,a){const l=n.getPosition(),o=t.actualOptions.interactivity?.modes.light?.shadow;if(!o)return;const c=n.lightShadow;if(!c)return;const _=n.getRadius(),h=n.sides,u=e.doublePI/h,p=-n.rotation+i,g=[];for(let t=0;t<h;t++)g.push({x:l.x+_*Math.sin(p+u*t)*1,y:l.y+_*Math.cos(p+u*t)*1});const d=[],I=o.length;for(const t of g){const s=Math.atan2(a.y-t.y,a.x-t.x),e={x:t.x+I*Math.sin(-s-r),y:t.y+I*Math.cos(-s-r)};d.push({end:e,start:t})}const P=e.getStyleFromRgb(c,t.hdr);for(let t=d.length-1,e=0;t>=0;e=t--){s.beginPath();const n=d[t],a=d[e];n&&a&&(s.moveTo(n.start.x,n.start.y),s.lineTo(a.start.x,a.start.y),s.lineTo(a.end.x,a.end.y),s.lineTo(n.end.x,n.end.y),s.fillStyle=P,s.fill())}}(n,s,t,l)})}isEnabled(t,s){const n=t.interactivity,a=s.mouse,r=n.events;if(!r.onHover.enable||!a.position)return!1;const i=e.isInArray(l,r.onHover.mode);if(i&&n.modes.light){const s=n.modes.light.shadow;t.lightShadow=e.rangeColorToRgb(this._pluginManager,s.color)}return i}reset(){}}async function g(t){t.checkVersion("4.0.0-beta.15"),await t.pluginManager.register(t=>{s.ensureInteractivityPluginLoaded(t),t.pluginManager.addInteractor?.("externalLight",s=>Promise.resolve(new u(t.pluginManager,s))),t.pluginManager.addInteractor?.("particlesLight",s=>Promise.resolve(new p(t.pluginManager,s)))})}const d=globalThis;d.__tsParticlesInternals=d.__tsParticlesInternals??{},d.loadLightInteraction=g,t.Light=h,t.LightArea=c,t.LightGradient=o,t.LightShadow=_,t.loadLightInteraction=g}),Object.assign(globalThis.window||globalThis,{loadLightInteraction:(globalThis.__tsParticlesInternals.interactions.light||{}).loadLightInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Engine } from "@tsparticles/engine/lazy";
|
|
2
|
+
export declare function loadLightInteraction(engine: Engine): Promise<void>;
|
|
3
|
+
export * from "./Options/Classes/Light.js";
|
|
4
|
+
export * from "./Options/Classes/LightArea.js";
|
|
5
|
+
export * from "./Options/Classes/LightGradient.js";
|
|
6
|
+
export * from "./Options/Classes/LightShadow.js";
|
|
7
|
+
export type * from "./Options/Interfaces/ILight.js";
|
|
8
|
+
export type * from "./Options/Interfaces/ILightArea.js";
|
|
9
|
+
export type * from "./Options/Interfaces/ILightGradient.js";
|
|
10
|
+
export type * from "./Options/Interfaces/ILightShadow.js";
|
package/481.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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())}}}}]);
|
package/621.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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())}}}}]);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Author : Matteo Bruni
|
|
3
|
-
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
-
* Demo / Generator : https://particles.js.org/
|
|
5
|
-
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
-
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-beta.11
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_interaction_light"] = this["webpackChunk_tsparticles_interaction_light"] || []).push([["dist_browser_ExternalLighter_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/ExternalLighter.js"
|
|
21
|
-
/*!*****************************************!*\
|
|
22
|
-
!*** ./dist/browser/ExternalLighter.js ***!
|
|
23
|
-
\*****************************************/
|
|
24
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
|
-
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExternalLighter: () => (/* binding */ ExternalLighter)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n/* harmony import */ var _Options_Classes_Light_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Options/Classes/Light.js */ \"./dist/browser/Options/Classes/Light.js\");\n\n\n\n\nclass ExternalLighter extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n maxDistance = 0;\n _pluginManager;\n constructor(pluginManager, container){\n super(container);\n this._pluginManager = pluginManager;\n }\n clear() {}\n init() {}\n interact(interactivityData) {\n const container = this.container, options = container.actualOptions, interactivity = interactivityData;\n if (!options.interactivity?.events.onHover.enable || interactivity.status !== \"pointermove\") {\n return;\n }\n const mousePos = interactivity.mouse.position;\n if (!mousePos) {\n return;\n }\n container.canvas.render.draw((ctx)=>{\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.drawLight)(container, ctx, mousePos);\n });\n }\n isEnabled(interactivityData, particle) {\n const container = this.container, mouse = interactivityData.mouse, interactivity = particle?.interactivity ?? container.actualOptions.interactivity, events = interactivity?.events;\n if (!(events?.onHover.enable && mouse.position)) {\n return false;\n }\n const res = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.isInArray)(_Utils_js__WEBPACK_IMPORTED_MODULE_2__.lightMode, events.onHover.mode);\n if (res && interactivity?.modes.light) {\n const lightGradient = interactivity.modes.light.area.gradient;\n container.canvas.mouseLight = {\n start: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.rangeColorToRgb)(this._pluginManager, lightGradient.start),\n stop: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.rangeColorToRgb)(this._pluginManager, lightGradient.stop)\n };\n }\n return res;\n }\n loadModeOptions(options, ...sources) {\n options.light ??= new _Options_Classes_Light_js__WEBPACK_IMPORTED_MODULE_3__.Light();\n for (const source of sources){\n options.light.load(source?.light);\n }\n }\n reset() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-light/./dist/browser/ExternalLighter.js?\n}");
|
|
27
|
-
|
|
28
|
-
/***/ },
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/Utils.js"
|
|
31
|
-
/*!*******************************!*\
|
|
32
|
-
!*** ./dist/browser/Utils.js ***!
|
|
33
|
-
\*******************************/
|
|
34
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
|
-
|
|
36
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawLight: () => (/* binding */ drawLight),\n/* harmony export */ drawParticleShadow: () => (/* binding */ drawParticleShadow),\n/* harmony export */ lightMode: () => (/* binding */ lightMode)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst gradientPos = {\n max: 1,\n min: 0\n}, halfPI = Math.PI * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, quarterPI = Math.PI * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.quarter, arcStart = 0;\nconst lightMode = \"light\";\nfunction drawLight(container, context, mousePos) {\n const lightOptions = container.actualOptions.interactivity?.modes.light?.area;\n if (!lightOptions) {\n return;\n }\n context.beginPath();\n context.arc(mousePos.x, mousePos.y, lightOptions.radius, arcStart, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI);\n const gradientAmbientLight = context.createRadialGradient(mousePos.x, mousePos.y, arcStart, mousePos.x, mousePos.y, lightOptions.radius), gradientRgb = container.canvas.mouseLight;\n if (!gradientRgb?.start || !gradientRgb.stop) {\n return;\n }\n gradientAmbientLight.addColorStop(gradientPos.min, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(gradientRgb.start, container.hdr));\n gradientAmbientLight.addColorStop(gradientPos.max, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(gradientRgb.stop, container.hdr));\n context.fillStyle = gradientAmbientLight;\n context.fill();\n}\nfunction drawParticleShadow(container, context, particle, mousePos) {\n const pos = particle.getPosition(), shadowOptions = container.actualOptions.interactivity?.modes.light?.shadow;\n if (!shadowOptions) {\n return;\n }\n const shadowRgb = particle.lightShadow;\n if (!shadowRgb) {\n return;\n }\n const radius = particle.getRadius(), sides = particle.sides, full = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI / sides, angle = -particle.rotation + quarterPI, factor = 1, dots = [];\n for(let i = 0; i < sides; i++){\n dots.push({\n x: pos.x + radius * Math.sin(angle + full * i) * factor,\n y: pos.y + radius * Math.cos(angle + full * i) * factor\n });\n }\n const points = [], shadowLength = shadowOptions.length;\n for (const dot of dots){\n const dotAngle = Math.atan2(mousePos.y - dot.y, mousePos.x - dot.x), end = {\n x: dot.x + shadowLength * Math.sin(-dotAngle - halfPI),\n y: dot.y + shadowLength * Math.cos(-dotAngle - halfPI)\n };\n points.push({\n end: end,\n start: dot\n });\n }\n const shadowColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(shadowRgb, container.hdr), lastOffset = 1, firstPos = 0, last = points.length - lastOffset;\n for(let i = last, n = 0; i >= firstPos; n = i--){\n context.beginPath();\n const iPoint = points[i], nPoint = points[n];\n if (!iPoint || !nPoint) {\n continue;\n }\n context.moveTo(iPoint.start.x, iPoint.start.y);\n context.lineTo(nPoint.start.x, nPoint.start.y);\n context.lineTo(nPoint.end.x, nPoint.end.y);\n context.lineTo(iPoint.end.x, iPoint.end.y);\n context.fillStyle = shadowColor;\n context.fill();\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-light/./dist/browser/Utils.js?\n}");
|
|
37
|
-
|
|
38
|
-
/***/ }
|
|
39
|
-
|
|
40
|
-
}]);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Author : Matteo Bruni
|
|
3
|
-
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
-
* Demo / Generator : https://particles.js.org/
|
|
5
|
-
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
-
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-beta.11
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_interaction_light"] = this["webpackChunk_tsparticles_interaction_light"] || []).push([["dist_browser_ParticlesLighter_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/ParticlesLighter.js"
|
|
21
|
-
/*!******************************************!*\
|
|
22
|
-
!*** ./dist/browser/ParticlesLighter.js ***!
|
|
23
|
-
\******************************************/
|
|
24
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
|
-
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ParticlesLighter: () => (/* binding */ ParticlesLighter)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nclass ParticlesLighter extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__.ParticlesInteractorBase {\n maxDistance;\n _pluginManager;\n constructor(pluginManager, container){\n super(container);\n this._pluginManager = pluginManager;\n this.maxDistance = 0;\n }\n clear() {}\n init() {}\n interact(particle, interactivityData) {\n const container = this.container, options = container.actualOptions;\n if (!options.interactivity?.events.onHover.enable || interactivityData.status !== \"pointermove\") {\n return;\n }\n const mousePos = interactivityData.mouse.position;\n if (!mousePos) {\n return;\n }\n container.canvas.render.draw((ctx)=>{\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.drawParticleShadow)(container, ctx, particle, mousePos);\n });\n }\n isEnabled(particle, interactivityData) {\n const interactivity = particle.interactivity, mouse = interactivityData.mouse, events = interactivity.events;\n if (!(events.onHover.enable && mouse.position)) {\n return false;\n }\n const res = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.isInArray)(_Utils_js__WEBPACK_IMPORTED_MODULE_2__.lightMode, events.onHover.mode);\n if (res && interactivity.modes.light) {\n const shadowOptions = interactivity.modes.light.shadow;\n particle.lightShadow = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.rangeColorToRgb)(this._pluginManager, shadowOptions.color);\n }\n return res;\n }\n reset() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-light/./dist/browser/ParticlesLighter.js?\n}");
|
|
27
|
-
|
|
28
|
-
/***/ },
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/Utils.js"
|
|
31
|
-
/*!*******************************!*\
|
|
32
|
-
!*** ./dist/browser/Utils.js ***!
|
|
33
|
-
\*******************************/
|
|
34
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
|
-
|
|
36
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawLight: () => (/* binding */ drawLight),\n/* harmony export */ drawParticleShadow: () => (/* binding */ drawParticleShadow),\n/* harmony export */ lightMode: () => (/* binding */ lightMode)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst gradientPos = {\n max: 1,\n min: 0\n}, halfPI = Math.PI * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, quarterPI = Math.PI * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.quarter, arcStart = 0;\nconst lightMode = \"light\";\nfunction drawLight(container, context, mousePos) {\n const lightOptions = container.actualOptions.interactivity?.modes.light?.area;\n if (!lightOptions) {\n return;\n }\n context.beginPath();\n context.arc(mousePos.x, mousePos.y, lightOptions.radius, arcStart, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI);\n const gradientAmbientLight = context.createRadialGradient(mousePos.x, mousePos.y, arcStart, mousePos.x, mousePos.y, lightOptions.radius), gradientRgb = container.canvas.mouseLight;\n if (!gradientRgb?.start || !gradientRgb.stop) {\n return;\n }\n gradientAmbientLight.addColorStop(gradientPos.min, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(gradientRgb.start, container.hdr));\n gradientAmbientLight.addColorStop(gradientPos.max, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(gradientRgb.stop, container.hdr));\n context.fillStyle = gradientAmbientLight;\n context.fill();\n}\nfunction drawParticleShadow(container, context, particle, mousePos) {\n const pos = particle.getPosition(), shadowOptions = container.actualOptions.interactivity?.modes.light?.shadow;\n if (!shadowOptions) {\n return;\n }\n const shadowRgb = particle.lightShadow;\n if (!shadowRgb) {\n return;\n }\n const radius = particle.getRadius(), sides = particle.sides, full = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI / sides, angle = -particle.rotation + quarterPI, factor = 1, dots = [];\n for(let i = 0; i < sides; i++){\n dots.push({\n x: pos.x + radius * Math.sin(angle + full * i) * factor,\n y: pos.y + radius * Math.cos(angle + full * i) * factor\n });\n }\n const points = [], shadowLength = shadowOptions.length;\n for (const dot of dots){\n const dotAngle = Math.atan2(mousePos.y - dot.y, mousePos.x - dot.x), end = {\n x: dot.x + shadowLength * Math.sin(-dotAngle - halfPI),\n y: dot.y + shadowLength * Math.cos(-dotAngle - halfPI)\n };\n points.push({\n end: end,\n start: dot\n });\n }\n const shadowColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(shadowRgb, container.hdr), lastOffset = 1, firstPos = 0, last = points.length - lastOffset;\n for(let i = last, n = 0; i >= firstPos; n = i--){\n context.beginPath();\n const iPoint = points[i], nPoint = points[n];\n if (!iPoint || !nPoint) {\n continue;\n }\n context.moveTo(iPoint.start.x, iPoint.start.y);\n context.lineTo(nPoint.start.x, nPoint.start.y);\n context.lineTo(nPoint.end.x, nPoint.end.y);\n context.lineTo(iPoint.end.x, iPoint.end.y);\n context.fillStyle = shadowColor;\n context.fill();\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-light/./dist/browser/Utils.js?\n}");
|
|
37
|
-
|
|
38
|
-
/***/ }
|
|
39
|
-
|
|
40
|
-
}]);
|