@tsparticles/interaction-particles-repulse 3.0.0-alpha.1 → 3.0.0-beta.1
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/Options/Classes/ParticlesRepulse.js +1 -1
- package/browser/Repulser.js +4 -5
- package/browser/index.js +3 -3
- package/browser/package.json +1 -0
- package/cjs/Repulser.js +33 -45
- package/cjs/index.js +3 -3
- package/cjs/package.json +1 -0
- package/esm/Options/Classes/ParticlesRepulse.js +1 -1
- package/esm/Repulser.js +4 -5
- package/esm/index.js +3 -3
- package/esm/package.json +1 -0
- package/package.json +23 -6
- package/report.html +4 -4
- package/tsparticles.interaction.particles.repulse.js +6 -7
- package/tsparticles.interaction.particles.repulse.min.js +1 -1
- package/tsparticles.interaction.particles.repulse.min.js.LICENSE.txt +1 -8
- package/types/Options/Classes/ParticlesRepulse.d.ts +2 -3
- package/types/Repulser.d.ts +2 -3
- package/types/Types.d.ts +2 -2
- package/types/index.d.ts +1 -1
- package/umd/Repulser.js +5 -6
- package/umd/index.js +4 -4
|
@@ -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.1
|
|
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
|
+
loadParticlesRepulseInteraction: () => (/* binding */ loadParticlesRepulseInteraction)
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
@@ -175,23 +175,22 @@ class Repulser extends engine_root_window_.ParticlesInteractorBase {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
isEnabled(particle) {
|
|
178
|
-
|
|
179
|
-
return (_b = (_a = particle.options.repulse) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : false;
|
|
178
|
+
return particle.options.repulse?.enabled ?? false;
|
|
180
179
|
}
|
|
181
180
|
loadParticlesOptions(options, ...sources) {
|
|
182
181
|
if (!options.repulse) {
|
|
183
182
|
options.repulse = new ParticlesRepulse();
|
|
184
183
|
}
|
|
185
184
|
for (const source of sources) {
|
|
186
|
-
options.repulse.load(source
|
|
185
|
+
options.repulse.load(source?.repulse);
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
reset() {}
|
|
190
189
|
}
|
|
191
190
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
192
191
|
|
|
193
|
-
function loadParticlesRepulseInteraction(engine) {
|
|
194
|
-
engine.addInteractor("particlesRepulse", container => new Repulser(container));
|
|
192
|
+
async function loadParticlesRepulseInteraction(engine, refresh = true) {
|
|
193
|
+
await engine.addInteractor("particlesRepulse", container => new Repulser(container), refresh);
|
|
195
194
|
}
|
|
196
195
|
})();
|
|
197
196
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.particles.repulse.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 o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(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 s in o)("object"==typeof exports?exports:e)[s]=o[s]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function s(e){var r=o[e];if(void 0!==r)return r.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,s),n.exports}s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{s.r(r),s.d(r,{loadParticlesRepulseInteraction:()=>n});var e=s(533);class t extends e.ValueWithRandom{constructor(){super(),this.enabled=!1,this.distance=1,this.duration=1,this.factor=1,this.speed=1}load(t){super.load(t),t&&(void 0!==t.enabled&&(this.enabled=t.enabled),void 0!==t.distance&&(this.distance=(0,e.setRangeValue)(t.distance)),void 0!==t.duration&&(this.duration=(0,e.setRangeValue)(t.duration)),void 0!==t.factor&&(this.factor=(0,e.setRangeValue)(t.factor)),void 0!==t.speed&&(this.speed=(0,e.setRangeValue)(t.speed)))}}class o extends e.ParticlesInteractorBase{constructor(e){super(e)}clear(){}init(){}async interact(t){const o=this.container;if(!t.repulse){const s=t.options.repulse;if(!s)return;t.repulse={distance:(0,e.getRangeValue)(s.distance)*o.retina.pixelRatio,speed:(0,e.getRangeValue)(s.speed),factor:(0,e.getRangeValue)(s.factor)}}const s=t.getPosition(),r=o.particles.quadTree.queryCircle(s,t.repulse.distance);for(const o of r){if(t===o||o.destroyed)continue;const r=o.getPosition(),{dx:n,dy:a,distance:i}=(0,e.getDistances)(r,s),c=t.repulse.speed*t.repulse.factor;if(i>0){const s=(0,e.clamp)((1-Math.pow(i/t.repulse.distance,2))*c,0,c),r=e.Vector.create(n/i*s,a/i*s);o.position.addTo(r)}else{const t=e.Vector.create(c,c);o.position.addTo(t)}}}isEnabled(e){return e.options.repulse?.enabled??!1}loadParticlesOptions(e,...o){e.repulse||(e.repulse=new t);for(const t of o)e.repulse.load(t?.repulse)}reset(){}}async function n(e,t=!0){await e.addInteractor("particlesRepulse",(e=>new o(e)),t)}})(),r})()));
|
|
@@ -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.1
|
|
8
|
-
*/
|
|
1
|
+
/*! tsParticles Repulse Particles Interaction v3.0.0-beta.1 by Matteo Bruni */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import type { IParticlesRepulse } from "../Interfaces/IParticlesRepulse";
|
|
1
|
+
import { type IOptionLoader, type RangeValue, type RecursivePartial, ValueWithRandom } from "@tsparticles/engine";
|
|
2
|
+
import type { IParticlesRepulse } from "../Interfaces/IParticlesRepulse.js";
|
|
4
3
|
export declare class ParticlesRepulse extends ValueWithRandom implements IParticlesRepulse, IOptionLoader<IParticlesRepulse> {
|
|
5
4
|
distance: RangeValue;
|
|
6
5
|
duration: RangeValue;
|
package/types/Repulser.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { IRepulseParticlesOptions, RepulseParticlesOptions } from "./Types";
|
|
3
|
-
import { ParticlesInteractorBase } from "@tsparticles/engine";
|
|
1
|
+
import { type Container, type Particle, ParticlesInteractorBase, type RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { IRepulseParticlesOptions, RepulseParticlesOptions } from "./Types.js";
|
|
4
3
|
type RepulseParticle = Particle & {
|
|
5
4
|
options: RepulseParticlesOptions;
|
|
6
5
|
repulse?: {
|
package/types/Types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IParticlesOptions, ParticlesOptions } from "@tsparticles/engine";
|
|
2
|
-
import type { IParticlesRepulse } from "./Options/Interfaces/IParticlesRepulse";
|
|
3
|
-
import type { ParticlesRepulse } from "./Options/Classes/ParticlesRepulse";
|
|
2
|
+
import type { IParticlesRepulse } from "./Options/Interfaces/IParticlesRepulse.js";
|
|
3
|
+
import type { ParticlesRepulse } from "./Options/Classes/ParticlesRepulse.js";
|
|
4
4
|
export type RepulseParticlesOptions = ParticlesOptions & {
|
|
5
5
|
repulse?: ParticlesRepulse;
|
|
6
6
|
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadParticlesRepulseInteraction(engine: Engine): void
|
|
2
|
+
export declare function loadParticlesRepulseInteraction(engine: Engine, refresh?: boolean): Promise<void>;
|
package/umd/Repulser.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/ParticlesRepulse"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/ParticlesRepulse.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Repulser = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const
|
|
14
|
+
const ParticlesRepulse_js_1 = require("./Options/Classes/ParticlesRepulse.js");
|
|
15
15
|
class Repulser extends engine_1.ParticlesInteractorBase {
|
|
16
16
|
constructor(container) {
|
|
17
17
|
super(container);
|
|
@@ -53,15 +53,14 @@
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
isEnabled(particle) {
|
|
56
|
-
|
|
57
|
-
return (_b = (_a = particle.options.repulse) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : false;
|
|
56
|
+
return particle.options.repulse?.enabled ?? false;
|
|
58
57
|
}
|
|
59
58
|
loadParticlesOptions(options, ...sources) {
|
|
60
59
|
if (!options.repulse) {
|
|
61
|
-
options.repulse = new
|
|
60
|
+
options.repulse = new ParticlesRepulse_js_1.ParticlesRepulse();
|
|
62
61
|
}
|
|
63
62
|
for (const source of sources) {
|
|
64
|
-
options.repulse.load(source
|
|
63
|
+
options.repulse.load(source?.repulse);
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
reset() {
|
package/umd/index.js
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./Repulser"], factory);
|
|
7
|
+
define(["require", "exports", "./Repulser.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.loadParticlesRepulseInteraction = void 0;
|
|
13
|
-
const
|
|
14
|
-
function loadParticlesRepulseInteraction(engine) {
|
|
15
|
-
engine.addInteractor("particlesRepulse", (container) => new
|
|
13
|
+
const Repulser_js_1 = require("./Repulser.js");
|
|
14
|
+
async function loadParticlesRepulseInteraction(engine, refresh = true) {
|
|
15
|
+
await engine.addInteractor("particlesRepulse", (container) => new Repulser_js_1.Repulser(container), refresh);
|
|
16
16
|
}
|
|
17
17
|
exports.loadParticlesRepulseInteraction = loadParticlesRepulseInteraction;
|
|
18
18
|
});
|