tsparticles-interaction-external-bounce
Advanced tools
Comparing version 2.10.1 to 2.11.0
import { Bouncer } from "./Bouncer"; | ||
export async function loadExternalBounceInteraction(engine) { | ||
await engine.addInteractor("externalBounce", (container) => new Bouncer(container)); | ||
export async function loadExternalBounceInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalBounce", (container) => new Bouncer(container), refresh); | ||
} | ||
export * from "./Options/Classes/Bounce"; | ||
export * from "./Options/Interfaces/IBounce"; |
@@ -19,4 +19,4 @@ "use strict"; | ||
const Bouncer_1 = require("./Bouncer"); | ||
async function loadExternalBounceInteraction(engine) { | ||
await engine.addInteractor("externalBounce", (container) => new Bouncer_1.Bouncer(container)); | ||
async function loadExternalBounceInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalBounce", (container) => new Bouncer_1.Bouncer(container), refresh); | ||
} | ||
@@ -23,0 +23,0 @@ exports.loadExternalBounceInteraction = loadExternalBounceInteraction; |
import { Bouncer } from "./Bouncer"; | ||
export async function loadExternalBounceInteraction(engine) { | ||
await engine.addInteractor("externalBounce", (container) => new Bouncer(container)); | ||
export async function loadExternalBounceInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalBounce", (container) => new Bouncer(container), refresh); | ||
} | ||
export * from "./Options/Classes/Bounce"; | ||
export * from "./Options/Interfaces/IBounce"; |
{ | ||
"name": "tsparticles-interaction-external-bounce", | ||
"version": "2.10.1", | ||
"version": "2.11.0", | ||
"description": "tsParticles bounce 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 | ||
loadExternalBounceInteraction(tsParticles); | ||
(async () => { | ||
await loadExternalBounceInteraction(tsParticles); | ||
tsParticles.load("tsparticles", { | ||
/* options */ | ||
}); | ||
await tsParticles.load({ | ||
id: "tsparticles", | ||
options: { | ||
/* options */ | ||
}, | ||
}); | ||
})(); | ||
``` | ||
@@ -58,3 +63,5 @@ | ||
loadExternalBounceInteraction(tsParticles); | ||
(async () => { | ||
await loadExternalBounceInteraction(tsParticles); | ||
})(); | ||
``` | ||
@@ -68,3 +75,5 @@ | ||
loadExternalBounceInteraction(tsParticles); | ||
(async () => { | ||
await loadExternalBounceInteraction(tsParticles); | ||
})(); | ||
``` |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v2.10.1 | ||
* v2.11.0 | ||
*/ | ||
@@ -211,4 +211,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
async function loadExternalBounceInteraction(engine) { | ||
await engine.addInteractor("externalBounce", container => new Bouncer(container)); | ||
async function loadExternalBounceInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalBounce", container => new Bouncer(container), refresh); | ||
} | ||
@@ -215,0 +215,0 @@ |
/*! For license information please see tsparticles.interaction.external.bounce.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 o="object"==typeof exports?t(require("tsparticles-engine")):t(e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(e=>(()=>{"use strict";var t={961:t=>{t.exports=e}},o={};function n(e){var i=o[e];if(void 0!==i)return i.exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{Bounce:()=>t,loadExternalBounceInteraction:()=>r});var e=n(961);class t{constructor(){this.distance=200}load(e){e&&void 0!==e.distance&&(this.distance=e.distance)}}class o extends e.ExternalInteractorBase{constructor(t){super(t),this._processBounce=(t,o,n)=>{const i=this.container.particles.quadTree.query(n,(e=>this.isEnabled(e)));for(const r of i)n instanceof e.Circle?(0,e.circleBounce)((0,e.circleBounceDataFromParticle)(r),{position:t,radius:o,mass:o**2*Math.PI/2,velocity:e.Vector.origin,factor:e.Vector.origin}):n instanceof e.Rectangle&&(0,e.rectBounce)(r,(0,e.calculateBounds)(t,o))},this._processMouseBounce=()=>{const t=this.container,o=10*t.retina.pixelRatio,n=t.interactivity.mouse.position,i=t.retina.bounceModeDistance;!i||i<0||!n||this._processBounce(n,i,new e.Circle(n.x,n.y,i+o))},this._singleSelectorBounce=(t,o)=>{const n=this.container,i=document.querySelectorAll(t);i.length&&i.forEach((t=>{const i=t,r=n.retina.pixelRatio,c={x:(i.offsetLeft+i.offsetWidth/2)*r,y:(i.offsetTop+i.offsetHeight/2)*r},s=i.offsetWidth/2*r,a=10*r,u="circle"===o.type?new e.Circle(c.x,c.y,s+a):new e.Rectangle(i.offsetLeft*r-a,i.offsetTop*r-a,i.offsetWidth*r+2*a,i.offsetHeight*r+2*a);this._processBounce(c,s,u)}))}}clear(){}init(){const e=this.container,t=e.actualOptions.interactivity.modes.bounce;t&&(e.retina.bounceModeDistance=t.distance*e.retina.pixelRatio)}async interact(){const t=this.container,o=t.actualOptions.interactivity.events,n=t.interactivity.status===e.mouseMoveEvent,i=o.onHover.enable,r=o.onHover.mode,c=o.onDiv;n&&i&&(0,e.isInArray)("bounce",r)?this._processMouseBounce():(0,e.divModeExecute)("bounce",c,((e,t)=>this._singleSelectorBounce(e,t)))}isEnabled(t){const o=this.container,n=o.actualOptions,i=o.interactivity.mouse,r=(t?.interactivity??n.interactivity).events,c=r.onDiv;return i.position&&r.onHover.enable&&(0,e.isInArray)("bounce",r.onHover.mode)||(0,e.isDivModeEnabled)("bounce",c)}loadModeOptions(e,...o){e.bounce||(e.bounce=new t);for(const t of o)e.bounce.load(t?.bounce)}reset(){}}async function r(e){await e.addInteractor("externalBounce",(e=>new o(e)))}})(),i})())); | ||
!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 n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(e=>(()=>{"use strict";var t={961:t=>{t.exports=e}},o={};function n(e){var i=o[e];if(void 0!==i)return i.exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{Bounce:()=>t,loadExternalBounceInteraction:()=>r});var e=n(961);class t{constructor(){this.distance=200}load(e){e&&void 0!==e.distance&&(this.distance=e.distance)}}class o extends e.ExternalInteractorBase{constructor(t){super(t),this._processBounce=(t,o,n)=>{const i=this.container.particles.quadTree.query(n,(e=>this.isEnabled(e)));for(const r of i)n instanceof e.Circle?(0,e.circleBounce)((0,e.circleBounceDataFromParticle)(r),{position:t,radius:o,mass:o**2*Math.PI/2,velocity:e.Vector.origin,factor:e.Vector.origin}):n instanceof e.Rectangle&&(0,e.rectBounce)(r,(0,e.calculateBounds)(t,o))},this._processMouseBounce=()=>{const t=this.container,o=10*t.retina.pixelRatio,n=t.interactivity.mouse.position,i=t.retina.bounceModeDistance;!i||i<0||!n||this._processBounce(n,i,new e.Circle(n.x,n.y,i+o))},this._singleSelectorBounce=(t,o)=>{const n=this.container,i=document.querySelectorAll(t);i.length&&i.forEach((t=>{const i=t,r=n.retina.pixelRatio,c={x:(i.offsetLeft+i.offsetWidth/2)*r,y:(i.offsetTop+i.offsetHeight/2)*r},s=i.offsetWidth/2*r,a=10*r,u="circle"===o.type?new e.Circle(c.x,c.y,s+a):new e.Rectangle(i.offsetLeft*r-a,i.offsetTop*r-a,i.offsetWidth*r+2*a,i.offsetHeight*r+2*a);this._processBounce(c,s,u)}))}}clear(){}init(){const e=this.container,t=e.actualOptions.interactivity.modes.bounce;t&&(e.retina.bounceModeDistance=t.distance*e.retina.pixelRatio)}async interact(){const t=this.container,o=t.actualOptions.interactivity.events,n=t.interactivity.status===e.mouseMoveEvent,i=o.onHover.enable,r=o.onHover.mode,c=o.onDiv;n&&i&&(0,e.isInArray)("bounce",r)?this._processMouseBounce():(0,e.divModeExecute)("bounce",c,((e,t)=>this._singleSelectorBounce(e,t)))}isEnabled(t){const o=this.container,n=o.actualOptions,i=o.interactivity.mouse,r=(t?.interactivity??n.interactivity).events,c=r.onDiv;return i.position&&r.onHover.enable&&(0,e.isInArray)("bounce",r.onHover.mode)||(0,e.isDivModeEnabled)("bounce",c)}loadModeOptions(e,...o){e.bounce||(e.bounce=new t);for(const t of o)e.bounce.load(t?.bounce)}reset(){}}async function r(e,t=!0){await e.addInteractor("externalBounce",(e=>new o(e)),t)}})(),i})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Bounce External Interaction v2.10.1 by Matteo Bruni */ | ||
/*! tsParticles Bounce External Interaction v2.11.0 by Matteo Bruni */ |
import type { Engine } from "tsparticles-engine"; | ||
export declare function loadExternalBounceInteraction(engine: Engine): Promise<void>; | ||
export declare function loadExternalBounceInteraction(engine: Engine, refresh?: boolean): Promise<void>; | ||
export * from "./Options/Classes/Bounce"; | ||
export * from "./Options/Interfaces/IBounce"; |
@@ -28,4 +28,4 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
const Bouncer_1 = require("./Bouncer"); | ||
async function loadExternalBounceInteraction(engine) { | ||
await engine.addInteractor("externalBounce", (container) => new Bouncer_1.Bouncer(container)); | ||
async function loadExternalBounceInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalBounce", (container) => new Bouncer_1.Bouncer(container), refresh); | ||
} | ||
@@ -32,0 +32,0 @@ exports.loadExternalBounceInteraction = loadExternalBounceInteraction; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
323866
77
Updatedtsparticles-engine@^2.11.0