@tsparticles/updater-out-modes 3.3.0 → 3.4.0
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/browser/BounceOutMode.js +3 -3
- package/browser/DestroyOutMode.js +5 -5
- package/browser/NoneOutMode.js +6 -6
- package/browser/OutOfCanvasUpdater.js +9 -8
- package/browser/OutOutMode.js +9 -9
- package/browser/Utils.js +19 -19
- package/browser/index.js +3 -3
- package/cjs/BounceOutMode.js +2 -2
- package/cjs/DestroyOutMode.js +4 -4
- package/cjs/NoneOutMode.js +5 -5
- package/cjs/OutOfCanvasUpdater.js +9 -8
- package/cjs/OutOutMode.js +8 -8
- package/cjs/Utils.js +18 -18
- package/cjs/index.js +3 -3
- package/esm/BounceOutMode.js +3 -3
- package/esm/DestroyOutMode.js +5 -5
- package/esm/NoneOutMode.js +6 -6
- package/esm/OutOfCanvasUpdater.js +9 -8
- package/esm/OutOutMode.js +9 -9
- package/esm/Utils.js +19 -19
- package/esm/index.js +3 -3
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.updater.out-modes.js +62 -200
- package/tsparticles.updater.out-modes.min.js +1 -1
- package/tsparticles.updater.out-modes.min.js.LICENSE.txt +1 -1
- package/umd/BounceOutMode.js +2 -2
- package/umd/DestroyOutMode.js +4 -4
- package/umd/NoneOutMode.js +5 -5
- package/umd/OutOfCanvasUpdater.js +10 -9
- package/umd/OutOutMode.js +8 -8
- package/umd/Utils.js +18 -18
- package/umd/index.js +4 -28
- package/128.min.js +0 -2
- package/128.min.js.LICENSE.txt +0 -1
- package/dist_browser_OutOfCanvasUpdater_js.js +0 -80
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.updater.out-modes.min.js.LICENSE.txt */
|
|
2
|
-
!function(e
|
|
2
|
+
!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 o="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}}(this,(t=>(()=>{var e={303:e=>{e.exports=t}},o={};function i(t){var n=o[t];if(void 0!==n)return n.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,i),s.exports}i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{i.r(n),i.d(n,{loadOutModesUpdater:()=>d});var t=i(303);class e{constructor(e){this.container=e,this.modes=[t.OutMode.bounce,t.OutMode.split]}update(e,o,i,n){if(!this.modes.includes(n))return;const s=this.container;let r=!1;for(const[,t]of s.plugins)if(void 0!==t.particleBounce&&(r=t.particleBounce(e,i,o)),r)break;if(r)return;const a=e.getPosition(),c=e.offset,d=e.getRadius(),u=(0,t.calculateBounds)(a,d),p=s.canvas.size;!function(e){if(e.outMode!==t.OutMode.bounce&&e.outMode!==t.OutMode.split||e.direction!==t.OutModeDirection.left&&e.direction!==t.OutModeDirection.right)return;e.bounds.right<0&&e.direction===t.OutModeDirection.left?e.particle.position.x=e.size+e.offset.x:e.bounds.left>e.canvasSize.width&&e.direction===t.OutModeDirection.right&&(e.particle.position.x=e.canvasSize.width-e.size-e.offset.x);const o=e.particle.velocity.x;let i=!1;if(e.direction===t.OutModeDirection.right&&e.bounds.right>=e.canvasSize.width&&o>0||e.direction===t.OutModeDirection.left&&e.bounds.left<=0&&o<0){const o=(0,t.getRangeValue)(e.particle.options.bounce.horizontal.value);e.particle.velocity.x*=-o,i=!0}if(!i)return;const n=e.offset.x+e.size;e.bounds.right>=e.canvasSize.width&&e.direction===t.OutModeDirection.right?e.particle.position.x=e.canvasSize.width-n:e.bounds.left<=0&&e.direction===t.OutModeDirection.left&&(e.particle.position.x=n),e.outMode===t.OutMode.split&&e.particle.destroy()}({particle:e,outMode:n,direction:o,bounds:u,canvasSize:p,offset:c,size:d}),function(e){if(e.outMode!==t.OutMode.bounce&&e.outMode!==t.OutMode.split||e.direction!==t.OutModeDirection.bottom&&e.direction!==t.OutModeDirection.top)return;e.bounds.bottom<0&&e.direction===t.OutModeDirection.top?e.particle.position.y=e.size+e.offset.y:e.bounds.top>e.canvasSize.height&&e.direction===t.OutModeDirection.bottom&&(e.particle.position.y=e.canvasSize.height-e.size-e.offset.y);const o=e.particle.velocity.y;let i=!1;if(e.direction===t.OutModeDirection.bottom&&e.bounds.bottom>=e.canvasSize.height&&o>0||e.direction===t.OutModeDirection.top&&e.bounds.top<=0&&o<0){const o=(0,t.getRangeValue)(e.particle.options.bounce.vertical.value);e.particle.velocity.y*=-o,i=!0}if(!i)return;const n=e.offset.y+e.size;e.bounds.bottom>=e.canvasSize.height&&e.direction===t.OutModeDirection.bottom?e.particle.position.y=e.canvasSize.height-n:e.bounds.top<=0&&e.direction===t.OutModeDirection.top&&(e.particle.position.y=n),e.outMode===t.OutMode.split&&e.particle.destroy()}({particle:e,outMode:n,direction:o,bounds:u,canvasSize:p,offset:c,size:d})}}class o{constructor(e){this.container=e,this.modes=[t.OutMode.destroy]}update(e,o,i,n){if(!this.modes.includes(n))return;const s=this.container;switch(e.outType){case t.ParticleOutType.normal:case t.ParticleOutType.outside:if((0,t.isPointInside)(e.position,s.canvas.size,t.Vector.origin,e.getRadius(),o))return;break;case t.ParticleOutType.inside:{const{dx:o,dy:i}=(0,t.getDistances)(e.position,e.moveCenter),{x:n,y:s}=e.velocity;if(n<0&&o>e.moveCenter.radius||s<0&&i>e.moveCenter.radius||n>=0&&o<-e.moveCenter.radius||s>=0&&i<-e.moveCenter.radius)return;break}}s.particles.remove(e,void 0,!0)}}class s{constructor(e){this.container=e,this.modes=[t.OutMode.none]}update(e,o,i,n){if(!this.modes.includes(n))return;if((e.options.move.distance.horizontal&&(o===t.OutModeDirection.left||o===t.OutModeDirection.right))??(e.options.move.distance.vertical&&(o===t.OutModeDirection.top||o===t.OutModeDirection.bottom)))return;const s=e.options.move.gravity,r=this.container,a=r.canvas.size,c=e.getRadius();if(s.enable){const i=e.position;(!s.inverse&&i.y>a.height+c&&o===t.OutModeDirection.bottom||s.inverse&&i.y<-c&&o===t.OutModeDirection.top)&&r.particles.remove(e)}else{if(e.velocity.y>0&&e.position.y<=a.height+c||e.velocity.y<0&&e.position.y>=-c||e.velocity.x>0&&e.position.x<=a.width+c||e.velocity.x<0&&e.position.x>=-c)return;(0,t.isPointInside)(e.position,r.canvas.size,t.Vector.origin,c,o)||r.particles.remove(e)}}}class r{constructor(e){this.container=e,this.modes=[t.OutMode.out]}update(e,o,i,n){if(!this.modes.includes(n))return;const s=this.container;switch(e.outType){case t.ParticleOutType.inside:{const{x:o,y:i}=e.velocity,n=t.Vector.origin;n.length=e.moveCenter.radius,n.angle=e.velocity.angle+Math.PI,n.addTo(t.Vector.create(e.moveCenter));const{dx:r,dy:a}=(0,t.getDistances)(e.position,n);if(o<=0&&r>=0||i<=0&&a>=0||o>=0&&r<=0||i>=0&&a<=0)return;e.position.x=Math.floor((0,t.randomInRange)({min:0,max:s.canvas.size.width})),e.position.y=Math.floor((0,t.randomInRange)({min:0,max:s.canvas.size.height}));const{dx:c,dy:d}=(0,t.getDistances)(e.position,e.moveCenter);e.direction=Math.atan2(-d,-c),e.velocity.angle=e.direction;break}default:if((0,t.isPointInside)(e.position,s.canvas.size,t.Vector.origin,e.getRadius(),o))return;switch(e.outType){case t.ParticleOutType.outside:{e.position.x=Math.floor((0,t.randomInRange)({min:-e.moveCenter.radius,max:e.moveCenter.radius}))+e.moveCenter.x,e.position.y=Math.floor((0,t.randomInRange)({min:-e.moveCenter.radius,max:e.moveCenter.radius}))+e.moveCenter.y;const{dx:o,dy:i}=(0,t.getDistances)(e.position,e.moveCenter);e.moveCenter.radius&&(e.direction=Math.atan2(i,o),e.velocity.angle=e.direction);break}case t.ParticleOutType.normal:{const i=e.options.move.warp,n=s.canvas.size,r={bottom:n.height+e.getRadius()+e.offset.y,left:-e.getRadius()-e.offset.x,right:n.width+e.getRadius()+e.offset.x,top:-e.getRadius()-e.offset.y},a=e.getRadius(),c=(0,t.calculateBounds)(e.position,a);o===t.OutModeDirection.right&&c.left>n.width+e.offset.x?(e.position.x=r.left,e.initialPosition.x=e.position.x,i||(e.position.y=(0,t.getRandom)()*n.height,e.initialPosition.y=e.position.y)):o===t.OutModeDirection.left&&c.right<-e.offset.x&&(e.position.x=r.right,e.initialPosition.x=e.position.x,i||(e.position.y=(0,t.getRandom)()*n.height,e.initialPosition.y=e.position.y)),o===t.OutModeDirection.bottom&&c.top>n.height+e.offset.y?(i||(e.position.x=(0,t.getRandom)()*n.width,e.initialPosition.x=e.position.x),e.position.y=r.top,e.initialPosition.y=e.position.y):o===t.OutModeDirection.top&&c.bottom<-e.offset.y&&(i||(e.position.x=(0,t.getRandom)()*n.width,e.initialPosition.x=e.position.x),e.position.y=r.bottom,e.initialPosition.y=e.position.y);break}}}}}const a=(t,e)=>t.default===e||t.bottom===e||t.left===e||t.right===e||t.top===e;class c{constructor(t){this._updateOutMode=(t,e,o,i)=>{for(const n of this.updaters)n.update(t,i,e,o)},this.container=t,this.updaters=[]}init(i){this.updaters=[];const n=i.options.move.outModes;a(n,t.OutMode.bounce)?this.updaters.push(new e(this.container)):a(n,t.OutMode.out)?this.updaters.push(new r(this.container)):a(n,t.OutMode.destroy)?this.updaters.push(new o(this.container)):a(n,t.OutMode.none)&&this.updaters.push(new s(this.container))}isEnabled(t){return!t.destroyed&&!t.spawning}update(e,o){const i=e.options.move.outModes;this._updateOutMode(e,o,i.bottom??i.default,t.OutModeDirection.bottom),this._updateOutMode(e,o,i.left??i.default,t.OutModeDirection.left),this._updateOutMode(e,o,i.right??i.default,t.OutModeDirection.right),this._updateOutMode(e,o,i.top??i.default,t.OutModeDirection.top)}}async function d(t,e=!0){await t.addParticleUpdater("outModes",(t=>Promise.resolve(new c(t))),e)}})(),n})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Out Modes Updater v3.
|
|
1
|
+
/*! tsParticles Out Modes Updater v3.4.0 by Matteo Bruni */
|
package/umd/BounceOutMode.js
CHANGED
package/umd/DestroyOutMode.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
class DestroyOutMode {
|
|
16
16
|
constructor(container) {
|
|
17
17
|
this.container = container;
|
|
18
|
-
this.modes = [
|
|
18
|
+
this.modes = [engine_1.OutMode.destroy];
|
|
19
19
|
}
|
|
20
20
|
update(particle, direction, _delta, outMode) {
|
|
21
21
|
if (!this.modes.includes(outMode)) {
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
}
|
|
24
24
|
const container = this.container;
|
|
25
25
|
switch (particle.outType) {
|
|
26
|
-
case
|
|
27
|
-
case
|
|
26
|
+
case engine_1.ParticleOutType.normal:
|
|
27
|
+
case engine_1.ParticleOutType.outside:
|
|
28
28
|
if ((0, engine_1.isPointInside)(particle.position, container.canvas.size, engine_1.Vector.origin, particle.getRadius(), direction)) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
break;
|
|
32
|
-
case
|
|
32
|
+
case engine_1.ParticleOutType.inside: {
|
|
33
33
|
const { dx, dy } = (0, engine_1.getDistances)(particle.position, particle.moveCenter), { x: vx, y: vy } = particle.velocity;
|
|
34
34
|
if ((vx < minVelocity && dx > particle.moveCenter.radius) ||
|
|
35
35
|
(vy < minVelocity && dy > particle.moveCenter.radius) ||
|
package/umd/NoneOutMode.js
CHANGED
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
class NoneOutMode {
|
|
16
16
|
constructor(container) {
|
|
17
17
|
this.container = container;
|
|
18
|
-
this.modes = [
|
|
18
|
+
this.modes = [engine_1.OutMode.none];
|
|
19
19
|
}
|
|
20
20
|
update(particle, direction, delta, outMode) {
|
|
21
21
|
if (!this.modes.includes(outMode)) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
if ((particle.options.move.distance.horizontal &&
|
|
25
|
-
(direction ===
|
|
25
|
+
(direction === engine_1.OutModeDirection.left || direction === engine_1.OutModeDirection.right)) ??
|
|
26
26
|
(particle.options.move.distance.vertical &&
|
|
27
|
-
(direction ===
|
|
27
|
+
(direction === engine_1.OutModeDirection.top || direction === engine_1.OutModeDirection.bottom))) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
const gravityOptions = particle.options.move.gravity, container = this.container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
const position = particle.position;
|
|
44
44
|
if ((!gravityOptions.inverse &&
|
|
45
45
|
position.y > canvasSize.height + pRadius &&
|
|
46
|
-
direction ===
|
|
47
|
-
(gravityOptions.inverse && position.y < -pRadius && direction ===
|
|
46
|
+
direction === engine_1.OutModeDirection.bottom) ||
|
|
47
|
+
(gravityOptions.inverse && position.y < -pRadius && direction === engine_1.OutModeDirection.top)) {
|
|
48
48
|
container.particles.remove(particle);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./BounceOutMode.js", "./DestroyOutMode.js", "./NoneOutMode.js", "./OutOutMode.js"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./BounceOutMode.js", "./DestroyOutMode.js", "./NoneOutMode.js", "./OutOutMode.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.OutOfCanvasUpdater = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
13
14
|
const BounceOutMode_js_1 = require("./BounceOutMode.js");
|
|
14
15
|
const DestroyOutMode_js_1 = require("./DestroyOutMode.js");
|
|
15
16
|
const NoneOutMode_js_1 = require("./NoneOutMode.js");
|
|
@@ -34,16 +35,16 @@
|
|
|
34
35
|
init(particle) {
|
|
35
36
|
this.updaters = [];
|
|
36
37
|
const outModes = particle.options.move.outModes;
|
|
37
|
-
if (checkOutMode(outModes,
|
|
38
|
+
if (checkOutMode(outModes, engine_1.OutMode.bounce)) {
|
|
38
39
|
this.updaters.push(new BounceOutMode_js_1.BounceOutMode(this.container));
|
|
39
40
|
}
|
|
40
|
-
else if (checkOutMode(outModes,
|
|
41
|
+
else if (checkOutMode(outModes, engine_1.OutMode.out)) {
|
|
41
42
|
this.updaters.push(new OutOutMode_js_1.OutOutMode(this.container));
|
|
42
43
|
}
|
|
43
|
-
else if (checkOutMode(outModes,
|
|
44
|
+
else if (checkOutMode(outModes, engine_1.OutMode.destroy)) {
|
|
44
45
|
this.updaters.push(new DestroyOutMode_js_1.DestroyOutMode(this.container));
|
|
45
46
|
}
|
|
46
|
-
else if (checkOutMode(outModes,
|
|
47
|
+
else if (checkOutMode(outModes, engine_1.OutMode.none)) {
|
|
47
48
|
this.updaters.push(new NoneOutMode_js_1.NoneOutMode(this.container));
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -52,10 +53,10 @@
|
|
|
52
53
|
}
|
|
53
54
|
update(particle, delta) {
|
|
54
55
|
const outModes = particle.options.move.outModes;
|
|
55
|
-
this._updateOutMode(particle, delta, outModes.bottom ?? outModes.default,
|
|
56
|
-
this._updateOutMode(particle, delta, outModes.left ?? outModes.default,
|
|
57
|
-
this._updateOutMode(particle, delta, outModes.right ?? outModes.default,
|
|
58
|
-
this._updateOutMode(particle, delta, outModes.top ?? outModes.default,
|
|
56
|
+
this._updateOutMode(particle, delta, outModes.bottom ?? outModes.default, engine_1.OutModeDirection.bottom);
|
|
57
|
+
this._updateOutMode(particle, delta, outModes.left ?? outModes.default, engine_1.OutModeDirection.left);
|
|
58
|
+
this._updateOutMode(particle, delta, outModes.right ?? outModes.default, engine_1.OutModeDirection.right);
|
|
59
|
+
this._updateOutMode(particle, delta, outModes.top ?? outModes.default, engine_1.OutModeDirection.top);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
exports.OutOfCanvasUpdater = OutOfCanvasUpdater;
|
package/umd/OutOutMode.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
class OutOutMode {
|
|
16
16
|
constructor(container) {
|
|
17
17
|
this.container = container;
|
|
18
|
-
this.modes = [
|
|
18
|
+
this.modes = [engine_1.OutMode.out];
|
|
19
19
|
}
|
|
20
20
|
update(particle, direction, delta, outMode) {
|
|
21
21
|
if (!this.modes.includes(outMode)) {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
const container = this.container;
|
|
25
25
|
switch (particle.outType) {
|
|
26
|
-
case
|
|
26
|
+
case engine_1.ParticleOutType.inside: {
|
|
27
27
|
const { x: vx, y: vy } = particle.velocity;
|
|
28
28
|
const circVec = engine_1.Vector.origin;
|
|
29
29
|
circVec.length = particle.moveCenter.radius;
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
switch (particle.outType) {
|
|
57
|
-
case
|
|
57
|
+
case engine_1.ParticleOutType.outside: {
|
|
58
58
|
particle.position.x =
|
|
59
59
|
Math.floor((0, engine_1.randomInRange)({
|
|
60
60
|
min: -particle.moveCenter.radius,
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
}
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
|
-
case
|
|
75
|
+
case engine_1.ParticleOutType.normal: {
|
|
76
76
|
const warp = particle.options.move.warp, canvasSize = container.canvas.size, newPos = {
|
|
77
77
|
bottom: canvasSize.height + particle.getRadius() + particle.offset.y,
|
|
78
78
|
left: -particle.getRadius() - particle.offset.x,
|
|
79
79
|
right: canvasSize.width + particle.getRadius() + particle.offset.x,
|
|
80
80
|
top: -particle.getRadius() - particle.offset.y,
|
|
81
81
|
}, sizeValue = particle.getRadius(), nextBounds = (0, engine_1.calculateBounds)(particle.position, sizeValue);
|
|
82
|
-
if (direction ===
|
|
82
|
+
if (direction === engine_1.OutModeDirection.right &&
|
|
83
83
|
nextBounds.left > canvasSize.width + particle.offset.x) {
|
|
84
84
|
particle.position.x = newPos.left;
|
|
85
85
|
particle.initialPosition.x = particle.position.x;
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
particle.initialPosition.y = particle.position.y;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
else if (direction ===
|
|
91
|
+
else if (direction === engine_1.OutModeDirection.left && nextBounds.right < -particle.offset.x) {
|
|
92
92
|
particle.position.x = newPos.right;
|
|
93
93
|
particle.initialPosition.x = particle.position.x;
|
|
94
94
|
if (!warp) {
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
particle.initialPosition.y = particle.position.y;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
if (direction ===
|
|
99
|
+
if (direction === engine_1.OutModeDirection.bottom &&
|
|
100
100
|
nextBounds.top > canvasSize.height + particle.offset.y) {
|
|
101
101
|
if (!warp) {
|
|
102
102
|
particle.position.x = (0, engine_1.getRandom)() * canvasSize.width;
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
particle.position.y = newPos.top;
|
|
106
106
|
particle.initialPosition.y = particle.position.y;
|
|
107
107
|
}
|
|
108
|
-
else if (direction ===
|
|
108
|
+
else if (direction === engine_1.OutModeDirection.top && nextBounds.bottom < -particle.offset.y) {
|
|
109
109
|
if (!warp) {
|
|
110
110
|
particle.position.x = (0, engine_1.getRandom)() * canvasSize.width;
|
|
111
111
|
particle.initialPosition.x = particle.position.x;
|
package/umd/Utils.js
CHANGED
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const minVelocity = 0, boundsMin = 0;
|
|
15
15
|
function bounceHorizontal(data) {
|
|
16
|
-
if ((data.outMode !==
|
|
17
|
-
(data.direction !==
|
|
16
|
+
if ((data.outMode !== engine_1.OutMode.bounce && data.outMode !== engine_1.OutMode.split) ||
|
|
17
|
+
(data.direction !== engine_1.OutModeDirection.left && data.direction !== engine_1.OutModeDirection.right)) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
if (data.bounds.right < boundsMin && data.direction ===
|
|
20
|
+
if (data.bounds.right < boundsMin && data.direction === engine_1.OutModeDirection.left) {
|
|
21
21
|
data.particle.position.x = data.size + data.offset.x;
|
|
22
22
|
}
|
|
23
|
-
else if (data.bounds.left > data.canvasSize.width && data.direction ===
|
|
23
|
+
else if (data.bounds.left > data.canvasSize.width && data.direction === engine_1.OutModeDirection.right) {
|
|
24
24
|
data.particle.position.x = data.canvasSize.width - data.size - data.offset.x;
|
|
25
25
|
}
|
|
26
26
|
const velocity = data.particle.velocity.x;
|
|
27
27
|
let bounced = false;
|
|
28
|
-
if ((data.direction ===
|
|
28
|
+
if ((data.direction === engine_1.OutModeDirection.right &&
|
|
29
29
|
data.bounds.right >= data.canvasSize.width &&
|
|
30
30
|
velocity > minVelocity) ||
|
|
31
|
-
(data.direction ===
|
|
31
|
+
(data.direction === engine_1.OutModeDirection.left && data.bounds.left <= boundsMin && velocity < minVelocity)) {
|
|
32
32
|
const newVelocity = (0, engine_1.getRangeValue)(data.particle.options.bounce.horizontal.value);
|
|
33
33
|
data.particle.velocity.x *= -newVelocity;
|
|
34
34
|
bounced = true;
|
|
@@ -37,34 +37,34 @@
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
const minPos = data.offset.x + data.size;
|
|
40
|
-
if (data.bounds.right >= data.canvasSize.width && data.direction ===
|
|
40
|
+
if (data.bounds.right >= data.canvasSize.width && data.direction === engine_1.OutModeDirection.right) {
|
|
41
41
|
data.particle.position.x = data.canvasSize.width - minPos;
|
|
42
42
|
}
|
|
43
|
-
else if (data.bounds.left <= boundsMin && data.direction ===
|
|
43
|
+
else if (data.bounds.left <= boundsMin && data.direction === engine_1.OutModeDirection.left) {
|
|
44
44
|
data.particle.position.x = minPos;
|
|
45
45
|
}
|
|
46
|
-
if (data.outMode ===
|
|
46
|
+
if (data.outMode === engine_1.OutMode.split) {
|
|
47
47
|
data.particle.destroy();
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
exports.bounceHorizontal = bounceHorizontal;
|
|
51
51
|
function bounceVertical(data) {
|
|
52
|
-
if ((data.outMode !==
|
|
53
|
-
(data.direction !==
|
|
52
|
+
if ((data.outMode !== engine_1.OutMode.bounce && data.outMode !== engine_1.OutMode.split) ||
|
|
53
|
+
(data.direction !== engine_1.OutModeDirection.bottom && data.direction !== engine_1.OutModeDirection.top)) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
if (data.bounds.bottom < boundsMin && data.direction ===
|
|
56
|
+
if (data.bounds.bottom < boundsMin && data.direction === engine_1.OutModeDirection.top) {
|
|
57
57
|
data.particle.position.y = data.size + data.offset.y;
|
|
58
58
|
}
|
|
59
|
-
else if (data.bounds.top > data.canvasSize.height && data.direction ===
|
|
59
|
+
else if (data.bounds.top > data.canvasSize.height && data.direction === engine_1.OutModeDirection.bottom) {
|
|
60
60
|
data.particle.position.y = data.canvasSize.height - data.size - data.offset.y;
|
|
61
61
|
}
|
|
62
62
|
const velocity = data.particle.velocity.y;
|
|
63
63
|
let bounced = false;
|
|
64
|
-
if ((data.direction ===
|
|
64
|
+
if ((data.direction === engine_1.OutModeDirection.bottom &&
|
|
65
65
|
data.bounds.bottom >= data.canvasSize.height &&
|
|
66
66
|
velocity > minVelocity) ||
|
|
67
|
-
(data.direction ===
|
|
67
|
+
(data.direction === engine_1.OutModeDirection.top && data.bounds.top <= boundsMin && velocity < minVelocity)) {
|
|
68
68
|
const newVelocity = (0, engine_1.getRangeValue)(data.particle.options.bounce.vertical.value);
|
|
69
69
|
data.particle.velocity.y *= -newVelocity;
|
|
70
70
|
bounced = true;
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
const minPos = data.offset.y + data.size;
|
|
76
|
-
if (data.bounds.bottom >= data.canvasSize.height && data.direction ===
|
|
76
|
+
if (data.bounds.bottom >= data.canvasSize.height && data.direction === engine_1.OutModeDirection.bottom) {
|
|
77
77
|
data.particle.position.y = data.canvasSize.height - minPos;
|
|
78
78
|
}
|
|
79
|
-
else if (data.bounds.top <= boundsMin && data.direction ===
|
|
79
|
+
else if (data.bounds.top <= boundsMin && data.direction === engine_1.OutModeDirection.top) {
|
|
80
80
|
data.particle.position.y = minPos;
|
|
81
81
|
}
|
|
82
|
-
if (data.outMode ===
|
|
82
|
+
if (data.outMode === engine_1.OutMode.split) {
|
|
83
83
|
data.particle.destroy();
|
|
84
84
|
}
|
|
85
85
|
}
|
package/umd/index.js
CHANGED
|
@@ -1,43 +1,19 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
-
}
|
|
7
|
-
Object.defineProperty(o, k2, desc);
|
|
8
|
-
}) : (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
o[k2] = m[k];
|
|
11
|
-
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
1
|
(function (factory) {
|
|
25
2
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
26
3
|
var v = factory(require, exports);
|
|
27
4
|
if (v !== undefined) module.exports = v;
|
|
28
5
|
}
|
|
29
6
|
else if (typeof define === "function" && define.amd) {
|
|
30
|
-
define(["require", "exports"], factory);
|
|
7
|
+
define(["require", "exports", "./OutOfCanvasUpdater.js"], factory);
|
|
31
8
|
}
|
|
32
9
|
})(function (require, exports) {
|
|
33
10
|
"use strict";
|
|
34
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
35
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
12
|
exports.loadOutModesUpdater = void 0;
|
|
13
|
+
const OutOfCanvasUpdater_js_1 = require("./OutOfCanvasUpdater.js");
|
|
37
14
|
async function loadOutModesUpdater(engine, refresh = true) {
|
|
38
|
-
await engine.addParticleUpdater("outModes",
|
|
39
|
-
|
|
40
|
-
return new OutOfCanvasUpdater(container);
|
|
15
|
+
await engine.addParticleUpdater("outModes", container => {
|
|
16
|
+
return Promise.resolve(new OutOfCanvasUpdater_js_1.OutOfCanvasUpdater(container));
|
|
41
17
|
}, refresh);
|
|
42
18
|
}
|
|
43
19
|
exports.loadOutModesUpdater = loadOutModesUpdater;
|
package/128.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 128.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_updater_out_modes=this.webpackChunk_tsparticles_updater_out_modes||[]).push([[128],{128:(t,i,o)=>{o.d(i,{OutOfCanvasUpdater:()=>d});var e=o(303);class s{constructor(t){this.container=t,this.modes=["bounce","split"]}update(t,i,o,s){if(!this.modes.includes(s))return;const n=this.container;let a=!1;for(const[,e]of n.plugins)if(void 0!==e.particleBounce&&(a=e.particleBounce(t,o,i)),a)break;if(a)return;const r=t.getPosition(),c=t.offset,d=t.getRadius(),u=(0,e.calculateBounds)(r,d),p=n.canvas.size;!function(t){if("bounce"!==t.outMode&&"split"!==t.outMode||"left"!==t.direction&&"right"!==t.direction)return;t.bounds.right<0&&"left"===t.direction?t.particle.position.x=t.size+t.offset.x:t.bounds.left>t.canvasSize.width&&"right"===t.direction&&(t.particle.position.x=t.canvasSize.width-t.size-t.offset.x);const i=t.particle.velocity.x;let o=!1;if("right"===t.direction&&t.bounds.right>=t.canvasSize.width&&i>0||"left"===t.direction&&t.bounds.left<=0&&i<0){const i=(0,e.getRangeValue)(t.particle.options.bounce.horizontal.value);t.particle.velocity.x*=-i,o=!0}if(!o)return;const s=t.offset.x+t.size;t.bounds.right>=t.canvasSize.width&&"right"===t.direction?t.particle.position.x=t.canvasSize.width-s:t.bounds.left<=0&&"left"===t.direction&&(t.particle.position.x=s),"split"===t.outMode&&t.particle.destroy()}({particle:t,outMode:s,direction:i,bounds:u,canvasSize:p,offset:c,size:d}),function(t){if("bounce"!==t.outMode&&"split"!==t.outMode||"bottom"!==t.direction&&"top"!==t.direction)return;t.bounds.bottom<0&&"top"===t.direction?t.particle.position.y=t.size+t.offset.y:t.bounds.top>t.canvasSize.height&&"bottom"===t.direction&&(t.particle.position.y=t.canvasSize.height-t.size-t.offset.y);const i=t.particle.velocity.y;let o=!1;if("bottom"===t.direction&&t.bounds.bottom>=t.canvasSize.height&&i>0||"top"===t.direction&&t.bounds.top<=0&&i<0){const i=(0,e.getRangeValue)(t.particle.options.bounce.vertical.value);t.particle.velocity.y*=-i,o=!0}if(!o)return;const s=t.offset.y+t.size;t.bounds.bottom>=t.canvasSize.height&&"bottom"===t.direction?t.particle.position.y=t.canvasSize.height-s:t.bounds.top<=0&&"top"===t.direction&&(t.particle.position.y=s),"split"===t.outMode&&t.particle.destroy()}({particle:t,outMode:s,direction:i,bounds:u,canvasSize:p,offset:c,size:d})}}class n{constructor(t){this.container=t,this.modes=["destroy"]}update(t,i,o,s){if(!this.modes.includes(s))return;const n=this.container;switch(t.outType){case"normal":case"outside":if((0,e.isPointInside)(t.position,n.canvas.size,e.Vector.origin,t.getRadius(),i))return;break;case"inside":{const{dx:i,dy:o}=(0,e.getDistances)(t.position,t.moveCenter),{x:s,y:n}=t.velocity;if(s<0&&i>t.moveCenter.radius||n<0&&o>t.moveCenter.radius||s>=0&&i<-t.moveCenter.radius||n>=0&&o<-t.moveCenter.radius)return;break}}n.particles.remove(t,void 0,!0)}}class a{constructor(t){this.container=t,this.modes=["none"]}update(t,i,o,s){if(!this.modes.includes(s))return;if((t.options.move.distance.horizontal&&("left"===i||"right"===i))??(t.options.move.distance.vertical&&("top"===i||"bottom"===i)))return;const n=t.options.move.gravity,a=this.container,r=a.canvas.size,c=t.getRadius();if(n.enable){const o=t.position;(!n.inverse&&o.y>r.height+c&&"bottom"===i||n.inverse&&o.y<-c&&"top"===i)&&a.particles.remove(t)}else{if(t.velocity.y>0&&t.position.y<=r.height+c||t.velocity.y<0&&t.position.y>=-c||t.velocity.x>0&&t.position.x<=r.width+c||t.velocity.x<0&&t.position.x>=-c)return;(0,e.isPointInside)(t.position,a.canvas.size,e.Vector.origin,c,i)||a.particles.remove(t)}}}class r{constructor(t){this.container=t,this.modes=["out"]}update(t,i,o,s){if(!this.modes.includes(s))return;const n=this.container;switch(t.outType){case"inside":{const{x:i,y:o}=t.velocity,s=e.Vector.origin;s.length=t.moveCenter.radius,s.angle=t.velocity.angle+Math.PI,s.addTo(e.Vector.create(t.moveCenter));const{dx:a,dy:r}=(0,e.getDistances)(t.position,s);if(i<=0&&a>=0||o<=0&&r>=0||i>=0&&a<=0||o>=0&&r<=0)return;t.position.x=Math.floor((0,e.randomInRange)({min:0,max:n.canvas.size.width})),t.position.y=Math.floor((0,e.randomInRange)({min:0,max:n.canvas.size.height}));const{dx:c,dy:d}=(0,e.getDistances)(t.position,t.moveCenter);t.direction=Math.atan2(-d,-c),t.velocity.angle=t.direction;break}default:if((0,e.isPointInside)(t.position,n.canvas.size,e.Vector.origin,t.getRadius(),i))return;switch(t.outType){case"outside":{t.position.x=Math.floor((0,e.randomInRange)({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.x,t.position.y=Math.floor((0,e.randomInRange)({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.y;const{dx:i,dy:o}=(0,e.getDistances)(t.position,t.moveCenter);t.moveCenter.radius&&(t.direction=Math.atan2(o,i),t.velocity.angle=t.direction);break}case"normal":{const o=t.options.move.warp,s=n.canvas.size,a={bottom:s.height+t.getRadius()+t.offset.y,left:-t.getRadius()-t.offset.x,right:s.width+t.getRadius()+t.offset.x,top:-t.getRadius()-t.offset.y},r=t.getRadius(),c=(0,e.calculateBounds)(t.position,r);"right"===i&&c.left>s.width+t.offset.x?(t.position.x=a.left,t.initialPosition.x=t.position.x,o||(t.position.y=(0,e.getRandom)()*s.height,t.initialPosition.y=t.position.y)):"left"===i&&c.right<-t.offset.x&&(t.position.x=a.right,t.initialPosition.x=t.position.x,o||(t.position.y=(0,e.getRandom)()*s.height,t.initialPosition.y=t.position.y)),"bottom"===i&&c.top>s.height+t.offset.y?(o||(t.position.x=(0,e.getRandom)()*s.width,t.initialPosition.x=t.position.x),t.position.y=a.top,t.initialPosition.y=t.position.y):"top"===i&&c.bottom<-t.offset.y&&(o||(t.position.x=(0,e.getRandom)()*s.width,t.initialPosition.x=t.position.x),t.position.y=a.bottom,t.initialPosition.y=t.position.y);break}}}}}const c=(t,i)=>t.default===i||t.bottom===i||t.left===i||t.right===i||t.top===i;class d{constructor(t){this._updateOutMode=(t,i,o,e)=>{for(const s of this.updaters)s.update(t,e,i,o)},this.container=t,this.updaters=[]}init(t){this.updaters=[];const i=t.options.move.outModes;c(i,"bounce")?this.updaters.push(new s(this.container)):c(i,"out")?this.updaters.push(new r(this.container)):c(i,"destroy")?this.updaters.push(new n(this.container)):c(i,"none")&&this.updaters.push(new a(this.container))}isEnabled(t){return!t.destroyed&&!t.spawning}update(t,i){const o=t.options.move.outModes;this._updateOutMode(t,i,o.bottom??o.default,"bottom"),this._updateOutMode(t,i,o.left??o.default,"left"),this._updateOutMode(t,i,o.right??o.default,"right"),this._updateOutMode(t,i,o.top??o.default,"top")}}}}]);
|
package/128.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Out Modes Updater v3.3.0 by Matteo Bruni */
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Author : Matteo Bruni
|
|
3
|
-
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
-
* Demo / Generator : https://particles.js.org/
|
|
5
|
-
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
-
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.3.0
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_updater_out_modes"] = this["webpackChunk_tsparticles_updater_out_modes"] || []).push([["dist_browser_OutOfCanvasUpdater_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/BounceOutMode.js":
|
|
21
|
-
/*!***************************************!*\
|
|
22
|
-
!*** ./dist/browser/BounceOutMode.js ***!
|
|
23
|
-
\***************************************/
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BounceOutMode: () => (/* binding */ BounceOutMode)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\nclass BounceOutMode {\n constructor(container) {\n this.container = container;\n this.modes = [\"bounce\", \"split\"];\n }\n update(particle, direction, delta, outMode) {\n if (!this.modes.includes(outMode)) {\n return;\n }\n const container = this.container;\n let handled = false;\n for (const [, plugin] of container.plugins) {\n if (plugin.particleBounce !== undefined) {\n handled = plugin.particleBounce(particle, delta, direction);\n }\n if (handled) {\n break;\n }\n }\n if (handled) {\n return;\n }\n const pos = particle.getPosition(),\n offset = particle.offset,\n size = particle.getRadius(),\n bounds = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.calculateBounds)(pos, size),\n canvasSize = container.canvas.size;\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.bounceHorizontal)({\n particle,\n outMode,\n direction,\n bounds,\n canvasSize,\n offset,\n size\n });\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.bounceVertical)({\n particle,\n outMode,\n direction,\n bounds,\n canvasSize,\n offset,\n size\n });\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-out-modes/./dist/browser/BounceOutMode.js?");
|
|
27
|
-
|
|
28
|
-
/***/ }),
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/DestroyOutMode.js":
|
|
31
|
-
/*!****************************************!*\
|
|
32
|
-
!*** ./dist/browser/DestroyOutMode.js ***!
|
|
33
|
-
\****************************************/
|
|
34
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
35
|
-
|
|
36
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyOutMode: () => (/* binding */ DestroyOutMode)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst minVelocity = 0;\nclass DestroyOutMode {\n constructor(container) {\n this.container = container;\n this.modes = [\"destroy\"];\n }\n update(particle, direction, _delta, outMode) {\n if (!this.modes.includes(outMode)) {\n return;\n }\n const container = this.container;\n switch (particle.outType) {\n case \"normal\":\n case \"outside\":\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isPointInside)(particle.position, container.canvas.size, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin, particle.getRadius(), direction)) {\n return;\n }\n break;\n case \"inside\":\n {\n const {\n dx,\n dy\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, particle.moveCenter),\n {\n x: vx,\n y: vy\n } = particle.velocity;\n if (vx < minVelocity && dx > particle.moveCenter.radius || vy < minVelocity && dy > particle.moveCenter.radius || vx >= minVelocity && dx < -particle.moveCenter.radius || vy >= minVelocity && dy < -particle.moveCenter.radius) {\n return;\n }\n break;\n }\n }\n container.particles.remove(particle, undefined, true);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-out-modes/./dist/browser/DestroyOutMode.js?");
|
|
37
|
-
|
|
38
|
-
/***/ }),
|
|
39
|
-
|
|
40
|
-
/***/ "./dist/browser/NoneOutMode.js":
|
|
41
|
-
/*!*************************************!*\
|
|
42
|
-
!*** ./dist/browser/NoneOutMode.js ***!
|
|
43
|
-
\*************************************/
|
|
44
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
45
|
-
|
|
46
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NoneOutMode: () => (/* binding */ NoneOutMode)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst minVelocity = 0;\nclass NoneOutMode {\n constructor(container) {\n this.container = container;\n this.modes = [\"none\"];\n }\n update(particle, direction, delta, outMode) {\n if (!this.modes.includes(outMode)) {\n return;\n }\n if ((particle.options.move.distance.horizontal && (direction === \"left\" || direction === \"right\")) ?? (particle.options.move.distance.vertical && (direction === \"top\" || direction === \"bottom\"))) {\n return;\n }\n const gravityOptions = particle.options.move.gravity,\n container = this.container,\n canvasSize = container.canvas.size,\n pRadius = particle.getRadius();\n if (!gravityOptions.enable) {\n if (particle.velocity.y > minVelocity && particle.position.y <= canvasSize.height + pRadius || particle.velocity.y < minVelocity && particle.position.y >= -pRadius || particle.velocity.x > minVelocity && particle.position.x <= canvasSize.width + pRadius || particle.velocity.x < minVelocity && particle.position.x >= -pRadius) {\n return;\n }\n if (!(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isPointInside)(particle.position, container.canvas.size, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin, pRadius, direction)) {\n container.particles.remove(particle);\n }\n } else {\n const position = particle.position;\n if (!gravityOptions.inverse && position.y > canvasSize.height + pRadius && direction === \"bottom\" || gravityOptions.inverse && position.y < -pRadius && direction === \"top\") {\n container.particles.remove(particle);\n }\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-out-modes/./dist/browser/NoneOutMode.js?");
|
|
47
|
-
|
|
48
|
-
/***/ }),
|
|
49
|
-
|
|
50
|
-
/***/ "./dist/browser/OutOfCanvasUpdater.js":
|
|
51
|
-
/*!********************************************!*\
|
|
52
|
-
!*** ./dist/browser/OutOfCanvasUpdater.js ***!
|
|
53
|
-
\********************************************/
|
|
54
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
55
|
-
|
|
56
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OutOfCanvasUpdater: () => (/* binding */ OutOfCanvasUpdater)\n/* harmony export */ });\n/* harmony import */ var _BounceOutMode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BounceOutMode.js */ \"./dist/browser/BounceOutMode.js\");\n/* harmony import */ var _DestroyOutMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./DestroyOutMode.js */ \"./dist/browser/DestroyOutMode.js\");\n/* harmony import */ var _NoneOutMode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NoneOutMode.js */ \"./dist/browser/NoneOutMode.js\");\n/* harmony import */ var _OutOutMode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OutOutMode.js */ \"./dist/browser/OutOutMode.js\");\n\n\n\n\nconst checkOutMode = (outModes, outMode) => {\n return outModes.default === outMode || outModes.bottom === outMode || outModes.left === outMode || outModes.right === outMode || outModes.top === outMode;\n};\nclass OutOfCanvasUpdater {\n constructor(container) {\n this._updateOutMode = (particle, delta, outMode, direction) => {\n for (const updater of this.updaters) {\n updater.update(particle, direction, delta, outMode);\n }\n };\n this.container = container;\n this.updaters = [];\n }\n init(particle) {\n this.updaters = [];\n const outModes = particle.options.move.outModes;\n if (checkOutMode(outModes, \"bounce\")) {\n this.updaters.push(new _BounceOutMode_js__WEBPACK_IMPORTED_MODULE_0__.BounceOutMode(this.container));\n } else if (checkOutMode(outModes, \"out\")) {\n this.updaters.push(new _OutOutMode_js__WEBPACK_IMPORTED_MODULE_1__.OutOutMode(this.container));\n } else if (checkOutMode(outModes, \"destroy\")) {\n this.updaters.push(new _DestroyOutMode_js__WEBPACK_IMPORTED_MODULE_2__.DestroyOutMode(this.container));\n } else if (checkOutMode(outModes, \"none\")) {\n this.updaters.push(new _NoneOutMode_js__WEBPACK_IMPORTED_MODULE_3__.NoneOutMode(this.container));\n }\n }\n isEnabled(particle) {\n return !particle.destroyed && !particle.spawning;\n }\n update(particle, delta) {\n const outModes = particle.options.move.outModes;\n this._updateOutMode(particle, delta, outModes.bottom ?? outModes.default, \"bottom\");\n this._updateOutMode(particle, delta, outModes.left ?? outModes.default, \"left\");\n this._updateOutMode(particle, delta, outModes.right ?? outModes.default, \"right\");\n this._updateOutMode(particle, delta, outModes.top ?? outModes.default, \"top\");\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-out-modes/./dist/browser/OutOfCanvasUpdater.js?");
|
|
57
|
-
|
|
58
|
-
/***/ }),
|
|
59
|
-
|
|
60
|
-
/***/ "./dist/browser/OutOutMode.js":
|
|
61
|
-
/*!************************************!*\
|
|
62
|
-
!*** ./dist/browser/OutOutMode.js ***!
|
|
63
|
-
\************************************/
|
|
64
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
65
|
-
|
|
66
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OutOutMode: () => (/* binding */ OutOutMode)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst minVelocity = 0,\n minDistance = 0;\nclass OutOutMode {\n constructor(container) {\n this.container = container;\n this.modes = [\"out\"];\n }\n update(particle, direction, delta, outMode) {\n if (!this.modes.includes(outMode)) {\n return;\n }\n const container = this.container;\n switch (particle.outType) {\n case \"inside\":\n {\n const {\n x: vx,\n y: vy\n } = particle.velocity;\n const circVec = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin;\n circVec.length = particle.moveCenter.radius;\n circVec.angle = particle.velocity.angle + Math.PI;\n circVec.addTo(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(particle.moveCenter));\n const {\n dx,\n dy\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, circVec);\n if (vx <= minVelocity && dx >= minDistance || vy <= minVelocity && dy >= minDistance || vx >= minVelocity && dx <= minDistance || vy >= minVelocity && dy <= minDistance) {\n return;\n }\n particle.position.x = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)({\n min: 0,\n max: container.canvas.size.width\n }));\n particle.position.y = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)({\n min: 0,\n max: container.canvas.size.height\n }));\n const {\n dx: newDx,\n dy: newDy\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, particle.moveCenter);\n particle.direction = Math.atan2(-newDy, -newDx);\n particle.velocity.angle = particle.direction;\n break;\n }\n default:\n {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isPointInside)(particle.position, container.canvas.size, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin, particle.getRadius(), direction)) {\n return;\n }\n switch (particle.outType) {\n case \"outside\":\n {\n particle.position.x = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)({\n min: -particle.moveCenter.radius,\n max: particle.moveCenter.radius\n })) + particle.moveCenter.x;\n particle.position.y = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)({\n min: -particle.moveCenter.radius,\n max: particle.moveCenter.radius\n })) + particle.moveCenter.y;\n const {\n dx,\n dy\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, particle.moveCenter);\n if (particle.moveCenter.radius) {\n particle.direction = Math.atan2(dy, dx);\n particle.velocity.angle = particle.direction;\n }\n break;\n }\n case \"normal\":\n {\n const warp = particle.options.move.warp,\n canvasSize = container.canvas.size,\n newPos = {\n bottom: canvasSize.height + particle.getRadius() + particle.offset.y,\n left: -particle.getRadius() - particle.offset.x,\n right: canvasSize.width + particle.getRadius() + particle.offset.x,\n top: -particle.getRadius() - particle.offset.y\n },\n sizeValue = particle.getRadius(),\n nextBounds = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.calculateBounds)(particle.position, sizeValue);\n if (direction === \"right\" && nextBounds.left > canvasSize.width + particle.offset.x) {\n particle.position.x = newPos.left;\n particle.initialPosition.x = particle.position.x;\n if (!warp) {\n particle.position.y = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * canvasSize.height;\n particle.initialPosition.y = particle.position.y;\n }\n } else if (direction === \"left\" && nextBounds.right < -particle.offset.x) {\n particle.position.x = newPos.right;\n particle.initialPosition.x = particle.position.x;\n if (!warp) {\n particle.position.y = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * canvasSize.height;\n particle.initialPosition.y = particle.position.y;\n }\n }\n if (direction === \"bottom\" && nextBounds.top > canvasSize.height + particle.offset.y) {\n if (!warp) {\n particle.position.x = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * canvasSize.width;\n particle.initialPosition.x = particle.position.x;\n }\n particle.position.y = newPos.top;\n particle.initialPosition.y = particle.position.y;\n } else if (direction === \"top\" && nextBounds.bottom < -particle.offset.y) {\n if (!warp) {\n particle.position.x = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * canvasSize.width;\n particle.initialPosition.x = particle.position.x;\n }\n particle.position.y = newPos.bottom;\n particle.initialPosition.y = particle.position.y;\n }\n break;\n }\n }\n break;\n }\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-out-modes/./dist/browser/OutOutMode.js?");
|
|
67
|
-
|
|
68
|
-
/***/ }),
|
|
69
|
-
|
|
70
|
-
/***/ "./dist/browser/Utils.js":
|
|
71
|
-
/*!*******************************!*\
|
|
72
|
-
!*** ./dist/browser/Utils.js ***!
|
|
73
|
-
\*******************************/
|
|
74
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
75
|
-
|
|
76
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ bounceHorizontal: () => (/* binding */ bounceHorizontal),\n/* harmony export */ bounceVertical: () => (/* binding */ bounceVertical)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst minVelocity = 0,\n boundsMin = 0;\nfunction bounceHorizontal(data) {\n if (data.outMode !== \"bounce\" && data.outMode !== \"split\" || data.direction !== \"left\" && data.direction !== \"right\") {\n return;\n }\n if (data.bounds.right < boundsMin && data.direction === \"left\") {\n data.particle.position.x = data.size + data.offset.x;\n } else if (data.bounds.left > data.canvasSize.width && data.direction === \"right\") {\n data.particle.position.x = data.canvasSize.width - data.size - data.offset.x;\n }\n const velocity = data.particle.velocity.x;\n let bounced = false;\n if (data.direction === \"right\" && data.bounds.right >= data.canvasSize.width && velocity > minVelocity || data.direction === \"left\" && data.bounds.left <= boundsMin && velocity < minVelocity) {\n const newVelocity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(data.particle.options.bounce.horizontal.value);\n data.particle.velocity.x *= -newVelocity;\n bounced = true;\n }\n if (!bounced) {\n return;\n }\n const minPos = data.offset.x + data.size;\n if (data.bounds.right >= data.canvasSize.width && data.direction === \"right\") {\n data.particle.position.x = data.canvasSize.width - minPos;\n } else if (data.bounds.left <= boundsMin && data.direction === \"left\") {\n data.particle.position.x = minPos;\n }\n if (data.outMode === \"split\") {\n data.particle.destroy();\n }\n}\nfunction bounceVertical(data) {\n if (data.outMode !== \"bounce\" && data.outMode !== \"split\" || data.direction !== \"bottom\" && data.direction !== \"top\") {\n return;\n }\n if (data.bounds.bottom < boundsMin && data.direction === \"top\") {\n data.particle.position.y = data.size + data.offset.y;\n } else if (data.bounds.top > data.canvasSize.height && data.direction === \"bottom\") {\n data.particle.position.y = data.canvasSize.height - data.size - data.offset.y;\n }\n const velocity = data.particle.velocity.y;\n let bounced = false;\n if (data.direction === \"bottom\" && data.bounds.bottom >= data.canvasSize.height && velocity > minVelocity || data.direction === \"top\" && data.bounds.top <= boundsMin && velocity < minVelocity) {\n const newVelocity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(data.particle.options.bounce.vertical.value);\n data.particle.velocity.y *= -newVelocity;\n bounced = true;\n }\n if (!bounced) {\n return;\n }\n const minPos = data.offset.y + data.size;\n if (data.bounds.bottom >= data.canvasSize.height && data.direction === \"bottom\") {\n data.particle.position.y = data.canvasSize.height - minPos;\n } else if (data.bounds.top <= boundsMin && data.direction === \"top\") {\n data.particle.position.y = minPos;\n }\n if (data.outMode === \"split\") {\n data.particle.destroy();\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-out-modes/./dist/browser/Utils.js?");
|
|
77
|
-
|
|
78
|
-
/***/ })
|
|
79
|
-
|
|
80
|
-
}]);
|