@tsparticles/interaction-particles-collisions 4.0.0-beta.9 → 4.0.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/browser.js +5 -0
- package/browser/index.js +7 -9
- package/browser/index.lazy.js +15 -0
- package/cjs/browser.js +5 -0
- package/cjs/index.js +7 -9
- package/cjs/index.lazy.js +15 -0
- package/esm/browser.js +5 -0
- package/esm/index.js +7 -9
- package/esm/index.lazy.js +15 -0
- package/package.json +10 -3
- package/report.html +4949 -94
- package/tsparticles.interaction.particles.collisions.js +279 -347
- package/tsparticles.interaction.particles.collisions.min.js +1 -2
- package/types/Bounce.d.ts +1 -2
- package/types/browser.d.ts +1 -0
- package/types/index.lazy.d.ts +2 -0
- package/176.min.js +0 -1
- package/410.min.js +0 -1
- package/561.min.js +0 -1
- package/dist_browser_Collider_js.js +0 -110
- package/dist_browser_OverlapPluginInstance_js.js +0 -30
- package/dist_browser_OverlapPlugin_js.js +0 -30
|
@@ -1,2 +1 @@
|
|
|
1
|
-
!function(
|
|
2
|
-
(`+o+": "+n+")",a.name="ChunkLoadError",a.type=o,a.request=n,i[1](a)}},"chunk-"+e,e)}},i=(e,t)=>{var i,o,[n,a,c]=t,l=0;if(n.some(e=>0!==r[e])){for(i in a)s.o(a,i)&&(s.m[i]=a[i]);c&&c(s)}for(e&&e(t);l<n.length;l++)o=n[l],s.o(r,o)&&r[o]&&r[o][0](),r[o]=0},(o=this.webpackChunk_tsparticles_interaction_particles_collisions=this.webpackChunk_tsparticles_interaction_particles_collisions||[]).forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var g={};async function h(e){e.checkVersion("4.0.0-beta.9"),await e.pluginManager.register(async e=>{let[{ensureInteractivityPluginLoaded:t},{OverlapPlugin:r}]=await Promise.all([Promise.resolve().then(s.t.bind(s,702,19)),s.e(410).then(s.bind(s,410))]);t(e),e.pluginManager.addPlugin(new r),e.pluginManager.addInteractor?.("particlesCollisions",async e=>{let{Collider:t}=await s.e(176).then(s.bind(s,176));return new t(e)})})}return s.r(g),s.d(g,{loadParticlesCollisionsInteraction:()=>h}),g})());
|
|
1
|
+
!function(s){s.__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.bundles=s.__tsParticlesInternals.bundles||{},s.__tsParticlesInternals.effects=s.__tsParticlesInternals.effects||{},s.__tsParticlesInternals.engine=s.__tsParticlesInternals.engine||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.palettes=s.__tsParticlesInternals.palettes||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.emittersShapes=s.__tsParticlesInternals.plugins.emittersShapes||{},s.__tsParticlesInternals.presets=s.__tsParticlesInternals.presets||{},s.__tsParticlesInternals.shapes=s.__tsParticlesInternals.shapes||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.utils=s.__tsParticlesInternals.utils||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas.utils=s.__tsParticlesInternals.canvas.utils||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path.utils=s.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(s){return new Proxy(s,{get:function(s,t){return t in s||(s[t]={}),s[t]}})}:function(s){return s};s.__tsParticlesInternals.bundles=t(s.__tsParticlesInternals.bundles),s.__tsParticlesInternals.effects=t(s.__tsParticlesInternals.effects),s.__tsParticlesInternals.interactions=t(s.__tsParticlesInternals.interactions),s.__tsParticlesInternals.palettes=t(s.__tsParticlesInternals.palettes),s.__tsParticlesInternals.paths=t(s.__tsParticlesInternals.paths),s.__tsParticlesInternals.plugins=t(s.__tsParticlesInternals.plugins),s.__tsParticlesInternals.plugins.emittersShapes=t(s.__tsParticlesInternals.plugins.emittersShapes),s.__tsParticlesInternals.presets=t(s.__tsParticlesInternals.presets),s.__tsParticlesInternals.shapes=t(s.__tsParticlesInternals.shapes),s.__tsParticlesInternals.updaters=t(s.__tsParticlesInternals.updaters),s.__tsParticlesInternals.utils=t(s.__tsParticlesInternals.utils),s.__tsParticlesInternals.canvas=t(s.__tsParticlesInternals.canvas),s.__tsParticlesInternals.path=t(s.__tsParticlesInternals.path),s.tsparticlesInternalExports=s.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(s,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],t):t(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.interactions.particlesCollisions=s.__tsParticlesInternals.interactions.particlesCollisions||{}),s.__tsParticlesInternals.plugins.interactivity,s.__tsParticlesInternals.engine)}(this,function(s,t,e){"use strict";var n;!function(s){s.absorb="absorb",s.bounce="bounce",s.destroy="destroy"}(n||(n={}));class a{speed;constructor(){this.speed=2}load(s){e.isNull(s)||void 0!==s.speed&&(this.speed=s.speed)}}class i{enable;retries;constructor(){this.enable=!0,this.retries=0}load(s){e.isNull(s)||(void 0!==s.enable&&(this.enable=s.enable),void 0!==s.retries&&(this.retries=s.retries))}}class l{absorb;bounce;enable;maxSpeed;mode;overlap;constructor(){this.absorb=new a,this.bounce=new e.ParticlesBounce,this.enable=!1,this.maxSpeed=50,this.mode=n.bounce,this.overlap=new i}load(s){e.isNull(s)||(this.absorb.load(s.absorb),this.bounce.load(s.bounce),void 0!==s.enable&&(this.enable=s.enable),void 0!==s.maxSpeed&&(this.maxSpeed=e.setRangeValue(s.maxSpeed)),void 0!==s.mode&&(this.mode=s.mode),this.overlap.load(s.overlap))}}function r(s,t,n,a,i,l){if(!s.options.collisions||!n.options.collisions)return;const r=s.options.collisions.absorb.speed,o=e.clamp(r*i.factor,0,a);s.size.value=Math.sqrt(t*t+o*o),n.size.value-=o,n.size.value<=l&&(n.size.value=0,n.destroy())}const o=s=>{s.options.collisions&&(s.collisionMaxSpeed??=e.getRangeValue(s.options.collisions.maxSpeed),s.velocity.length>s.collisionMaxSpeed&&(s.velocity.length=s.collisionMaxSpeed))};function c(s,t){const n=s.getMass(),a=t.getMass(),i=s.velocity.length,l=t.velocity.length,r=n*i*i+a*l*l;e.circleBounce(e.circleBounceDataFromParticle(s),e.circleBounceDataFromParticle(t));const c=s.velocity.length,_=t.velocity.length,p=n*c*c+a*_*_;if(p>1e-6*r){const e=Math.sqrt(r/p);Math.abs(e-1)>1e-4&&(s.velocity.length=c*e,t.velocity.length=_*e)}o(s),o(t)}function _(s,t,e,a){if(s.options.collisions&&t.options.collisions)switch(s.options.collisions.mode){case n.absorb:!function(s,t,e,n){const a=s.getRadius(),i=t.getRadius();!a&&i?s.destroy():a&&!i?t.destroy():a&&i&&(a>=i?r(s,a,t,i,e,n):r(t,i,s,a,e,n))}(s,t,e,a);break;case n.bounce:c(s,t);break;case n.destroy:!function(s,t){s.unbreakable||t.unbreakable||c(s,t);const e=s.getRadius(),n=t.getRadius();!e&&n?s.destroy():e&&!n?t.destroy():e&&n&&(s.getRadius()>=t.getRadius()?t:s).destroy()}(s,t)}}class p extends t.ParticlesInteractorBase{maxDistance;constructor(s){super(s),this.maxDistance=0}clear(){}init(){}interact(s,t,n){if(s.destroyed||s.spawning)return;const a=this.container,i=s.getPosition(),l=s.getRadius(),r=a.particles.grid.queryCircle(i,l*e.double);for(const t of r){if(s===t||s.id>=t.id||!s.options.collisions?.enable||!t.options.collisions?.enable||s.options.collisions.mode!==t.options.collisions.mode||t.destroyed||t.spawning)continue;const r=t.getPosition(),o=t.getRadius();if(Math.abs(Math.round(i.z)-Math.round(r.z))>l+o)continue;e.getDistance(i,r)>l+o||_(s,t,n,a.retina.pixelRatio)}}isEnabled(s){return!!s.options.collisions?.enable}loadParticlesOptions(s,...t){s.collisions??=new l;for(const e of t)s.collisions.load(e?.collisions)}reset(){}}class u{id="overlap";async getPlugin(s){const{OverlapPluginInstance:t}=await Promise.resolve().then(function(){return I});return new t(s)}loadOptions(){}needsPlugin(){return!0}}async function d(s){s.checkVersion("4.0.0"),await s.pluginManager.register(s=>{t.ensureInteractivityPluginLoaded(s),s.pluginManager.addPlugin(new u),s.pluginManager.addInteractor?.("particlesCollisions",s=>Promise.resolve(new p(s)))})}const P=globalThis;P.__tsParticlesInternals=P.__tsParticlesInternals??{},P.loadParticlesCollisionsInteraction=d;var I=Object.freeze({__proto__:null,OverlapPluginInstance:class{_container;constructor(s){this._container=s}checkParticlePosition(s,t,e){return!this._hasOverlaps(s,t,e)}_hasOverlaps=(s,t,n)=>{const a=s.options.collisions;if(!a?.enable)return!1;const i=a.overlap;if(i.enable)return!1;const l=i.retries;if(l>=0&&n>l)throw new Error("Particle is overlapping and can't be placed");return!!this._container.particles.find(n=>e.getDistance(t,n.position)<s.getRadius()+n.getRadius())}}});s.loadParticlesCollisionsInteraction=d}),Object.assign(globalThis.window||globalThis,{loadParticlesCollisionsInteraction:(globalThis.__tsParticlesInternals.interactions.particlesCollisions||{}).loadParticlesCollisionsInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
package/types/Bounce.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type CollisionParticle } from "./Types.js";
|
|
2
|
-
type BounceParticle = CollisionParticle & {
|
|
2
|
+
export type BounceParticle = CollisionParticle & {
|
|
3
3
|
collisionMaxSpeed?: number;
|
|
4
4
|
};
|
|
5
5
|
export declare function bounce(p1: BounceParticle, p2: BounceParticle): void;
|
|
6
|
-
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.js";
|
package/176.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_interaction_particles_collisions=this.webpackChunk_tsparticles_interaction_particles_collisions||[]).push([[176],{176(e,s,o){o.d(s,{Collider:()=>p});var i,t,l=o(303),a=o(702);(i=t||(t={})).absorb="absorb",i.bounce="bounce",i.destroy="destroy";class n{speed;constructor(){this.speed=2}load(e){(0,l.isNull)(e)||void 0!==e.speed&&(this.speed=e.speed)}}class c{enable;retries;constructor(){this.enable=!0,this.retries=0}load(e){(0,l.isNull)(e)||(void 0!==e.enable&&(this.enable=e.enable),void 0!==e.retries&&(this.retries=e.retries))}}class r{absorb;bounce;enable;maxSpeed;mode;overlap;constructor(){this.absorb=new n,this.bounce=new l.ParticlesBounce,this.enable=!1,this.maxSpeed=50,this.mode=t.bounce,this.overlap=new c}load(e){(0,l.isNull)(e)||(this.absorb.load(e.absorb),this.bounce.load(e.bounce),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.maxSpeed&&(this.maxSpeed=(0,l.setRangeValue)(e.maxSpeed)),void 0!==e.mode&&(this.mode=e.mode),this.overlap.load(e.overlap))}}function d(e,s,o,i,t,a){if(!e.options.collisions||!o.options.collisions)return;let n=e.options.collisions.absorb.speed,c=(0,l.clamp)(n*t.factor,0,i);e.size.value=Math.sqrt(s*s+c*c),o.size.value-=c,o.size.value<=a&&(o.size.value=0,o.destroy())}let u=e=>{e.options.collisions&&(e.collisionMaxSpeed??=(0,l.getRangeValue)(e.options.collisions.maxSpeed),e.velocity.length>e.collisionMaxSpeed&&(e.velocity.length=e.collisionMaxSpeed))};function b(e,s){let o=e.getMass(),i=s.getMass(),t=e.velocity.length,a=s.velocity.length,n=o*t*t+i*a*a;(0,l.circleBounce)((0,l.circleBounceDataFromParticle)(e),(0,l.circleBounceDataFromParticle)(s));let c=e.velocity.length,r=s.velocity.length,d=o*c*c+i*r*r;if(d>1e-6*n){let o=Math.sqrt(n/d);Math.abs(o-1)>1e-4&&(e.velocity.length=c*o,s.velocity.length=r*o)}u(e),u(s)}class p extends a.ParticlesInteractorBase{maxDistance;constructor(e){super(e),this.maxDistance=0}clear(){}init(){}interact(e,s,o){if(e.destroyed||e.spawning)return;let i=this.container,a=e.getPosition(),n=e.getRadius();for(let s of i.particles.grid.queryCircle(a,n*l.double)){if(e===s||e.id>=s.id||!e.options.collisions?.enable||!s.options.collisions?.enable||e.options.collisions.mode!==s.options.collisions.mode||s.destroyed||s.spawning)continue;let c=s.getPosition(),r=s.getRadius();if(!(Math.abs(Math.round(a.z)-Math.round(c.z))>n+r))(0,l.getDistance)(a,c)>n+r||function(e,s,o,i){if(e.options.collisions&&s.options.collisions)switch(e.options.collisions.mode){case t.absorb:let l,a;l=e.getRadius(),a=s.getRadius(),!l&&a?e.destroy():l&&!a?s.destroy():l&&a&&(l>=a?d(e,l,s,a,o,i):d(s,a,e,l,o,i));break;case t.bounce:b(e,s);break;case t.destroy:let n,c;e.unbreakable||s.unbreakable||b(e,s),n=e.getRadius(),c=s.getRadius(),!n&&c?e.destroy():n&&!c?s.destroy():n&&c&&(e.getRadius()>=s.getRadius()?s:e).destroy()}}(e,s,o,i.retina.pixelRatio)}}isEnabled(e){return!!e.options.collisions?.enable}loadParticlesOptions(e,...s){for(let o of(e.collisions??=new r,s))e.collisions.load(o?.collisions)}reset(){}}}}]);
|
package/410.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_interaction_particles_collisions=this.webpackChunk_tsparticles_interaction_particles_collisions||[]).push([[410],{410(i,t,e){e.r(t),e.d(t,{OverlapPlugin:()=>s});class s{id="overlap";async getPlugin(i){let{OverlapPluginInstance:t}=await e.e(561).then(e.bind(e,561));return new t(i)}loadOptions(){}needsPlugin(){return!0}}}}]);
|
package/561.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_interaction_particles_collisions=this.webpackChunk_tsparticles_interaction_particles_collisions||[]).push([[561],{561(t,i,e){e.d(i,{OverlapPluginInstance:()=>r});var s=e(303);class r{_container;constructor(t){this._container=t}checkParticlePosition(t,i,e){return!this._hasOverlaps(t,i,e)}_hasOverlaps=(t,i,e)=>{let r=t.options.collisions;if(!r?.enable)return!1;let n=r.overlap;if(n.enable)return!1;let a=n.retries;if(a>=0&&e>a)throw Error("Particle is overlapping and can't be placed");return!!this._container.particles.find(e=>(0,s.getDistance)(i,e.position)<t.getRadius()+e.getRadius())}}}}]);
|
|
@@ -1,110 +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.9
|
|
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_particles_collisions"] = this["webpackChunk_tsparticles_interaction_particles_collisions"] || []).push([["dist_browser_Collider_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/Absorb.js"
|
|
21
|
-
/*!********************************!*\
|
|
22
|
-
!*** ./dist/browser/Absorb.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 */ absorb: () => (/* binding */ absorb)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst minAbsorbAmount = 0;\nfunction updateAbsorb(p1, r1, p2, r2, delta, pixelRatio) {\n if (!p1.options.collisions || !p2.options.collisions) {\n return;\n }\n const absorbSpeed = p1.options.collisions.absorb.speed, shrinkAmount = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(absorbSpeed * delta.factor, minAbsorbAmount, r2);\n p1.size.value = Math.sqrt(r1 * r1 + shrinkAmount * shrinkAmount);\n p2.size.value -= shrinkAmount;\n if (p2.size.value <= pixelRatio) {\n p2.size.value = 0;\n p2.destroy();\n }\n}\nfunction absorb(p1, p2, delta, pixelRatio) {\n const r1 = p1.getRadius(), r2 = p2.getRadius();\n if (!r1 && r2) {\n p1.destroy();\n } else if (r1 && !r2) {\n p2.destroy();\n } else if (r1 && r2) {\n if (r1 >= r2) {\n updateAbsorb(p1, r1, p2, r2, delta, pixelRatio);\n } else {\n updateAbsorb(p2, r2, p1, r1, delta, pixelRatio);\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/Absorb.js?\n}");
|
|
27
|
-
|
|
28
|
-
/***/ },
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/Bounce.js"
|
|
31
|
-
/*!********************************!*\
|
|
32
|
-
!*** ./dist/browser/Bounce.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 */ bounce: () => (/* binding */ bounce)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst energyCorrectionMinRatio = 1e-6, energyDriftThreshold = 1e-4, correctionFactorNeutral = 1, fixBounceSpeed = (p)=>{\n if (!p.options.collisions) {\n return;\n }\n p.collisionMaxSpeed ??= (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(p.options.collisions.maxSpeed);\n if (p.velocity.length > p.collisionMaxSpeed) {\n p.velocity.length = p.collisionMaxSpeed;\n }\n};\nfunction bounce(p1, p2) {\n const m1 = p1.getMass(), m2 = p2.getMass(), speed1Before = p1.velocity.length, speed2Before = p2.velocity.length, keBefore = m1 * speed1Before * speed1Before + m2 * speed2Before * speed2Before;\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.circleBounce)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.circleBounceDataFromParticle)(p1), (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.circleBounceDataFromParticle)(p2));\n const speed1After = p1.velocity.length, speed2After = p2.velocity.length, keAfter = m1 * speed1After * speed1After + m2 * speed2After * speed2After;\n if (keAfter > keBefore * energyCorrectionMinRatio) {\n const correctionFactor = Math.sqrt(keBefore / keAfter);\n if (Math.abs(correctionFactor - correctionFactorNeutral) > energyDriftThreshold) {\n p1.velocity.length = speed1After * correctionFactor;\n p2.velocity.length = speed2After * correctionFactor;\n }\n }\n fixBounceSpeed(p1);\n fixBounceSpeed(p2);\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/Bounce.js?\n}");
|
|
37
|
-
|
|
38
|
-
/***/ },
|
|
39
|
-
|
|
40
|
-
/***/ "./dist/browser/Collider.js"
|
|
41
|
-
/*!**********************************!*\
|
|
42
|
-
!*** ./dist/browser/Collider.js ***!
|
|
43
|
-
\**********************************/
|
|
44
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
45
|
-
|
|
46
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Collider: () => (/* binding */ Collider)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\");\n/* harmony import */ var _Options_Classes_Collisions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Collisions.js */ \"./dist/browser/Options/Classes/Collisions.js\");\n/* harmony import */ var _ResolveCollision_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ResolveCollision.js */ \"./dist/browser/ResolveCollision.js\");\n\n\n\n\nclass Collider extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_1__.ParticlesInteractorBase {\n maxDistance;\n constructor(container){\n super(container);\n this.maxDistance = 0;\n }\n clear() {}\n init() {}\n interact(p1, _interactivityData, delta) {\n if (p1.destroyed || p1.spawning) {\n return;\n }\n const container = this.container, pos1 = p1.getPosition(), radius1 = p1.getRadius(), query = container.particles.grid.queryCircle(pos1, radius1 * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double);\n for (const p2 of query){\n if (p1 === p2 || p1.id >= p2.id || !p1.options.collisions?.enable || !p2.options.collisions?.enable || p1.options.collisions.mode !== p2.options.collisions.mode || p2.destroyed || p2.spawning) {\n continue;\n }\n const pos2 = p2.getPosition(), radius2 = p2.getRadius();\n if (Math.abs(Math.round(pos1.z) - Math.round(pos2.z)) > radius1 + radius2) {\n continue;\n }\n const dist = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos1, pos2), distP = radius1 + radius2;\n if (dist > distP) {\n continue;\n }\n (0,_ResolveCollision_js__WEBPACK_IMPORTED_MODULE_3__.resolveCollision)(p1, p2, delta, container.retina.pixelRatio);\n }\n }\n isEnabled(particle) {\n return !!particle.options.collisions?.enable;\n }\n loadParticlesOptions(options, ...sources) {\n options.collisions ??= new _Options_Classes_Collisions_js__WEBPACK_IMPORTED_MODULE_2__.Collisions();\n for (const source of sources){\n options.collisions.load(source?.collisions);\n }\n }\n reset() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/Collider.js?\n}");
|
|
47
|
-
|
|
48
|
-
/***/ },
|
|
49
|
-
|
|
50
|
-
/***/ "./dist/browser/CollisionMode.js"
|
|
51
|
-
/*!***************************************!*\
|
|
52
|
-
!*** ./dist/browser/CollisionMode.js ***!
|
|
53
|
-
\***************************************/
|
|
54
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
55
|
-
|
|
56
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CollisionMode: () => (/* binding */ CollisionMode)\n/* harmony export */ });\nvar CollisionMode;\n(function(CollisionMode) {\n CollisionMode[\"absorb\"] = \"absorb\";\n CollisionMode[\"bounce\"] = \"bounce\";\n CollisionMode[\"destroy\"] = \"destroy\";\n})(CollisionMode || (CollisionMode = {}));\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/CollisionMode.js?\n}");
|
|
57
|
-
|
|
58
|
-
/***/ },
|
|
59
|
-
|
|
60
|
-
/***/ "./dist/browser/Destroy.js"
|
|
61
|
-
/*!*********************************!*\
|
|
62
|
-
!*** ./dist/browser/Destroy.js ***!
|
|
63
|
-
\*********************************/
|
|
64
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
65
|
-
|
|
66
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ destroy: () => (/* binding */ destroy)\n/* harmony export */ });\n/* harmony import */ var _Bounce_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Bounce.js */ \"./dist/browser/Bounce.js\");\n\nfunction destroy(p1, p2) {\n if (!p1.unbreakable && !p2.unbreakable) {\n (0,_Bounce_js__WEBPACK_IMPORTED_MODULE_0__.bounce)(p1, p2);\n }\n const p1Radius = p1.getRadius(), p2Radius = p2.getRadius();\n if (!p1Radius && p2Radius) {\n p1.destroy();\n } else if (p1Radius && !p2Radius) {\n p2.destroy();\n } else if (p1Radius && p2Radius) {\n const deleteP = p1.getRadius() >= p2.getRadius() ? p2 : p1;\n deleteP.destroy();\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/Destroy.js?\n}");
|
|
67
|
-
|
|
68
|
-
/***/ },
|
|
69
|
-
|
|
70
|
-
/***/ "./dist/browser/Options/Classes/Collisions.js"
|
|
71
|
-
/*!****************************************************!*\
|
|
72
|
-
!*** ./dist/browser/Options/Classes/Collisions.js ***!
|
|
73
|
-
\****************************************************/
|
|
74
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
75
|
-
|
|
76
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Collisions: () => (/* binding */ Collisions)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _CollisionMode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../CollisionMode.js */ \"./dist/browser/CollisionMode.js\");\n/* harmony import */ var _CollisionsAbsorb_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CollisionsAbsorb.js */ \"./dist/browser/Options/Classes/CollisionsAbsorb.js\");\n/* harmony import */ var _CollisionsOverlap_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CollisionsOverlap.js */ \"./dist/browser/Options/Classes/CollisionsOverlap.js\");\n\n\n\n\nclass Collisions {\n absorb;\n bounce;\n enable;\n maxSpeed;\n mode;\n overlap;\n constructor(){\n this.absorb = new _CollisionsAbsorb_js__WEBPACK_IMPORTED_MODULE_2__.CollisionsAbsorb();\n this.bounce = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ParticlesBounce();\n this.enable = false;\n this.maxSpeed = 50;\n this.mode = _CollisionMode_js__WEBPACK_IMPORTED_MODULE_1__.CollisionMode.bounce;\n this.overlap = new _CollisionsOverlap_js__WEBPACK_IMPORTED_MODULE_3__.CollisionsOverlap();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n this.absorb.load(data.absorb);\n this.bounce.load(data.bounce);\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.maxSpeed !== undefined) {\n this.maxSpeed = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.maxSpeed);\n }\n if (data.mode !== undefined) {\n this.mode = data.mode;\n }\n this.overlap.load(data.overlap);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/Options/Classes/Collisions.js?\n}");
|
|
77
|
-
|
|
78
|
-
/***/ },
|
|
79
|
-
|
|
80
|
-
/***/ "./dist/browser/Options/Classes/CollisionsAbsorb.js"
|
|
81
|
-
/*!**********************************************************!*\
|
|
82
|
-
!*** ./dist/browser/Options/Classes/CollisionsAbsorb.js ***!
|
|
83
|
-
\**********************************************************/
|
|
84
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
85
|
-
|
|
86
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CollisionsAbsorb: () => (/* binding */ CollisionsAbsorb)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass CollisionsAbsorb {\n speed;\n constructor(){\n this.speed = 2;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.speed !== undefined) {\n this.speed = data.speed;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/Options/Classes/CollisionsAbsorb.js?\n}");
|
|
87
|
-
|
|
88
|
-
/***/ },
|
|
89
|
-
|
|
90
|
-
/***/ "./dist/browser/Options/Classes/CollisionsOverlap.js"
|
|
91
|
-
/*!***********************************************************!*\
|
|
92
|
-
!*** ./dist/browser/Options/Classes/CollisionsOverlap.js ***!
|
|
93
|
-
\***********************************************************/
|
|
94
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
95
|
-
|
|
96
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CollisionsOverlap: () => (/* binding */ CollisionsOverlap)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass CollisionsOverlap {\n enable;\n retries;\n constructor(){\n this.enable = true;\n this.retries = 0;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.retries !== undefined) {\n this.retries = data.retries;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/Options/Classes/CollisionsOverlap.js?\n}");
|
|
97
|
-
|
|
98
|
-
/***/ },
|
|
99
|
-
|
|
100
|
-
/***/ "./dist/browser/ResolveCollision.js"
|
|
101
|
-
/*!******************************************!*\
|
|
102
|
-
!*** ./dist/browser/ResolveCollision.js ***!
|
|
103
|
-
\******************************************/
|
|
104
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
105
|
-
|
|
106
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ resolveCollision: () => (/* binding */ resolveCollision)\n/* harmony export */ });\n/* harmony import */ var _CollisionMode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CollisionMode.js */ \"./dist/browser/CollisionMode.js\");\n/* harmony import */ var _Absorb_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Absorb.js */ \"./dist/browser/Absorb.js\");\n/* harmony import */ var _Bounce_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Bounce.js */ \"./dist/browser/Bounce.js\");\n/* harmony import */ var _Destroy_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Destroy.js */ \"./dist/browser/Destroy.js\");\n\n\n\n\nfunction resolveCollision(p1, p2, delta, pixelRatio) {\n if (!p1.options.collisions || !p2.options.collisions) {\n return;\n }\n switch(p1.options.collisions.mode){\n case _CollisionMode_js__WEBPACK_IMPORTED_MODULE_0__.CollisionMode.absorb:\n {\n (0,_Absorb_js__WEBPACK_IMPORTED_MODULE_1__.absorb)(p1, p2, delta, pixelRatio);\n break;\n }\n case _CollisionMode_js__WEBPACK_IMPORTED_MODULE_0__.CollisionMode.bounce:\n {\n (0,_Bounce_js__WEBPACK_IMPORTED_MODULE_2__.bounce)(p1, p2);\n break;\n }\n case _CollisionMode_js__WEBPACK_IMPORTED_MODULE_0__.CollisionMode.destroy:\n {\n (0,_Destroy_js__WEBPACK_IMPORTED_MODULE_3__.destroy)(p1, p2);\n break;\n }\n default:\n break;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/ResolveCollision.js?\n}");
|
|
107
|
-
|
|
108
|
-
/***/ }
|
|
109
|
-
|
|
110
|
-
}]);
|
|
@@ -1,30 +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.9
|
|
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_particles_collisions"] = this["webpackChunk_tsparticles_interaction_particles_collisions"] || []).push([["dist_browser_OverlapPluginInstance_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/OverlapPluginInstance.js"
|
|
21
|
-
/*!***********************************************!*\
|
|
22
|
-
!*** ./dist/browser/OverlapPluginInstance.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 */ OverlapPluginInstance: () => (/* binding */ OverlapPluginInstance)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst minRetries = 0;\nclass OverlapPluginInstance {\n _container;\n constructor(container){\n this._container = container;\n }\n checkParticlePosition(particle, position, tryCount) {\n return !this._hasOverlaps(particle, position, tryCount);\n }\n _hasOverlaps = (particle, pos, tryCount)=>{\n const collisionsOptions = particle.options.collisions;\n if (!collisionsOptions?.enable) {\n return false;\n }\n const overlapOptions = collisionsOptions.overlap;\n if (overlapOptions.enable) {\n return false;\n }\n const retries = overlapOptions.retries;\n if (retries >= minRetries && tryCount > retries) {\n throw new Error(`Particle is overlapping and can't be placed`);\n }\n return !!this._container.particles.find((p)=>(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, p.position) < particle.getRadius() + p.getRadius());\n };\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/OverlapPluginInstance.js?\n}");
|
|
27
|
-
|
|
28
|
-
/***/ }
|
|
29
|
-
|
|
30
|
-
}]);
|
|
@@ -1,30 +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.9
|
|
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_particles_collisions"] = this["webpackChunk_tsparticles_interaction_particles_collisions"] || []).push([["dist_browser_OverlapPlugin_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/OverlapPlugin.js"
|
|
21
|
-
/*!***************************************!*\
|
|
22
|
-
!*** ./dist/browser/OverlapPlugin.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 */ OverlapPlugin: () => (/* binding */ OverlapPlugin)\n/* harmony export */ });\nclass OverlapPlugin {\n id = \"overlap\";\n async getPlugin(container) {\n const { OverlapPluginInstance } = await __webpack_require__.e(/*! import() */ \"dist_browser_OverlapPluginInstance_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./OverlapPluginInstance.js */ \"./dist/browser/OverlapPluginInstance.js\"));\n return new OverlapPluginInstance(container);\n }\n loadOptions() {}\n needsPlugin() {\n return true;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-collisions/./dist/browser/OverlapPlugin.js?\n}");
|
|
27
|
-
|
|
28
|
-
/***/ }
|
|
29
|
-
|
|
30
|
-
}]);
|