@tsparticles/updater-out-modes 3.1.0 → 3.2.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/103.min.js +2 -0
- package/103.min.js.LICENSE.txt +1 -0
- package/388.min.js +2 -0
- package/388.min.js.LICENSE.txt +1 -0
- package/53.min.js +2 -0
- package/53.min.js.LICENSE.txt +1 -0
- package/569.min.js +2 -0
- package/569.min.js.LICENSE.txt +1 -0
- package/886.min.js +2 -0
- package/886.min.js.LICENSE.txt +1 -0
- package/920.min.js +2 -0
- package/920.min.js.LICENSE.txt +1 -0
- package/browser/BounceOutMode.js +3 -8
- package/browser/DestroyOutMode.js +3 -3
- package/browser/NoneOutMode.js +3 -4
- package/browser/OutOfCanvasUpdater.js +34 -18
- package/browser/OutOutMode.js +2 -1
- package/browser/Utils.js +2 -8
- package/browser/index.js +4 -2
- package/cjs/BounceOutMode.js +28 -10
- package/cjs/DestroyOutMode.js +3 -3
- package/cjs/NoneOutMode.js +3 -4
- package/cjs/OutOfCanvasUpdater.js +57 -18
- package/cjs/OutOutMode.js +2 -1
- package/cjs/Utils.js +2 -8
- package/cjs/index.js +27 -2
- package/dist_browser_BounceOutMode_js.js +30 -0
- package/dist_browser_DestroyOutMode_js.js +30 -0
- package/dist_browser_NoneOutMode_js.js +30 -0
- package/dist_browser_OutOfCanvasUpdater_js.js +30 -0
- package/dist_browser_OutOutMode_js.js +30 -0
- package/dist_browser_Utils_js.js +30 -0
- package/esm/BounceOutMode.js +3 -8
- package/esm/DestroyOutMode.js +3 -3
- package/esm/NoneOutMode.js +3 -4
- package/esm/OutOfCanvasUpdater.js +34 -18
- package/esm/OutOutMode.js +2 -1
- package/esm/Utils.js +2 -8
- package/esm/index.js +4 -2
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.updater.out-modes.js +241 -360
- package/tsparticles.updater.out-modes.min.js +1 -1
- package/tsparticles.updater.out-modes.min.js.LICENSE.txt +1 -1
- package/types/BounceOutMode.d.ts +3 -3
- package/types/DestroyOutMode.d.ts +3 -3
- package/types/IBounceData.d.ts +2 -2
- package/types/IOutModeManager.d.ts +3 -3
- package/types/NoneOutMode.d.ts +3 -3
- package/types/OutOfCanvasUpdater.d.ts +2 -2
- package/types/OutOutMode.d.ts +3 -3
- package/umd/BounceOutMode.js +30 -11
- package/umd/DestroyOutMode.js +3 -3
- package/umd/NoneOutMode.js +3 -4
- package/umd/OutOfCanvasUpdater.js +59 -19
- package/umd/OutOutMode.js +2 -1
- package/umd/Utils.js +2 -8
- package/umd/index.js +29 -3
|
@@ -4,7 +4,15 @@
|
|
|
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
|
-
* v3.
|
|
7
|
+
* v3.2.0
|
|
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/).
|
|
8
16
|
*/
|
|
9
17
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
18
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -15,15 +23,28 @@
|
|
|
15
23
|
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
16
24
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
17
25
|
}
|
|
18
|
-
})(this, (
|
|
26
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
19
27
|
return /******/ (() => { // webpackBootstrap
|
|
20
28
|
/******/ "use strict";
|
|
21
29
|
/******/ var __webpack_modules__ = ({
|
|
22
30
|
|
|
23
|
-
/***/
|
|
31
|
+
/***/ "./dist/browser/index.js":
|
|
32
|
+
/*!*******************************!*\
|
|
33
|
+
!*** ./dist/browser/index.js ***!
|
|
34
|
+
\*******************************/
|
|
35
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
+
|
|
37
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadOutModesUpdater: () => (/* binding */ loadOutModesUpdater)\n/* harmony export */ });\nasync function loadOutModesUpdater(engine, refresh = true) {\n await engine.addParticleUpdater(\"outModes\", async container => {\n const {\n OutOfCanvasUpdater\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_OutOfCanvasUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./OutOfCanvasUpdater.js */ \"./dist/browser/OutOfCanvasUpdater.js\"));\n return new OutOfCanvasUpdater(container);\n }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/updater-out-modes/./dist/browser/index.js?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ "@tsparticles/engine":
|
|
42
|
+
/*!*********************************************************************************************************************************!*\
|
|
43
|
+
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
44
|
+
\*********************************************************************************************************************************/
|
|
24
45
|
/***/ ((module) => {
|
|
25
46
|
|
|
26
|
-
module.exports =
|
|
47
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
27
48
|
|
|
28
49
|
/***/ })
|
|
29
50
|
|
|
@@ -53,7 +74,22 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
|
|
|
53
74
|
/******/ return module.exports;
|
|
54
75
|
/******/ }
|
|
55
76
|
/******/
|
|
77
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
78
|
+
/******/ __webpack_require__.m = __webpack_modules__;
|
|
79
|
+
/******/
|
|
56
80
|
/************************************************************************/
|
|
81
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
82
|
+
/******/ (() => {
|
|
83
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
84
|
+
/******/ __webpack_require__.n = (module) => {
|
|
85
|
+
/******/ var getter = module && module.__esModule ?
|
|
86
|
+
/******/ () => (module['default']) :
|
|
87
|
+
/******/ () => (module);
|
|
88
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
89
|
+
/******/ return getter;
|
|
90
|
+
/******/ };
|
|
91
|
+
/******/ })();
|
|
92
|
+
/******/
|
|
57
93
|
/******/ /* webpack/runtime/define property getters */
|
|
58
94
|
/******/ (() => {
|
|
59
95
|
/******/ // define getter functions for harmony exports
|
|
@@ -66,11 +102,91 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
|
|
|
66
102
|
/******/ };
|
|
67
103
|
/******/ })();
|
|
68
104
|
/******/
|
|
105
|
+
/******/ /* webpack/runtime/ensure chunk */
|
|
106
|
+
/******/ (() => {
|
|
107
|
+
/******/ __webpack_require__.f = {};
|
|
108
|
+
/******/ // This file contains only the entry chunk.
|
|
109
|
+
/******/ // The chunk loading function for additional chunks
|
|
110
|
+
/******/ __webpack_require__.e = (chunkId) => {
|
|
111
|
+
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
112
|
+
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
113
|
+
/******/ return promises;
|
|
114
|
+
/******/ }, []));
|
|
115
|
+
/******/ };
|
|
116
|
+
/******/ })();
|
|
117
|
+
/******/
|
|
118
|
+
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
119
|
+
/******/ (() => {
|
|
120
|
+
/******/ // This function allow to reference async chunks
|
|
121
|
+
/******/ __webpack_require__.u = (chunkId) => {
|
|
122
|
+
/******/ // return url for filenames based on template
|
|
123
|
+
/******/ return "" + chunkId + ".js";
|
|
124
|
+
/******/ };
|
|
125
|
+
/******/ })();
|
|
126
|
+
/******/
|
|
127
|
+
/******/ /* webpack/runtime/global */
|
|
128
|
+
/******/ (() => {
|
|
129
|
+
/******/ __webpack_require__.g = (function() {
|
|
130
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
131
|
+
/******/ try {
|
|
132
|
+
/******/ return this || new Function('return this')();
|
|
133
|
+
/******/ } catch (e) {
|
|
134
|
+
/******/ if (typeof window === 'object') return window;
|
|
135
|
+
/******/ }
|
|
136
|
+
/******/ })();
|
|
137
|
+
/******/ })();
|
|
138
|
+
/******/
|
|
69
139
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
70
140
|
/******/ (() => {
|
|
71
141
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
72
142
|
/******/ })();
|
|
73
143
|
/******/
|
|
144
|
+
/******/ /* webpack/runtime/load script */
|
|
145
|
+
/******/ (() => {
|
|
146
|
+
/******/ var inProgress = {};
|
|
147
|
+
/******/ var dataWebpackPrefix = "@tsparticles/updater-out-modes:";
|
|
148
|
+
/******/ // loadScript function to load a script via script tag
|
|
149
|
+
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
150
|
+
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
151
|
+
/******/ var script, needAttach;
|
|
152
|
+
/******/ if(key !== undefined) {
|
|
153
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
154
|
+
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
155
|
+
/******/ var s = scripts[i];
|
|
156
|
+
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
157
|
+
/******/ }
|
|
158
|
+
/******/ }
|
|
159
|
+
/******/ if(!script) {
|
|
160
|
+
/******/ needAttach = true;
|
|
161
|
+
/******/ script = document.createElement('script');
|
|
162
|
+
/******/
|
|
163
|
+
/******/ script.charset = 'utf-8';
|
|
164
|
+
/******/ script.timeout = 120;
|
|
165
|
+
/******/ if (__webpack_require__.nc) {
|
|
166
|
+
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
167
|
+
/******/ }
|
|
168
|
+
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
169
|
+
/******/
|
|
170
|
+
/******/ script.src = url;
|
|
171
|
+
/******/ }
|
|
172
|
+
/******/ inProgress[url] = [done];
|
|
173
|
+
/******/ var onScriptComplete = (prev, event) => {
|
|
174
|
+
/******/ // avoid mem leaks in IE.
|
|
175
|
+
/******/ script.onerror = script.onload = null;
|
|
176
|
+
/******/ clearTimeout(timeout);
|
|
177
|
+
/******/ var doneFns = inProgress[url];
|
|
178
|
+
/******/ delete inProgress[url];
|
|
179
|
+
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
180
|
+
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
181
|
+
/******/ if(prev) return prev(event);
|
|
182
|
+
/******/ }
|
|
183
|
+
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
184
|
+
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
185
|
+
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
186
|
+
/******/ needAttach && document.head.appendChild(script);
|
|
187
|
+
/******/ };
|
|
188
|
+
/******/ })();
|
|
189
|
+
/******/
|
|
74
190
|
/******/ /* webpack/runtime/make namespace object */
|
|
75
191
|
/******/ (() => {
|
|
76
192
|
/******/ // define __esModule on exports
|
|
@@ -82,363 +198,128 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
|
|
|
82
198
|
/******/ };
|
|
83
199
|
/******/ })();
|
|
84
200
|
/******/
|
|
201
|
+
/******/ /* webpack/runtime/publicPath */
|
|
202
|
+
/******/ (() => {
|
|
203
|
+
/******/ var scriptUrl;
|
|
204
|
+
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
205
|
+
/******/ var document = __webpack_require__.g.document;
|
|
206
|
+
/******/ if (!scriptUrl && document) {
|
|
207
|
+
/******/ if (document.currentScript)
|
|
208
|
+
/******/ scriptUrl = document.currentScript.src;
|
|
209
|
+
/******/ if (!scriptUrl) {
|
|
210
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
211
|
+
/******/ if(scripts.length) {
|
|
212
|
+
/******/ var i = scripts.length - 1;
|
|
213
|
+
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
|
|
214
|
+
/******/ }
|
|
215
|
+
/******/ }
|
|
216
|
+
/******/ }
|
|
217
|
+
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
218
|
+
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
219
|
+
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
220
|
+
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
221
|
+
/******/ __webpack_require__.p = scriptUrl;
|
|
222
|
+
/******/ })();
|
|
223
|
+
/******/
|
|
224
|
+
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
225
|
+
/******/ (() => {
|
|
226
|
+
/******/ // no baseURI
|
|
227
|
+
/******/
|
|
228
|
+
/******/ // object to store loaded and loading chunks
|
|
229
|
+
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
230
|
+
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
231
|
+
/******/ var installedChunks = {
|
|
232
|
+
/******/ "tsparticles.updater.out-modes": 0
|
|
233
|
+
/******/ };
|
|
234
|
+
/******/
|
|
235
|
+
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
236
|
+
/******/ // JSONP chunk loading for javascript
|
|
237
|
+
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
238
|
+
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
239
|
+
/******/
|
|
240
|
+
/******/ // a Promise means "currently loading".
|
|
241
|
+
/******/ if(installedChunkData) {
|
|
242
|
+
/******/ promises.push(installedChunkData[2]);
|
|
243
|
+
/******/ } else {
|
|
244
|
+
/******/ if(true) { // all chunks have JS
|
|
245
|
+
/******/ // setup Promise in chunk cache
|
|
246
|
+
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
247
|
+
/******/ promises.push(installedChunkData[2] = promise);
|
|
248
|
+
/******/
|
|
249
|
+
/******/ // start chunk loading
|
|
250
|
+
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
251
|
+
/******/ // create error before stack unwound to get useful stacktrace later
|
|
252
|
+
/******/ var error = new Error();
|
|
253
|
+
/******/ var loadingEnded = (event) => {
|
|
254
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
255
|
+
/******/ installedChunkData = installedChunks[chunkId];
|
|
256
|
+
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
257
|
+
/******/ if(installedChunkData) {
|
|
258
|
+
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
259
|
+
/******/ var realSrc = event && event.target && event.target.src;
|
|
260
|
+
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
261
|
+
/******/ error.name = 'ChunkLoadError';
|
|
262
|
+
/******/ error.type = errorType;
|
|
263
|
+
/******/ error.request = realSrc;
|
|
264
|
+
/******/ installedChunkData[1](error);
|
|
265
|
+
/******/ }
|
|
266
|
+
/******/ }
|
|
267
|
+
/******/ };
|
|
268
|
+
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
269
|
+
/******/ }
|
|
270
|
+
/******/ }
|
|
271
|
+
/******/ }
|
|
272
|
+
/******/ };
|
|
273
|
+
/******/
|
|
274
|
+
/******/ // no prefetching
|
|
275
|
+
/******/
|
|
276
|
+
/******/ // no preloaded
|
|
277
|
+
/******/
|
|
278
|
+
/******/ // no HMR
|
|
279
|
+
/******/
|
|
280
|
+
/******/ // no HMR manifest
|
|
281
|
+
/******/
|
|
282
|
+
/******/ // no on chunks loaded
|
|
283
|
+
/******/
|
|
284
|
+
/******/ // install a JSONP callback for chunk loading
|
|
285
|
+
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
286
|
+
/******/ var chunkIds = data[0];
|
|
287
|
+
/******/ var moreModules = data[1];
|
|
288
|
+
/******/ var runtime = data[2];
|
|
289
|
+
/******/ // add "moreModules" to the modules object,
|
|
290
|
+
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
291
|
+
/******/ var moduleId, chunkId, i = 0;
|
|
292
|
+
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
293
|
+
/******/ for(moduleId in moreModules) {
|
|
294
|
+
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
295
|
+
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
296
|
+
/******/ }
|
|
297
|
+
/******/ }
|
|
298
|
+
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
299
|
+
/******/ }
|
|
300
|
+
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
301
|
+
/******/ for(;i < chunkIds.length; i++) {
|
|
302
|
+
/******/ chunkId = chunkIds[i];
|
|
303
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
304
|
+
/******/ installedChunks[chunkId][0]();
|
|
305
|
+
/******/ }
|
|
306
|
+
/******/ installedChunks[chunkId] = 0;
|
|
307
|
+
/******/ }
|
|
308
|
+
/******/
|
|
309
|
+
/******/ }
|
|
310
|
+
/******/
|
|
311
|
+
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_updater_out_modes"] = this["webpackChunk_tsparticles_updater_out_modes"] || [];
|
|
312
|
+
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
313
|
+
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
314
|
+
/******/ })();
|
|
315
|
+
/******/
|
|
85
316
|
/************************************************************************/
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
//
|
|
90
|
-
__webpack_require__.
|
|
91
|
-
|
|
92
|
-
// EXPORTS
|
|
93
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
94
|
-
loadOutModesUpdater: () => (/* binding */ loadOutModesUpdater)
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
98
|
-
var engine_root_window_ = __webpack_require__(533);
|
|
99
|
-
;// CONCATENATED MODULE: ./dist/browser/Utils.js
|
|
100
|
-
|
|
101
|
-
const minVelocity = 0,
|
|
102
|
-
boundsMin = 0;
|
|
103
|
-
function bounceHorizontal(data) {
|
|
104
|
-
if (data.outMode !== "bounce" && data.outMode !== "bounce-horizontal" && data.outMode !== "bounceHorizontal" && data.outMode !== "split" || data.direction !== "left" && data.direction !== "right") {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (data.bounds.right < boundsMin && data.direction === "left") {
|
|
108
|
-
data.particle.position.x = data.size + data.offset.x;
|
|
109
|
-
} else if (data.bounds.left > data.canvasSize.width && data.direction === "right") {
|
|
110
|
-
data.particle.position.x = data.canvasSize.width - data.size - data.offset.x;
|
|
111
|
-
}
|
|
112
|
-
const velocity = data.particle.velocity.x;
|
|
113
|
-
let bounced = false;
|
|
114
|
-
if (data.direction === "right" && data.bounds.right >= data.canvasSize.width && velocity > minVelocity || data.direction === "left" && data.bounds.left <= boundsMin && velocity < minVelocity) {
|
|
115
|
-
const newVelocity = (0,engine_root_window_.getRangeValue)(data.particle.options.bounce.horizontal.value);
|
|
116
|
-
data.particle.velocity.x *= -newVelocity;
|
|
117
|
-
bounced = true;
|
|
118
|
-
}
|
|
119
|
-
if (!bounced) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const minPos = data.offset.x + data.size;
|
|
123
|
-
if (data.bounds.right >= data.canvasSize.width && data.direction === "right") {
|
|
124
|
-
data.particle.position.x = data.canvasSize.width - minPos;
|
|
125
|
-
} else if (data.bounds.left <= boundsMin && data.direction === "left") {
|
|
126
|
-
data.particle.position.x = minPos;
|
|
127
|
-
}
|
|
128
|
-
if (data.outMode === "split") {
|
|
129
|
-
data.particle.destroy();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function bounceVertical(data) {
|
|
133
|
-
if (data.outMode !== "bounce" && data.outMode !== "bounce-vertical" && data.outMode !== "bounceVertical" && data.outMode !== "split" || data.direction !== "bottom" && data.direction !== "top") {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
if (data.bounds.bottom < boundsMin && data.direction === "top") {
|
|
137
|
-
data.particle.position.y = data.size + data.offset.y;
|
|
138
|
-
} else if (data.bounds.top > data.canvasSize.height && data.direction === "bottom") {
|
|
139
|
-
data.particle.position.y = data.canvasSize.height - data.size - data.offset.y;
|
|
140
|
-
}
|
|
141
|
-
const velocity = data.particle.velocity.y;
|
|
142
|
-
let bounced = false;
|
|
143
|
-
if (data.direction === "bottom" && data.bounds.bottom >= data.canvasSize.height && velocity > minVelocity || data.direction === "top" && data.bounds.top <= boundsMin && velocity < minVelocity) {
|
|
144
|
-
const newVelocity = (0,engine_root_window_.getRangeValue)(data.particle.options.bounce.vertical.value);
|
|
145
|
-
data.particle.velocity.y *= -newVelocity;
|
|
146
|
-
bounced = true;
|
|
147
|
-
}
|
|
148
|
-
if (!bounced) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
const minPos = data.offset.y + data.size;
|
|
152
|
-
if (data.bounds.bottom >= data.canvasSize.height && data.direction === "bottom") {
|
|
153
|
-
data.particle.position.y = data.canvasSize.height - minPos;
|
|
154
|
-
} else if (data.bounds.top <= boundsMin && data.direction === "top") {
|
|
155
|
-
data.particle.position.y = minPos;
|
|
156
|
-
}
|
|
157
|
-
if (data.outMode === "split") {
|
|
158
|
-
data.particle.destroy();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
;// CONCATENATED MODULE: ./dist/browser/BounceOutMode.js
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
class BounceOutMode {
|
|
165
|
-
constructor(container) {
|
|
166
|
-
this.container = container;
|
|
167
|
-
this.modes = ["bounce", "bounce-vertical", "bounce-horizontal", "bounceVertical", "bounceHorizontal", "split"];
|
|
168
|
-
}
|
|
169
|
-
update(particle, direction, delta, outMode) {
|
|
170
|
-
if (!this.modes.includes(outMode)) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const container = this.container;
|
|
174
|
-
let handled = false;
|
|
175
|
-
for (const [, plugin] of container.plugins) {
|
|
176
|
-
if (plugin.particleBounce !== undefined) {
|
|
177
|
-
handled = plugin.particleBounce(particle, delta, direction);
|
|
178
|
-
}
|
|
179
|
-
if (handled) {
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (handled) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
const pos = particle.getPosition(),
|
|
187
|
-
offset = particle.offset,
|
|
188
|
-
size = particle.getRadius(),
|
|
189
|
-
bounds = (0,engine_root_window_.calculateBounds)(pos, size),
|
|
190
|
-
canvasSize = container.canvas.size;
|
|
191
|
-
bounceHorizontal({
|
|
192
|
-
particle,
|
|
193
|
-
outMode,
|
|
194
|
-
direction,
|
|
195
|
-
bounds,
|
|
196
|
-
canvasSize,
|
|
197
|
-
offset,
|
|
198
|
-
size
|
|
199
|
-
});
|
|
200
|
-
bounceVertical({
|
|
201
|
-
particle,
|
|
202
|
-
outMode,
|
|
203
|
-
direction,
|
|
204
|
-
bounds,
|
|
205
|
-
canvasSize,
|
|
206
|
-
offset,
|
|
207
|
-
size
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
;// CONCATENATED MODULE: ./dist/browser/DestroyOutMode.js
|
|
212
|
-
|
|
213
|
-
const DestroyOutMode_minVelocity = 0;
|
|
214
|
-
class DestroyOutMode {
|
|
215
|
-
constructor(container) {
|
|
216
|
-
this.container = container;
|
|
217
|
-
this.modes = ["destroy"];
|
|
218
|
-
}
|
|
219
|
-
update(particle, direction, _delta, outMode) {
|
|
220
|
-
if (!this.modes.includes(outMode)) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
const container = this.container;
|
|
224
|
-
switch (particle.outType) {
|
|
225
|
-
case "normal":
|
|
226
|
-
case "outside":
|
|
227
|
-
if ((0,engine_root_window_.isPointInside)(particle.position, container.canvas.size, engine_root_window_.Vector.origin, particle.getRadius(), direction)) {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
break;
|
|
231
|
-
case "inside":
|
|
232
|
-
{
|
|
233
|
-
const {
|
|
234
|
-
dx,
|
|
235
|
-
dy
|
|
236
|
-
} = (0,engine_root_window_.getDistances)(particle.position, particle.moveCenter);
|
|
237
|
-
const {
|
|
238
|
-
x: vx,
|
|
239
|
-
y: vy
|
|
240
|
-
} = particle.velocity;
|
|
241
|
-
if (vx < DestroyOutMode_minVelocity && dx > particle.moveCenter.radius || vy < DestroyOutMode_minVelocity && dy > particle.moveCenter.radius || vx >= DestroyOutMode_minVelocity && dx < -particle.moveCenter.radius || vy >= DestroyOutMode_minVelocity && dy < -particle.moveCenter.radius) {
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
container.particles.remove(particle, undefined, true);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
;// CONCATENATED MODULE: ./dist/browser/NoneOutMode.js
|
|
251
|
-
|
|
252
|
-
const NoneOutMode_minVelocity = 0;
|
|
253
|
-
class NoneOutMode {
|
|
254
|
-
constructor(container) {
|
|
255
|
-
this.container = container;
|
|
256
|
-
this.modes = ["none"];
|
|
257
|
-
}
|
|
258
|
-
update(particle, direction, delta, outMode) {
|
|
259
|
-
if (!this.modes.includes(outMode)) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
if ((particle.options.move.distance.horizontal && (direction === "left" || direction === "right")) ?? (particle.options.move.distance.vertical && (direction === "top" || direction === "bottom"))) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
const gravityOptions = particle.options.move.gravity,
|
|
266
|
-
container = this.container;
|
|
267
|
-
const canvasSize = container.canvas.size;
|
|
268
|
-
const pRadius = particle.getRadius();
|
|
269
|
-
if (!gravityOptions.enable) {
|
|
270
|
-
if (particle.velocity.y > NoneOutMode_minVelocity && particle.position.y <= canvasSize.height + pRadius || particle.velocity.y < NoneOutMode_minVelocity && particle.position.y >= -pRadius || particle.velocity.x > NoneOutMode_minVelocity && particle.position.x <= canvasSize.width + pRadius || particle.velocity.x < NoneOutMode_minVelocity && particle.position.x >= -pRadius) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
if (!(0,engine_root_window_.isPointInside)(particle.position, container.canvas.size, engine_root_window_.Vector.origin, pRadius, direction)) {
|
|
274
|
-
container.particles.remove(particle);
|
|
275
|
-
}
|
|
276
|
-
} else {
|
|
277
|
-
const position = particle.position;
|
|
278
|
-
if (!gravityOptions.inverse && position.y > canvasSize.height + pRadius && direction === "bottom" || gravityOptions.inverse && position.y < -pRadius && direction === "top") {
|
|
279
|
-
container.particles.remove(particle);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
;// CONCATENATED MODULE: ./dist/browser/OutOutMode.js
|
|
285
|
-
|
|
286
|
-
const OutOutMode_minVelocity = 0,
|
|
287
|
-
minDistance = 0;
|
|
288
|
-
class OutOutMode {
|
|
289
|
-
constructor(container) {
|
|
290
|
-
this.container = container;
|
|
291
|
-
this.modes = ["out"];
|
|
292
|
-
}
|
|
293
|
-
update(particle, direction, delta, outMode) {
|
|
294
|
-
if (!this.modes.includes(outMode)) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
const container = this.container;
|
|
298
|
-
switch (particle.outType) {
|
|
299
|
-
case "inside":
|
|
300
|
-
{
|
|
301
|
-
const {
|
|
302
|
-
x: vx,
|
|
303
|
-
y: vy
|
|
304
|
-
} = particle.velocity;
|
|
305
|
-
const circVec = engine_root_window_.Vector.origin;
|
|
306
|
-
circVec.length = particle.moveCenter.radius;
|
|
307
|
-
circVec.angle = particle.velocity.angle + Math.PI;
|
|
308
|
-
circVec.addTo(engine_root_window_.Vector.create(particle.moveCenter));
|
|
309
|
-
const {
|
|
310
|
-
dx,
|
|
311
|
-
dy
|
|
312
|
-
} = (0,engine_root_window_.getDistances)(particle.position, circVec);
|
|
313
|
-
if (vx <= OutOutMode_minVelocity && dx >= minDistance || vy <= OutOutMode_minVelocity && dy >= minDistance || vx >= OutOutMode_minVelocity && dx <= minDistance || vy >= OutOutMode_minVelocity && dy <= minDistance) {
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
particle.position.x = Math.floor((0,engine_root_window_.randomInRange)({
|
|
317
|
-
min: 0,
|
|
318
|
-
max: container.canvas.size.width
|
|
319
|
-
}));
|
|
320
|
-
particle.position.y = Math.floor((0,engine_root_window_.randomInRange)({
|
|
321
|
-
min: 0,
|
|
322
|
-
max: container.canvas.size.height
|
|
323
|
-
}));
|
|
324
|
-
const {
|
|
325
|
-
dx: newDx,
|
|
326
|
-
dy: newDy
|
|
327
|
-
} = (0,engine_root_window_.getDistances)(particle.position, particle.moveCenter);
|
|
328
|
-
particle.direction = Math.atan2(-newDy, -newDx);
|
|
329
|
-
particle.velocity.angle = particle.direction;
|
|
330
|
-
break;
|
|
331
|
-
}
|
|
332
|
-
default:
|
|
333
|
-
{
|
|
334
|
-
if ((0,engine_root_window_.isPointInside)(particle.position, container.canvas.size, engine_root_window_.Vector.origin, particle.getRadius(), direction)) {
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
switch (particle.outType) {
|
|
338
|
-
case "outside":
|
|
339
|
-
{
|
|
340
|
-
particle.position.x = Math.floor((0,engine_root_window_.randomInRange)({
|
|
341
|
-
min: -particle.moveCenter.radius,
|
|
342
|
-
max: particle.moveCenter.radius
|
|
343
|
-
})) + particle.moveCenter.x;
|
|
344
|
-
particle.position.y = Math.floor((0,engine_root_window_.randomInRange)({
|
|
345
|
-
min: -particle.moveCenter.radius,
|
|
346
|
-
max: particle.moveCenter.radius
|
|
347
|
-
})) + particle.moveCenter.y;
|
|
348
|
-
const {
|
|
349
|
-
dx,
|
|
350
|
-
dy
|
|
351
|
-
} = (0,engine_root_window_.getDistances)(particle.position, particle.moveCenter);
|
|
352
|
-
if (particle.moveCenter.radius) {
|
|
353
|
-
particle.direction = Math.atan2(dy, dx);
|
|
354
|
-
particle.velocity.angle = particle.direction;
|
|
355
|
-
}
|
|
356
|
-
break;
|
|
357
|
-
}
|
|
358
|
-
case "normal":
|
|
359
|
-
{
|
|
360
|
-
const warp = particle.options.move.warp,
|
|
361
|
-
canvasSize = container.canvas.size,
|
|
362
|
-
newPos = {
|
|
363
|
-
bottom: canvasSize.height + particle.getRadius() + particle.offset.y,
|
|
364
|
-
left: -particle.getRadius() - particle.offset.x,
|
|
365
|
-
right: canvasSize.width + particle.getRadius() + particle.offset.x,
|
|
366
|
-
top: -particle.getRadius() - particle.offset.y
|
|
367
|
-
},
|
|
368
|
-
sizeValue = particle.getRadius(),
|
|
369
|
-
nextBounds = (0,engine_root_window_.calculateBounds)(particle.position, sizeValue);
|
|
370
|
-
if (direction === "right" && nextBounds.left > canvasSize.width + particle.offset.x) {
|
|
371
|
-
particle.position.x = newPos.left;
|
|
372
|
-
particle.initialPosition.x = particle.position.x;
|
|
373
|
-
if (!warp) {
|
|
374
|
-
particle.position.y = (0,engine_root_window_.getRandom)() * canvasSize.height;
|
|
375
|
-
particle.initialPosition.y = particle.position.y;
|
|
376
|
-
}
|
|
377
|
-
} else if (direction === "left" && nextBounds.right < -particle.offset.x) {
|
|
378
|
-
particle.position.x = newPos.right;
|
|
379
|
-
particle.initialPosition.x = particle.position.x;
|
|
380
|
-
if (!warp) {
|
|
381
|
-
particle.position.y = (0,engine_root_window_.getRandom)() * canvasSize.height;
|
|
382
|
-
particle.initialPosition.y = particle.position.y;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
if (direction === "bottom" && nextBounds.top > canvasSize.height + particle.offset.y) {
|
|
386
|
-
if (!warp) {
|
|
387
|
-
particle.position.x = (0,engine_root_window_.getRandom)() * canvasSize.width;
|
|
388
|
-
particle.initialPosition.x = particle.position.x;
|
|
389
|
-
}
|
|
390
|
-
particle.position.y = newPos.top;
|
|
391
|
-
particle.initialPosition.y = particle.position.y;
|
|
392
|
-
} else if (direction === "top" && nextBounds.bottom < -particle.offset.y) {
|
|
393
|
-
if (!warp) {
|
|
394
|
-
particle.position.x = (0,engine_root_window_.getRandom)() * canvasSize.width;
|
|
395
|
-
particle.initialPosition.x = particle.position.x;
|
|
396
|
-
}
|
|
397
|
-
particle.position.y = newPos.bottom;
|
|
398
|
-
particle.initialPosition.y = particle.position.y;
|
|
399
|
-
}
|
|
400
|
-
break;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
break;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
;// CONCATENATED MODULE: ./dist/browser/OutOfCanvasUpdater.js
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
class OutOfCanvasUpdater {
|
|
414
|
-
constructor(container) {
|
|
415
|
-
this._updateOutMode = (particle, delta, outMode, direction) => {
|
|
416
|
-
for (const updater of this.updaters) {
|
|
417
|
-
updater.update(particle, direction, delta, outMode);
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
this.container = container;
|
|
421
|
-
this.updaters = [new BounceOutMode(container), new DestroyOutMode(container), new OutOutMode(container), new NoneOutMode(container)];
|
|
422
|
-
}
|
|
423
|
-
init() {}
|
|
424
|
-
isEnabled(particle) {
|
|
425
|
-
return !particle.destroyed && !particle.spawning;
|
|
426
|
-
}
|
|
427
|
-
update(particle, delta) {
|
|
428
|
-
const outModes = particle.options.move.outModes;
|
|
429
|
-
this._updateOutMode(particle, delta, outModes.bottom ?? outModes.default, "bottom");
|
|
430
|
-
this._updateOutMode(particle, delta, outModes.left ?? outModes.default, "left");
|
|
431
|
-
this._updateOutMode(particle, delta, outModes.right ?? outModes.default, "right");
|
|
432
|
-
this._updateOutMode(particle, delta, outModes.top ?? outModes.default, "top");
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
436
|
-
|
|
437
|
-
async function loadOutModesUpdater(engine, refresh = true) {
|
|
438
|
-
await engine.addParticleUpdater("outModes", container => new OutOfCanvasUpdater(container), refresh);
|
|
439
|
-
}
|
|
440
|
-
})();
|
|
441
|
-
|
|
317
|
+
/******/
|
|
318
|
+
/******/ // startup
|
|
319
|
+
/******/ // Load entry module and return exports
|
|
320
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
321
|
+
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
322
|
+
/******/
|
|
442
323
|
/******/ return __webpack_exports__;
|
|
443
324
|
/******/ })()
|
|
444
325
|
;
|