@tsparticles/interaction-particles-attract 3.0.0-beta.3 → 3.0.0-beta.5
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/AttractParticle.js +1 -0
- package/browser/Attractor.js +6 -2
- package/cjs/AttractParticle.js +2 -0
- package/cjs/Attractor.js +5 -1
- package/esm/AttractParticle.js +1 -0
- package/esm/Attractor.js +6 -2
- package/package.json +3 -3
- package/report.html +4 -22
- package/tsparticles.interaction.particles.attract.js +6 -3
- package/tsparticles.interaction.particles.attract.min.js +1 -1
- package/tsparticles.interaction.particles.attract.min.js.LICENSE.txt +1 -1
- package/types/AttractParticle.d.ts +4 -0
- package/types/Attractor.d.ts +3 -2
- package/umd/AttractParticle.js +12 -0
- package/umd/Attractor.js +5 -1
|
@@ -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-beta.
|
|
7
|
+
* v3.0.0-beta.5
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -105,8 +105,11 @@ class Attractor extends engine_root_window_.ParticlesInteractorBase {
|
|
|
105
105
|
clear() {}
|
|
106
106
|
init() {}
|
|
107
107
|
async interact(p1) {
|
|
108
|
-
const container = this.container
|
|
109
|
-
|
|
108
|
+
const container = this.container;
|
|
109
|
+
if (p1.attractDistance === undefined) {
|
|
110
|
+
p1.attractDistance = (0,engine_root_window_.getRangeValue)(p1.options.move.attract.distance) * container.retina.pixelRatio;
|
|
111
|
+
}
|
|
112
|
+
const distance = p1.attractDistance,
|
|
110
113
|
pos1 = p1.getPosition(),
|
|
111
114
|
query = container.particles.quadTree.queryCircle(pos1, distance);
|
|
112
115
|
for (const p2 of query) {
|
|
@@ -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
|
|
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 o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function r(e){var a=o[e];if(void 0!==a)return a.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{r.r(a),r.d(a,{loadParticlesAttractInteraction:()=>o});var e=r(533);class t extends e.ParticlesInteractorBase{constructor(e){super(e)}clear(){}init(){}async interact(t){const o=this.container;void 0===t.attractDistance&&(t.attractDistance=(0,e.getRangeValue)(t.options.move.attract.distance)*o.retina.pixelRatio);const r=t.attractDistance,a=t.getPosition(),n=o.particles.quadTree.queryCircle(a,r);for(const o of n){if(t===o||!o.options.move.attract.enable||o.destroyed||o.spawning)continue;const r=o.getPosition(),{dx:n,dy:i}=(0,e.getDistances)(a,r),s=t.options.move.attract.rotate,c=n/(1e3*s.x),l=i/(1e3*s.y),p=o.size.value/t.size.value,d=1/p;t.velocity.x-=c*p,t.velocity.y-=l*p,o.velocity.x+=c*d,o.velocity.y+=l*d}}isEnabled(e){return e.options.move.attract.enable}reset(){}}async function o(e,o=!0){await e.addInteractor("particlesAttract",(e=>new t(e)),o)}})(),a})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Attract Particles Interaction v3.0.0-beta.
|
|
1
|
+
/*! tsParticles Attract Particles Interaction v3.0.0-beta.5 by Matteo Bruni */
|
package/types/Attractor.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type Container, type Particle, ParticlesInteractorBase } from "@tsparticles/engine";
|
|
2
|
-
|
|
2
|
+
import type { AttractParticle } from "./AttractParticle.js";
|
|
3
|
+
export declare class Attractor extends ParticlesInteractorBase<Container, AttractParticle> {
|
|
3
4
|
constructor(container: Container);
|
|
4
5
|
clear(): void;
|
|
5
6
|
init(): void;
|
|
6
|
-
interact(p1:
|
|
7
|
+
interact(p1: AttractParticle): Promise<void>;
|
|
7
8
|
isEnabled(particle: Particle): boolean;
|
|
8
9
|
reset(): void;
|
|
9
10
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
package/umd/Attractor.js
CHANGED
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
init() {
|
|
21
21
|
}
|
|
22
22
|
async interact(p1) {
|
|
23
|
-
const container = this.container
|
|
23
|
+
const container = this.container;
|
|
24
|
+
if (p1.attractDistance === undefined) {
|
|
25
|
+
p1.attractDistance = (0, engine_1.getRangeValue)(p1.options.move.attract.distance) * container.retina.pixelRatio;
|
|
26
|
+
}
|
|
27
|
+
const distance = p1.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
|
|
24
28
|
for (const p2 of query) {
|
|
25
29
|
if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {
|
|
26
30
|
continue;
|