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

tsparticles-interaction-external-bubble

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 2.0.0-alpha.2 to 2.0.0-alpha.3

4

package.json
{
"name": "tsparticles-interaction-external-bubble",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "tsParticles Bubble external interaction",
"homepage": "https://particles.matteobruni.it/",
"homepage": "https://particles.js.org/",
"repository": {

@@ -7,0 +7,0 @@ "type": "git",

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

[![banner](https://cdn.matteobruni.it/images/particles/banner2.png)](https://particles.matteobruni.it)
[![banner](https://cdn.matteobruni.it/images/particles/banner2.png)](https://particles.js.org)

@@ -3,0 +3,0 @@ # tsparticles-shape-bubble

/*!
* Author : Matteo Bruni - https://www.matteobruni.it
* MIT license: https://opensource.org/licenses/MIT
* Demo / Generator : https://particles.matteobruni.it/
* Demo / Generator : https://particles.js.org/
* GitHub : https://www.github.com/matteobruni/tsparticles
* How to use? : Check the GitHub README
* v2.0.0-alpha.2
* v2.0.0-alpha.3
*/

@@ -9,0 +9,0 @@ (function webpackUniversalModuleDefinition(root, factory) {

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

/*! tsParticles Bubble External Interaction v2.0.0-alpha.2 by Matteo Bruni */
/*! tsParticles Bubble External Interaction v2.0.0-alpha.3 by Matteo Bruni */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("tsparticles-core"));else if("function"==typeof define&&define.amd)define(["tsparticles-core"],t);else{var i="object"==typeof exports?t(require("tsparticles-core")):t(e.window);for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(this,(function(e){return(()=>{"use strict";var t={269:(e,t,i)=>{i.r(t),i.d(t,{loadInteraction:()=>r});var o=i(646);const b=(e,t,i,b)=>{if(t>i){const n=e+(t-i)*b;return(0,o.clamp)(n,e,t)}if(t<i){const n=e-(i-t)*b;return(0,o.clamp)(n,t,e)}};class n extends o.ExternalInteractorBase{constructor(e){super(e,"bubble")}isEnabled(){const e=this.container,t=e.options,i=e.interactivity.mouse,b=t.interactivity.events,n=b.onDiv,r=(0,o.isDivModeEnabled)("bubble",n);if(!(r||b.onHover.enable&&i.position||b.onClick.enable&&i.clickPosition))return!1;const l=b.onHover.mode,s=b.onClick.mode;return(0,o.isInArray)("bubble",l)||(0,o.isInArray)("bubble",s)||r}reset(e,t){e.bubble.inRange&&!t||(delete e.bubble.div,delete e.bubble.opacity,delete e.bubble.radius,delete e.bubble.color)}interact(){const e=this.container.options.interactivity.events,t=e.onHover,i=e.onClick,b=t.enable,n=t.mode,r=i.enable,l=i.mode,s=e.onDiv;b&&(0,o.isInArray)("bubble",n)?this.hoverBubble():r&&(0,o.isInArray)("bubble",l)?this.clickBubble():(0,o.divModeExecute)("bubble",s,((e,t)=>this.singleSelectorHover(e,t)))}singleSelectorHover(e,t){const i=this.container,b=document.querySelectorAll(e);b.length&&b.forEach((e=>{const b=e,n=i.retina.pixelRatio,r={x:(b.offsetLeft+b.offsetWidth/2)*n,y:(b.offsetTop+b.offsetHeight/2)*n},l=b.offsetWidth/2*n,s="circle"===t.type?new o.Circle(r.x,r.y,l):new o.Rectangle(b.offsetLeft*n,b.offsetTop*n,b.offsetWidth*n,b.offsetHeight*n),a=i.particles.quadTree.query(s);for(const e of a){if(!s.contains(e.getPosition()))continue;e.bubble.inRange=!0;const t=i.options.interactivity.modes.bubble.divs,n=(0,o.divMode)(t,b);e.bubble.div&&e.bubble.div===b||(this.reset(e,!0),e.bubble.div=b),this.hoverBubbleSize(e,1,n),this.hoverBubbleOpacity(e,1,n),this.hoverBubbleColor(e,n)}}))}process(e,t,i,o){const b=this.container,n=o.bubbleObj.optValue;if(void 0===n)return;const r=b.options.interactivity.modes.bubble.duration,l=b.retina.bubbleModeDistance,s=o.particlesObj.optValue,a=o.bubbleObj.value,u=o.particlesObj.value||0,c=o.type;if(n!==s)if(b.bubble.durationEnd)a&&("size"===c&&delete e.bubble.radius,"opacity"===c&&delete e.bubble.opacity);else if(t<=l){if((null!=a?a:u)!==n){const t=u-i*(u-n)/r;"size"===c&&(e.bubble.radius=t),"opacity"===c&&(e.bubble.opacity=t)}}else"size"===c&&delete e.bubble.radius,"opacity"===c&&delete e.bubble.opacity}clickBubble(){const e=this.container,t=e.options,i=e.interactivity.mouse.clickPosition;if(void 0===i)return;const b=e.retina.bubbleModeDistance,n=e.particles.quadTree.queryCircle(i,b);for(const b of n){if(!e.bubble.clicking)continue;b.bubble.inRange=!e.bubble.durationEnd;const n=b.getPosition(),r=(0,o.getDistance)(n,i),l=((new Date).getTime()-(e.interactivity.mouse.clickTime||0))/1e3;l>t.interactivity.modes.bubble.duration&&(e.bubble.durationEnd=!0),l>2*t.interactivity.modes.bubble.duration&&(e.bubble.clicking=!1,e.bubble.durationEnd=!1);const s=b.options.size.value,a=("number"==typeof s?s:s.max)*e.retina.pixelRatio,u={bubbleObj:{optValue:e.retina.bubbleModeSize,value:b.bubble.radius},particlesObj:{optValue:a,value:b.size.value},type:"size"};this.process(b,r,l,u);const c=b.options.opacity.value,d=("number"==typeof c?c:c.max)*e.retina.pixelRatio,p={bubbleObj:{optValue:t.interactivity.modes.bubble.opacity,value:b.bubble.opacity},particlesObj:{optValue:d,value:b.opacity.value},type:"opacity"};this.process(b,r,l,p),e.bubble.durationEnd?delete b.bubble.color:r<=e.retina.bubbleModeDistance?this.hoverBubbleColor(b):delete b.bubble.color}}hoverBubble(){const e=this.container,t=e.interactivity.mouse.position;if(void 0===t)return;const i=e.retina.bubbleModeDistance,b=e.particles.quadTree.queryCircle(t,i);for(const n of b){n.bubble.inRange=!0;const b=n.getPosition(),r=(0,o.getDistance)(b,t),l=1-r/i;r<=i?l>=0&&e.interactivity.status===o.Constants.mouseMoveEvent&&(this.hoverBubbleSize(n,l),this.hoverBubbleOpacity(n,l),this.hoverBubbleColor(n)):this.reset(n),e.interactivity.status===o.Constants.mouseLeaveEvent&&this.reset(n)}}hoverBubbleSize(e,t,i){const o=this.container,n=(null==i?void 0:i.size)?i.size*o.retina.pixelRatio:o.retina.bubbleModeSize;if(void 0===n)return;const r=e.options.size.value,l=("number"==typeof r?r:r.max)*o.retina.pixelRatio,s=e.size.value,a=b(s,n,l,t);void 0!==a&&(e.bubble.radius=a)}hoverBubbleOpacity(e,t,i){var o;const n=this.container,r=n.options,l=null!==(o=null==i?void 0:i.opacity)&&void 0!==o?o:r.interactivity.modes.bubble.opacity;if(void 0===l)return;const s=e.options.opacity.value,a=("number"==typeof s?s:s.max)*n.retina.pixelRatio,u=e.opacity.value,c=b(u,l,a,t);void 0!==c&&(e.bubble.opacity=c)}hoverBubbleColor(e,t){var i;const b=this.container.options;if(void 0===e.bubble.color){const n=null!==(i=null==t?void 0:t.color)&&void 0!==i?i:b.interactivity.modes.bubble.color;if(void 0===n)return;const r=n instanceof Array?(0,o.itemFromArray)(n):n;e.bubble.color=(0,o.colorToHsl)(r)}}}function r(e){e.addInteractor((e=>new n(e)))}r(o.tsParticles)},646:t=>{t.exports=e}},i={};function o(e){if(i[e])return i[e].exports;var b=i[e]={exports:{}};return t[e](b,b.exports,o),b.exports}return o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},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})},o(269)})()}));

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