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

@tsparticles/interaction-particles-attract

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/interaction-particles-attract - npm Package Compare versions

Comparing version 3.0.0-beta.3 to 3.0.0-beta.4

browser/AttractParticle.js

8

browser/Attractor.js

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

import { ParticlesInteractorBase, getDistances } from "@tsparticles/engine";
import { ParticlesInteractorBase, getDistances, getRangeValue, } from "@tsparticles/engine";
export class Attractor extends ParticlesInteractorBase {

@@ -11,3 +11,7 @@ constructor(container) {

async interact(p1) {
const container = this.container, distance = p1.retina.attractDistance ?? container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
const container = this.container;
if (p1.attractDistance === undefined) {
p1.attractDistance = getRangeValue(p1.options.move.attract.distance) * container.retina.pixelRatio;
}
const distance = p1.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
for (const p2 of query) {

@@ -14,0 +18,0 @@ if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {

@@ -14,3 +14,7 @@ "use strict";

async interact(p1) {
const container = this.container, distance = p1.retina.attractDistance ?? container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
const container = this.container;
if (p1.attractDistance === undefined) {
p1.attractDistance = (0, engine_1.getRangeValue)(p1.options.move.attract.distance) * container.retina.pixelRatio;
}
const distance = p1.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
for (const p2 of query) {

@@ -17,0 +21,0 @@ if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {

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

import { ParticlesInteractorBase, getDistances } from "@tsparticles/engine";
import { ParticlesInteractorBase, getDistances, getRangeValue, } from "@tsparticles/engine";
export class Attractor extends ParticlesInteractorBase {

@@ -11,3 +11,7 @@ constructor(container) {

async interact(p1) {
const container = this.container, distance = p1.retina.attractDistance ?? container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
const container = this.container;
if (p1.attractDistance === undefined) {
p1.attractDistance = getRangeValue(p1.options.move.attract.distance) * container.retina.pixelRatio;
}
const distance = p1.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
for (const p2 of query) {

@@ -14,0 +18,0 @@ if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {

{
"name": "@tsparticles/interaction-particles-attract",
"version": "3.0.0-beta.3",
"version": "3.0.0-beta.4",
"description": "tsParticles attract particles interaction",

@@ -63,3 +63,3 @@ "homepage": "https://particles.js.org",

"canvas-confetti",
"@tsparticles/plugin",
"tsparticles-plugin",
"@tsparticles/interaction"

@@ -91,3 +91,3 @@ ],

"dependencies": {
"@tsparticles/engine": "^3.0.0-beta.3"
"@tsparticles/engine": "^3.0.0-beta.4"
},

@@ -94,0 +94,0 @@ "publishConfig": {

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

* How to use? : Check the GitHub README
* v3.0.0-beta.3
* v3.0.0-beta.4
*/

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

async interact(p1) {
const container = this.container,
distance = p1.retina.attractDistance ?? container.retina.attractDistance,
const container = this.container;
if (p1.attractDistance === undefined) {
p1.attractDistance = (0,engine_root_window_.getRangeValue)(p1.options.move.attract.distance) * container.retina.pixelRatio;
}
const distance = p1.attractDistance,
pos1 = p1.getPosition(),

@@ -113,0 +116,0 @@ query = container.particles.quadTree.queryCircle(pos1, distance);

/*! For license information please see tsparticles.interaction.particles.attract.min.js.LICENSE.txt */
!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})()));
!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 +0,1 @@

/*! tsParticles Attract Particles Interaction v3.0.0-beta.3 by Matteo Bruni */
/*! tsParticles Attract Particles Interaction v3.0.0-beta.4 by Matteo Bruni */
import { type Container, type Particle, ParticlesInteractorBase } from "@tsparticles/engine";
export declare class Attractor extends ParticlesInteractorBase {
import type { AttractParticle } from "./AttractParticle.js";
export declare class Attractor extends ParticlesInteractorBase<Container, AttractParticle> {
constructor(container: Container);
clear(): void;
init(): void;
interact(p1: Particle): Promise<void>;
interact(p1: AttractParticle): Promise<void>;
isEnabled(particle: Particle): boolean;
reset(): void;
}

@@ -23,3 +23,7 @@ (function (factory) {

async interact(p1) {
const container = this.container, distance = p1.retina.attractDistance ?? container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
const container = this.container;
if (p1.attractDistance === undefined) {
p1.attractDistance = (0, engine_1.getRangeValue)(p1.options.move.attract.distance) * container.retina.pixelRatio;
}
const distance = p1.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
for (const p2 of query) {

@@ -26,0 +30,0 @@ if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {

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