@tsparticles/updater-out-modes 4.0.0-beta.9 → 4.0.1
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/OutOfCanvasUpdater.js +1 -0
- package/browser/OutOutMode.js +6 -0
- package/browser/browser.js +5 -0
- package/browser/index.js +4 -4
- package/browser/index.lazy.js +9 -0
- package/cjs/OutOfCanvasUpdater.js +1 -0
- package/cjs/OutOutMode.js +6 -0
- package/cjs/browser.js +5 -0
- package/cjs/index.js +4 -4
- package/cjs/index.lazy.js +9 -0
- package/esm/OutOfCanvasUpdater.js +1 -0
- package/esm/OutOutMode.js +6 -0
- package/esm/browser.js +5 -0
- package/esm/index.js +4 -4
- package/esm/index.lazy.js +9 -0
- package/package.json +9 -2
- package/report.html +4949 -94
- package/tsparticles.updater.out-modes.js +362 -310
- package/tsparticles.updater.out-modes.min.js +1 -2
- package/types/browser.d.ts +1 -0
- package/types/index.lazy.d.ts +2 -0
- package/655.min.js +0 -1
- package/dist_browser_OutOfCanvasUpdater_js.js +0 -80
|
@@ -1,317 +1,369 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
/*
|
|
10
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
11
|
-
* This devtool is neither made for production nor for readable output files.
|
|
12
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
13
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
14
|
-
* or disable the default devtool with "devtool: false".
|
|
15
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
16
|
-
*/
|
|
17
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
18
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
19
|
-
module.exports = factory(require("@tsparticles/engine"));
|
|
20
|
-
else if(typeof define === 'function' && define.amd)
|
|
21
|
-
define(["@tsparticles/engine"], factory);
|
|
22
|
-
else {
|
|
23
|
-
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
24
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
25
|
-
}
|
|
26
|
-
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
27
|
-
return /******/ (() => { // webpackBootstrap
|
|
28
|
-
/******/ "use strict";
|
|
29
|
-
/******/ var __webpack_modules__ = ({
|
|
1
|
+
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
+
/* Updater v4.0.1 */
|
|
3
|
+
(function (global, factory) {
|
|
4
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
|
|
5
|
+
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
|
|
6
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.updaters = global.__tsParticlesInternals.updaters || {}, global.__tsParticlesInternals.updaters.outModes = global.__tsParticlesInternals.updaters.outModes || {}), global.__tsParticlesInternals.engine));
|
|
7
|
+
})(this, (function (exports, engine) { 'use strict';
|
|
30
8
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
const minVelocity$3 = 0, boundsMin = 0;
|
|
10
|
+
function bounceHorizontal(data) {
|
|
11
|
+
if ((data.outMode !== engine.OutMode.bounce && data.outMode !== engine.OutMode.split) ||
|
|
12
|
+
(data.direction !== engine.OutModeDirection.left && data.direction !== engine.OutModeDirection.right)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (data.bounds.right < boundsMin && data.direction === engine.OutModeDirection.left) {
|
|
16
|
+
data.particle.position.x = data.size + data.offset.x;
|
|
17
|
+
}
|
|
18
|
+
else if (data.bounds.left > data.canvasSize.width && data.direction === engine.OutModeDirection.right) {
|
|
19
|
+
data.particle.position.x = data.canvasSize.width - data.size - data.offset.x;
|
|
20
|
+
}
|
|
21
|
+
const velocity = data.particle.velocity.x;
|
|
22
|
+
let bounced = false;
|
|
23
|
+
if ((data.direction === engine.OutModeDirection.right &&
|
|
24
|
+
data.bounds.right >= data.canvasSize.width &&
|
|
25
|
+
velocity > minVelocity$3) ||
|
|
26
|
+
(data.direction === engine.OutModeDirection.left && data.bounds.left <= boundsMin && velocity < minVelocity$3)) {
|
|
27
|
+
const newVelocity = engine.getRangeValue(data.particle.options.bounce.horizontal.value);
|
|
28
|
+
data.particle.velocity.x *= -newVelocity;
|
|
29
|
+
bounced = true;
|
|
30
|
+
}
|
|
31
|
+
if (!bounced) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const minPos = data.offset.x + data.size;
|
|
35
|
+
if (data.bounds.right >= data.canvasSize.width && data.direction === engine.OutModeDirection.right) {
|
|
36
|
+
data.particle.position.x = data.canvasSize.width - minPos;
|
|
37
|
+
}
|
|
38
|
+
else if (data.bounds.left <= boundsMin && data.direction === engine.OutModeDirection.left) {
|
|
39
|
+
data.particle.position.x = minPos;
|
|
40
|
+
}
|
|
41
|
+
if (data.outMode === engine.OutMode.split) {
|
|
42
|
+
data.particle.destroy();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function bounceVertical(data) {
|
|
46
|
+
if ((data.outMode !== engine.OutMode.bounce && data.outMode !== engine.OutMode.split) ||
|
|
47
|
+
(data.direction !== engine.OutModeDirection.bottom && data.direction !== engine.OutModeDirection.top)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (data.bounds.bottom < boundsMin && data.direction === engine.OutModeDirection.top) {
|
|
51
|
+
data.particle.position.y = data.size + data.offset.y;
|
|
52
|
+
}
|
|
53
|
+
else if (data.bounds.top > data.canvasSize.height && data.direction === engine.OutModeDirection.bottom) {
|
|
54
|
+
data.particle.position.y = data.canvasSize.height - data.size - data.offset.y;
|
|
55
|
+
}
|
|
56
|
+
const velocity = data.particle.velocity.y;
|
|
57
|
+
let bounced = false;
|
|
58
|
+
if ((data.direction === engine.OutModeDirection.bottom &&
|
|
59
|
+
data.bounds.bottom >= data.canvasSize.height &&
|
|
60
|
+
velocity > minVelocity$3) ||
|
|
61
|
+
(data.direction === engine.OutModeDirection.top && data.bounds.top <= boundsMin && velocity < minVelocity$3)) {
|
|
62
|
+
const newVelocity = engine.getRangeValue(data.particle.options.bounce.vertical.value);
|
|
63
|
+
data.particle.velocity.y *= -newVelocity;
|
|
64
|
+
bounced = true;
|
|
65
|
+
}
|
|
66
|
+
if (!bounced) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const minPos = data.offset.y + data.size;
|
|
70
|
+
if (data.bounds.bottom >= data.canvasSize.height && data.direction === engine.OutModeDirection.bottom) {
|
|
71
|
+
data.particle.position.y = data.canvasSize.height - minPos;
|
|
72
|
+
}
|
|
73
|
+
else if (data.bounds.top <= boundsMin && data.direction === engine.OutModeDirection.top) {
|
|
74
|
+
data.particle.position.y = minPos;
|
|
75
|
+
}
|
|
76
|
+
if (data.outMode === engine.OutMode.split) {
|
|
77
|
+
data.particle.destroy();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
36
80
|
|
|
37
|
-
|
|
81
|
+
class BounceOutMode {
|
|
82
|
+
container;
|
|
83
|
+
modes;
|
|
84
|
+
_particleBouncePlugins;
|
|
85
|
+
constructor(container) {
|
|
86
|
+
this.container = container;
|
|
87
|
+
this.modes = [
|
|
88
|
+
engine.OutMode.bounce,
|
|
89
|
+
engine.OutMode.split,
|
|
90
|
+
];
|
|
91
|
+
this._particleBouncePlugins = container.plugins.filter(p => p.particleBounce !== undefined);
|
|
92
|
+
}
|
|
93
|
+
update(particle, direction, delta, outMode) {
|
|
94
|
+
if (!this.modes.includes(outMode)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const container = this.container;
|
|
98
|
+
let handled = false;
|
|
99
|
+
for (const plugin of this._particleBouncePlugins) {
|
|
100
|
+
handled = plugin.particleBounce?.(particle, delta, direction) ?? false;
|
|
101
|
+
if (handled) {
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (handled) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = engine.calculateBounds(pos, size), canvasSize = container.canvas.size;
|
|
109
|
+
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
110
|
+
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
38
113
|
|
|
39
|
-
|
|
114
|
+
const minVelocity$2 = 0;
|
|
115
|
+
class DestroyOutMode {
|
|
116
|
+
container;
|
|
117
|
+
modes;
|
|
118
|
+
constructor(container) {
|
|
119
|
+
this.container = container;
|
|
120
|
+
this.modes = [engine.OutMode.destroy];
|
|
121
|
+
}
|
|
122
|
+
update(particle, direction, _delta, outMode) {
|
|
123
|
+
if (!this.modes.includes(outMode)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const container = this.container;
|
|
127
|
+
switch (particle.outType) {
|
|
128
|
+
case engine.ParticleOutType.normal:
|
|
129
|
+
case engine.ParticleOutType.outside:
|
|
130
|
+
if (engine.isPointInside(particle.position, container.canvas.size, engine.originPoint, particle.getRadius(), direction)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
case engine.ParticleOutType.inside: {
|
|
135
|
+
const { dx, dy } = engine.getDistances(particle.position, particle.moveCenter), { x: vx, y: vy } = particle.velocity;
|
|
136
|
+
if ((vx < minVelocity$2 && dx > particle.moveCenter.radius) ||
|
|
137
|
+
(vy < minVelocity$2 && dy > particle.moveCenter.radius) ||
|
|
138
|
+
(vx >= minVelocity$2 && dx < -particle.moveCenter.radius) ||
|
|
139
|
+
(vy >= minVelocity$2 && dy < -particle.moveCenter.radius)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
particle.destroy(true);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
40
148
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
(
|
|
149
|
+
const minVelocity$1 = 0;
|
|
150
|
+
class NoneOutMode {
|
|
151
|
+
container;
|
|
152
|
+
modes;
|
|
153
|
+
constructor(container) {
|
|
154
|
+
this.container = container;
|
|
155
|
+
this.modes = [engine.OutMode.none];
|
|
156
|
+
}
|
|
157
|
+
update(particle, direction, _delta, outMode) {
|
|
158
|
+
if (!this.modes.includes(outMode)) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if ((particle.options.move.distance.horizontal &&
|
|
162
|
+
(direction === engine.OutModeDirection.left || direction === engine.OutModeDirection.right)) ??
|
|
163
|
+
(particle.options.move.distance.vertical &&
|
|
164
|
+
(direction === engine.OutModeDirection.top || direction === engine.OutModeDirection.bottom))) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const gravityOptions = particle.options.move.gravity, container = this.container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
|
|
168
|
+
if (!gravityOptions.enable) {
|
|
169
|
+
if ((particle.velocity.y > minVelocity$1 && particle.position.y <= canvasSize.height + pRadius) ||
|
|
170
|
+
(particle.velocity.y < minVelocity$1 && particle.position.y >= -pRadius) ||
|
|
171
|
+
(particle.velocity.x > minVelocity$1 && particle.position.x <= canvasSize.width + pRadius) ||
|
|
172
|
+
(particle.velocity.x < minVelocity$1 && particle.position.x >= -pRadius)) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (!engine.isPointInside(particle.position, container.canvas.size, engine.originPoint, pRadius, direction)) {
|
|
176
|
+
particle.destroy();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const position = particle.position;
|
|
181
|
+
if ((!gravityOptions.inverse &&
|
|
182
|
+
position.y > canvasSize.height + pRadius &&
|
|
183
|
+
direction === engine.OutModeDirection.bottom) ||
|
|
184
|
+
(gravityOptions.inverse && position.y < -pRadius && direction === engine.OutModeDirection.top)) {
|
|
185
|
+
particle.destroy();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
46
190
|
|
|
47
|
-
|
|
191
|
+
const minVelocity = 0, minDistance = 0, updateVector = engine.Vector.origin;
|
|
192
|
+
class OutOutMode {
|
|
193
|
+
container;
|
|
194
|
+
modes;
|
|
195
|
+
constructor(container) {
|
|
196
|
+
this.container = container;
|
|
197
|
+
this.modes = [engine.OutMode.out];
|
|
198
|
+
}
|
|
199
|
+
update(particle, direction, _delta, outMode) {
|
|
200
|
+
if (!this.modes.includes(outMode)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const container = this.container;
|
|
204
|
+
switch (particle.outType) {
|
|
205
|
+
case engine.ParticleOutType.inside: {
|
|
206
|
+
const { x: vx, y: vy } = particle.velocity;
|
|
207
|
+
updateVector.setTo(engine.originPoint);
|
|
208
|
+
updateVector.length = particle.moveCenter.radius;
|
|
209
|
+
updateVector.angle = particle.velocity.angle + Math.PI;
|
|
210
|
+
updateVector.addTo(particle.moveCenter);
|
|
211
|
+
const { dx, dy } = engine.getDistances(particle.position, updateVector);
|
|
212
|
+
if ((vx <= minVelocity && dx >= minDistance) ||
|
|
213
|
+
(vy <= minVelocity && dy >= minDistance) ||
|
|
214
|
+
(vx >= minVelocity && dx <= minDistance) ||
|
|
215
|
+
(vy >= minVelocity && dy <= minDistance)) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
particle.position.x = Math.floor(engine.randomInRangeValue({
|
|
219
|
+
min: 0,
|
|
220
|
+
max: container.canvas.size.width,
|
|
221
|
+
}));
|
|
222
|
+
particle.position.y = Math.floor(engine.randomInRangeValue({
|
|
223
|
+
min: 0,
|
|
224
|
+
max: container.canvas.size.height,
|
|
225
|
+
}));
|
|
226
|
+
const { dx: newDx, dy: newDy } = engine.getDistances(particle.position, particle.moveCenter);
|
|
227
|
+
particle.direction = Math.atan2(-newDy, -newDx);
|
|
228
|
+
particle.velocity.angle = particle.direction;
|
|
229
|
+
particle.justWarped = true;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
default: {
|
|
233
|
+
if (engine.isPointInside(particle.position, container.canvas.size, engine.originPoint, particle.getRadius(), direction)) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
switch (particle.outType) {
|
|
237
|
+
case engine.ParticleOutType.outside: {
|
|
238
|
+
particle.position.x =
|
|
239
|
+
Math.floor(engine.randomInRangeValue({
|
|
240
|
+
min: -particle.moveCenter.radius,
|
|
241
|
+
max: particle.moveCenter.radius,
|
|
242
|
+
})) + particle.moveCenter.x;
|
|
243
|
+
particle.position.y =
|
|
244
|
+
Math.floor(engine.randomInRangeValue({
|
|
245
|
+
min: -particle.moveCenter.radius,
|
|
246
|
+
max: particle.moveCenter.radius,
|
|
247
|
+
})) + particle.moveCenter.y;
|
|
248
|
+
const { dx, dy } = engine.getDistances(particle.position, particle.moveCenter);
|
|
249
|
+
if (particle.moveCenter.radius) {
|
|
250
|
+
particle.direction = Math.atan2(dy, dx);
|
|
251
|
+
particle.velocity.angle = particle.direction;
|
|
252
|
+
}
|
|
253
|
+
particle.justWarped = true;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
case engine.ParticleOutType.normal: {
|
|
257
|
+
const warp = particle.options.move.warp, canvasSize = container.canvas.size, newPos = {
|
|
258
|
+
bottom: canvasSize.height + particle.getRadius() + particle.offset.y,
|
|
259
|
+
left: -particle.getRadius() - particle.offset.x,
|
|
260
|
+
right: canvasSize.width + particle.getRadius() + particle.offset.x,
|
|
261
|
+
top: -particle.getRadius() - particle.offset.y,
|
|
262
|
+
}, sizeValue = particle.getRadius(), nextBounds = engine.calculateBounds(particle.position, sizeValue);
|
|
263
|
+
if (direction === engine.OutModeDirection.right && nextBounds.left > canvasSize.width + particle.offset.x) {
|
|
264
|
+
particle.position.x = newPos.left;
|
|
265
|
+
particle.initialPosition.x = particle.position.x;
|
|
266
|
+
if (!warp) {
|
|
267
|
+
particle.position.y = engine.getRandom() * canvasSize.height;
|
|
268
|
+
particle.initialPosition.y = particle.position.y;
|
|
269
|
+
}
|
|
270
|
+
particle.justWarped = true;
|
|
271
|
+
}
|
|
272
|
+
else if (direction === engine.OutModeDirection.left && nextBounds.right < -particle.offset.x) {
|
|
273
|
+
particle.position.x = newPos.right;
|
|
274
|
+
particle.initialPosition.x = particle.position.x;
|
|
275
|
+
if (!warp) {
|
|
276
|
+
particle.position.y = engine.getRandom() * canvasSize.height;
|
|
277
|
+
particle.initialPosition.y = particle.position.y;
|
|
278
|
+
}
|
|
279
|
+
particle.justWarped = true;
|
|
280
|
+
}
|
|
281
|
+
if (direction === engine.OutModeDirection.bottom && nextBounds.top > canvasSize.height + particle.offset.y) {
|
|
282
|
+
if (!warp) {
|
|
283
|
+
particle.position.x = engine.getRandom() * canvasSize.width;
|
|
284
|
+
particle.initialPosition.x = particle.position.x;
|
|
285
|
+
}
|
|
286
|
+
particle.position.y = newPos.top;
|
|
287
|
+
particle.initialPosition.y = particle.position.y;
|
|
288
|
+
particle.justWarped = true;
|
|
289
|
+
}
|
|
290
|
+
else if (direction === engine.OutModeDirection.top && nextBounds.bottom < -particle.offset.y) {
|
|
291
|
+
if (!warp) {
|
|
292
|
+
particle.position.x = engine.getRandom() * canvasSize.width;
|
|
293
|
+
particle.initialPosition.x = particle.position.x;
|
|
294
|
+
}
|
|
295
|
+
particle.position.y = newPos.bottom;
|
|
296
|
+
particle.initialPosition.y = particle.position.y;
|
|
297
|
+
particle.justWarped = true;
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
48
307
|
|
|
49
|
-
|
|
308
|
+
const checkOutMode = (outModes, outMode) => {
|
|
309
|
+
return (outModes.default === outMode ||
|
|
310
|
+
outModes.bottom === outMode ||
|
|
311
|
+
outModes.left === outMode ||
|
|
312
|
+
outModes.right === outMode ||
|
|
313
|
+
outModes.top === outMode);
|
|
314
|
+
};
|
|
315
|
+
class OutOfCanvasUpdater {
|
|
316
|
+
updaters;
|
|
317
|
+
container;
|
|
318
|
+
constructor(container) {
|
|
319
|
+
this.container = container;
|
|
320
|
+
this.updaters = new Map();
|
|
321
|
+
}
|
|
322
|
+
init(particle) {
|
|
323
|
+
this._addUpdaterIfMissing(particle, engine.OutMode.bounce, container => new BounceOutMode(container));
|
|
324
|
+
this._addUpdaterIfMissing(particle, engine.OutMode.out, container => new OutOutMode(container));
|
|
325
|
+
this._addUpdaterIfMissing(particle, engine.OutMode.destroy, container => new DestroyOutMode(container));
|
|
326
|
+
this._addUpdaterIfMissing(particle, engine.OutMode.none, container => new NoneOutMode(container));
|
|
327
|
+
}
|
|
328
|
+
isEnabled(particle) {
|
|
329
|
+
return !particle.destroyed && !particle.spawning;
|
|
330
|
+
}
|
|
331
|
+
update(particle, delta) {
|
|
332
|
+
const outModes = particle.options.move.outModes;
|
|
333
|
+
particle.justWarped = false;
|
|
334
|
+
this._updateOutMode(particle, delta, outModes.bottom ?? outModes.default, engine.OutModeDirection.bottom);
|
|
335
|
+
this._updateOutMode(particle, delta, outModes.left ?? outModes.default, engine.OutModeDirection.left);
|
|
336
|
+
this._updateOutMode(particle, delta, outModes.right ?? outModes.default, engine.OutModeDirection.right);
|
|
337
|
+
this._updateOutMode(particle, delta, outModes.top ?? outModes.default, engine.OutModeDirection.top);
|
|
338
|
+
}
|
|
339
|
+
_addUpdaterIfMissing = (particle, outMode, getUpdater) => {
|
|
340
|
+
const outModes = particle.options.move.outModes;
|
|
341
|
+
if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
|
|
342
|
+
this.updaters.set(outMode, getUpdater(this.container));
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
_updateOutMode = (particle, delta, outMode, direction) => {
|
|
346
|
+
for (const updater of this.updaters.values()) {
|
|
347
|
+
updater.update(particle, direction, delta, outMode);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
}
|
|
50
351
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/******/
|
|
70
|
-
/******/ // Execute the module function
|
|
71
|
-
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
72
|
-
/******/ delete __webpack_module_cache__[moduleId];
|
|
73
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
74
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
75
|
-
/******/ throw e;
|
|
76
|
-
/******/ }
|
|
77
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
78
|
-
/******/
|
|
79
|
-
/******/ // Return the exports of the module
|
|
80
|
-
/******/ return module.exports;
|
|
81
|
-
/******/ }
|
|
82
|
-
/******/
|
|
83
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
84
|
-
/******/ __webpack_require__.m = __webpack_modules__;
|
|
85
|
-
/******/
|
|
86
|
-
/************************************************************************/
|
|
87
|
-
/******/ /* webpack/runtime/define property getters */
|
|
88
|
-
/******/ (() => {
|
|
89
|
-
/******/ // define getter functions for harmony exports
|
|
90
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
91
|
-
/******/ for(var key in definition) {
|
|
92
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
93
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
94
|
-
/******/ }
|
|
95
|
-
/******/ }
|
|
96
|
-
/******/ };
|
|
97
|
-
/******/ })();
|
|
98
|
-
/******/
|
|
99
|
-
/******/ /* webpack/runtime/ensure chunk */
|
|
100
|
-
/******/ (() => {
|
|
101
|
-
/******/ __webpack_require__.f = {};
|
|
102
|
-
/******/ // This file contains only the entry chunk.
|
|
103
|
-
/******/ // The chunk loading function for additional chunks
|
|
104
|
-
/******/ __webpack_require__.e = (chunkId) => {
|
|
105
|
-
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
106
|
-
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
107
|
-
/******/ return promises;
|
|
108
|
-
/******/ }, []));
|
|
109
|
-
/******/ };
|
|
110
|
-
/******/ })();
|
|
111
|
-
/******/
|
|
112
|
-
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
113
|
-
/******/ (() => {
|
|
114
|
-
/******/ // This function allow to reference async chunks
|
|
115
|
-
/******/ __webpack_require__.u = (chunkId) => {
|
|
116
|
-
/******/ // return url for filenames based on template
|
|
117
|
-
/******/ return "" + chunkId + ".js";
|
|
118
|
-
/******/ };
|
|
119
|
-
/******/ })();
|
|
120
|
-
/******/
|
|
121
|
-
/******/ /* webpack/runtime/global */
|
|
122
|
-
/******/ (() => {
|
|
123
|
-
/******/ __webpack_require__.g = (function() {
|
|
124
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
125
|
-
/******/ try {
|
|
126
|
-
/******/ return this || new Function('return this')();
|
|
127
|
-
/******/ } catch (e) {
|
|
128
|
-
/******/ if (typeof window === 'object') return window;
|
|
129
|
-
/******/ }
|
|
130
|
-
/******/ })();
|
|
131
|
-
/******/ })();
|
|
132
|
-
/******/
|
|
133
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
134
|
-
/******/ (() => {
|
|
135
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
136
|
-
/******/ })();
|
|
137
|
-
/******/
|
|
138
|
-
/******/ /* webpack/runtime/load script */
|
|
139
|
-
/******/ (() => {
|
|
140
|
-
/******/ var inProgress = {};
|
|
141
|
-
/******/ var dataWebpackPrefix = "@tsparticles/updater-out-modes:";
|
|
142
|
-
/******/ // loadScript function to load a script via script tag
|
|
143
|
-
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
144
|
-
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
145
|
-
/******/ var script, needAttach;
|
|
146
|
-
/******/ if(key !== undefined) {
|
|
147
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
148
|
-
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
149
|
-
/******/ var s = scripts[i];
|
|
150
|
-
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
151
|
-
/******/ }
|
|
152
|
-
/******/ }
|
|
153
|
-
/******/ if(!script) {
|
|
154
|
-
/******/ needAttach = true;
|
|
155
|
-
/******/ script = document.createElement('script');
|
|
156
|
-
/******/
|
|
157
|
-
/******/ script.charset = 'utf-8';
|
|
158
|
-
/******/ if (__webpack_require__.nc) {
|
|
159
|
-
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
160
|
-
/******/ }
|
|
161
|
-
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
162
|
-
/******/
|
|
163
|
-
/******/ script.src = url;
|
|
164
|
-
/******/ }
|
|
165
|
-
/******/ inProgress[url] = [done];
|
|
166
|
-
/******/ var onScriptComplete = (prev, event) => {
|
|
167
|
-
/******/ // avoid mem leaks in IE.
|
|
168
|
-
/******/ script.onerror = script.onload = null;
|
|
169
|
-
/******/ clearTimeout(timeout);
|
|
170
|
-
/******/ var doneFns = inProgress[url];
|
|
171
|
-
/******/ delete inProgress[url];
|
|
172
|
-
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
173
|
-
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
174
|
-
/******/ if(prev) return prev(event);
|
|
175
|
-
/******/ }
|
|
176
|
-
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
177
|
-
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
178
|
-
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
179
|
-
/******/ needAttach && document.head.appendChild(script);
|
|
180
|
-
/******/ };
|
|
181
|
-
/******/ })();
|
|
182
|
-
/******/
|
|
183
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
184
|
-
/******/ (() => {
|
|
185
|
-
/******/ // define __esModule on exports
|
|
186
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
187
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
188
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
189
|
-
/******/ }
|
|
190
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
191
|
-
/******/ };
|
|
192
|
-
/******/ })();
|
|
193
|
-
/******/
|
|
194
|
-
/******/ /* webpack/runtime/publicPath */
|
|
195
|
-
/******/ (() => {
|
|
196
|
-
/******/ var scriptUrl;
|
|
197
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
198
|
-
/******/ var document = __webpack_require__.g.document;
|
|
199
|
-
/******/ if (!scriptUrl && document) {
|
|
200
|
-
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
201
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
202
|
-
/******/ if (!scriptUrl) {
|
|
203
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
204
|
-
/******/ if(scripts.length) {
|
|
205
|
-
/******/ var i = scripts.length - 1;
|
|
206
|
-
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
207
|
-
/******/ }
|
|
208
|
-
/******/ }
|
|
209
|
-
/******/ }
|
|
210
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
211
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
212
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
213
|
-
/******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
214
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
215
|
-
/******/ })();
|
|
216
|
-
/******/
|
|
217
|
-
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
218
|
-
/******/ (() => {
|
|
219
|
-
/******/ // no baseURI
|
|
220
|
-
/******/
|
|
221
|
-
/******/ // object to store loaded and loading chunks
|
|
222
|
-
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
223
|
-
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
224
|
-
/******/ var installedChunks = {
|
|
225
|
-
/******/ "tsparticles.updater.out-modes": 0
|
|
226
|
-
/******/ };
|
|
227
|
-
/******/
|
|
228
|
-
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
229
|
-
/******/ // JSONP chunk loading for javascript
|
|
230
|
-
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
231
|
-
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
232
|
-
/******/
|
|
233
|
-
/******/ // a Promise means "currently loading".
|
|
234
|
-
/******/ if(installedChunkData) {
|
|
235
|
-
/******/ promises.push(installedChunkData[2]);
|
|
236
|
-
/******/ } else {
|
|
237
|
-
/******/ if(true) { // all chunks have JS
|
|
238
|
-
/******/ // setup Promise in chunk cache
|
|
239
|
-
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
240
|
-
/******/ promises.push(installedChunkData[2] = promise);
|
|
241
|
-
/******/
|
|
242
|
-
/******/ // start chunk loading
|
|
243
|
-
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
244
|
-
/******/ // create error before stack unwound to get useful stacktrace later
|
|
245
|
-
/******/ var error = new Error();
|
|
246
|
-
/******/ var loadingEnded = (event) => {
|
|
247
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
248
|
-
/******/ installedChunkData = installedChunks[chunkId];
|
|
249
|
-
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
250
|
-
/******/ if(installedChunkData) {
|
|
251
|
-
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
252
|
-
/******/ var realSrc = event && event.target && event.target.src;
|
|
253
|
-
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
254
|
-
/******/ error.name = 'ChunkLoadError';
|
|
255
|
-
/******/ error.type = errorType;
|
|
256
|
-
/******/ error.request = realSrc;
|
|
257
|
-
/******/ installedChunkData[1](error);
|
|
258
|
-
/******/ }
|
|
259
|
-
/******/ }
|
|
260
|
-
/******/ };
|
|
261
|
-
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
262
|
-
/******/ }
|
|
263
|
-
/******/ }
|
|
264
|
-
/******/ }
|
|
265
|
-
/******/ };
|
|
266
|
-
/******/
|
|
267
|
-
/******/ // no prefetching
|
|
268
|
-
/******/
|
|
269
|
-
/******/ // no preloaded
|
|
270
|
-
/******/
|
|
271
|
-
/******/ // no HMR
|
|
272
|
-
/******/
|
|
273
|
-
/******/ // no HMR manifest
|
|
274
|
-
/******/
|
|
275
|
-
/******/ // no on chunks loaded
|
|
276
|
-
/******/
|
|
277
|
-
/******/ // install a JSONP callback for chunk loading
|
|
278
|
-
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
279
|
-
/******/ var [chunkIds, moreModules, runtime] = data;
|
|
280
|
-
/******/ // add "moreModules" to the modules object,
|
|
281
|
-
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
282
|
-
/******/ var moduleId, chunkId, i = 0;
|
|
283
|
-
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
284
|
-
/******/ for(moduleId in moreModules) {
|
|
285
|
-
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
286
|
-
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
287
|
-
/******/ }
|
|
288
|
-
/******/ }
|
|
289
|
-
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
290
|
-
/******/ }
|
|
291
|
-
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
292
|
-
/******/ for(;i < chunkIds.length; i++) {
|
|
293
|
-
/******/ chunkId = chunkIds[i];
|
|
294
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
295
|
-
/******/ installedChunks[chunkId][0]();
|
|
296
|
-
/******/ }
|
|
297
|
-
/******/ installedChunks[chunkId] = 0;
|
|
298
|
-
/******/ }
|
|
299
|
-
/******/
|
|
300
|
-
/******/ }
|
|
301
|
-
/******/
|
|
302
|
-
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_updater_out_modes"] = this["webpackChunk_tsparticles_updater_out_modes"] || [];
|
|
303
|
-
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
304
|
-
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
305
|
-
/******/ })();
|
|
306
|
-
/******/
|
|
307
|
-
/************************************************************************/
|
|
308
|
-
/******/
|
|
309
|
-
/******/ // startup
|
|
310
|
-
/******/ // Load entry module and return exports
|
|
311
|
-
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
312
|
-
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
313
|
-
/******/
|
|
314
|
-
/******/ return __webpack_exports__;
|
|
315
|
-
/******/ })()
|
|
316
|
-
;
|
|
317
|
-
});
|
|
352
|
+
async function loadOutModesUpdater(engine) {
|
|
353
|
+
engine.checkVersion("4.0.1");
|
|
354
|
+
await engine.pluginManager.register(e => {
|
|
355
|
+
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
356
|
+
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const globalObject = globalThis;
|
|
362
|
+
globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
|
|
363
|
+
globalObject.loadOutModesUpdater = loadOutModesUpdater;
|
|
364
|
+
|
|
365
|
+
exports.loadOutModesUpdater = loadOutModesUpdater;
|
|
366
|
+
|
|
367
|
+
}));
|
|
368
|
+
Object.assign(globalThis.window || globalThis, { loadOutModesUpdater: (globalThis.__tsParticlesInternals.updaters.outModes || {}).loadOutModesUpdater });
|
|
369
|
+
delete (globalThis.window || globalThis).tsparticlesInternalExports;
|