@tsparticles/plugin-emitters-shape-square 3.9.1 → 4.0.0-alpha.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/815.min.js +2 -0
- package/815.min.js.LICENSE.txt +1 -0
- package/browser/index.js +6 -6
- package/cjs/EmittersSquareShape.js +5 -9
- package/cjs/EmittersSquareShapeGenerator.js +3 -7
- package/cjs/index.js +6 -9
- package/dist_browser_EmittersSquareShapeGenerator_js.js +40 -0
- package/esm/index.js +6 -6
- package/package.json +5 -4
- package/report.html +5 -4
- package/tsparticles.plugin.emitters.shape.square.js +212 -43
- package/tsparticles.plugin.emitters.shape.square.min.js +1 -1
- package/tsparticles.plugin.emitters.shape.square.min.js.LICENSE.txt +1 -1
- package/types/index.d.ts +1 -1
- package/umd/index.js +41 -7
package/815.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 815.min.js.LICENSE.txt */
|
|
2
|
+
(this.webpackChunk_tsparticles_plugin_emitters_shape_square=this.webpackChunk_tsparticles_plugin_emitters_shape_square||[]).push([[815],{815(t,e,o){o.d(e,{EmittersSquareShapeGenerator:()=>h});var i=o(526),s=o(303);var n;function a(t,e){return t+e*((0,s.getRandom)()-s.half)}!function(t){t[t.TopLeft=0]="TopLeft",t[t.TopRight=1]="TopRight",t[t.BottomRight=2]="BottomRight",t[t.BottomLeft=3]="BottomLeft"}(n||(n={}));class r extends i.EmitterShapeBase{constructor(t,e,o,i){super(t,e,o,i)}async init(){}randomPosition(){const t=this.fill,e=this.position,o=this.size;if(t)return{position:{x:a(e.x,o.width),y:a(e.y,o.height)}};{const t=o.width*s.half,i=o.height*s.half,a=Math.floor(4*(0,s.getRandom)()),r=((0,s.getRandom)()-s.half)*s.double;switch(a){case n.TopLeft:return{position:{x:e.x+r*t,y:e.y-i}};case n.TopRight:return{position:{x:e.x-t,y:e.y+r*i}};case n.BottomRight:return{position:{x:e.x+r*t,y:e.y+i}};case n.BottomLeft:default:return{position:{x:e.x+t,y:e.y+r*i}}}}}}class h{generate(t,e,o,i){return new r(t,e,o,i)}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Emitters Shape Square Plugin v4.0.0-alpha.1 by Matteo Bruni */
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export function loadEmittersShapeSquare(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.1");
|
|
3
|
+
engine.register(async (emittersEngine) => {
|
|
4
|
+
const { EmittersSquareShapeGenerator } = await import("./EmittersSquareShapeGenerator.js");
|
|
5
|
+
emittersEngine.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
|
|
6
|
+
});
|
|
7
7
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.EmittersSquareShape = void 0;
|
|
4
|
-
const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
|
|
5
|
-
const engine_1 = require("@tsparticles/engine");
|
|
1
|
+
import { EmitterShapeBase } from "@tsparticles/plugin-emitters";
|
|
2
|
+
import { double, getRandom, half } from "@tsparticles/engine";
|
|
6
3
|
const sides = 4;
|
|
7
4
|
var Sides;
|
|
8
5
|
(function (Sides) {
|
|
@@ -12,9 +9,9 @@ var Sides;
|
|
|
12
9
|
Sides[Sides["BottomLeft"] = 3] = "BottomLeft";
|
|
13
10
|
})(Sides || (Sides = {}));
|
|
14
11
|
function randomSquareCoordinate(position, offset) {
|
|
15
|
-
return position + offset * (
|
|
12
|
+
return position + offset * (getRandom() - half);
|
|
16
13
|
}
|
|
17
|
-
class EmittersSquareShape extends
|
|
14
|
+
export class EmittersSquareShape extends EmitterShapeBase {
|
|
18
15
|
constructor(position, size, fill, options) {
|
|
19
16
|
super(position, size, fill, options);
|
|
20
17
|
}
|
|
@@ -31,7 +28,7 @@ class EmittersSquareShape extends plugin_emitters_1.EmitterShapeBase {
|
|
|
31
28
|
};
|
|
32
29
|
}
|
|
33
30
|
else {
|
|
34
|
-
const halfW = size.width *
|
|
31
|
+
const halfW = size.width * half, halfH = size.height * half, side = Math.floor(getRandom() * sides), v = (getRandom() - half) * double;
|
|
35
32
|
switch (side) {
|
|
36
33
|
case Sides.TopLeft:
|
|
37
34
|
return {
|
|
@@ -66,4 +63,3 @@ class EmittersSquareShape extends plugin_emitters_1.EmitterShapeBase {
|
|
|
66
63
|
}
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
|
-
exports.EmittersSquareShape = EmittersSquareShape;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.EmittersSquareShapeGenerator = void 0;
|
|
4
|
-
const EmittersSquareShape_js_1 = require("./EmittersSquareShape.js");
|
|
5
|
-
class EmittersSquareShapeGenerator {
|
|
1
|
+
import { EmittersSquareShape } from "./EmittersSquareShape.js";
|
|
2
|
+
export class EmittersSquareShapeGenerator {
|
|
6
3
|
generate(position, size, fill, options) {
|
|
7
|
-
return new
|
|
4
|
+
return new EmittersSquareShape(position, size, fill, options);
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.EmittersSquareShapeGenerator = EmittersSquareShapeGenerator;
|
package/cjs/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
emittersEngine.checkVersion("3.9.1");
|
|
8
|
-
emittersEngine.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator_js_1.EmittersSquareShapeGenerator());
|
|
9
|
-
await emittersEngine.refresh(refresh);
|
|
1
|
+
export function loadEmittersShapeSquare(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.1");
|
|
3
|
+
engine.register(async (emittersEngine) => {
|
|
4
|
+
const { EmittersSquareShapeGenerator } = await import("./EmittersSquareShapeGenerator.js");
|
|
5
|
+
emittersEngine.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
|
|
6
|
+
});
|
|
10
7
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Author : Matteo Bruni
|
|
3
|
+
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
+
* Demo / Generator : https://particles.js.org/
|
|
5
|
+
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
+
* How to use? : Check the GitHub README
|
|
7
|
+
* v4.0.0-alpha.1
|
|
8
|
+
*/
|
|
9
|
+
"use strict";
|
|
10
|
+
/*
|
|
11
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
+
* This devtool is neither made for production nor for readable output files.
|
|
13
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
+
* or disable the default devtool with "devtool: false".
|
|
16
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
+
*/
|
|
18
|
+
(this["webpackChunk_tsparticles_plugin_emitters_shape_square"] = this["webpackChunk_tsparticles_plugin_emitters_shape_square"] || []).push([["dist_browser_EmittersSquareShapeGenerator_js"],{
|
|
19
|
+
|
|
20
|
+
/***/ "./dist/browser/EmittersSquareShape.js"
|
|
21
|
+
/*!*********************************************!*\
|
|
22
|
+
!*** ./dist/browser/EmittersSquareShape.js ***!
|
|
23
|
+
\*********************************************/
|
|
24
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
|
+
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmittersSquareShape: () => (/* binding */ EmittersSquareShape)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/plugin-emitters */ \"@tsparticles/plugin-emitters\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\n\nconst sides = 4;\nvar Sides;\n(function (Sides) {\n Sides[Sides[\"TopLeft\"] = 0] = \"TopLeft\";\n Sides[Sides[\"TopRight\"] = 1] = \"TopRight\";\n Sides[Sides[\"BottomRight\"] = 2] = \"BottomRight\";\n Sides[Sides[\"BottomLeft\"] = 3] = \"BottomLeft\";\n})(Sides || (Sides = {}));\nfunction randomSquareCoordinate(position, offset) {\n return position + offset * ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.getRandom)() - _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half);\n}\nclass EmittersSquareShape extends _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__.EmitterShapeBase {\n constructor(position, size, fill, options) {\n super(position, size, fill, options);\n }\n async init() {}\n randomPosition() {\n const fill = this.fill,\n position = this.position,\n size = this.size;\n if (fill) {\n return {\n position: {\n x: randomSquareCoordinate(position.x, size.width),\n y: randomSquareCoordinate(position.y, size.height)\n }\n };\n } else {\n const halfW = size.width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half,\n halfH = size.height * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half,\n side = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.getRandom)() * sides),\n v = ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.getRandom)() - _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.double;\n switch (side) {\n case Sides.TopLeft:\n return {\n position: {\n x: position.x + v * halfW,\n y: position.y - halfH\n }\n };\n case Sides.TopRight:\n return {\n position: {\n x: position.x - halfW,\n y: position.y + v * halfH\n }\n };\n case Sides.BottomRight:\n return {\n position: {\n x: position.x + v * halfW,\n y: position.y + halfH\n }\n };\n case Sides.BottomLeft:\n default:\n return {\n position: {\n x: position.x + halfW,\n y: position.y + v * halfH\n }\n };\n }\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-square/./dist/browser/EmittersSquareShape.js?\n}");
|
|
27
|
+
|
|
28
|
+
/***/ },
|
|
29
|
+
|
|
30
|
+
/***/ "./dist/browser/EmittersSquareShapeGenerator.js"
|
|
31
|
+
/*!******************************************************!*\
|
|
32
|
+
!*** ./dist/browser/EmittersSquareShapeGenerator.js ***!
|
|
33
|
+
\******************************************************/
|
|
34
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
|
+
|
|
36
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmittersSquareShapeGenerator: () => (/* binding */ EmittersSquareShapeGenerator)\n/* harmony export */ });\n/* harmony import */ var _EmittersSquareShape_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EmittersSquareShape.js */ \"./dist/browser/EmittersSquareShape.js\");\n\nclass EmittersSquareShapeGenerator {\n generate(position, size, fill, options) {\n return new _EmittersSquareShape_js__WEBPACK_IMPORTED_MODULE_0__.EmittersSquareShape(position, size, fill, options);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-square/./dist/browser/EmittersSquareShapeGenerator.js?\n}");
|
|
37
|
+
|
|
38
|
+
/***/ }
|
|
39
|
+
|
|
40
|
+
}]);
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export function loadEmittersShapeSquare(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.1");
|
|
3
|
+
engine.register(async (emittersEngine) => {
|
|
4
|
+
const { EmittersSquareShapeGenerator } = await import("./EmittersSquareShapeGenerator.js");
|
|
5
|
+
emittersEngine.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
|
|
6
|
+
});
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-emitters-shape-square",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"description": "tsParticles emitters shape square plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -100,10 +100,11 @@
|
|
|
100
100
|
"./package.json": "./package.json"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@tsparticles/engine": "
|
|
104
|
-
"@tsparticles/plugin-emitters": "
|
|
103
|
+
"@tsparticles/engine": "4.0.0-alpha.1",
|
|
104
|
+
"@tsparticles/plugin-emitters": "4.0.0-alpha.1"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|
|
108
|
-
}
|
|
108
|
+
},
|
|
109
|
+
"type": "module"
|
|
109
110
|
}
|