@tsparticles/interaction-external-bounce 4.0.0-beta.0 → 4.0.0-beta.2
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/{520.min.js → 624.min.js} +1 -1
- package/browser/index.js +4 -3
- package/cjs/index.js +4 -3
- package/dist_browser_Bouncer_js.js +1 -1
- package/esm/index.js +4 -3
- package/package.json +10 -7
- package/report.html +84 -29
- package/tsparticles.interaction.external.bounce.js +2 -2
- package/tsparticles.interaction.external.bounce.min.js +2 -2
- package/umd/Bouncer.js +0 -69
- package/umd/IRectSideResult.js +0 -12
- package/umd/Options/Classes/Bounce.js +0 -29
- package/umd/Options/Classes/BounceOptions.js +0 -12
- package/umd/Options/Interfaces/IBounce.js +0 -12
- package/umd/Types.js +0 -12
- package/umd/Utils.js +0 -137
- package/umd/index.js +0 -62
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_interaction_external_bounce=this.webpackChunk_tsparticles_interaction_external_bounce||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_interaction_external_bounce=this.webpackChunk_tsparticles_interaction_external_bounce||[]).push([[624],{624(e,t,i){i.d(t,{Bouncer:()=>u});var o=i(702),n=i(303);let a=Math.PI*n.half;function c(e,t,i,o,c){for(let l of e.particles.grid.query(o,c))o instanceof n.Circle?(0,n.circleBounce)((0,n.circleBounceDataFromParticle)(l),{position:t,radius:i,mass:i**2*a,velocity:n.Vector.origin,factor:n.Vector.origin}):o instanceof n.Rectangle&&function(e,t){let i=e.getPosition(),o=e.getRadius(),a=(0,n.calculateBounds)(i,o),c=e.options.bounce,l=r({pSide:{min:a.left,max:a.right},pOtherSide:{min:a.top,max:a.bottom},rectSide:{min:t.left,max:t.right},rectOtherSide:{min:t.top,max:t.bottom},velocity:e.velocity.x,factor:(0,n.getRangeValue)(c.horizontal.value)});l.bounced&&(void 0!==l.velocity&&(e.velocity.x=l.velocity),void 0!==l.position&&(e.position.x=l.position));let s=r({pSide:{min:a.top,max:a.bottom},pOtherSide:{min:a.left,max:a.right},rectSide:{min:t.top,max:t.bottom},rectOtherSide:{min:t.left,max:t.right},velocity:e.velocity.y,factor:(0,n.getRangeValue)(c.vertical.value)});s.bounced&&(void 0!==s.velocity&&(e.velocity.y=s.velocity),void 0!==s.position&&(e.position.y=s.position))}(l,(0,n.calculateBounds)(t,i))}function r(e){let t={bounced:!1},{pSide:i,pOtherSide:o,rectSide:a,rectOtherSide:c,velocity:r,factor:l}=e;return o.min<c.min||o.min>c.max||o.max<c.min||o.max>c.max||(i.max>=a.min&&i.max<=(a.max+a.min)*n.half&&r>0||i.min<=a.max&&i.min>(a.max+a.min)*n.half&&r<0)&&(t.velocity=-(r*l),t.bounced=!0),t}var l=i(701);let s="bounce";class u extends o.ExternalInteractorBase{_maxDistance;constructor(e){super(e),this._maxDistance=0}get maxDistance(){return this._maxDistance}clear(){}init(){let e=this.container,t=e.actualOptions.interactivity?.modes.bounce;t&&(this._maxDistance=t.distance,e.retina.bounceModeDistance=t.distance*e.retina.pixelRatio)}interact(e){var t,i,a,r;let l=this.container.actualOptions,u=l.interactivity?.events,m=e.status===o.mouseMoveEvent;if(!u)return;let f=u.onHover.enable,d=u.onHover.mode,v=u.onDiv;if(m&&f&&(0,n.isInArray)(s,d)){let o,a,r;t=this.container,i=t=>this.isEnabled(e,t),o=t.retina.pixelRatio,a=e.mouse.position,(r=t.retina.bounceModeDistance)&&!(r<0)&&a&&c(t,a,r,new n.Circle(a.x,a.y,r+10*o),i)}else a=this.container,r=t=>this.isEnabled(e,t),(0,o.divModeExecute)(s,v,(e,t)=>{let i;(i=(0,n.safeDocument)().querySelectorAll(e)).length&&i.forEach(e=>{let i=a.retina.pixelRatio,l={x:(e.offsetLeft+e.offsetWidth*n.half)*i,y:(e.offsetTop+e.offsetHeight*n.half)*i},s=e.offsetWidth*n.half*i,u=10*i,m=t.type===o.DivType.circle?new n.Circle(l.x,l.y,s+u):new n.Rectangle(e.offsetLeft*i-u,e.offsetTop*i-u,e.offsetWidth*i+u*n.double,e.offsetHeight*i+u*n.double);((e,t,i)=>{c(a,e,t,i,r)})(l,s,m)})})}isEnabled(e,t){let i=this.container.actualOptions,a=e.mouse,c=(t?.interactivity??i.interactivity)?.events;if(!c)return!1;let r=c.onDiv;return!!a.position&&c.onHover.enable&&(0,n.isInArray)(s,c.onHover.mode)||(0,o.isDivModeEnabled)(s,r)}loadModeOptions(e,...t){for(let i of(e.bounce??=new l.b,t))e.bounce.load(i?.bounce)}reset(){}}}}]);
|
package/browser/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import {} from "@tsparticles/engine";
|
|
1
2
|
export async function loadExternalBounceInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(async (e) => {
|
|
3
|
+
engine.checkVersion("4.0.0-beta.2");
|
|
4
|
+
await engine.pluginManager.register(async (e) => {
|
|
4
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
|
|
5
6
|
ensureInteractivityPluginLoaded(e);
|
|
6
|
-
e.addInteractor?.("externalBounce", async (container) => {
|
|
7
|
+
e.pluginManager.addInteractor?.("externalBounce", async (container) => {
|
|
7
8
|
const { Bouncer } = await import("./Bouncer.js");
|
|
8
9
|
return new Bouncer(container);
|
|
9
10
|
});
|
package/cjs/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import {} from "@tsparticles/engine";
|
|
1
2
|
export async function loadExternalBounceInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(async (e) => {
|
|
3
|
+
engine.checkVersion("4.0.0-beta.2");
|
|
4
|
+
await engine.pluginManager.register(async (e) => {
|
|
4
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
|
|
5
6
|
ensureInteractivityPluginLoaded(e);
|
|
6
|
-
e.addInteractor?.("externalBounce", async (container) => {
|
|
7
|
+
e.pluginManager.addInteractor?.("externalBounce", async (container) => {
|
|
7
8
|
const { Bouncer } = await import("./Bouncer.js");
|
|
8
9
|
return new Bouncer(container);
|
|
9
10
|
});
|
package/esm/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import {} from "@tsparticles/engine";
|
|
1
2
|
export async function loadExternalBounceInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(async (e) => {
|
|
3
|
+
engine.checkVersion("4.0.0-beta.2");
|
|
4
|
+
await engine.pluginManager.register(async (e) => {
|
|
4
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
|
|
5
6
|
ensureInteractivityPluginLoaded(e);
|
|
6
|
-
e.addInteractor?.("externalBounce", async (container) => {
|
|
7
|
+
e.pluginManager.addInteractor?.("externalBounce", async (container) => {
|
|
7
8
|
const { Bouncer } = await import("./Bouncer.js");
|
|
8
9
|
return new Bouncer(container);
|
|
9
10
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-bounce",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.2",
|
|
4
4
|
"description": "tsParticles bounce external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -81,17 +81,20 @@
|
|
|
81
81
|
"browser": "./browser/index.js",
|
|
82
82
|
"import": "./esm/index.js",
|
|
83
83
|
"require": "./cjs/index.js",
|
|
84
|
-
"
|
|
85
|
-
"default": "./cjs/index.js"
|
|
84
|
+
"default": "./esm/index.js"
|
|
86
85
|
},
|
|
87
86
|
"./package.json": "./package.json"
|
|
88
87
|
},
|
|
89
|
-
"
|
|
90
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
91
|
-
"@tsparticles/plugin-interactivity": "4.0.0-beta.
|
|
88
|
+
"peerDepdendencies": {
|
|
89
|
+
"@tsparticles/engine": "4.0.0-beta.1",
|
|
90
|
+
"@tsparticles/plugin-interactivity": "4.0.0-beta.1"
|
|
92
91
|
},
|
|
93
92
|
"publishConfig": {
|
|
94
93
|
"access": "public"
|
|
95
94
|
},
|
|
96
|
-
"type": "module"
|
|
95
|
+
"type": "module",
|
|
96
|
+
"peerDependencies": {
|
|
97
|
+
"@tsparticles/engine": "4.0.0-beta.1",
|
|
98
|
+
"@tsparticles/plugin-interactivity": "4.0.0-beta.1"
|
|
99
|
+
}
|
|
97
100
|
}
|