@tsparticles/interaction-external-cannon 4.3.1 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +3 -3
- package/report.html +1 -1
- package/tsparticles.interaction.external.cannon.js +2 -2
- package/tsparticles.interaction.external.cannon.min.js +1 -1
package/browser/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
3
3
|
import { Cannoner } from "./Cannoner.js";
|
|
4
4
|
export async function loadExternalCannonInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.
|
|
5
|
+
engine.checkVersion("4.4.0");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
ensureInteractivityPluginLoaded(e);
|
|
8
8
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
package/browser/index.lazy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
2
2
|
export async function loadExternalCannonInteraction(engine) {
|
|
3
|
-
engine.checkVersion("4.
|
|
3
|
+
engine.checkVersion("4.4.0");
|
|
4
4
|
await engine.pluginManager.register(async (e) => {
|
|
5
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
package/cjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
3
3
|
import { Cannoner } from "./Cannoner.js";
|
|
4
4
|
export async function loadExternalCannonInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.
|
|
5
|
+
engine.checkVersion("4.4.0");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
ensureInteractivityPluginLoaded(e);
|
|
8
8
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
package/cjs/index.lazy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
2
2
|
export async function loadExternalCannonInteraction(engine) {
|
|
3
|
-
engine.checkVersion("4.
|
|
3
|
+
engine.checkVersion("4.4.0");
|
|
4
4
|
await engine.pluginManager.register(async (e) => {
|
|
5
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
package/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
3
3
|
import { Cannoner } from "./Cannoner.js";
|
|
4
4
|
export async function loadExternalCannonInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.
|
|
5
|
+
engine.checkVersion("4.4.0");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
ensureInteractivityPluginLoaded(e);
|
|
8
8
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
package/esm/index.lazy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
2
2
|
export async function loadExternalCannonInteraction(engine) {
|
|
3
|
-
engine.checkVersion("4.
|
|
3
|
+
engine.checkVersion("4.4.0");
|
|
4
4
|
await engine.pluginManager.register(async (e) => {
|
|
5
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-cannon",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "tsParticles cannon external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
"type": "module",
|
|
99
99
|
"peerDependencies": {
|
|
100
|
-
"@tsparticles/engine": "4.
|
|
101
|
-
"@tsparticles/plugin-interactivity": "4.
|
|
100
|
+
"@tsparticles/engine": "4.4.0",
|
|
101
|
+
"@tsparticles/plugin-interactivity": "4.4.0"
|
|
102
102
|
}
|
|
103
103
|
}
|
package/report.html
CHANGED
|
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
|
|
|
4930
4930
|
</script>
|
|
4931
4931
|
<script>
|
|
4932
4932
|
/*<!--*/
|
|
4933
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.interaction.external.cannon.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes/Cannon.js","uid":"
|
|
4933
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.interaction.external.cannon.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes/Cannon.js","uid":"c263ad25-1"},{"uid":"c263ad25-3","name":"Cannoner.js"},{"uid":"c263ad25-5","name":"index.js"},{"uid":"c263ad25-7","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"c263ad25-1":{"renderedLength":932,"gzipLength":0,"brotliLength":0,"metaUid":"c263ad25-0"},"c263ad25-3":{"renderedLength":6023,"gzipLength":0,"brotliLength":0,"metaUid":"c263ad25-2"},"c263ad25-5":{"renderedLength":393,"gzipLength":0,"brotliLength":0,"metaUid":"c263ad25-4"},"c263ad25-7":{"renderedLength":201,"gzipLength":0,"brotliLength":0,"metaUid":"c263ad25-6"}},"nodeMetas":{"c263ad25-0":{"id":"/dist/browser/Options/Classes/Cannon.js","moduleParts":{"tsparticles.interaction.external.cannon.js":"c263ad25-1"},"imported":[{"uid":"c263ad25-9"}],"importedBy":[{"uid":"c263ad25-4"},{"uid":"c263ad25-2"}]},"c263ad25-2":{"id":"/dist/browser/Cannoner.js","moduleParts":{"tsparticles.interaction.external.cannon.js":"c263ad25-3"},"imported":[{"uid":"c263ad25-8"},{"uid":"c263ad25-9"},{"uid":"c263ad25-0"}],"importedBy":[{"uid":"c263ad25-4"}]},"c263ad25-4":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.interaction.external.cannon.js":"c263ad25-5"},"imported":[{"uid":"c263ad25-8"},{"uid":"c263ad25-0"},{"uid":"c263ad25-2"}],"importedBy":[{"uid":"c263ad25-6"}]},"c263ad25-6":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.interaction.external.cannon.js":"c263ad25-7"},"imported":[{"uid":"c263ad25-4"}],"importedBy":[],"isEntry":true},"c263ad25-8":{"id":"@tsparticles/plugin-interactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"c263ad25-4"},{"uid":"c263ad25-2"}],"isExternal":true},"c263ad25-9":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"c263ad25-0"},{"uid":"c263ad25-2"}],"isExternal":true}},"env":{"rollup":"4.63.1"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
|
|
4934
4934
|
|
|
4935
4935
|
const run = () => {
|
|
4936
4936
|
const width = window.innerWidth;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
-
/* External Interaction v4.
|
|
2
|
+
/* External Interaction v4.4.0 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/plugin-interactivity'), require('@tsparticles/engine')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/plugin-interactivity', '@tsparticles/engine'], factory) :
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
async function loadExternalCannonInteraction(engine) {
|
|
155
|
-
engine.checkVersion("4.
|
|
155
|
+
engine.checkVersion("4.4.0");
|
|
156
156
|
await engine.pluginManager.register((e) => {
|
|
157
157
|
pluginInteractivity.ensureInteractivityPluginLoaded(e);
|
|
158
158
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
|
@@ -1 +1 @@
|
|
|
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 e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.interactions.externalCannon=t.__tsParticlesInternals.interactions.externalCannon||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";class a{drawVector=!0;maxDragDistance=0;maxParticles=200;minParticles=5;particleFactor=.2;spread=30;vectorColor="#ffffff80";velocityFactor=.5;load(t){t&&(s.loadProperty(this,"spread",t.spread),s.loadProperty(this,"velocityFactor",t.velocityFactor),s.loadProperty(this,"particleFactor",t.particleFactor),s.loadProperty(this,"minParticles",t.minParticles),s.loadProperty(this,"maxParticles",t.maxParticles),s.loadProperty(this,"maxDragDistance",t.maxDragDistance),s.loadProperty(this,"drawVector",t.drawVector),s.loadProperty(this,"vectorColor",t.vectorColor))}}var n;!function(t){t[t.idle=0]="idle",t[t.aiming=1]="aiming",t[t.fired=2]="fired"}(n||(n={}));const r="cannon",i=s.identity/20;class l extends e.ExternalInteractorBase{maxDistance=0;#t;#e={origin:s.Vector.origin,current:s.Vector.origin,active:!1};#s=void 0;#a=n.idle;constructor(t){super(t)}clear(t,e){}init(){const t=this.container.actualOptions.interactivity?.modes.cannon??new a;this.#t={spread:s.degToRad(t.spread),maxDragDistance:t.maxDragDistance,velocityFactor:t.velocityFactor,particleFactor:t.particleFactor,minParticles:t.minParticles,maxParticles:t.maxParticles,drawVector:t.drawVector,vectorColor:t.vectorColor}}interact(t,e){const s=t.mouse,a=s.position,r=s.clicking,i=s.downPosition;r&&i&&i!==this.#s&&this.#a===n.idle&&(this.#s=i,this.#e={origin:{x:i.x,y:i.y},current:{x:i.x,y:i.y},active:!0},this.#a=n.aiming),this.#a===n.aiming&&a&&(this.#e.current={x:a.x,y:a.y},this.#n()),r||this.#a!==n.aiming||(this.#e.active=!1,this.#r(),this.#a=n.idle)}isEnabled(t){const e=this.container,s=e.actualOptions.interactivity?.events;if(!s?.onClick.enable)return!1;const a=s.onClick.mode;return!!(Array.isArray(a)?a.includes(r):a===r)&&(this.#a!==n.idle||t.mouse.clicking)}loadModeOptions(t,...e){s.loadOptionProperty(t,"cannon",a,...e)}reset(t,e){}#n(){this.container.canvas.render.draw(t=>{const e=this.#t;if(!e)return;const{origin:a,current:n}=this.#e,r=this.container.retina.pixelRatio,l=s.getDistance(a,n),c=e.maxDragDistance>s.none?Math.min(l,e.maxDragDistance*r):l,o=l>0?c/l:0,_=a.x+(n.x-a.x)*o,P=a.y+(n.y-a.y)*o;t.save(),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.beginPath(),t.moveTo(a.x,a.y),t.lineTo(_,P),t.stroke();const d=Math.max(4,c*i)*r;t.beginPath(),t.arc(a.x,a.y,d,0,s.doublePI),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.stroke(),t.restore()})}#r(){const t=this.#t;if(!t)return;const{origin:e,current:a}=this.#e,n=this.container.retina.pixelRatio,r=s.getDistance(e,a),i=t.maxDragDistance>s.none?Math.min(r,t.maxDragDistance*n):r;if(i<2)return;const l=s.identity/n,c=(d=a.x,p=a.y,I=e.x,u=e.y,Math.atan2(u-p,I-d)),o=i*l*t.velocityFactor,_=Math.min(t.maxParticles,Math.max(t.minParticles,Math.round(i*t.particleFactor))),P=180/Math.PI;var d,p,I,u;for(let a=0;a<_;a++){const a=c+s.getRandomInRange(-t.spread,t.spread),n=s.getRandomInRange(.25*o,o);this.container.particles.addParticle(e,{move:{enable:!0,speed:n,direction:a*P}})}}}async function c(t){t.checkVersion("4.
|
|
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 e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.interactions.externalCannon=t.__tsParticlesInternals.interactions.externalCannon||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";class a{drawVector=!0;maxDragDistance=0;maxParticles=200;minParticles=5;particleFactor=.2;spread=30;vectorColor="#ffffff80";velocityFactor=.5;load(t){t&&(s.loadProperty(this,"spread",t.spread),s.loadProperty(this,"velocityFactor",t.velocityFactor),s.loadProperty(this,"particleFactor",t.particleFactor),s.loadProperty(this,"minParticles",t.minParticles),s.loadProperty(this,"maxParticles",t.maxParticles),s.loadProperty(this,"maxDragDistance",t.maxDragDistance),s.loadProperty(this,"drawVector",t.drawVector),s.loadProperty(this,"vectorColor",t.vectorColor))}}var n;!function(t){t[t.idle=0]="idle",t[t.aiming=1]="aiming",t[t.fired=2]="fired"}(n||(n={}));const r="cannon",i=s.identity/20;class l extends e.ExternalInteractorBase{maxDistance=0;#t;#e={origin:s.Vector.origin,current:s.Vector.origin,active:!1};#s=void 0;#a=n.idle;constructor(t){super(t)}clear(t,e){}init(){const t=this.container.actualOptions.interactivity?.modes.cannon??new a;this.#t={spread:s.degToRad(t.spread),maxDragDistance:t.maxDragDistance,velocityFactor:t.velocityFactor,particleFactor:t.particleFactor,minParticles:t.minParticles,maxParticles:t.maxParticles,drawVector:t.drawVector,vectorColor:t.vectorColor}}interact(t,e){const s=t.mouse,a=s.position,r=s.clicking,i=s.downPosition;r&&i&&i!==this.#s&&this.#a===n.idle&&(this.#s=i,this.#e={origin:{x:i.x,y:i.y},current:{x:i.x,y:i.y},active:!0},this.#a=n.aiming),this.#a===n.aiming&&a&&(this.#e.current={x:a.x,y:a.y},this.#n()),r||this.#a!==n.aiming||(this.#e.active=!1,this.#r(),this.#a=n.idle)}isEnabled(t){const e=this.container,s=e.actualOptions.interactivity?.events;if(!s?.onClick.enable)return!1;const a=s.onClick.mode;return!!(Array.isArray(a)?a.includes(r):a===r)&&(this.#a!==n.idle||t.mouse.clicking)}loadModeOptions(t,...e){s.loadOptionProperty(t,"cannon",a,...e)}reset(t,e){}#n(){this.container.canvas.render.draw(t=>{const e=this.#t;if(!e)return;const{origin:a,current:n}=this.#e,r=this.container.retina.pixelRatio,l=s.getDistance(a,n),c=e.maxDragDistance>s.none?Math.min(l,e.maxDragDistance*r):l,o=l>0?c/l:0,_=a.x+(n.x-a.x)*o,P=a.y+(n.y-a.y)*o;t.save(),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.beginPath(),t.moveTo(a.x,a.y),t.lineTo(_,P),t.stroke();const d=Math.max(4,c*i)*r;t.beginPath(),t.arc(a.x,a.y,d,0,s.doublePI),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.stroke(),t.restore()})}#r(){const t=this.#t;if(!t)return;const{origin:e,current:a}=this.#e,n=this.container.retina.pixelRatio,r=s.getDistance(e,a),i=t.maxDragDistance>s.none?Math.min(r,t.maxDragDistance*n):r;if(i<2)return;const l=s.identity/n,c=(d=a.x,p=a.y,I=e.x,u=e.y,Math.atan2(u-p,I-d)),o=i*l*t.velocityFactor,_=Math.min(t.maxParticles,Math.max(t.minParticles,Math.round(i*t.particleFactor))),P=180/Math.PI;var d,p,I,u;for(let a=0;a<_;a++){const a=c+s.getRandomInRange(-t.spread,t.spread),n=s.getRandomInRange(.25*o,o);this.container.particles.addParticle(e,{move:{enable:!0,speed:n,direction:a*P}})}}}async function c(t){t.checkVersion("4.4.0"),await t.pluginManager.register(t=>{e.ensureInteractivityPluginLoaded(t),t.pluginManager.addInteractor?.("externalCannon",t=>Promise.resolve(new l(t)))})}const o=globalThis;o.__tsParticlesInternals=o.__tsParticlesInternals??{},o.loadExternalCannonInteraction=c,t.Cannon=a,t.loadExternalCannonInteraction=c}),Object.assign(globalThis.window||globalThis,{loadExternalCannonInteraction:(globalThis.__tsParticlesInternals.interactions.externalCannon||{}).loadExternalCannonInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|