@tsparticles/interaction-particles-attract 3.0.0-alpha.0 → 3.0.0-beta.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/README.md +25 -19
- package/browser/Attractor.js +2 -3
- package/browser/index.js +2 -2
- package/cjs/Attractor.js +11 -23
- package/cjs/index.js +2 -13
- package/esm/Attractor.js +2 -3
- package/esm/index.js +2 -2
- package/package.json +6 -5
- package/report.html +4 -4
- package/tsparticles.interaction.particles.attract.js +5 -6
- package/tsparticles.interaction.particles.attract.min.js +1 -1
- package/tsparticles.interaction.particles.attract.min.js.LICENSE.txt +1 -8
- package/types/Attractor.d.ts +1 -2
- package/types/index.d.ts +1 -1
- package/umd/Attractor.js +1 -2
- package/umd/index.js +2 -2
|
@@ -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
|
-
* v3.0.0-
|
|
7
|
+
* v3.0.0-beta.0
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -91,7 +91,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
91
91
|
|
|
92
92
|
// EXPORTS
|
|
93
93
|
__webpack_require__.d(__webpack_exports__, {
|
|
94
|
-
|
|
94
|
+
loadParticlesAttractInteraction: () => (/* binding */ loadParticlesAttractInteraction)
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
@@ -105,9 +105,8 @@ class Attractor extends engine_root_window_.ParticlesInteractorBase {
|
|
|
105
105
|
clear() {}
|
|
106
106
|
init() {}
|
|
107
107
|
async interact(p1) {
|
|
108
|
-
var _a;
|
|
109
108
|
const container = this.container,
|
|
110
|
-
distance =
|
|
109
|
+
distance = p1.retina.attractDistance ?? container.retina.attractDistance,
|
|
111
110
|
pos1 = p1.getPosition(),
|
|
112
111
|
query = container.particles.quadTree.queryCircle(pos1, distance);
|
|
113
112
|
for (const p2 of query) {
|
|
@@ -137,8 +136,8 @@ class Attractor extends engine_root_window_.ParticlesInteractorBase {
|
|
|
137
136
|
}
|
|
138
137
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
139
138
|
|
|
140
|
-
async function loadParticlesAttractInteraction(engine) {
|
|
141
|
-
await engine.addInteractor("particlesAttract", container => new Attractor(container));
|
|
139
|
+
async function loadParticlesAttractInteraction(engine, refresh = true) {
|
|
140
|
+
await engine.addInteractor("particlesAttract", container => new Attractor(container), refresh);
|
|
142
141
|
}
|
|
143
142
|
})();
|
|
144
143
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.particles.attract.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},r={};function o(e){var n=r[e];if(void 0!==n)return n.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{loadParticlesAttractInteraction:()=>r});var e=o(533);class t extends e.ParticlesInteractorBase{constructor(e){super(e)}clear(){}init(){}async interact(t){
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},r={};function o(e){var n=r[e];if(void 0!==n)return n.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{loadParticlesAttractInteraction:()=>r});var e=o(533);class t extends e.ParticlesInteractorBase{constructor(e){super(e)}clear(){}init(){}async interact(t){const r=this.container,o=t.retina.attractDistance??r.retina.attractDistance,n=t.getPosition(),i=r.particles.quadTree.queryCircle(n,o);for(const r of i){if(t===r||!r.options.move.attract.enable||r.destroyed||r.spawning)continue;const o=r.getPosition(),{dx:i,dy:a}=(0,e.getDistances)(n,o),s=t.options.move.attract.rotate,c=i/(1e3*s.x),l=a/(1e3*s.y),p=r.size.value/t.size.value,d=1/p;t.velocity.x-=c*p,t.velocity.y-=l*p,r.velocity.x+=c*d,r.velocity.y+=l*d}}isEnabled(e){return e.options.move.attract.enable}reset(){}}async function r(e,r=!0){await e.addInteractor("particlesAttract",(e=>new t(e)),r)}})(),n})()));
|
|
@@ -1,8 +1 @@
|
|
|
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
|
-
* v3.0.0-alpha.0
|
|
8
|
-
*/
|
|
1
|
+
/*! tsParticles Attract Particles Interaction v3.0.0-beta.0 by Matteo Bruni */
|
package/types/Attractor.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { ParticlesInteractorBase } from "@tsparticles/engine";
|
|
1
|
+
import { type Container, type IParticle, type Particle, ParticlesInteractorBase } from "@tsparticles/engine";
|
|
3
2
|
export declare class Attractor extends ParticlesInteractorBase {
|
|
4
3
|
constructor(container: Container);
|
|
5
4
|
clear(): void;
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadParticlesAttractInteraction(engine: Engine): Promise<void>;
|
|
2
|
+
export declare function loadParticlesAttractInteraction(engine: Engine, refresh?: boolean): Promise<void>;
|
package/umd/Attractor.js
CHANGED
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
init() {
|
|
21
21
|
}
|
|
22
22
|
async interact(p1) {
|
|
23
|
-
|
|
24
|
-
const container = this.container, distance = (_a = p1.retina.attractDistance) !== null && _a !== void 0 ? _a : container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
|
|
23
|
+
const container = this.container, distance = p1.retina.attractDistance ?? container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
|
|
25
24
|
for (const p2 of query) {
|
|
26
25
|
if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {
|
|
27
26
|
continue;
|
package/umd/index.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.loadParticlesAttractInteraction = void 0;
|
|
13
13
|
const Attractor_1 = require("./Attractor");
|
|
14
|
-
async function loadParticlesAttractInteraction(engine) {
|
|
15
|
-
await engine.addInteractor("particlesAttract", (container) => new Attractor_1.Attractor(container));
|
|
14
|
+
async function loadParticlesAttractInteraction(engine, refresh = true) {
|
|
15
|
+
await engine.addInteractor("particlesAttract", (container) => new Attractor_1.Attractor(container), refresh);
|
|
16
16
|
}
|
|
17
17
|
exports.loadParticlesAttractInteraction = loadParticlesAttractInteraction;
|
|
18
18
|
});
|