@tsparticles/updater-out-modes 4.0.0-beta.0 → 4.0.0-beta.10
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/655.min.js +1 -0
- package/README.md +29 -0
- package/browser/DestroyOutMode.js +1 -1
- package/browser/NoneOutMode.js +2 -2
- package/browser/index.js +3 -3
- package/cjs/DestroyOutMode.js +1 -1
- package/cjs/NoneOutMode.js +2 -2
- package/cjs/index.js +3 -3
- package/dist_browser_OutOfCanvasUpdater_js.js +3 -3
- package/esm/DestroyOutMode.js +1 -1
- package/esm/NoneOutMode.js +2 -2
- package/esm/index.js +3 -3
- package/package.json +4 -5
- package/report.html +84 -29
- package/tsparticles.updater.out-modes.js +2 -2
- package/tsparticles.updater.out-modes.min.js +2 -2
- package/631.min.js +0 -1
- package/umd/BounceOutMode.js +0 -48
- package/umd/DestroyOutMode.js +0 -49
- package/umd/IBounceData.js +0 -12
- package/umd/IOutModeManager.js +0 -12
- package/umd/NoneOutMode.js +0 -56
- package/umd/OutOfCanvasUpdater.js +0 -61
- package/umd/OutOutMode.js +0 -125
- package/umd/Utils.js +0 -86
- package/umd/index.js +0 -56
package/655.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_updater_out_modes=this.webpackChunk_tsparticles_updater_out_modes||[]).push([[655],{655(t,i,e){e.d(i,{OutOfCanvasUpdater:()=>u});var o=e(303);class n{container;modes;_particleBouncePlugins;constructor(t){this.container=t,this.modes=[o.OutMode.bounce,o.OutMode.split],this._particleBouncePlugins=t.plugins.filter(t=>void 0!==t.particleBounce)}update(t,i,e,n){if(!this.modes.includes(n))return;let s=this.container,r=!1;for(let o of this._particleBouncePlugins)if(r=o.particleBounce?.(t,e,i)??!1)break;if(r)return;let a=t.getPosition(),d=t.offset,u=t.getRadius(),c=(0,o.calculateBounds)(a,u),l=s.canvas.size;!function(t){if(t.outMode!==o.OutMode.bounce&&t.outMode!==o.OutMode.split||t.direction!==o.OutModeDirection.left&&t.direction!==o.OutModeDirection.right)return;t.bounds.right<0&&t.direction===o.OutModeDirection.left?t.particle.position.x=t.size+t.offset.x:t.bounds.left>t.canvasSize.width&&t.direction===o.OutModeDirection.right&&(t.particle.position.x=t.canvasSize.width-t.size-t.offset.x);let i=t.particle.velocity.x,e=!1;if(t.direction===o.OutModeDirection.right&&t.bounds.right>=t.canvasSize.width&&i>0||t.direction===o.OutModeDirection.left&&t.bounds.left<=0&&i<0){let i=(0,o.getRangeValue)(t.particle.options.bounce.horizontal.value);t.particle.velocity.x*=-i,e=!0}if(!e)return;let n=t.offset.x+t.size;t.bounds.right>=t.canvasSize.width&&t.direction===o.OutModeDirection.right?t.particle.position.x=t.canvasSize.width-n:t.bounds.left<=0&&t.direction===o.OutModeDirection.left&&(t.particle.position.x=n),t.outMode===o.OutMode.split&&t.particle.destroy()}({particle:t,outMode:n,direction:i,bounds:c,canvasSize:l,offset:d,size:u}),function(t){if(t.outMode!==o.OutMode.bounce&&t.outMode!==o.OutMode.split||t.direction!==o.OutModeDirection.bottom&&t.direction!==o.OutModeDirection.top)return;t.bounds.bottom<0&&t.direction===o.OutModeDirection.top?t.particle.position.y=t.size+t.offset.y:t.bounds.top>t.canvasSize.height&&t.direction===o.OutModeDirection.bottom&&(t.particle.position.y=t.canvasSize.height-t.size-t.offset.y);let i=t.particle.velocity.y,e=!1;if(t.direction===o.OutModeDirection.bottom&&t.bounds.bottom>=t.canvasSize.height&&i>0||t.direction===o.OutModeDirection.top&&t.bounds.top<=0&&i<0){let i=(0,o.getRangeValue)(t.particle.options.bounce.vertical.value);t.particle.velocity.y*=-i,e=!0}if(!e)return;let n=t.offset.y+t.size;t.bounds.bottom>=t.canvasSize.height&&t.direction===o.OutModeDirection.bottom?t.particle.position.y=t.canvasSize.height-n:t.bounds.top<=0&&t.direction===o.OutModeDirection.top&&(t.particle.position.y=n),t.outMode===o.OutMode.split&&t.particle.destroy()}({particle:t,outMode:n,direction:i,bounds:c,canvasSize:l,offset:d,size:u})}}class s{container;modes;constructor(t){this.container=t,this.modes=[o.OutMode.destroy]}update(t,i,e,n){if(!this.modes.includes(n))return;let s=this.container;switch(t.outType){case o.ParticleOutType.normal:case o.ParticleOutType.outside:if((0,o.isPointInside)(t.position,s.canvas.size,o.originPoint,t.getRadius(),i))return;break;case o.ParticleOutType.inside:{let{dx:i,dy:e}=(0,o.getDistances)(t.position,t.moveCenter),{x:n,y:s}=t.velocity;if(n<0&&i>t.moveCenter.radius||s<0&&e>t.moveCenter.radius||n>=0&&i<-t.moveCenter.radius||s>=0&&e<-t.moveCenter.radius)return}}t.destroy(!0)}}class r{container;modes;constructor(t){this.container=t,this.modes=[o.OutMode.none]}update(t,i,e,n){if(!this.modes.includes(n)||((t.options.move.distance.horizontal&&(i===o.OutModeDirection.left||i===o.OutModeDirection.right))??(t.options.move.distance.vertical&&(i===o.OutModeDirection.top||i===o.OutModeDirection.bottom))))return;let s=t.options.move.gravity,r=this.container,a=r.canvas.size,d=t.getRadius();if(s.enable){let e=t.position;(!s.inverse&&e.y>a.height+d&&i===o.OutModeDirection.bottom||s.inverse&&e.y<-d&&i===o.OutModeDirection.top)&&t.destroy()}else{if(t.velocity.y>0&&t.position.y<=a.height+d||t.velocity.y<0&&t.position.y>=-d||t.velocity.x>0&&t.position.x<=a.width+d||t.velocity.x<0&&t.position.x>=-d)return;(0,o.isPointInside)(t.position,r.canvas.size,o.originPoint,d,i)||t.destroy()}}}let a=o.Vector.origin;class d{container;modes;constructor(t){this.container=t,this.modes=[o.OutMode.out]}update(t,i,e,n){if(!this.modes.includes(n))return;let s=this.container;if(t.outType===o.ParticleOutType.inside){let{x:i,y:e}=t.velocity;a.setTo(o.originPoint),a.length=t.moveCenter.radius,a.angle=t.velocity.angle+Math.PI,a.addTo(t.moveCenter);let{dx:n,dy:r}=(0,o.getDistances)(t.position,a);if(i<=0&&n>=0||e<=0&&r>=0||i>=0&&n<=0||e>=0&&r<=0)return;t.position.x=Math.floor((0,o.randomInRangeValue)({min:0,max:s.canvas.size.width})),t.position.y=Math.floor((0,o.randomInRangeValue)({min:0,max:s.canvas.size.height}));let{dx:d,dy:u}=(0,o.getDistances)(t.position,t.moveCenter);t.direction=Math.atan2(-u,-d),t.velocity.angle=t.direction}else{if((0,o.isPointInside)(t.position,s.canvas.size,o.originPoint,t.getRadius(),i))return;switch(t.outType){case o.ParticleOutType.outside:{t.position.x=Math.floor((0,o.randomInRangeValue)({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.x,t.position.y=Math.floor((0,o.randomInRangeValue)({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.y;let{dx:i,dy:e}=(0,o.getDistances)(t.position,t.moveCenter);t.moveCenter.radius&&(t.direction=Math.atan2(e,i),t.velocity.angle=t.direction);break}case o.ParticleOutType.normal:{let e=t.options.move.warp,n=s.canvas.size,r={bottom:n.height+t.getRadius()+t.offset.y,left:-t.getRadius()-t.offset.x,right:n.width+t.getRadius()+t.offset.x,top:-t.getRadius()-t.offset.y},a=t.getRadius(),d=(0,o.calculateBounds)(t.position,a);i===o.OutModeDirection.right&&d.left>n.width+t.offset.x?(t.position.x=r.left,t.initialPosition.x=t.position.x,e||(t.position.y=(0,o.getRandom)()*n.height,t.initialPosition.y=t.position.y)):i===o.OutModeDirection.left&&d.right<-t.offset.x&&(t.position.x=r.right,t.initialPosition.x=t.position.x,e||(t.position.y=(0,o.getRandom)()*n.height,t.initialPosition.y=t.position.y)),i===o.OutModeDirection.bottom&&d.top>n.height+t.offset.y?(e||(t.position.x=(0,o.getRandom)()*n.width,t.initialPosition.x=t.position.x),t.position.y=r.top,t.initialPosition.y=t.position.y):i===o.OutModeDirection.top&&d.bottom<-t.offset.y&&(e||(t.position.x=(0,o.getRandom)()*n.width,t.initialPosition.x=t.position.x),t.position.y=r.bottom,t.initialPosition.y=t.position.y)}}}}}class u{updaters;container;constructor(t){this.container=t,this.updaters=new Map}init(t){this._addUpdaterIfMissing(t,o.OutMode.bounce,t=>new n(t)),this._addUpdaterIfMissing(t,o.OutMode.out,t=>new d(t)),this._addUpdaterIfMissing(t,o.OutMode.destroy,t=>new s(t)),this._addUpdaterIfMissing(t,o.OutMode.none,t=>new r(t))}isEnabled(t){return!t.destroyed&&!t.spawning}update(t,i){let e=t.options.move.outModes;this._updateOutMode(t,i,e.bottom??e.default,o.OutModeDirection.bottom),this._updateOutMode(t,i,e.left??e.default,o.OutModeDirection.left),this._updateOutMode(t,i,e.right??e.default,o.OutModeDirection.right),this._updateOutMode(t,i,e.top??e.default,o.OutModeDirection.top)}_addUpdaterIfMissing=(t,i,e)=>{let o=t.options.move.outModes;this.updaters.has(i)||o.default!==i&&o.bottom!==i&&o.left!==i&&o.right!==i&&o.top!==i||this.updaters.set(i,e(this.container))};_updateOutMode=(t,i,e,o)=>{for(let n of this.updaters.values())n.update(t,o,i,e)}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) updater plugin for out modes animations.
|
|
10
10
|
|
|
11
|
+
## Quick checklist
|
|
12
|
+
|
|
13
|
+
1. Install `@tsparticles/engine` (or use the CDN bundle below)
|
|
14
|
+
2. Call the package loader function(s) before `tsParticles.load(...)`
|
|
15
|
+
3. Apply the package options in your `tsParticles.load(...)` config
|
|
16
|
+
|
|
11
17
|
## How to use it
|
|
12
18
|
|
|
13
19
|
### CDN / Vanilla JS / jQuery
|
|
@@ -72,3 +78,26 @@ import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
|
|
|
72
78
|
await loadOutModesUpdater(tsParticles);
|
|
73
79
|
})();
|
|
74
80
|
```
|
|
81
|
+
|
|
82
|
+
## Option mapping
|
|
83
|
+
|
|
84
|
+
- Primary options key: `particles.move.outModes`
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"particles": {
|
|
89
|
+
"move.outModes": {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Common pitfalls
|
|
95
|
+
|
|
96
|
+
- Calling `tsParticles.load(...)` before `loadOutModesUpdater(...)`
|
|
97
|
+
- Verify required peer packages before enabling advanced options
|
|
98
|
+
- Change one option group at a time to isolate regressions quickly
|
|
99
|
+
|
|
100
|
+
## Related docs
|
|
101
|
+
|
|
102
|
+
- All packages catalog: <https://github.com/tsparticles/tsparticles>
|
|
103
|
+
- Main docs: <https://particles.js.org/docs/>
|
package/browser/NoneOutMode.js
CHANGED
|
@@ -26,7 +26,7 @@ export class NoneOutMode {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
if (!isPointInside(particle.position, container.canvas.size, originPoint, pRadius, direction)) {
|
|
29
|
-
|
|
29
|
+
particle.destroy();
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
@@ -35,7 +35,7 @@ export class NoneOutMode {
|
|
|
35
35
|
position.y > canvasSize.height + pRadius &&
|
|
36
36
|
direction === OutModeDirection.bottom) ||
|
|
37
37
|
(gravityOptions.inverse && position.y < -pRadius && direction === OutModeDirection.top)) {
|
|
38
|
-
|
|
38
|
+
particle.destroy();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadOutModesUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("outModes", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("outModes", async (container) => {
|
|
5
5
|
const { OutOfCanvasUpdater } = await import("./OutOfCanvasUpdater.js");
|
|
6
6
|
return new OutOfCanvasUpdater(container);
|
|
7
7
|
});
|
package/cjs/DestroyOutMode.js
CHANGED
package/cjs/NoneOutMode.js
CHANGED
|
@@ -26,7 +26,7 @@ export class NoneOutMode {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
if (!isPointInside(particle.position, container.canvas.size, originPoint, pRadius, direction)) {
|
|
29
|
-
|
|
29
|
+
particle.destroy();
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
@@ -35,7 +35,7 @@ export class NoneOutMode {
|
|
|
35
35
|
position.y > canvasSize.height + pRadius &&
|
|
36
36
|
direction === OutModeDirection.bottom) ||
|
|
37
37
|
(gravityOptions.inverse && position.y < -pRadius && direction === OutModeDirection.top)) {
|
|
38
|
-
|
|
38
|
+
particle.destroy();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadOutModesUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("outModes", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("outModes", async (container) => {
|
|
5
5
|
const { OutOfCanvasUpdater } = await import("./OutOfCanvasUpdater.js");
|
|
6
6
|
return new OutOfCanvasUpdater(container);
|
|
7
7
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-beta.
|
|
7
|
+
* v4.0.0-beta.10
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -33,7 +33,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
33
33
|
\****************************************/
|
|
34
34
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
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\nconst minVelocity = 0;\nclass DestroyOutMode {\n container;\n modes;\n constructor(container){\n this.container = container;\n this.modes = [\n _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.destroy\n ];\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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ParticleOutType.normal:\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ParticleOutType.outside:\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isPointInside)(particle.position, container.canvas.size, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint, particle.getRadius(), direction)) {\n return;\n }\n break;\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ParticleOutType.inside:\n {\n const { dx, dy } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, particle.moveCenter), { x: vx, y: vy } = 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
|
|
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\nconst minVelocity = 0;\nclass DestroyOutMode {\n container;\n modes;\n constructor(container){\n this.container = container;\n this.modes = [\n _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.destroy\n ];\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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ParticleOutType.normal:\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ParticleOutType.outside:\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isPointInside)(particle.position, container.canvas.size, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint, particle.getRadius(), direction)) {\n return;\n }\n break;\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ParticleOutType.inside:\n {\n const { dx, dy } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, particle.moveCenter), { x: vx, y: vy } = 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 particle.destroy(true);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-out-modes/./dist/browser/DestroyOutMode.js?\n}");
|
|
37
37
|
|
|
38
38
|
/***/ },
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
43
43
|
\*************************************/
|
|
44
44
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
45
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\nconst minVelocity = 0;\nclass NoneOutMode {\n container;\n modes;\n constructor(container){\n this.container = container;\n this.modes = [\n _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.none\n ];\n }\n update(particle, direction, _delta, outMode) {\n if (!this.modes.includes(outMode)) {\n return;\n }\n if ((particle.options.move.distance.horizontal && (direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.left || direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.right)) ?? (particle.options.move.distance.vertical && (direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.top || direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.bottom))) {\n return;\n }\n const gravityOptions = particle.options.move.gravity, container = this.container, canvasSize = container.canvas.size, 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__.originPoint, pRadius, direction)) {\n
|
|
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\nconst minVelocity = 0;\nclass NoneOutMode {\n container;\n modes;\n constructor(container){\n this.container = container;\n this.modes = [\n _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.none\n ];\n }\n update(particle, direction, _delta, outMode) {\n if (!this.modes.includes(outMode)) {\n return;\n }\n if ((particle.options.move.distance.horizontal && (direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.left || direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.right)) ?? (particle.options.move.distance.vertical && (direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.top || direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.bottom))) {\n return;\n }\n const gravityOptions = particle.options.move.gravity, container = this.container, canvasSize = container.canvas.size, 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__.originPoint, pRadius, direction)) {\n particle.destroy();\n }\n } else {\n const position = particle.position;\n if (!gravityOptions.inverse && position.y > canvasSize.height + pRadius && direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.bottom || gravityOptions.inverse && position.y < -pRadius && direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutModeDirection.top) {\n particle.destroy();\n }\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-out-modes/./dist/browser/NoneOutMode.js?\n}");
|
|
47
47
|
|
|
48
48
|
/***/ },
|
|
49
49
|
|
package/esm/DestroyOutMode.js
CHANGED
package/esm/NoneOutMode.js
CHANGED
|
@@ -26,7 +26,7 @@ export class NoneOutMode {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
if (!isPointInside(particle.position, container.canvas.size, originPoint, pRadius, direction)) {
|
|
29
|
-
|
|
29
|
+
particle.destroy();
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
@@ -35,7 +35,7 @@ export class NoneOutMode {
|
|
|
35
35
|
position.y > canvasSize.height + pRadius &&
|
|
36
36
|
direction === OutModeDirection.bottom) ||
|
|
37
37
|
(gravityOptions.inverse && position.y < -pRadius && direction === OutModeDirection.top)) {
|
|
38
|
-
|
|
38
|
+
particle.destroy();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadOutModesUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("outModes", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("outModes", async (container) => {
|
|
5
5
|
const { OutOfCanvasUpdater } = await import("./OutOfCanvasUpdater.js");
|
|
6
6
|
return new OutOfCanvasUpdater(container);
|
|
7
7
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-out-modes",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "tsParticles particles out modes updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -81,13 +81,12 @@
|
|
|
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.
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"@tsparticles/engine": "4.0.0-beta.10"
|
|
91
90
|
},
|
|
92
91
|
"publishConfig": {
|
|
93
92
|
"access": "public"
|