Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tsparticles-interaction-external-attract

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsparticles-interaction-external-attract - npm Package Compare versions

Comparing version 2.10.1 to 2.11.0

4

browser/index.js
import { Attractor } from "./Attractor";
export async function loadExternalAttractInteraction(engine) {
await engine.addInteractor("externalAttract", (container) => new Attractor(engine, container));
export async function loadExternalAttractInteraction(engine, refresh = true) {
await engine.addInteractor("externalAttract", (container) => new Attractor(engine, container), refresh);
}
export * from "./Options/Classes/Attract";
export * from "./Options/Interfaces/IAttract";

@@ -19,4 +19,4 @@ "use strict";

const Attractor_1 = require("./Attractor");
async function loadExternalAttractInteraction(engine) {
await engine.addInteractor("externalAttract", (container) => new Attractor_1.Attractor(engine, container));
async function loadExternalAttractInteraction(engine, refresh = true) {
await engine.addInteractor("externalAttract", (container) => new Attractor_1.Attractor(engine, container), refresh);
}

@@ -23,0 +23,0 @@ exports.loadExternalAttractInteraction = loadExternalAttractInteraction;

import { Attractor } from "./Attractor";
export async function loadExternalAttractInteraction(engine) {
await engine.addInteractor("externalAttract", (container) => new Attractor(engine, container));
export async function loadExternalAttractInteraction(engine, refresh = true) {
await engine.addInteractor("externalAttract", (container) => new Attractor(engine, container), refresh);
}
export * from "./Options/Classes/Attract";
export * from "./Options/Interfaces/IAttract";
{
"name": "tsparticles-interaction-external-attract",
"version": "2.10.1",
"version": "2.11.0",
"description": "tsParticles attract external interaction",

@@ -76,5 +76,6 @@ "homepage": "https://particles.js.org",

"types": "types/index.d.ts",
"sideEffects": false,
"dependencies": {
"tsparticles-engine": "^2.10.1"
"tsparticles-engine": "^2.11.0"
}
}

@@ -30,7 +30,12 @@ [![banner](https://particles.js.org/images/banner2.png)](https://particles.js.org)

```javascript
loadExternalAttractInteraction(tsParticles);
(async () => {
await loadExternalAttractInteraction(tsParticles);
tsParticles.load("tsparticles", {
/* options */
});
await tsParticles.load({
id: "tsparticles",
options: {
/* options */
},
});
})();
```

@@ -58,3 +63,5 @@

loadExternalAttractInteraction(tsParticles);
(async () => {
await loadExternalAttractInteraction(tsParticles);
})();
```

@@ -68,3 +75,5 @@

loadExternalAttractInteraction(tsParticles);
(async () => {
await loadExternalAttractInteraction(tsParticles);
})();
```

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v2.10.1
* v2.11.0
*/

@@ -288,4 +288,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

async function loadExternalAttractInteraction(engine) {
await engine.addInteractor("externalAttract", container => new Attractor(engine, container));
async function loadExternalAttractInteraction(engine, refresh = true) {
await engine.addInteractor("externalAttract", container => new Attractor(engine, container), refresh);
}

@@ -292,0 +292,0 @@

/*! For license information please see tsparticles.interaction.external.attract.min.js.LICENSE.txt */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],e);else{var i="object"==typeof exports?e(require("tsparticles-engine")):e(t.window);for(var a in i)("object"==typeof exports?exports:t)[a]=i[a]}}(this,(t=>(()=>{"use strict";var e={961:e=>{e.exports=t}},i={};function a(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,a),n.exports}a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{a.r(r),a.d(r,{Attract:()=>e,loadExternalAttractInteraction:()=>n});var t=a(961);class e{constructor(){this.distance=200,this.duration=.4,this.easing="ease-out-quad",this.factor=1,this.maxSpeed=50,this.speed=1}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),void 0!==t.duration&&(this.duration=t.duration),void 0!==t.easing&&(this.easing=t.easing),void 0!==t.factor&&(this.factor=t.factor),void 0!==t.maxSpeed&&(this.maxSpeed=t.maxSpeed),void 0!==t.speed&&(this.speed=t.speed))}}class i extends t.ExternalInteractorBase{constructor(e,i){super(i),this._clickAttract=()=>{const e=this.container;e.attract||(e.attract={particles:[]});const{attract:i}=e;if(i.finish||(i.count||(i.count=0),i.count++,i.count===e.particles.count&&(i.finish=!0)),i.clicking){const i=e.interactivity.mouse.clickPosition,a=e.retina.attractModeDistance;if(!a||a<0||!i)return;this._processAttract(i,a,new t.Circle(i.x,i.y,a))}else!1===i.clicking&&(i.particles=[])},this._hoverAttract=()=>{const e=this.container,i=e.interactivity.mouse.position,a=e.retina.attractModeDistance;!a||a<0||!i||this._processAttract(i,a,new t.Circle(i.x,i.y,a))},this._processAttract=(e,i,a)=>{const r=this.container,n=r.actualOptions.interactivity.modes.attract;if(!n)return;const c=r.particles.quadTree.query(a,(t=>this.isEnabled(t)));for(const a of c){const{dx:r,dy:c,distance:o}=(0,t.getDistances)(a.position,e),s=n.speed*n.factor,d=(0,t.clamp)((0,t.getEasing)(n.easing)(1-o/i)*s,0,n.maxSpeed),l=t.Vector.create(0===o?s:r/o*d,0===o?s:c/o*d);a.position.subFrom(l)}},this._engine=e,i.attract||(i.attract={particles:[]}),this.handleClickMode=t=>{const e=this.container.actualOptions.interactivity.modes.attract;if(e&&"attract"===t){i.attract||(i.attract={particles:[]}),i.attract.clicking=!0,i.attract.count=0;for(const t of i.attract.particles)this.isEnabled(t)&&t.velocity.setTo(t.initialVelocity);i.attract.particles=[],i.attract.finish=!1,setTimeout((()=>{i.destroyed||(i.attract||(i.attract={particles:[]}),i.attract.clicking=!1)}),1e3*e.duration)}}}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.attract;e&&(t.retina.attractModeDistance=e.distance*t.retina.pixelRatio)}async interact(){const e=this.container,i=e.actualOptions,a=e.interactivity.status===t.mouseMoveEvent,r=i.interactivity.events,n=r.onHover.enable,c=r.onHover.mode,o=r.onClick.enable,s=r.onClick.mode;a&&n&&(0,t.isInArray)("attract",c)?this._hoverAttract():o&&(0,t.isInArray)("attract",s)&&this._clickAttract()}isEnabled(e){const i=this.container,a=i.actualOptions,r=i.interactivity.mouse,n=(e?.interactivity??a.interactivity).events;if(!(r.position&&n.onHover.enable||r.clickPosition&&n.onClick.enable))return!1;const c=n.onHover.mode,o=n.onClick.mode;return(0,t.isInArray)("attract",c)||(0,t.isInArray)("attract",o)}loadModeOptions(t,...i){t.attract||(t.attract=new e);for(const e of i)t.attract.load(e?.attract)}reset(){}}async function n(t){await t.addInteractor("externalAttract",(e=>new i(t,e)))}})(),r})()));
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],e);else{var i="object"==typeof exports?e(require("tsparticles-engine")):e(t.window);for(var a in i)("object"==typeof exports?exports:t)[a]=i[a]}}(this,(t=>(()=>{"use strict";var e={961:e=>{e.exports=t}},i={};function a(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,a),n.exports}a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{a.r(r),a.d(r,{Attract:()=>e,loadExternalAttractInteraction:()=>n});var t=a(961);class e{constructor(){this.distance=200,this.duration=.4,this.easing="ease-out-quad",this.factor=1,this.maxSpeed=50,this.speed=1}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),void 0!==t.duration&&(this.duration=t.duration),void 0!==t.easing&&(this.easing=t.easing),void 0!==t.factor&&(this.factor=t.factor),void 0!==t.maxSpeed&&(this.maxSpeed=t.maxSpeed),void 0!==t.speed&&(this.speed=t.speed))}}class i extends t.ExternalInteractorBase{constructor(e,i){super(i),this._clickAttract=()=>{const e=this.container;e.attract||(e.attract={particles:[]});const{attract:i}=e;if(i.finish||(i.count||(i.count=0),i.count++,i.count===e.particles.count&&(i.finish=!0)),i.clicking){const i=e.interactivity.mouse.clickPosition,a=e.retina.attractModeDistance;if(!a||a<0||!i)return;this._processAttract(i,a,new t.Circle(i.x,i.y,a))}else!1===i.clicking&&(i.particles=[])},this._hoverAttract=()=>{const e=this.container,i=e.interactivity.mouse.position,a=e.retina.attractModeDistance;!a||a<0||!i||this._processAttract(i,a,new t.Circle(i.x,i.y,a))},this._processAttract=(e,i,a)=>{const r=this.container,n=r.actualOptions.interactivity.modes.attract;if(!n)return;const c=r.particles.quadTree.query(a,(t=>this.isEnabled(t)));for(const a of c){const{dx:r,dy:c,distance:o}=(0,t.getDistances)(a.position,e),s=n.speed*n.factor,d=(0,t.clamp)((0,t.getEasing)(n.easing)(1-o/i)*s,0,n.maxSpeed),l=t.Vector.create(0===o?s:r/o*d,0===o?s:c/o*d);a.position.subFrom(l)}},this._engine=e,i.attract||(i.attract={particles:[]}),this.handleClickMode=t=>{const e=this.container.actualOptions.interactivity.modes.attract;if(e&&"attract"===t){i.attract||(i.attract={particles:[]}),i.attract.clicking=!0,i.attract.count=0;for(const t of i.attract.particles)this.isEnabled(t)&&t.velocity.setTo(t.initialVelocity);i.attract.particles=[],i.attract.finish=!1,setTimeout((()=>{i.destroyed||(i.attract||(i.attract={particles:[]}),i.attract.clicking=!1)}),1e3*e.duration)}}}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.attract;e&&(t.retina.attractModeDistance=e.distance*t.retina.pixelRatio)}async interact(){const e=this.container,i=e.actualOptions,a=e.interactivity.status===t.mouseMoveEvent,r=i.interactivity.events,n=r.onHover.enable,c=r.onHover.mode,o=r.onClick.enable,s=r.onClick.mode;a&&n&&(0,t.isInArray)("attract",c)?this._hoverAttract():o&&(0,t.isInArray)("attract",s)&&this._clickAttract()}isEnabled(e){const i=this.container,a=i.actualOptions,r=i.interactivity.mouse,n=(e?.interactivity??a.interactivity).events;if(!(r.position&&n.onHover.enable||r.clickPosition&&n.onClick.enable))return!1;const c=n.onHover.mode,o=n.onClick.mode;return(0,t.isInArray)("attract",c)||(0,t.isInArray)("attract",o)}loadModeOptions(t,...i){t.attract||(t.attract=new e);for(const e of i)t.attract.load(e?.attract)}reset(){}}async function n(t,e=!0){await t.addInteractor("externalAttract",(e=>new i(t,e)),e)}})(),r})()));

@@ -1,1 +0,1 @@

/*! tsParticles Attract External Interaction v2.10.1 by Matteo Bruni */
/*! tsParticles Attract External Interaction v2.11.0 by Matteo Bruni */
import type { Engine } from "tsparticles-engine";
export declare function loadExternalAttractInteraction(engine: Engine): Promise<void>;
export declare function loadExternalAttractInteraction(engine: Engine, refresh?: boolean): Promise<void>;
export * from "./Options/Classes/Attract";
export * from "./Options/Interfaces/IAttract";

@@ -28,4 +28,4 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

const Attractor_1 = require("./Attractor");
async function loadExternalAttractInteraction(engine) {
await engine.addInteractor("externalAttract", (container) => new Attractor_1.Attractor(engine, container));
async function loadExternalAttractInteraction(engine, refresh = true) {
await engine.addInteractor("externalAttract", (container) => new Attractor_1.Attractor(engine, container), refresh);
}

@@ -32,0 +32,0 @@ exports.loadExternalAttractInteraction = loadExternalAttractInteraction;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc